mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Suspend SSmachines subsystem while we are initializing map templates.
- Adds the capability to "suspend" a subsystem while we're loading something.
This commit is contained in:
@@ -203,3 +203,15 @@
|
|||||||
//usually called via datum/controller/subsystem/New() when replacing a subsystem (i.e. due to a recurring crash)
|
//usually called via datum/controller/subsystem/New() when replacing a subsystem (i.e. due to a recurring crash)
|
||||||
//should attempt to salvage what it can from the old instance of subsystem
|
//should attempt to salvage what it can from the old instance of subsystem
|
||||||
/datum/controller/subsystem/Recover()
|
/datum/controller/subsystem/Recover()
|
||||||
|
|
||||||
|
// Suspends this subsystem from being queued for running. If already in the queue, sleeps until idle. Returns FALSE if the subsystem was already suspended.
|
||||||
|
/datum/controller/subsystem/proc/suspend()
|
||||||
|
. = (can_fire > 0) // Return true if we were previously runnable, false if previously suspended.
|
||||||
|
can_fire = FALSE
|
||||||
|
// Safely sleep in a loop until the subsystem is idle, (or its been un-suspended somehow)
|
||||||
|
while(can_fire <= 0 && state != SS_IDLE)
|
||||||
|
stoplag() // Safely sleep in a loop until
|
||||||
|
|
||||||
|
// Wakes a suspended subsystem.
|
||||||
|
/datum/controller/subsystem/proc/wake()
|
||||||
|
can_fire = TRUE
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
var/prev_shuttle_queue_state = SSshuttles.block_init_queue
|
var/prev_shuttle_queue_state = SSshuttles.block_init_queue
|
||||||
SSshuttles.block_init_queue = TRUE
|
SSshuttles.block_init_queue = TRUE
|
||||||
|
var/machinery_was_awake = SSmachines.suspend() // Suspend machinery (if it was not already suspended)
|
||||||
|
|
||||||
var/list/atom/atoms = list()
|
var/list/atom/atoms = list()
|
||||||
var/list/area/areas = list()
|
var/list/area/areas = list()
|
||||||
@@ -74,6 +75,8 @@
|
|||||||
var/area/A = I
|
var/area/A = I
|
||||||
A.power_change()
|
A.power_change()
|
||||||
|
|
||||||
|
if(machinery_was_awake)
|
||||||
|
SSmachines.wake() // Wake only if it was awake before we tried to suspended it.
|
||||||
SSshuttles.block_init_queue = prev_shuttle_queue_state
|
SSshuttles.block_init_queue = prev_shuttle_queue_state
|
||||||
SSshuttles.process_init_queues() // We will flush the queue unless there were other blockers, in which case they will do it.
|
SSshuttles.process_init_queues() // We will flush the queue unless there were other blockers, in which case they will do it.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user