mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 19:47:47 +01:00
Revert "[MIRROR] /atom New() => Initialize() [MDB IGNORE]"
This commit is contained in:
@@ -8,54 +8,52 @@ SUBSYSTEM_DEF(atoms)
|
||||
init_order = INIT_ORDER_ATOMS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
// override and GetArguments() exists for mod-override/downstream hook functionality.
|
||||
// Useful for total-overhaul type modifications.
|
||||
var/adjust_init_arguments = FALSE
|
||||
|
||||
var/atom_init_stage = INITIALIZATION_INSSATOMS
|
||||
var/old_init_stage
|
||||
var/static/initialized = INITIALIZATION_INSSATOMS
|
||||
// var/list/created_atoms // This is never used, so don't bother. ~Leshana
|
||||
var/static/old_initialized
|
||||
|
||||
var/list/late_loaders
|
||||
var/list/created_atoms
|
||||
|
||||
var/list/BadInitializeCalls = list()
|
||||
|
||||
/datum/controller/subsystem/atoms/Initialize(timeofday)
|
||||
setupgenetics() //to set the mutations' place in structural enzymes, so initializers know where to put mutations.
|
||||
atom_init_stage = INITIALIZATION_INNEW_MAPLOAD
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
to_world_log("Initializing objects")
|
||||
admin_notice("<span class='danger'>Initializing objects</span>", R_DEBUG)
|
||||
InitializeAtoms()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitializeAtoms(var/list/supplied_atoms)
|
||||
|
||||
if(atom_init_stage <= INITIALIZATION_INSSATOMS_LATE)
|
||||
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms)
|
||||
if(initialized == INITIALIZATION_INSSATOMS)
|
||||
return
|
||||
|
||||
atom_init_stage = INITIALIZATION_INNEW_MAPLOAD
|
||||
initialized = INITIALIZATION_INNEW_MAPLOAD
|
||||
|
||||
LAZYINITLIST(late_loaders)
|
||||
|
||||
var/count
|
||||
var/list/mapload_arg = list(TRUE)
|
||||
var/count = LAZYLEN(supplied_atoms)
|
||||
if(count)
|
||||
while(supplied_atoms.len)
|
||||
var/atom/A = supplied_atoms[supplied_atoms.len]
|
||||
supplied_atoms.len--
|
||||
if(atoms)
|
||||
created_atoms = list()
|
||||
count = atoms.len
|
||||
for(var/atom/A as anything in atoms)
|
||||
if(!A.initialized)
|
||||
InitAtom(A, GetArguments(A, mapload_arg))
|
||||
if(InitAtom(A, mapload_arg))
|
||||
atoms -= A
|
||||
CHECK_TICK
|
||||
else if(!subsystem_initialized)
|
||||
// If wondering why not just store all atoms in a list and use the block above: that turns out unbearably expensive.
|
||||
// Instead, atoms without extra arguments in New created on server start are fished out of world directly.
|
||||
// We do this exactly once.
|
||||
|
||||
for(var/atom/A in world)
|
||||
else
|
||||
count = 0
|
||||
for(var/atom/A in world) // This must be world, since this operation adds all the atoms to their specific lists.
|
||||
if(!A.initialized)
|
||||
InitAtom(A, GetArguments(A, mapload_arg, FALSE))
|
||||
InitAtom(A, mapload_arg)
|
||||
++count
|
||||
CHECK_TICK
|
||||
|
||||
report_progress("Initialized [count] atom\s")
|
||||
log_world("Initialized [count] atoms")
|
||||
|
||||
atom_init_stage = INITIALIZATION_INNEW_REGULAR
|
||||
initialized = INITIALIZATION_INNEW_REGULAR
|
||||
|
||||
if(late_loaders.len)
|
||||
for(var/atom/A as anything in late_loaders)
|
||||
@@ -64,8 +62,12 @@ SUBSYSTEM_DEF(atoms)
|
||||
testing("Late initialized [late_loaders.len] atoms")
|
||||
late_loaders.Cut()
|
||||
|
||||
// Nothing ever checks return value of this proc, so don't bother. If this ever changes fix code in /atom/New() ~Leshana
|
||||
// if(atoms)
|
||||
// . = created_atoms + atoms
|
||||
// created_atoms = null
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitAtom(atom/A, list/arguments)
|
||||
LAZYREMOVE(global.pre_init_created_atoms, A)
|
||||
var/the_type = A.type
|
||||
if(QDELING(A))
|
||||
BadInitializeCalls[the_type] |= BAD_INIT_QDEL_BEFORE
|
||||
@@ -84,9 +86,9 @@ SUBSYSTEM_DEF(atoms)
|
||||
switch(result)
|
||||
if(INITIALIZE_HINT_LATELOAD)
|
||||
if(arguments[1]) //mapload
|
||||
late_loaders[A] = arguments
|
||||
late_loaders += A
|
||||
else
|
||||
A.LateInitialize(arglist(arguments))
|
||||
A.LateInitialize()
|
||||
if(INITIALIZE_HINT_QDEL)
|
||||
qdel(A)
|
||||
qdeleted = TRUE
|
||||
@@ -100,37 +102,18 @@ SUBSYSTEM_DEF(atoms)
|
||||
|
||||
return qdeleted || QDELING(A)
|
||||
|
||||
// override and GetArguments() exists for mod-override/downstream hook functionality.
|
||||
// Useful for total-overhaul type modifications.
|
||||
/atom/proc/AdjustInitializeArguments(list/arguments)
|
||||
// Lists are passed by reference so can simply modify the arguments list without returning it
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/GetArguments(atom/A, list/mapload_arg, created=TRUE)
|
||||
if(!created && !adjust_init_arguments)
|
||||
return mapload_arg // Performance optimization. Nothing to do.
|
||||
var/list/arguments = mapload_arg.Copy()
|
||||
var/extra_args = LAZYACCESS(global.pre_init_created_atoms, A)
|
||||
if(created && extra_args)
|
||||
arguments += extra_args
|
||||
if(adjust_init_arguments)
|
||||
A.AdjustInitializeArguments(arguments)
|
||||
return arguments
|
||||
|
||||
/datum/controller/subsystem/atoms/stat_entry(msg)
|
||||
..("Bad Initialize Calls:[BadInitializeCalls.len]")
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_begin()
|
||||
old_init_stage = atom_init_stage
|
||||
atom_init_stage = INITIALIZATION_INSSATOMS_LATE
|
||||
old_initialized = initialized
|
||||
initialized = INITIALIZATION_INSSATOMS
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/map_loader_stop()
|
||||
atom_init_stage = old_init_stage
|
||||
initialized = old_initialized
|
||||
|
||||
/datum/controller/subsystem/atoms/Recover()
|
||||
atom_init_stage = SSatoms.atom_init_stage
|
||||
if(atom_init_stage == INITIALIZATION_INNEW_MAPLOAD)
|
||||
initialized = SSatoms.initialized
|
||||
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
|
||||
InitializeAtoms()
|
||||
old_init_stage = SSatoms.old_init_stage
|
||||
old_initialized = SSatoms.old_initialized
|
||||
BadInitializeCalls = SSatoms.BadInitializeCalls
|
||||
|
||||
/datum/controller/subsystem/atoms/proc/InitLog()
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
//
|
||||
// Controller handling icon updates of open space turfs
|
||||
//
|
||||
|
||||
GLOBAL_VAR_INIT(open_space_initialised, FALSE)
|
||||
|
||||
SUBSYSTEM_DEF(open_space)
|
||||
name = "Open Space"
|
||||
wait = 2 // 5 times per second.
|
||||
init_order = INIT_ORDER_OPENSPACE
|
||||
var/list/turfs_to_process = list() // List of turfs queued for update.
|
||||
var/list/turfs_to_process_old = null // List of turfs currently being updated.
|
||||
var/counter = 1 // Can't use .len because we need to iterate in order
|
||||
var/static/image/over_OS_darkness // Image overlayed over the bottom turf with stuff in it.
|
||||
|
||||
/datum/controller/subsystem/open_space/Initialize(timeofday)
|
||||
over_OS_darkness = image('icons/turf/open_space.dmi', "black_open")
|
||||
over_OS_darkness.plane = OVER_OPENSPACE_PLANE
|
||||
over_OS_darkness.layer = MOB_LAYER
|
||||
initialize_open_space()
|
||||
// Pre-process open space turfs once before the round starts.
|
||||
fire(FALSE, TRUE)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/open_space/Recover()
|
||||
flags |= SS_NO_INIT // Make extra sure we don't initialize twice.
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/open_space/fire(resumed = 0, init_tick_checks = FALSE)
|
||||
// We use a different list so any additions to the update lists during a delay from MC_TICK_CHECK
|
||||
// don't cause things to be cut from the list without being updated.
|
||||
|
||||
//If we're not resuming, this must mean it's a new iteration so we have to grab the turfs
|
||||
if (!resumed)
|
||||
src.counter = 1
|
||||
src.turfs_to_process_old = turfs_to_process
|
||||
turfs_to_process = list()
|
||||
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/turfs_to_process_old = src.turfs_to_process_old
|
||||
var/counter = src.counter
|
||||
while(counter <= turfs_to_process_old.len)
|
||||
var/turf/T = turfs_to_process_old[counter]
|
||||
counter += 1
|
||||
if(!QDELETED(T))
|
||||
update_turf(T)
|
||||
if (init_tick_checks)
|
||||
CHECK_TICK // Used during initialization processing
|
||||
else if (MC_TICK_CHECK)
|
||||
src.counter = counter // Save for when we're resumed
|
||||
return // Used during normal MC processing.
|
||||
|
||||
/datum/controller/subsystem/open_space/proc/update_turf(var/turf/T)
|
||||
for(var/atom/movable/A in T)
|
||||
A.fall()
|
||||
T.update_icon()
|
||||
|
||||
/datum/controller/subsystem/open_space/proc/add_turf(var/turf/T, var/recursive = 0)
|
||||
ASSERT(isturf(T))
|
||||
// Check for multiple additions
|
||||
// Pointless to process the same turf twice. But we need to push it to the end of the list
|
||||
// because any turfs below it need to process first.
|
||||
turfs_to_process -= T
|
||||
turfs_to_process += T
|
||||
if(recursive > 0)
|
||||
var/turf/above = GetAbove(T)
|
||||
if(above && isopenspace(above))
|
||||
add_turf(above, recursive)
|
||||
|
||||
// Queue the initial updates of open space turfs when the game starts. This will lag!
|
||||
/datum/controller/subsystem/open_space/proc/initialize_open_space()
|
||||
// Do initial setup from bottom to top.
|
||||
for(var/zlevel = 1 to world.maxz)
|
||||
for(var/turf/simulated/open/T in block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel)))
|
||||
add_turf(T)
|
||||
CHECK_TICK
|
||||
GLOB.open_space_initialised = TRUE
|
||||
|
||||
/datum/controller/subsystem/open_space/stat_entry(msg_prefix)
|
||||
return ..("T [turfs_to_process.len]")
|
||||
|
||||
/obj/update_icon()
|
||||
. = ..()
|
||||
if(GLOB.open_space_initialised && !invisibility && isturf(loc))
|
||||
var/turf/T = GetAbove(src)
|
||||
if(isopenspace(T))
|
||||
// log_debug("[T] ([T.x],[T.y],[T.z]) queued for update for [src].update_icon()")
|
||||
SSopen_space.add_turf(T, 1)
|
||||
|
||||
// We probably should hook Destroy() If we can think of something more efficient, lets hear it.
|
||||
/obj/Destroy()
|
||||
if(GLOB.open_space_initialised && !invisibility && isturf(loc))
|
||||
var/turf/T = GetAbove(src)
|
||||
if(isopenspace(T))
|
||||
SSopen_space.add_turf(T, 1)
|
||||
. = ..() // Important that this be at the bottom, or we will have been moved to nullspace.
|
||||
@@ -416,7 +416,7 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
if(new_char)
|
||||
qdel(player)
|
||||
if(new_char.client)
|
||||
var/obj/screen/splash/S = new(null, new_char.client, TRUE)
|
||||
var/obj/screen/splash/S = new(new_char.client, TRUE)
|
||||
S.Fade(TRUE)
|
||||
|
||||
// If they're a carbon, they can get manifested
|
||||
|
||||
Reference in New Issue
Block a user