mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 02:32:10 +00:00
* Adds the bare minimum admin components and allows admins to define list literals. * Update decaySS.dm Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
36 lines
954 B
Plaintext
36 lines
954 B
Plaintext
SUBSYSTEM_DEF(circuit_component)
|
|
name = "Circuit Components"
|
|
wait = 0.1 SECONDS
|
|
priority = FIRE_PRIORITY_DEFAULT
|
|
|
|
var/list/callbacks_to_invoke = list()
|
|
var/list/currentrun = list()
|
|
|
|
/datum/controller/subsystem/circuit_component/fire(resumed)
|
|
if(!resumed)
|
|
currentrun = callbacks_to_invoke.Copy()
|
|
callbacks_to_invoke.Cut()
|
|
|
|
while(length(currentrun))
|
|
var/datum/callback/to_call = currentrun[1]
|
|
currentrun.Cut(1,2)
|
|
|
|
if(QDELETED(to_call))
|
|
continue
|
|
|
|
to_call.user = null
|
|
to_call.InvokeAsync()
|
|
qdel(to_call)
|
|
|
|
if(MC_TICK_CHECK)
|
|
return
|
|
|
|
/**
|
|
* Adds a callback to be invoked when the next fire() is done. Used by the integrated circuit system.
|
|
*
|
|
* Prevents race conditions as it acts like a queue system.
|
|
* Those that registered first will be executed first and those registered last will be executed last.
|
|
*/
|
|
/datum/controller/subsystem/circuit_component/proc/add_callback(datum/callback/to_call)
|
|
callbacks_to_invoke += to_call
|