mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Adds USB to arrest consoles. Adds list circuit components. (#59850)
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
co-authored by
Watermelon914
Mothblocks
parent
b2285bf29b
commit
7e9e2df721
@@ -1,3 +1,34 @@
|
||||
TIMER_SUBSYSTEM_DEF(circuit_component)
|
||||
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.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
|
||||
|
||||
Reference in New Issue
Block a user