Files
Bubberstation/code/controllers/subsystem/processing/objects.dm
Cyberboss 5959ac32cc Refactors atom/Initialize. Fixes ruins being initialized twice (#22778)
* Refactors atom/Initialize

Captialized for compiling correctness and to be more inline with Destroy

Will now be called from atom/New if the world initialization loop in SSobj has already run. Should always call the base.

Now comes with the `roundstart` parameter indicating whether or not it was called by SSobj or atom/New

Other fixes/tweaks:
- Renamed a proc called Initialize in abduction consoles to Setup
- Removed /obj/item/device/radio/headset/headset_sec/department: Broken and referenced literally nowhere in the code
- Removed a spawn from the Initialize of turbine_computer which made literally zero sense
- Generalized the proc which fixes RND servers with no id set

Reasoning: It's better to check roundstart per function than to have to duplicate code in New and Initialize. Think of it as a safer New for atoms. If we move enough stuff to it, initial map load performance will increase due to less New calls

* Fixed a thing

* Actually, fuck the police

* >Expecting a merge without errors

* >Not calling ..() in New

* Sanic

* Fix the headset bug

* Makes sure the map loaders dew it right

* Fixes ruins being initialized twice

* Rename roundstart -> mapload

* Revert "Rename roundstart -> mapload"

This reverts commit 667c327fd2ccfa3ce4f4db52eac03f9e8b0f6812.

* Remove unrelated change

* A more direct solution to map loads

* And now we shouldnt need this warning

* Add the new var to SSobj recovery

* Revert "Revert "Rename roundstart -> mapload""

This reverts commit dee07dbd5e4696554ac43aae5b91cce743b9b9e0.

* Line endings
2017-01-23 09:37:45 +01:00

83 lines
2.0 KiB
Plaintext

var/datum/subsystem/objects/SSobj
/datum/var/isprocessing = 0
/datum/proc/process()
set waitfor = 0
STOP_PROCESSING(SSobj, src)
return 0
/datum/subsystem/objects
name = "Objects"
init_order = 12
priority = 40
var/initialized = FALSE
var/old_initialized
var/list/atom_spawners = list()
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
trigger_atom_spawners()
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
for(var/thing in world)
var/atom/A = thing
A.Initialize(TRUE)
CHECK_TICK
initialized = TRUE
. = ..()
/datum/subsystem/objects/proc/map_loader_begin()
old_initialized = initialized
initialized = FALSE
/datum/subsystem/objects/proc/map_loader_stop()
initialized = old_initialized
/datum/subsystem/objects/proc/trigger_atom_spawners(zlevel, ignore_z=FALSE)
for(var/V in atom_spawners)
var/atom/A = V
if (!ignore_z && (zlevel && A.z != zlevel))
continue
A.spawn_atom_to_world()
/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/proc/setup_template_objects(list/objects)
trigger_atom_spawners(0, ignore_z=TRUE)
if(initialized)
for(var/A in objects)
var/atom/B = A
B.Initialize(TRUE)
/datum/subsystem/objects/Recover()
initialized = SSobj.initialized
old_initialized = SSobj.old_initialized
if (istype(SSobj.atom_spawners))
atom_spawners = SSobj.atom_spawners
if (istype(SSobj.processing))
processing = SSobj.processing