diff --git a/code/__defines/_atoms.dm b/code/__defines/_atoms.dm new file mode 100644 index 0000000000..abc4d80517 --- /dev/null +++ b/code/__defines/_atoms.dm @@ -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 diff --git a/code/__defines/_helpers.dm b/code/__defines/_helpers.dm index cba0f3222c..bb8c3b3c5a 100644 --- a/code/__defines/_helpers.dm +++ b/code/__defines/_helpers.dm @@ -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 ; diff --git a/code/__defines/dcs/signals.dm b/code/__defines/dcs/signals.dm index 734da1990a..58938a5ed6 100644 --- a/code/__defines/dcs/signals.dm +++ b/code/__defines/dcs/signals.dm @@ -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. diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index dfcbf73374..3852940e67 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -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 diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 1662ebdde1..96e7c01cdc 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1254,7 +1254,7 @@ var/list/WALLITEMS = list( var/color = hex ? hex : "#[num2hex(red, 2)][num2hex(green, 2)][num2hex(blue, 2)]" return "___" -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 diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 737493ea83..8cd701e089 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -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 diff --git a/code/controllers/subsystems/atoms.dm b/code/controllers/subsystems/atoms.dm index 972765a4f2..e30803118c 100644 --- a/code/controllers/subsystems/atoms.dm +++ b/code/controllers/subsystems/atoms.dm @@ -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 - else - A.LateInitialize() - if(INITIALIZE_HINT_QDEL) - qdel(A) - qdeleted = TRUE - else - BadInitializeCalls[the_type] |= BAD_INIT_NO_HINT + #ifdef TESTING + var/count + #endif - if(!A) //possible harddel - qdeleted = TRUE - else if(!(A.flags & ATOM_INITIALIZED)) - BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT + var/list/mapload_arg = list(TRUE) - return qdeleted || QDELING(A) + if(atoms) + #ifdef TESTING + count = atoms.len + #endif -/datum/controller/subsystem/atoms/proc/map_loader_begin() - old_initialized = initialized - initialized = INITIALIZATION_INSSATOMS + 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 + #ifdef TESTING + count = 0 + #endif -/datum/controller/subsystem/atoms/proc/map_loader_stop() - initialized = old_initialized + 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) + + #ifdef TESTING + testing("Initialized [count] atoms") + #endif + +/datum/controller/subsystem/atoms/proc/map_loader_begin(source) + set_tracked_initalized(INITIALIZATION_INSSATOMS, source) + +/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 diff --git a/code/game/area/Away Mission areas.dm b/code/game/area/Away Mission areas.dm index fc6ff0b01d..70f83543e2 100644 --- a/code/game/area/Away Mission areas.dm +++ b/code/game/area/Away Mission areas.dm @@ -22,7 +22,7 @@ valid_spawn_turfs |= F /area/LateInitialize() - ..() + . = ..() EvalValidSpawnTurfs() if(!valid_spawn_turfs.len && (mobcountmax || floracountmax)) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e61f52af4b..8a41a72f1c 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -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. * diff --git a/code/game/atoms_init.dm b/code/game/atoms_init.dm new file mode 100644 index 0000000000..666ff6312a --- /dev/null +++ b/code/game/atoms_init.dm @@ -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!") diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 06e2311d41..28db32dead 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -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) diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 2d18ccfe5f..46e3d87844 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -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) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 7bfbd9c1c5..4697c98675 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -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) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 1594b1a65b..ee1b5fcbed 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -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! diff --git a/code/game/objects/effects/explosion_particles.dm b/code/game/objects/effects/explosion_particles.dm index 0b8091ceb8..450d97bb30 100644 --- a/code/game/objects/effects/explosion_particles.dm +++ b/code/game/objects/effects/explosion_particles.dm @@ -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 diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index c7a76be876..b04ec5ce07 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -109,8 +109,6 @@ . = ..() tag = "start*[name]" - return 1 - /obj/effect/landmark/forbidden_level delete_me = TRUE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 768559e061..abb5f36cf3 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -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) diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm index baa68d2a15..2a6a3bf9cc 100644 --- a/code/game/objects/items/devices/communicator/communicator.dm +++ b/code/game/objects/items/devices/communicator/communicator.dm @@ -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 diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index abdf86cb23..6aaa3d897f 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -87,45 +87,45 @@ var/global/list/default_medbay_channels = list( wires = new(src) internal_channels = default_internal_channels.Copy() listening_objects += src - return INITIALIZE_HINT_LATELOAD + + 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) - if(RX.id == bs_tx_preload_id) //Again, bs_tx is the thing to TRANSMIT TO, so a receiver. - bs_tx_weakref = WEAKREF(RX) - RX.link_radio(src) + if(bs_tx_preload_id) + //Try to find a receiver + for(var/obj/machinery/telecomms/receiver/RX in telecomms_list) + if(RX.id == bs_tx_preload_id) //Again, bs_tx is the thing to TRANSMIT TO, so a receiver. + bs_tx_weakref = WEAKREF(RX) + RX.link_radio(src) + break + //Hmm, howabout an AIO machine + if(!bs_tx_weakref) + for(var/obj/machinery/telecomms/allinone/AIO in telecomms_list) + if(AIO.id == bs_tx_preload_id) + bs_tx_weakref = WEAKREF(AIO) + AIO.link_radio(src) break - //Hmm, howabout an AIO machine - if(!bs_tx_weakref) - for(var/obj/machinery/telecomms/allinone/AIO in telecomms_list) - if(AIO.id == bs_tx_preload_id) - bs_tx_weakref = WEAKREF(AIO) - AIO.link_radio(src) - break - if(!bs_tx_weakref) - testing("A radio [src] at [x],[y],[z] specified bluespace prelink IDs, but the machines with corresponding IDs ([bs_tx_preload_id], [bs_rx_preload_id]) couldn't be found.") + if(!bs_tx_weakref) + testing("A radio [src] at [x],[y],[z] specified bluespace prelink IDs, but the machines with corresponding IDs ([bs_tx_preload_id], [bs_rx_preload_id]) couldn't be found.") - if(bs_rx_preload_id) - var/found = 0 - //Try to find a transmitter - for(var/obj/machinery/telecomms/broadcaster/TX in telecomms_list) - if(TX.id == bs_rx_preload_id) //Again, bs_rx is the thing to RECEIVE FROM, so a transmitter. - TX.link_radio(src) + if(bs_rx_preload_id) + var/found = 0 + //Try to find a transmitter + for(var/obj/machinery/telecomms/broadcaster/TX in telecomms_list) + if(TX.id == bs_rx_preload_id) //Again, bs_rx is the thing to RECEIVE FROM, so a transmitter. + TX.link_radio(src) + found = 1 + break + //Hmm, howabout an AIO machine + if(!found) + for(var/obj/machinery/telecomms/allinone/AIO in telecomms_list) + if(AIO.id == bs_rx_preload_id) + AIO.link_radio(src) found = 1 break - //Hmm, howabout an AIO machine - if(!found) - for(var/obj/machinery/telecomms/allinone/AIO in telecomms_list) - if(AIO.id == bs_rx_preload_id) - AIO.link_radio(src) - found = 1 - break - if(!found) - testing("A radio [src] at [x],[y],[z] specified bluespace prelink IDs, but the machines with corresponding IDs ([bs_tx_preload_id], [bs_rx_preload_id]) couldn't be found.") + if(!found) + testing("A radio [src] at [x],[y],[z] specified bluespace prelink IDs, but the machines with corresponding IDs ([bs_tx_preload_id], [bs_rx_preload_id]) couldn't be found.") /obj/item/radio/Destroy() qdel(wires) diff --git a/code/game/objects/structures/crates_lockers/__closets.dm b/code/game/objects/structures/crates_lockers/__closets.dm index a0cb0f0035..39f5b52633 100644 --- a/code/game/objects/structures/crates_lockers/__closets.dm +++ b/code/game/objects/structures/crates_lockers/__closets.dm @@ -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 diff --git a/code/game/objects/structures/low_wall.dm b/code/game/objects/structures/low_wall.dm index 52e7330e1b..807ac96af8 100644 --- a/code/game/objects/structures/low_wall.dm +++ b/code/game/objects/structures/low_wall.dm @@ -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() diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index b7cd4ca178..3bd50f5f00 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -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 diff --git a/code/game/turfs/simulated/wall_types.dm b/code/game/turfs/simulated/wall_types.dm index 631a933296..5f0172430c 100644 --- a/code/game/turfs/simulated/wall_types.dm +++ b/code/game/turfs/simulated/wall_types.dm @@ -354,7 +354,6 @@ return INITIALIZE_HINT_LATELOAD /obj/structure/hull_corner/LateInitialize() - . = ..() update_look() /obj/structure/hull_corner/proc/get_dirs_to_test() diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index eeb0b1b85a..f9962dc239 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -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" diff --git a/code/modules/holomap/station_holomap.dm b/code/modules/holomap/station_holomap.dm index c441f50f4b..714e2650f3 100644 --- a/code/modules/holomap/station_holomap.dm +++ b/code/modules/holomap/station_holomap.dm @@ -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 diff --git a/code/modules/lighting/lighting_fake_sun_vr.dm b/code/modules/lighting/lighting_fake_sun_vr.dm index ca4140a599..b05aff2bba 100644 --- a/code/modules/lighting/lighting_fake_sun_vr.dm +++ b/code/modules/lighting/lighting_fake_sun_vr.dm @@ -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? diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index cea33bfc65..487aaed66f 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -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)) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 62859e344d..0dadf32271 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -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)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index b8899706a8..5fb3f242fe 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -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) ..() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d12b980739..ca7be65ec0 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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 diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index 2cb3e76daf..8570d8999e 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -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) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 66747d62a1..b5544375be 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -208,7 +208,6 @@ /mob/living/silicon/robot/LateInitialize() - . = ..() pick_module() update_icon() diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm index e093dcefef..eadd25b60b 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm @@ -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 diff --git a/code/modules/mob/living/voice/voice.dm b/code/modules/mob/living/voice/voice.dm index cbe2ca2051..f21a2136bc 100644 --- a/code/modules/mob/living/voice/voice.dm +++ b/code/modules/mob/living/voice/voice.dm @@ -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 diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm index e11f5cf159..057efdc5f1 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -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 diff --git a/code/modules/nifsoft/software/01_vision.dm b/code/modules/nifsoft/software/01_vision.dm index 77331a48d9..d64e547c49 100644 --- a/code/modules/nifsoft/software/01_vision.dm +++ b/code/modules/nifsoft/software/01_vision.dm @@ -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 diff --git a/code/modules/nifsoft/software/13_soulcatcher.dm b/code/modules/nifsoft/software/13_soulcatcher.dm index d26e4a1849..c243f5850b 100644 --- a/code/modules/nifsoft/software/13_soulcatcher.dm +++ b/code/modules/nifsoft/software/13_soulcatcher.dm @@ -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) diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index 6b74db042d..93457b226d 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -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 diff --git a/code/modules/organs/internal/eyes.dm b/code/modules/organs/internal/eyes.dm index 85af29bceb..37a38a8736 100644 --- a/code/modules/organs/internal/eyes.dm +++ b/code/modules/organs/internal/eyes.dm @@ -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 diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm index 6a661f23e3..b023a997e5 100644 --- a/code/modules/organs/internal/heart.dm +++ b/code/modules/organs/internal/heart.dm @@ -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 diff --git a/code/modules/organs/internal/kidneys.dm b/code/modules/organs/internal/kidneys.dm index b53f7be09f..1cfb925c9f 100644 --- a/code/modules/organs/internal/kidneys.dm +++ b/code/modules/organs/internal/kidneys.dm @@ -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 diff --git a/code/modules/organs/internal/liver.dm b/code/modules/organs/internal/liver.dm index 64deaca348..db0ed2f8ef 100644 --- a/code/modules/organs/internal/liver.dm +++ b/code/modules/organs/internal/liver.dm @@ -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 diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm index 87e1954615..b018cd58b4 100644 --- a/code/modules/organs/internal/lungs.dm +++ b/code/modules/organs/internal/lungs.dm @@ -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 diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 73b8ecd79e..8f8b825bde 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -253,7 +253,6 @@ return INITIALIZE_HINT_LATELOAD /obj/item/organ/external/LateInitialize() - . = ..() if(!QDELETED(src)) get_icon() diff --git a/code/modules/organs/subtypes/machine.dm b/code/modules/organs/subtypes/machine.dm index e7cb1f7495..12d7991c72 100644 --- a/code/modules/organs/subtypes/machine.dm +++ b/code/modules/organs/subtypes/machine.dm @@ -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. diff --git a/code/modules/organs/subtypes/xenos.dm b/code/modules/organs/subtypes/xenos.dm index 4ddeb32ba0..a991e90985 100644 --- a/code/modules/organs/subtypes/xenos.dm +++ b/code/modules/organs/subtypes/xenos.dm @@ -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 diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 00ee04d209..cb02760373 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -217,7 +217,6 @@ GLOBAL_LIST_EMPTY(apcs) return INITIALIZE_HINT_LATELOAD /obj/machinery/power/apc/LateInitialize() - . = ..() update() /obj/machinery/power/apc/Destroy() diff --git a/code/modules/power/gravitygenerator_vr.dm b/code/modules/power/gravitygenerator_vr.dm index d8b161b746..b9095f18cd 100644 --- a/code/modules/power/gravitygenerator_vr.dm +++ b/code/modules/power/gravitygenerator_vr.dm @@ -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() . = ..() diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index efc8edf3ca..e07153116f 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -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++) diff --git a/code/modules/turbolift/turbolift_map.dm b/code/modules/turbolift/turbolift_map.dm index 3a01831851..c57706008a 100644 --- a/code/modules/turbolift/turbolift_map.dm +++ b/code/modules/turbolift/turbolift_map.dm @@ -25,7 +25,6 @@ return INITIALIZE_HINT_LATELOAD /obj/turbolift_map_holder/LateInitialize() - . = ..() // Create our system controller. var/datum/turbolift/lift = new() diff --git a/code/modules/ventcrawl/ventcrawl.dm b/code/modules/ventcrawl/ventcrawl.dm index ca63a33404..ea7e05d971 100644 --- a/code/modules/ventcrawl/ventcrawl.dm +++ b/code/modules/ventcrawl/ventcrawl.dm @@ -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 diff --git a/code/modules/vore/eating/soulcatcher_mob.dm b/code/modules/vore/eating/soulcatcher_mob.dm index 30bab93745..5929192c0b 100644 --- a/code/modules/vore/eating/soulcatcher_mob.dm +++ b/code/modules/vore/eating/soulcatcher_mob.dm @@ -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) diff --git a/modular_chomp/code/game/objects/effects/simple_portals.dm b/modular_chomp/code/game/objects/effects/simple_portals.dm index cbda18e22c..d4ca52fe55 100644 --- a/modular_chomp/code/game/objects/effects/simple_portals.dm +++ b/modular_chomp/code/game/objects/effects/simple_portals.dm @@ -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() diff --git a/vorestation.dme b/vorestation.dme index eebfc7b8d5..14d0276ef4 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -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"