Fixes powernet avail checks (#47771)

This commit is contained in:
ShizCalev
2019-11-15 03:25:54 -05:00
committed by Rob Bailey
parent 859709c432
commit fc405b418a
3 changed files with 8 additions and 8 deletions

View File

@@ -57,7 +57,7 @@
damage_deflection = 10
resistance_flags = FIRE_PROOF
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON
ui_x = 450
ui_x = 450
ui_y = 460
var/lon_range = 1.5
@@ -1120,9 +1120,9 @@
if(terminal && terminal.powernet)
terminal.add_load(amount)
/obj/machinery/power/apc/avail()
/obj/machinery/power/apc/avail(amount)
if(terminal)
return terminal.avail()
return terminal.avail(amount)
else
return 0

View File

@@ -210,9 +210,9 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri
else
return 0
/obj/structure/cable/proc/avail()
/obj/structure/cable/proc/avail(amount)
if(powernet)
return powernet.avail
return amount ? powernet.avail >= amount : powernet.avail
else
return 0

View File

@@ -51,9 +51,9 @@
else
return 0
/obj/machinery/power/proc/avail()
/obj/machinery/power/proc/avail(amount)
if(powernet)
return powernet.avail
return amount ? powernet.avail >= amount : powernet.avail
else
return 0
@@ -235,7 +235,7 @@
index++
var/list/connections = working_cable.get_cable_connections(skip_assigned_powernets)
for(var/obj/structure/cable/cable_entry in connections)
if(!cables[cable_entry]) //Since it's an associated list, we can just do an access and check it's null before adding; prevents duplicate entries
cables[cable_entry] = TRUE