Ports more of /tg/'s powernet code.

Among other things this fixes a a bug where SMES would draw excess power from the powergrid they were outputting to, rather than drawing from.
This commit is contained in:
PsiOmega
2014-10-29 14:01:35 +01:00
parent c8e27555b9
commit a1c19b78be
14 changed files with 204 additions and 278 deletions
-24
View File
@@ -212,30 +212,6 @@ obj/structure/cable/proc/cableColor(var/colorC)
color_n = colorC
color = color_n
////////////////////////////////////////////
// Power related
///////////////////////////////////////////
obj/structure/cable/proc/add_avail(var/amount)
if(powernet)
powernet.newavail += amount
obj/structure/cable/proc/add_load(var/amount)
if(powernet)
powernet.load += amount
obj/structure/cable/proc/surplus()
if(powernet)
return powernet.avail-powernet.load
else
return 0
obj/structure/cable/proc/avail()
if(powernet)
return powernet.avail
else
return 0
/////////////////////////////////////////////////
// Cable laying helpers
////////////////////////////////////////////////