mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
Massive optimization for sink objective. (#11563)
This commit is contained in:
@@ -41,16 +41,9 @@
|
|||||||
var/count = 0
|
var/count = 0
|
||||||
|
|
||||||
/datum/sabotage_objective/processing/power_sink/check_condition_processing()
|
/datum/sabotage_objective/processing/power_sink/check_condition_processing()
|
||||||
count += 1
|
for(var/s in GLOB.power_sinks)
|
||||||
if(count==10 || sink_found) // doesn't need to fire that often unless a sink exists
|
var/obj/item/powersink/sink = s
|
||||||
var/sink_found_this_time = FALSE
|
won = max(won,sink.power_drained/1e8)
|
||||||
for(var/datum/powernet/PN in GLOB.powernets)
|
|
||||||
for(var/obj/item/powersink/sink in PN.nodes)
|
|
||||||
sink_found_this_time = TRUE
|
|
||||||
won = max(won,sink.power_drained/1e8)
|
|
||||||
sink_found = sink_found_this_time
|
|
||||||
count = 0
|
|
||||||
return FALSE
|
|
||||||
|
|
||||||
/obj/item/paper/guides/antag/supermatter_sabotage
|
/obj/item/paper/guides/antag/supermatter_sabotage
|
||||||
info = "Ways to sabotage a supermatter:<br>\
|
info = "Ways to sabotage a supermatter:<br>\
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// Powersink - used to drain station power
|
// Powersink - used to drain station power
|
||||||
|
|
||||||
|
GLOBAL_LIST_EMPTY(power_sinks)
|
||||||
|
|
||||||
/obj/item/powersink
|
/obj/item/powersink
|
||||||
desc = "A nulling power sink which drains energy from electrical systems."
|
desc = "A nulling power sink which drains energy from electrical systems."
|
||||||
name = "power sink"
|
name = "power sink"
|
||||||
@@ -26,6 +28,14 @@
|
|||||||
|
|
||||||
var/obj/structure/cable/attached // the attached cable
|
var/obj/structure/cable/attached // the attached cable
|
||||||
|
|
||||||
|
/obj/item/powersink/Initialize()
|
||||||
|
. = ..()
|
||||||
|
GLOB.power_sinks += src
|
||||||
|
|
||||||
|
/obj/item/powersink/Destroy()
|
||||||
|
GLOB.power_sinks -= src
|
||||||
|
. = ..()
|
||||||
|
|
||||||
/obj/item/powersink/update_icon_state()
|
/obj/item/powersink/update_icon_state()
|
||||||
icon_state = "powersink[mode == OPERATING]"
|
icon_state = "powersink[mode == OPERATING]"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user