Better vent hibernation (#17221)

* Experimental vent hibernation

* loooopppp

* fix that too

* functional

* fixes

* ensure all vents get checked at some point

---------

Co-authored-by: Willburd <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
Cameron Lennox
2025-03-03 18:41:39 -05:00
committed by GitHub
co-authored by Willburd
parent a59cf22f8a
commit 90be6b856e
3 changed files with 42 additions and 14 deletions
@@ -26,7 +26,6 @@
var/area_uid
var/id_tag = null
var/hibernate = 0 //Do we even process?
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND
@@ -99,6 +98,7 @@
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
SSmachines.wake_vent(WEAKREF(src)) // So we are removed from hibernating list
unregister_radio(src, frequency)
if(initial_loc)
initial_loc.air_vent_info -= id_tag
@@ -204,9 +204,6 @@
/obj/machinery/atmospherics/unary/vent_pump/process()
..()
if (hibernate)
return 1
if (!node)
update_use_power(USE_POWER_OFF)
if(!can_pump())
@@ -237,9 +234,7 @@
if(pump_direction && pressure_checks == PRESSURE_CHECK_EXTERNAL && Master.iteration > 10) //99% of all vents
//Fucking hibernate because you ain't doing shit.
hibernate = 1
addtimer(VARSET_CALLBACK(src, hibernate, 0), rand(10 SECONDS,20 SECONDS), TIMER_DELETE_ME) //hibernate randomly
SSmachines.hibernate_vent(src)
if (power_draw >= 0)
last_power_draw = power_draw
@@ -318,7 +313,7 @@
if(stat & (NOPOWER|BROKEN))
return
hibernate = 0
SSmachines.wake_vent(WEAKREF(src))
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
@@ -18,7 +18,6 @@
var/frequency = 1439
var/datum/radio_frequency/radio_connection
var/hibernate = 0 //Do we even process?
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
var/list/scrubbing_gas = list(GAS_CO2, GAS_PHORON)
@@ -50,6 +49,7 @@
id_tag = num2text(uid)
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
SSmachines.wake_vent(WEAKREF(src)) // So we are removed from hibernating list
unregister_radio(src, frequency)
if(initial_loc)
initial_loc.air_scrub_info -= id_tag
@@ -137,9 +137,6 @@
/obj/machinery/atmospherics/unary/vent_scrubber/process()
..()
if (hibernate)
return 1
if (!node)
update_use_power(USE_POWER_OFF)
//broadcast_status()
@@ -162,8 +159,7 @@
if(scrubbing && power_draw < 0 && Master.iteration > 10) //99% of all scrubbers
//Fucking hibernate because you ain't doing shit.
hibernate = 1
addtimer(VARSET_CALLBACK(src, hibernate, 0), rand(10 SECONDS,20 SECONDS), TIMER_DELETE_ME) //hibernate randomly
SSmachines.hibernate_vent(src)
if (power_draw >= 0)
last_power_draw = power_draw