diff --git a/code/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm
index fe19d7a559..041a6283e7 100644
--- a/code/__DEFINES/qdel.dm
+++ b/code/__DEFINES/qdel.dm
@@ -14,5 +14,6 @@
#define GC_QUEUED_FOR_HARD_DEL -2
#define GC_CURRENTLY_BEING_QDELETED -3
-#define QDELETED(X) (!X || X.gc_destroyed)
+#define QDELING(X) (X.gc_destroyed)
+#define QDELETED(X) (!X || QDELING(X))
#define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED)
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 0b27e01326..c0b9a20d3b 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -20,6 +20,24 @@
#define FLIGHTSUIT_PROCESSING_NONE 0
#define FLIGHTSUIT_PROCESSING_FULL 1
+#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
+#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
+#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
+
+#define INITIALIZE_HINT_NORMAL 0 //Nothing happens
+#define INITIALIZE_HINT_LATELOAD 1 //Call LateInitialize
+#define INITIALIZE_HINT_QDEL 2 //Call qdel on the atom
+
+//type and all subtypes should always call Initialize in New()
+#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
+ ..();\
+ if(!initialized) {\
+ args[1] = TRUE;\
+ SSatoms.InitAtom(src, args);\
+ }\
+}
+
+
// Subsystem init_order, from highest priority to lowest priority
// The numbers just define the ordering, they are meaningless otherwise.
diff --git a/code/__DEFINES/subsystems.dm.rej b/code/__DEFINES/subsystems.dm.rej
new file mode 100644
index 0000000000..cf39977224
--- /dev/null
+++ b/code/__DEFINES/subsystems.dm.rej
@@ -0,0 +1,18 @@
+diff a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm (rejected hunks)
+@@ -26,4 +26,13 @@
+
+ #define INITIALIZE_HINT_NORMAL 0 //Nothing happens
+ #define INITIALIZE_HINT_LATELOAD 1 //Call LateInitialize
+-#define INITIALIZE_HINT_QDEL 2 //Call qdel on the atom
+\ No newline at end of file
++#define INITIALIZE_HINT_QDEL 2 //Call qdel on the atom
++
++//type and all subtypes should always call Initialize in New()
++#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
++ ..();\
++ if(!initialized) {\
++ args[1] = TRUE;\
++ SSatoms.InitAtom(src, args);\
++ }\
++}
+\ No newline at end of file
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index a3a60b1f31..81754efc93 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -544,7 +544,7 @@
plane = SPLASHSCREEN_PLANE
var/client/holder
-/obj/screen/splash/New(client/C, visible, use_previous_title)
+/obj/screen/splash/New(client/C, visible, use_previous_title) //TODO: Make this use INITIALIZE_IMMEDIATE
holder = C
if(!visible)
diff --git a/code/controllers/admin.dm b/code/controllers/admin.dm
index 99f6a148a4..2be7139a27 100644
--- a/code/controllers/admin.dm
+++ b/code/controllers/admin.dm
@@ -3,7 +3,9 @@
name = "Initializing..."
var/target
-/obj/effect/statclick/New(loc, text, target) //Don't port this to Initialize it's too critical
+INITIALIZE_IMMEDIATE(/obj/effect/statclick)
+
+/obj/effect/statclick/Initialize(mapload, text, target) //Don't port this to Initialize it's too critical
..()
name = text
src.target = target
diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm
index c687a7b0e5..711da25889 100644
--- a/code/controllers/subsystem/atoms.dm
+++ b/code/controllers/subsystem/atoms.dm
@@ -1,111 +1,158 @@
-#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
-#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
-#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
-
-SUBSYSTEM_DEF(atoms)
- name = "Atoms"
+#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/initialized = INITIALIZATION_INSSATOMS
- var/old_initialized
-
- var/list/late_loaders
-
-/datum/controller/subsystem/atoms/Initialize(timeofday)
- GLOB.fire_overlay.appearance_flags = RESET_COLOR
- setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
- initialized = INITIALIZATION_INNEW_MAPLOAD
- InitializeAtoms()
- return ..()
-
-/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms = null)
- if(initialized == INITIALIZATION_INSSATOMS)
- return
-
- initialized = INITIALIZATION_INNEW_MAPLOAD
-
- var/static/list/NewQdelList = list()
-
- if(atoms)
- for(var/I in atoms)
- var/atom/A = I
- if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
- if(QDELETED(A))
- if(!(NewQdelList[A.type]))
- WARNING("Found new qdeletion in type [A.type]!")
- NewQdelList[A.type] = TRUE
- continue
- var/start_tick = world.time
- if(A.Initialize(TRUE))
- LAZYADD(late_loaders, A)
- if(start_tick != world.time)
- WARNING("[A]: [A.type] slept during it's Initialize!")
- CHECK_TICK
- testing("Initialized [atoms.len] atoms")
- else
- #ifdef TESTING
- var/count = 0
- #endif
- for(var/atom/A in world)
- if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
- if(QDELETED(A))
- if(!(NewQdelList[A.type]))
- WARNING("Found new qdeletion in type [A.type]!")
- NewQdelList[A.type] = TRUE
- continue
- var/start_tick = world.time
- if(A.Initialize(TRUE))
- LAZYADD(late_loaders, A)
- #ifdef TESTING
- else
- ++count
- #endif TESTING
- if(start_tick != world.time)
- WARNING("[A]: [A.type] slept during it's Initialize!")
- CHECK_TICK
- testing("Roundstart initialized [count] atoms")
-
- initialized = INITIALIZATION_INNEW_REGULAR
-
- for(var/I in late_loaders)
- var/atom/A = I
- var/start_tick = world.time
- A.Initialize(FALSE)
- if(start_tick != world.time)
- WARNING("[A]: [A.type] slept during it's Initialize!")
- CHECK_TICK
- testing("Late-initialized [LAZYLEN(late_loaders)] atoms")
- LAZYCLEARLIST(late_loaders)
-
-/datum/controller/subsystem/atoms/proc/map_loader_begin()
- old_initialized = initialized
- initialized = INITIALIZATION_INSSATOMS
-
-/datum/controller/subsystem/atoms/proc/map_loader_stop()
- initialized = old_initialized
-
-/datum/controller/subsystem/atoms/Recover()
- initialized = SSatoms.initialized
- if(initialized == INITIALIZATION_INNEW_MAPLOAD)
- InitializeAtoms()
- old_initialized = SSatoms.old_initialized
-
-/datum/controller/subsystem/atoms/proc/setupGenetics()
- var/list/avnums = new /list(DNA_STRUC_ENZYMES_BLOCKS)
- for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++)
- avnums[i] = i
- CHECK_TICK
-
- for(var/A in subtypesof(/datum/mutation/human))
- var/datum/mutation/human/B = new A()
- if(B.dna_block == NON_SCANNABLE)
- continue
- B.dna_block = pick_n_take(avnums)
- if(B.quality == POSITIVE)
- GLOB.good_mutations |= B
- else if(B.quality == NEGATIVE)
- GLOB.bad_mutations |= B
- else if(B.quality == MINOR_NEGATIVE)
- GLOB.not_good_mutations |= B
- CHECK_TICK
+ flags = SS_NO_FIRE
+
+ var/initialized = INITIALIZATION_INSSATOMS
+ var/old_initialized
+
+ var/list/late_loaders
+ var/list/created_atoms
+
+ var/list/BadInitializeCalls = list()
+
+/datum/controller/subsystem/atoms/Initialize(timeofday)
+ GLOB.fire_overlay.appearance_flags = RESET_COLOR
+ setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
+ initialized = INITIALIZATION_INNEW_MAPLOAD
+ InitializeAtoms()
+ return ..()
+
+/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms)
+ if(initialized == INITIALIZATION_INSSATOMS)
+ return
+
+ initialized = INITIALIZATION_INNEW_MAPLOAD
+
+ LAZYINITLIST(late_loaders)
+
+ var/count
+ var/list/mapload_arg = list(TRUE)
+ if(atoms)
+ created_atoms = list()
+ count = atoms.len
+ for(var/I in atoms)
+ var/atom/A = I
+ if(!A.initialized)
+ if(InitAtom(I, mapload_arg))
+ atoms -= I
+ CHECK_TICK
+ else
+ count = 0
+ for(var/atom/A in world)
+ if(!A.initialized)
+ InitAtom(A, mapload_arg)
+ ++count
+ CHECK_TICK
+
+ log_world("Initialized [count] atoms")
+
+ initialized = INITIALIZATION_INNEW_REGULAR
+
+ if(late_loaders.len)
+ for(var/I in late_loaders)
+ var/atom/A = I
+ A.LateInitialize()
+ testing("Late initialized [late_loaders.len] atoms")
+ late_loaders.Cut()
+
+ if(atoms)
+ . = created_atoms + atoms
+ created_atoms = null
+
+/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
+
+ var/start_tick = world.time
+
+ var/result = A.Initialize(arglist(arguments))
+
+ if(start_tick != world.time)
+ BadInitializeCalls[the_type] |= BAD_INIT_SLEPT
+
+ var/qdeleted = FALSE
+
+ 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
+
+ if(!A) //possible harddel
+ qdeleted = TRUE
+ else if(!A.initialized)
+ BadInitializeCalls[the_type] |= BAD_INIT_DIDNT_INIT
+
+ return qdeleted || QDELETED(A)
+
+/datum/controller/subsystem/atoms/proc/map_loader_begin()
+ old_initialized = initialized
+ initialized = INITIALIZATION_INSSATOMS
+
+/datum/controller/subsystem/atoms/proc/map_loader_stop()
+ initialized = old_initialized
+
+/datum/controller/subsystem/atoms/Recover()
+ initialized = SSatoms.initialized
+ if(initialized == INITIALIZATION_INNEW_MAPLOAD)
+ InitializeAtoms()
+ old_initialized = SSatoms.old_initialized
+ BadInitializeCalls = SSatoms.BadInitializeCalls
+
+/datum/controller/subsystem/atoms/proc/setupGenetics()
+ var/list/avnums = new /list(DNA_STRUC_ENZYMES_BLOCKS)
+ for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++)
+ avnums[i] = i
+ CHECK_TICK
+
+ for(var/A in subtypesof(/datum/mutation/human))
+ var/datum/mutation/human/B = new A()
+ if(B.dna_block == NON_SCANNABLE)
+ continue
+ B.dna_block = pick_n_take(avnums)
+ if(B.quality == POSITIVE)
+ GLOB.good_mutations |= B
+ else if(B.quality == NEGATIVE)
+ GLOB.bad_mutations |= B
+ else if(B.quality == MINOR_NEGATIVE)
+ GLOB.not_good_mutations |= B
+ CHECK_TICK
+
+/datum/controller/subsystem/atoms/proc/InitLog()
+ . = ""
+ for(var/path in BadInitializeCalls)
+ . += "Path : [path] \n"
+ var/fails = BadInitializeCalls[path]
+ if(fails & BAD_INIT_DIDNT_INIT)
+ . += "- Didn't call atom/Initialize()\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"
+ if(fails & BAD_INIT_SLEPT)
+ . += "- Slept during Initialize()\n"
+
+/datum/controller/subsystem/atoms/Shutdown()
+ var/initlog = InitLog()
+ if(initlog)
+ log_world(initlog)
+
+#undef BAD_INIT_QDEL_BEFORE
+#undef BAD_INIT_DIDNT_INIT
+#undef BAD_INIT_SLEPT
+#undef BAD_INIT_NO_HINT
diff --git a/code/controllers/subsystem/atoms.dm.rej b/code/controllers/subsystem/atoms.dm.rej
new file mode 100644
index 0000000000..4d7225164f
--- /dev/null
+++ b/code/controllers/subsystem/atoms.dm.rej
@@ -0,0 +1,9 @@
+diff a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm (rejected hunks)
+@@ -12,6 +12,7 @@ SUBSYSTEM_DEF(atoms)
+ var/old_initialized
+
+ var/list/late_loaders
++ var/list/created_atoms
+
+ var/list/BadInitializeCalls = list()
+
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index fda74c2ac8..ab0038f7be 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -39,20 +39,21 @@
var/do_initialize = SSatoms.initialized
if(do_initialize > INITIALIZATION_INSSATOMS)
- if(QDELETED(src))
- CRASH("Found new qdeletion in type [type]!")
- var/mapload = do_initialize == INITIALIZATION_INNEW_MAPLOAD
- args[1] = mapload
- if(Initialize(arglist(args)) && mapload)
- LAZYADD(SSatoms.late_loaders, src)
+ args[1] = do_initialize == INITIALIZATION_INNEW_MAPLOAD
+ if(SSatoms.InitAtom(src, args))
+ //we were deleted
+ return
+
+ var/list/created = SSatoms.created_atoms
+ if(created)
+ created += src
//Called after New if the map is being loaded. mapload = TRUE
//Called from base of New if the map is being loaded. mapload = FALSE
-//This base must be called or derivatives must set initialized to TRUE to prevent repeat calls
-//Derivatives must not sleep
-//Returning TRUE while mapload is TRUE will cause the object to be initialized again with mapload = FALSE when everything else is done
-//(Useful for things that requires turfs to have air). This base may only be called once, however
+//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 __DEFINES/subsystems.dm
//Note: the following functions don't call the base for optimization and must copypasta:
// /turf/Initialize
@@ -75,7 +76,16 @@
if (opacity && isturf(loc))
var/turf/T = loc
T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guaranteed to be on afterwards anyways.
+ return INITIALIZE_HINT_NORMAL
+//called if Initialize returns INITIALIZE_HINT_LATELOAD
+//This version shouldn't be called
+/atom/proc/LateInitialize()
+ var/static/list/warned_types = list()
+ if(!warned_types[type])
+ WARNING("Old style LateInitialize behaviour detected in [type]!")
+ warned_types[type] = TRUE
+ Initialize(FALSE)
/atom/Destroy()
if(alternate_appearances)
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index 9ff8c7c1b6..5d81e1f80c 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -45,7 +45,7 @@
return ..()
/atom/movable/Initialize(mapload)
- ..()
+ . = ..()
for(var/L in initial_languages)
grant_language(L)
diff --git a/code/game/gamemodes/miniantags/abduction/machinery/console.dm b/code/game/gamemodes/miniantags/abduction/machinery/console.dm
index c569ac00cc..8ad8cc8474 100644
--- a/code/game/gamemodes/miniantags/abduction/machinery/console.dm
+++ b/code/game/gamemodes/miniantags/abduction/machinery/console.dm
@@ -135,10 +135,10 @@
/obj/machinery/abductor/console/Initialize(mapload)
- if(mapload)
- return TRUE //wait for machines list
..()
+ return INITIALIZE_HINT_LATELOAD
+/obj/machinery/abductor/console/LateInitialize()
if(!team)
return
diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm
index bc8e5972f8..562e2c5b38 100644
--- a/code/game/machinery/embedded_controller/access_controller.dm
+++ b/code/game/machinery/embedded_controller/access_controller.dm
@@ -19,12 +19,12 @@
/obj/machinery/doorButtons/proc/findObjsByTag()
return
-/obj/machinery/doorButtons/Initialize(mapload)
- if(mapload)
- ..()
- return TRUE
- else
- findObjsByTag()
+/obj/machinery/doorButtons/Initialize()
+ ..()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/doorButtons/LateInitialize()
+ findObjsByTag()
/obj/machinery/doorButtons/emag_act(mob/user)
if(!emagged)
diff --git a/code/game/objects/items.dm.rej b/code/game/objects/items.dm.rej
new file mode 100644
index 0000000000..7366e22899
--- /dev/null
+++ b/code/game/objects/items.dm.rej
@@ -0,0 +1,10 @@
+diff a/code/game/objects/items.dm b/code/game/objects/items.dm (rejected hunks)
+@@ -102,7 +102,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
+ /obj/item/Initialize()
+ if (!materials)
+ materials = list()
+- ..()
++ . = ..()
+ for(var/path in actions_types)
+ new path(src)
+ actions_types = null
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index 4c61b09ca3..e29d372a6c 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -37,7 +37,7 @@
..()
/obj/Initialize()
- ..()
+ . = ..()
if (!armor)
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 0, acid = 0)
if(on_blueprints && isturf(loc))
diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm
index ec82b45a1f..5a7988e8d4 100644
--- a/code/game/objects/structures/ladders.dm
+++ b/code/game/objects/structures/ladders.dm
@@ -14,18 +14,15 @@
/obj/structure/ladder/Initialize(mapload)
- if(!initialized)
- GLOB.ladders += src
- ..()
- if(mapload)
- return TRUE
- update_link()
+ GLOB.ladders += src
+ ..()
+ return INITIALIZE_HINT_LATELOAD
/obj/structure/ladder/Destroy()
GLOB.ladders -= src
. = ..()
-/obj/structure/ladder/proc/update_link()
+/obj/structure/ladder/LateInitialize()
for(var/obj/structure/ladder/L in GLOB.ladders)
if(L.id == id)
if(L.height == (height - 1))
diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm
index 6c1e2743cd..a0940eded1 100644
--- a/code/game/turfs/space/space.dm
+++ b/code/game/turfs/space/space.dm
@@ -42,6 +42,8 @@
if (opacity)
has_opaque_atom = TRUE
+
+ return INITIALIZE_HINT_NORMAL
/turf/open/space/attack_ghost(mob/dead/observer/user)
if(destination_z)
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 10eefc4b14..1c2d65355e 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -56,6 +56,7 @@
if (opacity)
has_opaque_atom = TRUE
+ return INITIALIZE_HINT_NORMAL
/turf/proc/Initalize_Atmos(times_fired)
CalculateAdjacentTurfs()
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 22045b99ff..19e2c372b3 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -166,8 +166,10 @@ GLOBAL_LIST_INIT(admin_verbs_debug, AVerbsDebug())
//citadel code
/client/proc/give_humans_genitals,
/client/proc/test_mammal_overlays,
- /client/proc/pump_random_event
+ /client/proc/pump_random_event,
+ /client/proc/cmd_display_init_log
)
+
GLOBAL_PROTECT(admin_verbs_possess)
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess,/proc/release))
GLOBAL_PROTECT(admin_verbs_permissions)
diff --git a/code/modules/admin/admin_verbs.dm.rej b/code/modules/admin/admin_verbs.dm.rej
new file mode 100644
index 0000000000..e710d417c2
--- /dev/null
+++ b/code/modules/admin/admin_verbs.dm.rej
@@ -0,0 +1,11 @@
+diff a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm (rejected hunks)
+@@ -153,7 +153,8 @@ var/list/admin_verbs_debug = list(
+ /client/proc/clear_dynamic_transit,
+ /client/proc/toggle_medal_disable,
+ /client/proc/view_runtimes,
+- /client/proc/pump_random_event
++ /client/proc/pump_random_event,
++ /client/proc/cmd_display_init_log
+ )
+ var/list/admin_verbs_possess = list(
+ /proc/possess,
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 54be219a48..c9014da3b0 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -721,6 +721,13 @@ GLOBAL_PROTECT(AdminProcCall)
usr << browse(dat, "window=dellog")
+/client/proc/cmd_display_init_log()
+ set category = "Debug"
+ set name = "Display Initialzie() Log"
+ set desc = "Displays a list of things that didn't handle Initialize() properly"
+
+ usr << browse(replacetext(SSatoms.InitLog(), "\n", "
"), "window=initlog")
+
/client/proc/debug_huds(i as num)
set category = "Debug"
set name = "Debug HUDs"
diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm
index 18be292e97..7947ef4413 100644
--- a/code/modules/holodeck/computer.dm
+++ b/code/modules/holodeck/computer.dm
@@ -45,52 +45,52 @@
var/list/effects = list()
var/last_change = 0
-
+
/obj/machinery/computer/holodeck/Initialize(mapload)
- . = mapload //late-initialize, area_copy need turfs to have air
- if(!mapload)
- ..()
+ ..()
+ return INITIALIZE_HINT_LATELOAD
- if(ispath(holodeck_type,/area))
- var/list/possible = get_areas(holodeck_type,subtypes = FALSE)
- linked = pop(possible)
- if(ispath(offline_program,/area))
- var/list/possible = get_areas(offline_program,subtypes = FALSE)
- offline_program = pop(possible)
- // the following is necessary for power reasons
- if(!linked || !offline_program)
- log_world("No matching holodeck area found")
- qdel(src)
- return
- var/area/AS = get_area(src)
- if(istype(AS,/area/holodeck))
- log_world("### MAPPING ERROR")
- log_world("Holodeck computer cannot be in a holodeck.")
- log_world("This would cause circular power dependency.")
- qdel(src) // todo handle constructed computers
- return //l-lewd...
- else
- linked.linked = src // todo detect multiple/constructed computers
+/obj/machinery/computer/holodeck/LateInitialize()
+ if(ispath(holodeck_type,/area))
+ var/list/possible = get_areas(holodeck_type,subtypes = FALSE)
+ linked = pop(possible)
+ if(ispath(offline_program,/area))
+ var/list/possible = get_areas(offline_program,subtypes = FALSE)
+ offline_program = pop(possible)
+ // the following is necessary for power reasons
+ if(!linked || !offline_program)
+ log_world("No matching holodeck area found")
+ qdel(src)
+ return
+ var/area/AS = get_area(src)
+ if(istype(AS,/area/holodeck))
+ log_world("### MAPPING ERROR")
+ log_world("Holodeck computer cannot be in a holodeck.")
+ log_world("This would cause circular power dependency.")
+ qdel(src) // todo handle constructed computers
+ return //l-lewd...
+ else
+ linked.linked = src // todo detect multiple/constructed computers
- program_cache = list()
- emag_programs = list()
- for(var/typekey in subtypesof(program_type))
- var/area/holodeck/A = locate(typekey)
- if(!A || A == offline_program)
- continue
- if(A.contents.len == 0)
- continue // not loaded
- if(A.restricted)
- emag_programs += A
- else
- program_cache += A
- if(typekey == init_program)
- load_program(A,force=1)
- if(random_program && program_cache.len && init_program == null)
- load_program(pick(program_cache),force=1)
- else if(!program)
- load_program(offline_program)
+ program_cache = list()
+ emag_programs = list()
+ for(var/typekey in subtypesof(program_type))
+ var/area/holodeck/A = locate(typekey)
+ if(!A || A == offline_program)
+ continue
+ if(A.contents.len == 0)
+ continue // not loaded
+ if(A.restricted)
+ emag_programs += A
+ else
+ program_cache += A
+ if(typekey == init_program)
+ load_program(A,force=1)
+ if(random_program && program_cache.len && init_program == null)
+ load_program(pick(program_cache),force=1)
+ else if(!program)
+ load_program(offline_program)
/obj/machinery/computer/holodeck/power_change()
..()
diff --git a/code/modules/holodeck/computer.dm.rej b/code/modules/holodeck/computer.dm.rej
new file mode 100644
index 0000000000..7a8dcd75cd
--- /dev/null
+++ b/code/modules/holodeck/computer.dm.rej
@@ -0,0 +1,47 @@
+diff a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm (rejected hunks)
+@@ -64,25 +64,26 @@
+ ..()
+
+ /obj/machinery/computer/holodeck/Initialize(mapload)
+- . = mapload //late-initialize, area_copy need turfs to have air
+- if(!mapload)
+- ..()
+- program_cache = list()
+- emag_programs = list()
+- for(var/typekey in subtypesof(program_type))
+- var/area/holodeck/A = locate(typekey)
+- if(!A || A == offline_program) continue
+- if(A.contents.len == 0) continue // not loaded
+- if(A.restricted)
+- emag_programs += A
+- else
+- program_cache += A
+- if(typekey == init_program)
+- load_program(A,force=1)
+- if(random_program && program_cache.len && init_program == null)
+- load_program(pick(program_cache),force=1)
+- else if(!program)
+- load_program(offline_program)
++ ..()
++ return INITIALIZE_HINT_LATELOAD
++
++/obj/machinery/computer/holodeck/LateInitialize()
++ program_cache = list()
++ emag_programs = list()
++ for(var/typekey in subtypesof(program_type))
++ var/area/holodeck/A = locate(typekey)
++ if(!A || A == offline_program) continue
++ if(A.contents.len == 0) continue // not loaded
++ if(A.restricted)
++ emag_programs += A
++ else
++ program_cache += A
++ if(typekey == init_program)
++ load_program(A,force=1)
++ if(random_program && program_cache.len && init_program == null)
++ load_program(pick(program_cache),force=1)
++ else if(!program)
++ load_program(offline_program)
+
+ /obj/machinery/computer/holodeck/power_change()
+ ..()
diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm
index 81f36bf221..4cc57ca62f 100644
--- a/code/modules/mob/dead/dead.dm
+++ b/code/modules/mob/dead/dead.dm
@@ -1,9 +1,6 @@
//Dead mobs can exist whenever. This is needful
-/mob/dead/New(loc)
- ..()
- if(!initialized)
- args[1] = FALSE
- Initialize(arglist(args)) //EXIST DAMN YOU!!!
+
+INITIALIZE_IMMEDIATE(/mob/dead)
/mob/dead/dust() //ghosts can't be vaporised.
return
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index 72f83bf546..e6adb53ff6 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -30,6 +30,7 @@
loc = pick(GLOB.newplayer_start)
else
loc = locate(1,1,1)
+ return INITIALIZE_HINT_NORMAL
/mob/dead/new_player/proc/new_player_panel()
@@ -48,11 +49,11 @@
output += "