[MIRROR] ss atoms update (#10736)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-04-24 23:18:14 -07:00
committed by GitHub
parent 84fad52804
commit 6169daa735
54 changed files with 435 additions and 247 deletions

12
code/__defines/_atoms.dm Normal file
View File

@@ -0,0 +1,12 @@
#define BAD_INIT_QDEL_BEFORE 1
#define BAD_INIT_DIDNT_INIT 2
#define BAD_INIT_SLEPT 4
#define BAD_INIT_NO_HINT 8
#ifdef PROFILE_MAPLOAD_INIT_ATOM
#define PROFILE_INIT_ATOM_BEGIN(...) var/__profile_stat_time = TICK_USAGE
#define PROFILE_INIT_ATOM_END(atom) mapload_init_times[##atom.type] += TICK_USAGE_TO_MS(__profile_stat_time)
#else
#define PROFILE_INIT_ATOM_BEGIN(...)
#define PROFILE_INIT_ATOM_END(...)
#endif

View File

@@ -14,3 +14,5 @@
#define ICON_SIZE_X 32
/// The Y/Height dimension of ICON_SIZE. This will more than likely be the smaller axis.
#define ICON_SIZE_Y 32
#define EMPTY_BLOCK_GUARD ;

View File

@@ -61,6 +61,12 @@
#define COMSIG_ATOM_CREATED "atom_created"
//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE "atom_init_success"
//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization and has a loc
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON "atom_init_success_on"
/// called post /obj/item initialize (obj/item/created_item)
#define COMSIG_GLOB_ATOM_AFTER_POST_INIT "!atom_after_post_init"
///from base of atom/attackby(): (/obj/item, /mob/living, params)
#define COMSIG_PARENT_ATTACKBY "atom_attackby"
///Return this in response if you don't want later item attack procs to be called.

View File

@@ -76,8 +76,11 @@
#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
..();\
if(!(flags & ATOM_INITIALIZED)) {\
var/previous_initialized_value = SSatoms.initialized;\
SSatoms.initialized = INITIALIZATION_INNEW_MAPLOAD;\
args[1] = TRUE;\
SSatoms.InitAtom(src, args);\
SSatoms.InitAtom(src, FALSE, args);\
SSatoms.initialized = previous_initialized_value;\
}\
}
//CHOMPEdit End

View File

@@ -1254,7 +1254,7 @@ var/list/WALLITEMS = list(
var/color = hex ? hex : "#[num2hex(red, 2)][num2hex(green, 2)][num2hex(blue, 2)]"
return "<span style='font-face: fixedsys; font-size: 14px; background-color: [color]; color: [color]'>___</span>"
var/mob/dview/dview_mob = new
var/mob/dview/dview_mob
//Version of view() which ignores darkness, because BYOND doesn't have it.
/proc/dview(var/range = world.view, var/center, var/invis_flags = 0)
@@ -1262,7 +1262,6 @@ var/mob/dview/dview_mob = new
return
if(!dview_mob) //VOREStation Add: Debugging
dview_mob = new
log_error("Had to recreate the dview mob!")
dview_mob.loc = center

View File

@@ -3,21 +3,21 @@
The global hud:
Uses the same visual objects for all players.
*/
var/datum/global_hud/global_hud = new()
var/list/global_huds = list(
global_hud.druggy,
global_hud.blurry,
global_hud.whitense,
global_hud.vimpaired,
global_hud.darkMask,
global_hud.centermarker,
global_hud.nvg,
global_hud.thermal,
global_hud.meson,
global_hud.science,
global_hud.material,
global_hud.holomap
)
GLOBAL_DATUM_INIT(global_hud, /datum/global_hud, new)
GLOBAL_LIST_INIT(global_huds, list(
GLOB.global_hud.druggy,
GLOB.global_hud.blurry,
GLOB.global_hud.whitense,
GLOB.global_hud.vimpaired,
GLOB.global_hud.darkMask,
GLOB.global_hud.centermarker,
GLOB.global_hud.nvg,
GLOB.global_hud.thermal,
GLOB.global_hud.meson,
GLOB.global_hud.science,
GLOB.global_hud.material,
GLOB.global_hud.holomap
))
/datum/hud/var/obj/screen/grab_intent
/datum/hud/var/obj/screen/hurt_intent

View File

@@ -1,112 +1,174 @@
#define BAD_INIT_QDEL_BEFORE 1
#define BAD_INIT_DIDNT_INIT 2
#define BAD_INIT_SLEPT 4
#define BAD_INIT_NO_HINT 8
SUBSYSTEM_DEF(atoms)
name = "Atoms"
init_order = INIT_ORDER_ATOMS
flags = SS_NO_FIRE
var/static/initialized = INITIALIZATION_INSSATOMS
var/static/old_initialized
/// A stack of list(source, desired initialized state)
/// We read the source of init changes from the last entry, and assert that all changes will come with a reset
var/list/initialized_state = list()
var/base_initialized
var/list/late_loaders
var/list/created_atoms
var/initialized = INITIALIZATION_INSSATOMS
var/list/late_loaders = list()
var/list/BadInitializeCalls = list()
///initAtom() adds the atom its creating to this list iff InitializeAtoms() has been given a list to populate as an argument
var/list/created_atoms
/// Atoms that will be deleted once the subsystem is initialized
var/list/queued_deletions = list()
var/init_start_time
#ifdef PROFILE_MAPLOAD_INIT_ATOM
var/list/mapload_init_times = list()
#endif
initialized = INITIALIZATION_INSSATOMS
/datum/controller/subsystem/atoms/Initialize()
init_start_time = world.time
initialized = INITIALIZATION_INNEW_MAPLOAD
to_world_log("Initializing objects")
admin_notice(span_danger("Initializing objects"), R_DEBUG)
InitializeAtoms()
initialized = INITIALIZATION_INNEW_REGULAR
return SS_INIT_SUCCESS
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms)
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms, list/atoms_to_return)
if(initialized == INITIALIZATION_INSSATOMS)
return
initialized = INITIALIZATION_INNEW_MAPLOAD
// Generate a unique mapload source for this run of InitializeAtoms
var/static/uid = 0
uid = (uid + 1) % (SHORT_REAL_LIMIT - 1)
var/source = "subsystem init [uid]"
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, source)
LAZYINITLIST(late_loaders)
var/count
var/list/mapload_arg = list(TRUE)
if(atoms)
created_atoms = list()
count = atoms.len
for(var/atom/A as anything in atoms)
if(!(A.flags & ATOM_INITIALIZED))
if(InitAtom(A, mapload_arg))
atoms -= A
CHECK_TICK
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.flags & ATOM_INITIALIZED))
InitAtom(A, mapload_arg)
++count
CHECK_TICK
log_world("Initialized [count] atoms")
initialized = INITIALIZATION_INNEW_REGULAR
// This may look a bit odd, but if the actual atom creation runtimes for some reason, we absolutely need to set initialized BACK
CreateAtoms(atoms, atoms_to_return, source)
clear_tracked_initalize(source)
if(late_loaders.len)
for(var/atom/A as anything in late_loaders)
for(var/I in 1 to late_loaders.len)
var/atom/A = late_loaders[I]
//I hate that we need this
if(QDELETED(A))
continue
A.LateInitialize()
CHECK_TICK
testing("Late initialized [late_loaders.len] atoms")
late_loaders.Cut()
/datum/controller/subsystem/atoms/proc/InitAtom(atom/A, list/arguments)
var/the_type = A.type
if(QDELING(A))
BadInitializeCalls[the_type] |= BAD_INIT_QDEL_BEFORE
return TRUE
if (created_atoms)
atoms_to_return += created_atoms
created_atoms = null
var/start_tick = world.time
for (var/queued_deletion in queued_deletions)
qdel(queued_deletion)
var/result = A.Initialize(arglist(arguments))
testing("[queued_deletions.len] atoms were queued for deletion.")
queued_deletions.Cut()
if(start_tick != world.time)
BadInitializeCalls[the_type] |= BAD_INIT_SLEPT
#ifdef PROFILE_MAPLOAD_INIT_ATOM
rustg_file_write(json_encode(mapload_init_times), "[GLOB.log_directory]/init_times.json")
#endif
var/qdeleted = FALSE
/// Actually creates the list of atoms. Exists solely so a runtime in the creation logic doesn't cause initialized to totally break
/datum/controller/subsystem/atoms/proc/CreateAtoms(list/atoms, list/atoms_to_return = null, mapload_source = null)
if (atoms_to_return)
LAZYINITLIST(created_atoms)
if(result != INITIALIZE_HINT_NORMAL)
switch(result)
if(INITIALIZE_HINT_LATELOAD)
if(arguments[1]) //mapload
late_loaders += A
#ifdef TESTING
var/count
#endif
var/list/mapload_arg = list(TRUE)
if(atoms)
#ifdef TESTING
count = atoms.len
#endif
for(var/I in 1 to atoms.len)
var/atom/A = atoms[I]
if(!(A.flags & ATOM_INITIALIZED))
// Unrolled CHECK_TICK setup to let us enable/disable mapload based off source
if(TICK_CHECK)
clear_tracked_initalize(mapload_source)
stoplag()
if(mapload_source)
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, mapload_source)
PROFILE_INIT_ATOM_BEGIN()
InitAtom(A, TRUE, mapload_arg)
PROFILE_INIT_ATOM_END(A)
else
A.LateInitialize()
if(INITIALIZE_HINT_QDEL)
qdel(A)
qdeleted = TRUE
else
BadInitializeCalls[the_type] |= BAD_INIT_NO_HINT
#ifdef TESTING
count = 0
#endif
if(!A) //possible harddel
qdeleted = TRUE
else if(!(A.flags & ATOM_INITIALIZED))
BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT
for(var/atom/A as anything in world)
if(!(A.flags & ATOM_INITIALIZED))
PROFILE_INIT_ATOM_BEGIN()
InitAtom(A, FALSE, mapload_arg)
PROFILE_INIT_ATOM_END(A)
#ifdef TESTING
++count
#endif
if(TICK_CHECK)
clear_tracked_initalize(mapload_source)
stoplag()
if(mapload_source)
set_tracked_initalized(INITIALIZATION_INNEW_MAPLOAD, mapload_source)
return qdeleted || QDELING(A)
#ifdef TESTING
testing("Initialized [count] atoms")
#endif
/datum/controller/subsystem/atoms/proc/map_loader_begin()
old_initialized = initialized
initialized = INITIALIZATION_INSSATOMS
/datum/controller/subsystem/atoms/proc/map_loader_begin(source)
set_tracked_initalized(INITIALIZATION_INSSATOMS, source)
/datum/controller/subsystem/atoms/proc/map_loader_stop()
initialized = old_initialized
/datum/controller/subsystem/atoms/proc/map_loader_stop(source)
clear_tracked_initalize(source)
/// Returns the source currently modifying SSatom's init behavior
/datum/controller/subsystem/atoms/proc/get_initialized_source()
var/state_length = length(initialized_state)
if(!state_length)
return null
return initialized_state[state_length][1]
/// Use this to set initialized to prevent error states where the old initialized is overridden, and we end up losing all context
/// Accepts a state and a source, the most recent state is used, sources exist to prevent overriding old values accidentally
/datum/controller/subsystem/atoms/proc/set_tracked_initalized(state, source)
if(!length(initialized_state))
base_initialized = initialized
initialized_state += list(list(source, state))
initialized = state
/datum/controller/subsystem/atoms/proc/clear_tracked_initalize(source)
if(!length(initialized_state))
return
for(var/i in length(initialized_state) to 1 step -1)
if(initialized_state[i][1] == source)
initialized_state.Cut(i, i+1)
break
if(!length(initialized_state))
initialized = base_initialized
base_initialized = INITIALIZATION_INNEW_REGULAR
return
initialized = initialized_state[length(initialized_state)][2]
/// Returns TRUE if anything is currently being initialized
/datum/controller/subsystem/atoms/proc/initializing_something()
return length(initialized_state) > 1
/datum/controller/subsystem/atoms/Recover()
initialized = SSatoms.initialized
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
InitializeAtoms()
old_initialized = SSatoms.old_initialized
initialized_state = SSatoms.initialized_state
BadInitializeCalls = SSatoms.BadInitializeCalls
/datum/controller/subsystem/atoms/proc/InitLog()
@@ -115,20 +177,23 @@ SUBSYSTEM_DEF(atoms)
. += "Path : [path] \n"
var/fails = BadInitializeCalls[path]
if(fails & BAD_INIT_DIDNT_INIT)
. += "- Didn't call atom/Initialize()\n"
. += "- Didn't call atom/Initialize(mapload)\n"
if(fails & BAD_INIT_NO_HINT)
. += "- Didn't return an Initialize hint\n"
if(fails & BAD_INIT_QDEL_BEFORE)
. += "- Qdel'd in New()\n"
. += "- Qdel'd before Initialize proc ran\n"
if(fails & BAD_INIT_SLEPT)
. += "- Slept during Initialize()\n"
/// Prepares an atom to be deleted once the atoms SS is initialized.
/datum/controller/subsystem/atoms/proc/prepare_deletion(atom/target)
if (initialized == INITIALIZATION_INNEW_REGULAR)
// Atoms SS has already completed, just kill it now.
qdel(target)
else
queued_deletions += WEAKREF(target)
/datum/controller/subsystem/atoms/Shutdown()
var/initlog = InitLog()
if(initlog)
text2file(initlog, "[GLOB.log_directory]-initialize.log")
#undef BAD_INIT_QDEL_BEFORE
#undef BAD_INIT_DIDNT_INIT
#undef BAD_INIT_SLEPT
#undef BAD_INIT_NO_HINT

View File

@@ -22,7 +22,7 @@
valid_spawn_turfs |= F
/area/LateInitialize()
..()
. = ..()
EvalValidSpawnTurfs()
if(!valid_spawn_turfs.len && (mobcountmax || floracountmax))

View File

@@ -60,47 +60,6 @@
/// You will need to manage adding/removing from this yourself, but I'll do the updating for you
var/list/image/update_on_z
/atom/New(loc, ...)
// Don't call ..() unless /datum/New() ever exists
// During dynamic mapload (reader.dm) this assigns the var overrides from the .dmm file
// Native BYOND maploading sets those vars before invoking New(), by doing this FIRST we come as close to that behavior as we can.
if(GLOB.use_preloader && (src.type == GLOB._preloader_path))//in case the instanciated atom is creating other atoms in New()
world.preloader_load(src)
// Pass our arguments to InitAtom so they can be passed to initialize(), but replace 1st with if-we're-during-mapload.
var/do_initialize = SSatoms.initialized
if(do_initialize > INITIALIZATION_INSSATOMS)
args[1] = (do_initialize == INITIALIZATION_INNEW_MAPLOAD)
if(SSatoms.InitAtom(src, args))
// We were deleted. No sense continuing
return
// Uncomment if anything ever uses the return value of SSatoms.InitializeAtoms ~Leshana
// If a map is being loaded, it might want to know about newly created objects so they can be handled.
// var/list/created = SSatoms.created_atoms
// if(created)
// created += src
// Note: I removed "auto_init" feature (letting types disable auto-init) since it shouldn't be needed anymore.
// You can replicate the same by checking the value of the first parameter to initialize() ~Leshana
// Called after New if the map is being loaded, with mapload = TRUE
// Called from base of New if the map is not being loaded, with mapload = FALSE
// This base must be called or derivatives must set initialized to TRUE
// Must not sleep!
// Other parameters are passed from New (excluding loc), this does not happen if mapload is TRUE
// Must return an Initialize hint. Defined in code/__defines/subsystems.dm
/atom/proc/Initialize(mapload, ...)
SHOULD_NOT_SLEEP(TRUE)
SHOULD_CALL_PARENT(TRUE)
if(QDELETED(src))
stack_trace("GC: -- [type] had initialize() called after qdel() --")
if(flags & ATOM_INITIALIZED)
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags |= ATOM_INITIALIZED
return INITIALIZE_HINT_NORMAL
/atom/Destroy()
if(reagents)
QDEL_NULL(reagents)
@@ -108,10 +67,6 @@
QDEL_NULL(light)
return ..()
// Called after all object's normal initialize() if initialize() returns INITIALIZE_HINT_LATELOAD
/atom/proc/LateInitialize()
return
/atom/proc/reveal_blood()
return
@@ -818,6 +773,27 @@ GLOBAL_LIST_EMPTY(icon_dimensions)
GLOB.icon_dimensions[icon_path] = list("width" = my_icon.Width(), "height" = my_icon.Height())
return GLOB.icon_dimensions[icon_path]
///Returns the src and all recursive contents as a list.
/atom/proc/get_all_contents(ignore_flag_1)
. = list(src)
var/i = 0
while(i < length(.))
var/atom/checked_atom = .[++i]
if(checked_atom.flags & ignore_flag_1)
continue
. += checked_atom.contents
///identical to get_all_contents but returns a list of atoms of the type passed in the argument.
/atom/proc/get_all_contents_type(type)
var/list/processing_list = list(src)
. = list()
while(length(processing_list))
var/atom/checked_atom = processing_list[1]
processing_list.Cut(1, 2)
processing_list += checked_atom.contents
if(istype(checked_atom, type))
. += checked_atom
/**
* Respond to our atom being checked by a virus extrapolator.
*

153
code/game/atoms_init.dm Normal file
View File

@@ -0,0 +1,153 @@
/// Init this specific atom
/datum/controller/subsystem/atoms/proc/InitAtom(atom/A, from_template = FALSE, list/arguments)
var/the_type = A.type
if(QDELING(A))
// Check init_start_time to not worry about atoms created before the atoms SS that are cleaned up before this
if (A.gc_destroyed > init_start_time)
BadInitializeCalls[the_type] |= BAD_INIT_QDEL_BEFORE
return TRUE
// This is handled and battle tested by dreamchecker. Limit to UNIT_TESTS just in case that ever fails.
#ifdef UNIT_TESTS
var/start_tick = world.time
#endif
var/result = A.Initialize(arglist(arguments))
#ifdef UNIT_TESTS
if(start_tick != world.time)
BadInitializeCalls[the_type] |= BAD_INIT_SLEPT
#endif
var/qdeleted = FALSE
switch(result)
if (INITIALIZE_HINT_NORMAL)
EMPTY_BLOCK_GUARD // Pass
if(INITIALIZE_HINT_LATELOAD)
if(arguments[1]) //mapload
late_loaders += A
else
A.LateInitialize()
if(INITIALIZE_HINT_QDEL)
qdel(A)
qdeleted = TRUE
else
BadInitializeCalls[the_type] |= BAD_INIT_NO_HINT
if(!A) //possible harddel
qdeleted = TRUE
else if(!(A.flags & ATOM_INITIALIZED))
BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT
else
SEND_SIGNAL(A, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_ATOM_AFTER_POST_INIT, A)
var/atom/location = A.loc
if(location)
/// Sends a signal that the new atom `src`, has been created at `loc`
SEND_SIGNAL(location, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON, A, arguments[1])
if(created_atoms && from_template && ispath(the_type, /atom/movable))//we only want to populate the list with movables
created_atoms += A.get_all_contents()
return qdeleted || QDELING(A)
/**
* Called when an atom is created in byond (built in engine proc)
*
* Not a lot happens here in SS13 code, as we offload most of the work to the
* [Initialization][/atom/proc/Initialize] proc, mostly we run the preloader
* if the preloader is being used and then call [InitAtom][/datum/controller/subsystem/atoms/proc/InitAtom] of which the ultimate
* result is that the Initialize proc is called.
*
*/
/atom/New(loc, ...)
//atom creation method that preloads variables at creation
if(GLOB.use_preloader && src.type == GLOB._preloader_path)//in case the instantiated atom is creating other atoms in New()
world.preloader_load(src)
var/do_initialize = SSatoms.initialized
if(do_initialize != INITIALIZATION_INSSATOMS)
args[1] = do_initialize == INITIALIZATION_INNEW_MAPLOAD
if(SSatoms.InitAtom(src, FALSE, args))
//we were deleted
return
/**
* The primary method that objects are setup in SS13 with
*
* we don't use New as we have better control over when this is called and we can choose
* to delay calls or hook other logic in and so forth
*
* During roundstart map parsing, atoms are queued for initialization in the base atom/New(),
* After the map has loaded, then Initialize is called on all atoms one by one. NB: this
* is also true for loading map templates as well, so they don't Initialize until all objects
* in the map file are parsed and present in the world
*
* If you're creating an object at any point after SSInit has run then this proc will be
* immediately be called from New.
*
* mapload: This parameter is true if the atom being loaded is either being initialized during
* the Atom subsystem initialization, or if the atom is being loaded from the map template.
* If the item is being created at runtime any time after the Atom subsystem is initialized then
* it's false.
*
* The mapload argument occupies the same position as loc when Initialize() is called by New().
* loc will no longer be needed after it passed New(), and thus it is being overwritten
* with mapload at the end of atom/New() before this proc (atom/Initialize()) is called.
*
* You must always call the parent of this proc, otherwise failures will occur as the item
* will not be seen as initialized (this can lead to all sorts of strange behaviour, like
* the item being completely unclickable)
*
* You must not sleep in this proc, or any subprocs
*
* Any parameters from new are passed through (excluding loc), naturally if you're loading from a map
* there are no other arguments
*
* Must return an [initialization hint][INITIALIZE_HINT_NORMAL] or a runtime will occur.
*
* Note: the following functions don't call the base for optimization and must copypasta handling:
* * [/turf/proc/Initialize]
* * [/turf/open/space/proc/Initialize]
*/
/atom/proc/Initialize(mapload, ...)
SHOULD_NOT_SLEEP(TRUE)
SHOULD_CALL_PARENT(TRUE)
if(flags & ATOM_INITIALIZED)
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags |= ATOM_INITIALIZED
/*SET_PLANE_IMPLICIT(src, plane)
if(greyscale_config && greyscale_colors) //we'll check again at item/init for inhand/belt/worn configs.
update_greyscale()
*/
//atom color stuff
if(color)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
/*
if (light_system == COMPLEX_LIGHT && light_power && light_range)
update_light()
*/
return INITIALIZE_HINT_NORMAL
/**
* Late Initialization, for code that should run after all atoms have run Initialization
*
* To have your LateIntialize proc be called, your atoms [Initialization][/atom/proc/Initialize]
* proc must return the hint
* [INITIALIZE_HINT_LATELOAD] otherwise it will never be called.
*
* useful for doing things like finding other machines on GLOB.machines because you can guarantee
* that all atoms will actually exist in the "WORLD" at this time and that all their Initialization
* code has been run
*/
/atom/proc/LateInitialize()
set waitfor = FALSE
SHOULD_CALL_PARENT(FALSE)
stack_trace("[src] ([type]) called LateInitialize but has nothing on it!")

View File

@@ -46,7 +46,7 @@
wires = new(src)
assembly = new(src)
assembly.state = 4
client_huds |= global_hud.whitense
client_huds |= GLOB.global_hud.whitense
/* // Use this to look for cameras that have the same c_tag.
for(var/obj/machinery/camera/C in cameranet.cameras)

View File

@@ -73,7 +73,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/machinery/computer/message_monitor/LateInitialize()
. = ..()
//Is the server isn't linked to a server, and there's a server available, default it to the first one in the list.
if(!linkedServer)
if(message_servers && message_servers.len > 0)

View File

@@ -41,8 +41,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/machinery/door_timer/LateInitialize()
. = ..()
for(var/obj/machinery/door/window/brigdoor/M in GLOB.machines)
if(M.id == id)
LAZYADD(targets,M)

View File

@@ -123,8 +123,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
/obj/machinery/telecomms/LateInitialize()
. = ..()
//Set the listening_level if there's none.
if(!listening_level)
//Defaults to our Z level!

View File

@@ -9,7 +9,6 @@
/obj/effect/expl_particles/Initialize(mapload)
. = ..()
QDEL_IN(src, 1.5 SECONDS)
return
/datum/effect/system/expl_particles
var/number = 10
@@ -44,7 +43,6 @@
/obj/effect/explosion/Initialize(mapload)
. = ..()
QDEL_IN(src, 1 SECOND)
return
/datum/effect/system/explosion
var/turf/location

View File

@@ -109,8 +109,6 @@
. = ..()
tag = "start*[name]"
return 1
/obj/effect/landmark/forbidden_level
delete_me = TRUE

View File

@@ -810,7 +810,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
if((M.stat && !zoom) || !(ishuman(M)))
to_chat(M, span_filter_notice("You are unable to focus through the [devicename]."))
cannotzoom = 1
else if(!zoom && (global_hud.darkMask[1] in M.client.screen))
else if(!zoom && (GLOB.global_hud.darkMask[1] in M.client.screen))
to_chat(M, span_filter_notice("Your visor gets in the way of looking through the [devicename]."))
cannotzoom = 1
else if(!zoom && M.get_active_hand() != src)

View File

@@ -451,8 +451,8 @@ var/global/list/obj/item/communicator/all_communicators = list() //Don't change
/obj/machinery/camera/communicator/Initialize(mapload)
. = ..()
client_huds |= global_hud.whitense
client_huds |= global_hud.darkMask
client_huds |= GLOB.global_hud.whitense
client_huds |= GLOB.global_hud.darkMask
//It's the 26th century. We should have smart watches by now.
/obj/item/communicator/watch

View File

@@ -87,11 +87,11 @@ var/global/list/default_medbay_channels = list(
wires = new(src)
internal_channels = default_internal_channels.Copy()
listening_objects += src
if(bluespace_radio && (bs_tx_preload_id || bs_rx_preload_id))
return INITIALIZE_HINT_LATELOAD
/obj/item/radio/LateInitialize()
. = ..()
if(bluespace_radio)
if(bs_tx_preload_id)
//Try to find a receiver
for(var/obj/machinery/telecomms/receiver/RX in telecomms_list)

View File

@@ -47,7 +47,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/closet/LateInitialize()
. = ..()
if(starts_with)
create_objects_in_loc(src, starts_with)
starts_with = null

View File

@@ -46,7 +46,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/low_wall/LateInitialize()
. = ..()
update_connections(1)
update_icon()
@@ -351,7 +350,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/grille/bay/LateInitialize()
. = ..()
update_connections(1)
update_icon()
@@ -412,7 +410,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/window/bay/LateInitialize()
. = ..()
icon_state = ""
update_icon()
@@ -503,7 +500,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/window/eris/LateInitialize()
. = ..()
icon_state = ""
update_icon()

View File

@@ -34,7 +34,6 @@ FLOOR SAFES
return INITIALIZE_HINT_LATELOAD
/obj/structure/safe/LateInitialize()
. = ..()
for(var/obj/item/I in loc)
if(space >= maxspace)
return

View File

@@ -354,7 +354,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/structure/hull_corner/LateInitialize()
. = ..()
update_look()
/obj/structure/hull_corner/proc/get_dirs_to_test()

View File

@@ -99,7 +99,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/meson/Initialize(mapload)
. = ..()
overlay = global_hud.meson
overlay = GLOB.global_hud.meson
/obj/item/clothing/glasses/meson/prescription
name = "prescription mesons"
@@ -144,7 +144,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/science/Initialize(mapload)
. = ..()
overlay = global_hud.science
overlay = GLOB.global_hud.science
/obj/item/clothing/glasses/goggles
name = "goggles"
@@ -174,7 +174,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/night/Initialize(mapload)
. = ..()
overlay = global_hud.nvg
overlay = GLOB.global_hud.nvg
/obj/item/clothing/glasses/eyepatch
name = "eyepatch"
@@ -244,7 +244,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/material/Initialize(mapload)
. = ..()
overlay = global_hud.material
overlay = GLOB.global_hud.material
/obj/item/clothing/glasses/material/prescription
name = "prescription optical material scanner"
@@ -266,7 +266,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/graviton/Initialize(mapload)
. = ..()
overlay = global_hud.material
overlay = GLOB.global_hud.material
/obj/item/clothing/glasses/regular
name = "prescription glasses"
@@ -553,7 +553,7 @@ BLIND // can't see anything
/obj/item/clothing/glasses/thermal/Initialize(mapload)
. = ..()
overlay = global_hud.thermal
overlay = GLOB.global_hud.thermal
/obj/item/clothing/glasses/thermal/syndi //These are now a traitor item, concealed as mesons. -Pete
name = "optical meson scanner"

View File

@@ -100,12 +100,12 @@
// TODO - This part!! ~Leshana
if(isliving(user) && anchored && !(stat & (NOPOWER|BROKEN)))
if(user.client)
holomap_datum.station_map.loc = global_hud.holomap // Put the image on the holomap hud
holomap_datum.station_map.loc = GLOB.global_hud.holomap // Put the image on the holomap hud
holomap_datum.station_map.alpha = 0 // Set to transparent so we can fade in
animate(holomap_datum.station_map, alpha = 255, time = 5, easing = LINEAR_EASING)
flick("station_map_activate", src)
// Wait, if wea re not modifying the holomap_obj... can't it be part of the global hud?
user.client.screen |= global_hud.holomap // TODO - HACK! This should be there permenently really.
user.client.screen |= GLOB.global_hud.holomap // TODO - HACK! This should be there permenently really.
user.client.images |= holomap_datum.station_map
watching_mob = user

View File

@@ -124,7 +124,6 @@ var/static/list/fake_sunlight_zs = list()
return INITIALIZE_HINT_LATELOAD
/obj/effect/fake_sun/LateInitialize()
. = ..()
if(family) //Allows one to make multiple fake_suns to use the same settings
for(var/obj/effect/fake_sun/l in world_suns) //check all the suns that exist
if(l.family == family && l.shared_settings) //do you have settings we need?

View File

@@ -123,7 +123,7 @@
healths.icon_state = "health7"
if (client)
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
if ( stat != 2)
if ((blinded))

View File

@@ -204,7 +204,7 @@
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if (client)
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
if (stat != 2)
if ((blinded))

View File

@@ -1501,7 +1501,7 @@
..()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson, global_hud.science, global_hud.material, global_hud.whitense)
client.screen.Remove(GLOB.global_hud.blurry, GLOB.global_hud.druggy, GLOB.global_hud.vimpaired, GLOB.global_hud.darkMask, GLOB.global_hud.nvg, GLOB.global_hud.thermal, GLOB.global_hud.meson, GLOB.global_hud.science, GLOB.global_hud.material, GLOB.global_hud.whitense)
if(istype(client.eye,/obj/machinery/camera))
var/obj/machinery/camera/cam = client.eye
@@ -1708,7 +1708,7 @@
found_welder = 1
if(absorbed) found_welder = 1
if(found_welder)
client.screen |= global_hud.darkMask
client.screen |= GLOB.global_hud.darkMask
/mob/living/carbon/human/reset_view(atom/A)
..()

View File

@@ -9,7 +9,7 @@
make_hud_overlays()
//I'll just hang my coat up over here
dsoverlay = image('icons/mob/darksight.dmi',global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see.
dsoverlay = image('icons/mob/darksight.dmi',GLOB.global_hud.darksight) //This is a secret overlay! Go look at the file, you'll see.
var/mutable_appearance/dsma = new(dsoverlay) //Changing like ten things, might as well.
dsma.alpha = 0
dsma.plane = PLANE_LIGHTING

View File

@@ -5,7 +5,7 @@
mind.active = 1 //indicates that the mind is currently synced with a client
//If they're SSD, remove it so they can wake back up.
update_antag_icons(mind)
client.screen |= global_hud.darksight
client.screen |= GLOB.global_hud.darksight
client.images |= dsoverlay
if(ai_holder && !ai_holder.autopilot)

View File

@@ -208,7 +208,6 @@
/mob/living/silicon/robot/LateInitialize()
. = ..()
pick_module()
update_icon()

View File

@@ -1109,15 +1109,15 @@
/obj/effect/landmark/area_gatherer
name = "stardog area gatherer"
/obj/effect/landmark/area_gatherer/Initialize(mapload)
. = ..()
LateInitialize()
return INITIALIZE_HINT_LATELOAD
/obj/effect/landmark/area_gatherer/LateInitialize() //I am very afraid
var/obj/effect/overmap/visitable/ship/simplemob/stardog/s = get_overmap_sector(z)
var/mob/living/simple_mob/vore/overmap/stardog/dog = s.parent
dog.weather_areas |= get_area(src)
for(var/thing in dog.weather_areas)
qdel(src)
/obj/machinery/computer/ship/navigation/telescreen/dog_eye

View File

@@ -41,8 +41,8 @@
// Description: Adds a static overlay to the client's screen.
/mob/living/voice/Login()
..()
client.screen |= global_hud.whitense
client.screen |= global_hud.darkMask
client.screen |= GLOB.global_hud.whitense
client.screen |= GLOB.global_hud.darkMask
// Proc: Destroy()
// Parameters: None

View File

@@ -305,7 +305,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
var/percent_done = (world.time - (install_done - (15 MINUTES))) / (15 MINUTES) //CHOMPedit: 35 minutes down to 15 minutes.
if(human.client)
human.client.screen.Add(global_hud.whitense) //This is the camera static
human.client.screen.Add(GLOB.global_hud.whitense) //This is the camera static
switch(percent_done) //This is 0.0 to 1.0 kinda percent.
//Connecting to optical nerves

View File

@@ -112,7 +112,7 @@
if((. = ..()))
var/mob/living/carbon/human/H = nif.human
if(H.client)
H.client.screen |= global_hud.meson
H.client.screen |= GLOB.global_hud.meson
/datum/nifsoft/material
name = "Material Scanner"
@@ -132,7 +132,7 @@
if((. = ..()))
var/mob/living/carbon/human/H = nif.human
if(H.client)
H.client.screen |= global_hud.material
H.client.screen |= GLOB.global_hud.material
/datum/nifsoft/thermals
name = "Thermal Scanner"
@@ -153,7 +153,7 @@
if((. = ..()))
var/mob/living/carbon/human/H = nif.human
if(H.client)
H.client.screen |= global_hud.thermal
H.client.screen |= GLOB.global_hud.thermal
/datum/nifsoft/nightvis
name = "Low-Light Amp"
@@ -173,4 +173,4 @@
if((. = ..()))
var/mob/living/carbon/human/H = nif.human
if(H.client)
H.client.screen |= global_hud.nvg
H.client.screen |= GLOB.global_hud.nvg

View File

@@ -348,12 +348,12 @@
if(soulcatcher) // needs it's own handling to allow vore_fx
if(ext_blind)
eye_blind = 5
client.screen.Remove(global_hud.whitense)
client.screen.Remove(GLOB.global_hud.whitense)
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
else
eye_blind = 0
clear_fullscreens()
client.screen.Add(global_hud.whitense)
client.screen.Add(GLOB.global_hud.whitense)
//If they're deaf
if(ext_deaf)

View File

@@ -86,7 +86,6 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/brain/LateInitialize()
. = ..()
if(brainmob)
butcherable = FALSE

View File

@@ -28,7 +28,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/eyes/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -33,7 +33,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/heart/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -49,7 +49,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/kidneys/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -64,7 +64,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/liver/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -64,7 +64,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/lungs/grey/colormatch/LateInitialize()
. = ..()
if(owner && ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -253,7 +253,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/external/LateInitialize()
. = ..()
if(!QDELETED(src))
get_icon()

View File

@@ -57,7 +57,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/mmi_holder/LateInitialize()
. = ..()
update_from_mmi()
// This sits in the brain organ slot, but is not a brain. Posibrains and dronecores aren't brains either.

View File

@@ -19,7 +19,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/xenos/eggsac/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color
@@ -62,7 +61,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/xenos/plasmavessel/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color
@@ -101,7 +99,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/xenos/acidgland/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color
@@ -120,7 +117,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/xenos/hivenode/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color
@@ -144,7 +140,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/item/organ/internal/xenos/resinspinner/grey/colormatch/LateInitialize()
. = ..()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
color = H.species.blood_color

View File

@@ -217,7 +217,6 @@ GLOBAL_LIST_EMPTY(apcs)
return INITIALIZE_HINT_LATELOAD
/obj/machinery/power/apc/LateInitialize()
. = ..()
update()
/obj/machinery/power/apc/Destroy()

View File

@@ -134,7 +134,6 @@ GLOBAL_LIST_EMPTY(gravity_generators)
/obj/machinery/gravity_generator/main/LateInitialize() //Needs to happen after overmap sectors are initialized so we can figure out where we are
update_list()
update_areas()
return ..()
/obj/machinery/gravity_generator/main/set_fix()
. = ..()

View File

@@ -86,10 +86,12 @@ GLOBAL_LIST_EMPTY(smeses)
connect_to_network()
if(!should_be_mapped)
warning("Non-buildable or Non-magical SMES at [src.x]X [src.y]Y [src.z]Z")
/obj/machinery/power/smes/buildable/Initialize(mapload)
. = ..()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/power/smes/buildable/LateInitialize()
. = ..()
// Detect new coils placed by mappers
var/list/parts_found = list()
for(var/i = 1, i <= loc.contents.len, i++)

View File

@@ -25,7 +25,6 @@
return INITIALIZE_HINT_LATELOAD
/obj/turbolift_map_holder/LateInitialize()
. = ..()
// Create our system controller.
var/datum/turbolift/lift = new()

View File

@@ -57,7 +57,7 @@ var/list/ventcrawl_machinery = list(
if(is_ventcrawling && istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes
remove_ventcrawl()
add_ventcrawl(loc)
client.screen += global_hud.centermarker
client.screen += GLOB.global_hud.centermarker
/mob/living/simple_mob/slime/xenobio/can_ventcrawl()
if(victim)
@@ -239,7 +239,7 @@ var/list/ventcrawl_machinery = list(
pipes_shown += A.pipe_image
client.images += A.pipe_image
if(client)
client.screen += global_hud.centermarker
client.screen += GLOB.global_hud.centermarker
/mob/living/proc/remove_ventcrawl()
is_ventcrawling = 0
@@ -247,7 +247,7 @@ var/list/ventcrawl_machinery = list(
if(client)
for(var/image/current_image in pipes_shown)
client.images -= current_image
client.screen -= global_hud.centermarker
client.screen -= GLOB.global_hud.centermarker
client.eye = src
pipes_shown.len = 0

View File

@@ -30,15 +30,15 @@
if(ext_blind)
eye_blind = 5
client.screen.Remove(global_hud.whitense)
client.screen.Remove(GLOB.global_hud.whitense)
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
else
eye_blind = 0
clear_fullscreen("blind")
if(!gem.flag_check(SOULGEM_SHOW_VORE_SFX))
client.screen.Add(global_hud.whitense)
client.screen.Add(GLOB.global_hud.whitense)
if(gem.flag_check(SOULGEM_SHOW_VORE_SFX))
client.screen.Remove(global_hud.whitense)
client.screen.Remove(GLOB.global_hud.whitense)
// Say proc for captures souls
/mob/living/carbon/brain/caught_soul/vore/say(var/message, var/datum/language/speaking = null, var/whispering = 0)

View File

@@ -12,12 +12,14 @@ GLOBAL_LIST_EMPTY(simple_portals)
var/teleport_sound = 'sound/effects/portal_effect.ogg'
/obj/effect/simple_portal/Initialize(mapload)
..()
. = ..()
GLOB.simple_portals += src
/obj/effect/simple_portal/linked/Initialize(mapload)
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/simple_portal/linked/LateInitialize()
. = ..()
if(portal_id)
link_portal()

View File

@@ -18,6 +18,7 @@
#include "code\names.dm"
#include "code\world.dm"
#include "code\__defines\__globals.dm"
#include "code\__defines\_atoms.dm"
#include "code\__defines\_bitfields.dm"
#include "code\__defines\_click.dm"
#include "code\__defines\_compile_options.dm"
@@ -744,6 +745,7 @@
#include "code\defines\procs\statistics.dm"
#include "code\game\atoms.dm"
#include "code\game\atoms_ch.dm"
#include "code\game\atoms_init.dm"
#include "code\game\atoms_movable.dm"
#include "code\game\atoms_movable_ch.dm"
#include "code\game\atoms_movable_vr.dm"