mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 03:02:38 +00:00
* Moves turf New calls to Initialize * Much faster * Fixed * Makes add_to_active queue up before SSair is initialized * Remove active queuing * And the proc * Move the check * Fix some shit * F U C K T U R F S * Necessary * Unnecessary * SHUT THE FUCK UP * Panic mode hurts the code * Such a * Simple answer * A well thought out plan * /turf/open optimization * Undo the warning suppression now that it's fixed * Fixes lava typecaching badly * Added late initialization * Make the atmos offenders late initialize * Add extra logging * GLABALS * Better solution for trying to activate w/o air * Further base calling copypasta * Gates, guards, gorans * Small doc fix * Do the faster * T U R F V A R P E R S I S T E N C E * The solution is always so simple * The (hopefully) final nail in the coffin
111 lines
3.1 KiB
Plaintext
111 lines
3.1 KiB
Plaintext
var/datum/subsystem/objects/SSobj
|
|
|
|
#define INITIALIZATION_INSSOBJ 0 //New should not call Initialize
|
|
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
|
|
#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
|
|
|
|
/datum/subsystem/objects
|
|
name = "Objects"
|
|
init_order = 12
|
|
priority = 40
|
|
|
|
var/initialized = INITIALIZATION_INSSOBJ
|
|
var/old_initialized
|
|
var/list/processing = list()
|
|
var/list/currentrun = list()
|
|
|
|
/datum/subsystem/objects/New()
|
|
NEW_SS_GLOBAL(SSobj)
|
|
|
|
/datum/subsystem/objects/Initialize(timeofdayl)
|
|
fire_overlay.appearance_flags = RESET_COLOR
|
|
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
|
|
initialized = INITIALIZATION_INNEW_MAPLOAD
|
|
InitializeAtoms()
|
|
. = ..()
|
|
|
|
/datum/subsystem/objects/proc/InitializeAtoms(list/objects = null)
|
|
if(initialized == INITIALIZATION_INSSOBJ)
|
|
return
|
|
|
|
var/list/late_loaders
|
|
|
|
initialized = INITIALIZATION_INNEW_MAPLOAD
|
|
|
|
if(objects)
|
|
for(var/I in objects)
|
|
var/atom/A = I
|
|
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
|
|
var/start_tick = world.time
|
|
if(A.Initialize(TRUE))
|
|
LAZYADD(late_loaders, A)
|
|
if(start_tick != world.time)
|
|
WARNING("[A]: [A.type] slept during it's Initialize!")
|
|
CHECK_TICK
|
|
testing("Initialized [objects.len] atoms")
|
|
else
|
|
#ifdef TESTING
|
|
var/count = 0
|
|
#endif
|
|
for(var/atom/A in world)
|
|
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
|
|
var/start_tick = world.time
|
|
if(A.Initialize(TRUE))
|
|
LAZYADD(late_loaders, A)
|
|
#ifdef TESTING
|
|
else
|
|
++count
|
|
#endif TESTING
|
|
if(start_tick != world.time)
|
|
WARNING("[A]: [A.type] slept during it's Initialize!")
|
|
CHECK_TICK
|
|
testing("Roundstart initialized [count] atoms")
|
|
|
|
initialized = INITIALIZATION_INNEW_REGULAR
|
|
|
|
if(late_loaders)
|
|
for(var/I in late_loaders)
|
|
var/atom/A = I
|
|
var/start_tick = world.time
|
|
A.Initialize(FALSE)
|
|
if(start_tick != world.time)
|
|
WARNING("[A]: [A.type] slept during it's Initialize!")
|
|
CHECK_TICK
|
|
testing("Late-initialized [late_loaders.len] atoms")
|
|
|
|
/datum/subsystem/objects/proc/map_loader_begin()
|
|
old_initialized = initialized
|
|
initialized = INITIALIZATION_INSSOBJ
|
|
|
|
/datum/subsystem/objects/proc/map_loader_stop()
|
|
initialized = old_initialized
|
|
|
|
/datum/subsystem/objects/stat_entry()
|
|
..("P:[processing.len]")
|
|
|
|
|
|
/datum/subsystem/objects/fire(resumed = 0)
|
|
if (!resumed)
|
|
src.currentrun = processing.Copy()
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
|
|
while(currentrun.len)
|
|
var/datum/thing = currentrun[currentrun.len]
|
|
currentrun.len--
|
|
if(thing)
|
|
thing.process(wait)
|
|
else
|
|
SSobj.processing -= thing
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/subsystem/objects/Recover()
|
|
initialized = SSobj.initialized
|
|
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
|
|
InitializeAtoms()
|
|
old_initialized = SSobj.old_initialized
|
|
|
|
if (istype(SSobj.processing))
|
|
processing = SSobj.processing
|