Early Assets, Lateloaded Assets, and Debugging Tools (#4696)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Various asset systems I want in before more TGUI work. and also
byond-tracy support... and also light update debugging...
## Changelog
🆑
tweak: Chem Master UI has been reworked slightly.
This commit is contained in:
Zandario
2022-11-20 17:36:24 -07:00
committed by GitHub
parent d477ee4e43
commit 7bf4c2a34f
191 changed files with 2507 additions and 1591 deletions
@@ -0,0 +1,30 @@
/**
* 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
subsystem_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
+2 -2
View File
@@ -26,11 +26,11 @@ SUBSYSTEM_DEF(assets)
for(var/type in typesof(/datum/asset))
var/datum/asset/A = type
if (type != initial(A._abstract))
get_asset_datum(type)
load_asset_datum(type)
transport.Initialize(cache)
..()
return ..()
/datum/controller/subsystem/assets/Recover()
cache = SSassets.cache
@@ -0,0 +1,26 @@
/**
* Initializes any assets that need to be loaded ASAP.
* This houses preference menu assets, since they can be loaded at any time,
* most dangerously before the atoms SS initializes.
* Thus, we want it to fail consistently in CI as if it would've if a player
* opened it up early.
*/
SUBSYSTEM_DEF(early_assets)
name = "Early Assets"
init_order = INIT_ORDER_EARLY_ASSETS
subsystem_flags = SS_NO_FIRE
/datum/controller/subsystem/early_assets/Initialize(timeofday)
for (var/datum/asset/asset_type as anything in subtypesof(/datum/asset))
if (initial(asset_type._abstract) == asset_type)
continue
if (!initial(asset_type.early))
continue
if (!load_asset_datum(asset_type))
stack_trace("Could not initialize early asset [asset_type]!")
CHECK_TICK
return ..()
+7 -2
View File
@@ -1,7 +1,12 @@
GLOBAL_LIST_EMPTY(lighting_update_lights) // List of lighting sources queued for update.
GLOBAL_LIST_EMPTY(lighting_update_corners) // List of lighting corners queued for update.
GLOBAL_LIST_EMPTY(lighting_update_lights) // List of lighting sources queued for update.
GLOBAL_LIST_EMPTY(lighting_update_corners) // List of lighting corners queued for update.
GLOBAL_LIST_EMPTY(lighting_update_objects) // List of lighting objects queued for update.
#ifdef VISUALIZE_LIGHT_UPDATES
GLOBAL_VAR_INIT(allow_duped_values, FALSE)
GLOBAL_VAR_INIT(allow_duped_corners, FALSE)
#endif
SUBSYSTEM_DEF(lighting)
name = "Lighting"
wait = 2
@@ -17,12 +17,14 @@ PROCESSING_SUBSYSTEM_DEF(chemistry)
initialize_chemical_reagents()
return ..()
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list
// It is filtered into multiple lists within a list.
// For example:
// chemical_reaction_list["phoron"] is a list of all reactions relating to phoron
// Note that entries in the list are NOT duplicated. So if a reaction pertains to
// more than one chemical it will still only appear in only one of the sublists.
/**
* Chemical Reactions - Initialises all /datum/chemical_reaction into a list
* It is filtered into multiple lists within a list.
* For example:
* - chemical_reaction_list["phoron"] is a list of all reactions relating to phoron
* - Note that entries in the list are NOT duplicated. So if a reaction pertains to
* - more than one chemical it will still only appear in only one of the sublists.
*/
/datum/controller/subsystem/processing/chemistry/proc/initialize_chemical_reactions()
var/paths = typesof(/datum/chemical_reaction) - /datum/chemical_reaction
chemical_reactions = list()
@@ -36,7 +38,7 @@ PROCESSING_SUBSYSTEM_DEF(chemistry)
LAZYINITLIST(chemical_reactions_by_reagent[reagent_id])
chemical_reactions_by_reagent[reagent_id] += D
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
/// Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
/datum/controller/subsystem/processing/chemistry/proc/initialize_chemical_reagents()
var/paths = typesof(/datum/reagent) - /datum/reagent
chemical_reagents = list()