Files
Bubberstation/code/controllers/subsystem/asset_loading.dm
SkyratBot e03bb250c5 [MIRROR] Ensures early assets init when expected during unit tests, [MDB IGNORE] (#17259)
* Ensures early assets init when expected during unit tests,  (#70753)

Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>

* Ensures early assets init when expected during unit tests,

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
2022-10-31 14:09:52 +00:00

29 lines
956 B
Plaintext

/// Allows us to lazyload asset datums
/// Anything inserted here will fully load if directly gotten
/// So this just serves to remove the requirement to load assets fully during init
SUBSYSTEM_DEF(asset_loading)
name = "Asset Loading"
priority = FIRE_PRIORITY_ASSETS
flags = SS_NO_INIT
runlevels = RUNLEVEL_LOBBY|RUNLEVELS_DEFAULT
var/list/datum/asset/generate_queue = list()
/datum/controller/subsystem/asset_loading/fire(resumed)
while(length(generate_queue))
var/datum/asset/to_load = generate_queue[generate_queue.len]
to_load.queued_generation()
if(MC_TICK_CHECK)
return
generate_queue.len--
/datum/controller/subsystem/asset_loading/proc/queue_asset(datum/asset/queue)
#ifdef DO_NOT_DEFER_ASSETS
stack_trace("We queued an instance of [queue.type] for lateloading despite not allowing it")
#endif
generate_queue += queue
/datum/controller/subsystem/asset_loading/proc/dequeue_asset(datum/asset/queue)
generate_queue -= queue