diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index dfc7a04e57f..d527abb2205 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -107,7 +107,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list( static_inventory += screentip_text for(var/mytype in subtypesof(/atom/movable/plane_master_controller)) - var/atom/movable/plane_master_controller/controller_instance = new mytype(src) + var/atom/movable/plane_master_controller/controller_instance = new mytype(null,src) plane_master_controllers[controller_instance.name] = controller_instance owner.overlay_fullscreen("see_through_darkness", /atom/movable/screen/fullscreen/see_through_darkness) diff --git a/code/_onclick/hud/new_player.dm b/code/_onclick/hud/new_player.dm index 60772302b63..975487f3164 100644 --- a/code/_onclick/hud/new_player.dm +++ b/code/_onclick/hud/new_player.dm @@ -6,7 +6,8 @@ return var/list/buttons = subtypesof(/atom/movable/screen/lobby) for(var/button_type in buttons) - var/atom/movable/screen/lobbyscreen = new button_type() + var/atom/movable/screen/lobby/lobbyscreen = new button_type() + lobbyscreen.SlowInit() lobbyscreen.hud = src static_inventory += lobbyscreen if(istype(lobbyscreen, /atom/movable/screen/lobby/button)) @@ -18,6 +19,10 @@ layer = LOBBY_BUTTON_LAYER screen_loc = "TOP,CENTER" +/// Run sleeping actions after initialize +/atom/movable/screen/lobby/proc/SlowInit() + return + /atom/movable/screen/lobby/background layer = LOBBY_BACKGROUND_LAYER icon = 'icons/hud/lobby/background.dmi' @@ -256,10 +261,9 @@ var/new_poll = FALSE -///Need to use New due to init -/atom/movable/screen/lobby/button/poll/New(loc, ...) +/atom/movable/screen/lobby/button/poll/SlowInit(mapload) . = ..() - if(!usr) // + if(!usr) return var/mob/dead/new_player/new_player = usr if(IsGuestKey(new_player.key)) diff --git a/code/_onclick/hud/plane_master_controller.dm b/code/_onclick/hud/plane_master_controller.dm index 67fbb485475..f3d7c88cf70 100644 --- a/code/_onclick/hud/plane_master_controller.dm +++ b/code/_onclick/hud/plane_master_controller.dm @@ -5,8 +5,10 @@ ///hud that owns this controller var/datum/hud/owner_hud +INITIALIZE_IMMEDIATE(/atom/movable/plane_master_controller) + ///Ensures that all the planes are correctly in the controlled_planes list. -/atom/movable/plane_master_controller/New(datum/hud/hud) +/atom/movable/plane_master_controller/Initialize(mapload, datum/hud/hud) . = ..() if(!istype(hud)) return diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 6922e6d4395..937e4e5adb1 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -673,7 +673,9 @@ plane = SPLASHSCREEN_PLANE var/client/holder -/atom/movable/screen/splash/New(client/C, visible, use_previous_title) //TODO: Make this use INITIALIZE_IMMEDIATE, except its not easy +INITIALIZE_IMMEDIATE(/atom/movable/screen/splash) + +/atom/movable/screen/splash/Initialize(mapload, client/C, visible, use_previous_title) . = ..() if(!istype(C)) return @@ -688,8 +690,7 @@ icon = SStitle.icon else if(!SStitle.previous_icon) - qdel(src) - return + return INITIALIZE_HINT_QDEL icon = SStitle.previous_icon holder.screen += src diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 27c3a7ae0fa..5d3d05919b3 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -449,7 +449,7 @@ SUBSYSTEM_DEF(ticker) qdel(player) living.notransform = TRUE if(living.client) - var/atom/movable/screen/splash/S = new(living.client, TRUE) + var/atom/movable/screen/splash/S = new(null, living.client, TRUE) S.Fade(TRUE) living.client.init_verbs() livings += living diff --git a/code/datums/components/admin_popup.dm b/code/datums/components/admin_popup.dm index 65b97e09b1a..0fff57863e3 100644 --- a/code/datums/components/admin_popup.dm +++ b/code/datums/components/admin_popup.dm @@ -83,7 +83,7 @@ /// The `world.time` when the last color update occurred. var/last_update_time = 0 -/atom/movable/screen/admin_popup/New(loc, ...) +/atom/movable/screen/admin_popup/Initialize(mapload, ...) . = ..() START_PROCESSING(SSobj, src) diff --git a/code/game/area/areas/shuttles.dm b/code/game/area/areas/shuttles.dm index b7d8f9ee5a4..88f0474f76c 100644 --- a/code/game/area/areas/shuttles.dm +++ b/code/game/area/areas/shuttles.dm @@ -107,7 +107,7 @@ /area/shuttle/arrival/on_joining_game(mob/living/boarder) if(SSshuttle.arrivals?.mode == SHUTTLE_CALL) - var/atom/movable/screen/splash/Spl = new(boarder.client, TRUE) + var/atom/movable/screen/splash/Spl = new(null, boarder.client, TRUE) Spl.Fade(TRUE) boarder.playsound_local(get_turf(boarder), 'sound/voice/ApproachingTG.ogg', 25) boarder.update_parallax_teleport() diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index 1e7c7f311ba..8c4870167f0 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -219,8 +219,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/landmark) /// What department this spawner is for var/department -/obj/effect/landmark/start/depsec/New() - ..() +/obj/effect/landmark/start/depsec/Initialize(mapload) + . = ..() LAZYADDASSOCLIST(GLOB.department_security_spawns, department, src) /obj/effect/landmark/start/depsec/Destroy() @@ -408,8 +408,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/landmark/start/new_player) layer = HIGH_LANDMARK_LAYER -/obj/effect/landmark/event_spawn/New() - ..() +/obj/effect/landmark/event_spawn/Initialize(mapload) + . = ..() GLOB.generic_event_spawns += src /obj/effect/landmark/event_spawn/Destroy() @@ -419,9 +419,9 @@ INITIALIZE_IMMEDIATE(/obj/effect/landmark/start/new_player) /obj/effect/landmark/ruin var/datum/map_template/ruin/ruin_template -/obj/effect/landmark/ruin/New(loc, my_ruin_template) +/obj/effect/landmark/ruin/Initialize(mapload, my_ruin_template) + . = ..() name = "ruin_[GLOB.ruin_landmarks.len + 1]" - ..(loc) ruin_template = my_ruin_template GLOB.ruin_landmarks |= src diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 4027ad9ff16..038f720abd5 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -397,8 +397,8 @@ /// How many seconds between each recharge var/charge_delay = 20 -/obj/item/flashlight/emp/New() - ..() +/obj/item/flashlight/emp/Initialize(mapload) + . = ..() START_PROCESSING(SSobj, src) /obj/item/flashlight/emp/Destroy() diff --git a/code/game/objects/items/secret_documents.dm b/code/game/objects/items/secret_documents.dm index ed360ed6657..8c5780b1785 100644 --- a/code/game/objects/items/secret_documents.dm +++ b/code/game/objects/items/secret_documents.dm @@ -58,8 +58,8 @@ ///What was copied var/copy_type = null -/obj/item/documents/photocopy/New(loc, obj/item/documents/copy=null) - ..() +/obj/item/documents/photocopy/Initialize(mapload, obj/item/documents/copy=null) + . = ..() if(copy) copy_type = copy.type if(istype(copy, /obj/item/documents/photocopy)) // Copy Of A Copy Of A Copy diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index cc7784fe8a0..02fa1417e55 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -16,8 +16,8 @@ var/fuel_added = 0 var/flame_expiry_timer -/obj/structure/fireplace/New() - ..() +/obj/structure/fireplace/Initialize(mapload) + . = ..() START_PROCESSING(SSobj, src) /obj/structure/fireplace/Destroy() diff --git a/code/game/objects/structures/industrial_lift.dm b/code/game/objects/structures/industrial_lift.dm index ba29ed037ec..5a1a1bc711b 100644 --- a/code/game/objects/structures/industrial_lift.dm +++ b/code/game/objects/structures/industrial_lift.dm @@ -157,12 +157,9 @@ GLOBAL_LIST_EMPTY(lifts) var/list/atom/movable/lift_load //things to move var/datum/lift_master/lift_master_datum //control from -/obj/structure/industrial_lift/New() - GLOB.lifts.Add(src) - ..() - /obj/structure/industrial_lift/Initialize(mapload) . = ..() + GLOB.lifts.Add(src) var/static/list/loc_connections = list( COMSIG_ATOM_EXITED =.proc/UncrossedRemoveItemFromLift, COMSIG_ATOM_ENTERED = .proc/AddItemOnLift, diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index c0f2f655950..abf40ae8087 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -139,25 +139,25 @@ icon_state = "magic_mirror" var/list/choosable_races = list() -/obj/structure/mirror/magic/New() +/obj/structure/mirror/magic/Initialize(mapload) + . = ..() if(!choosable_races.len) for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = speciestype if(initial(S.changesource_flags) & MIRROR_MAGIC) choosable_races += initial(S.id) choosable_races = sortList(choosable_races) - ..() -/obj/structure/mirror/magic/lesser/New() +/obj/structure/mirror/magic/lesser/Initialize(mapload) choosable_races = get_selectable_species().Copy() - ..() + return ..() -/obj/structure/mirror/magic/badmin/New() +/obj/structure/mirror/magic/badmin/Initialize(mapload) for(var/speciestype in subtypesof(/datum/species)) var/datum/species/S = speciestype if(initial(S.changesource_flags) & MIRROR_BADMIN) choosable_races += initial(S.id) - ..() + return ..() /obj/structure/mirror/magic/attack_hand(mob/user, list/modifiers) . = ..() diff --git a/code/game/objects/structures/petrified_statue.dm b/code/game/objects/structures/petrified_statue.dm index 2f83eefd285..f32cd324d39 100644 --- a/code/game/objects/structures/petrified_statue.dm +++ b/code/game/objects/structures/petrified_statue.dm @@ -8,7 +8,8 @@ var/timer = 480 //eventually the person will be freed var/mob/living/petrified_mob -/obj/structure/statue/petrified/New(loc, mob/living/L, statue_timer) +/obj/structure/statue/petrified/Initialize(mapload, mob/living/L, statue_timer) + . = ..() if(statue_timer) timer = statue_timer if(L) @@ -23,7 +24,6 @@ atom_integrity = L.health + 100 //stoning damaged mobs will result in easier to shatter statues max_integrity = atom_integrity START_PROCESSING(SSobj, src) - ..() /obj/structure/statue/petrified/process(delta_time) if(!petrified_mob) diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm index 28f36f10163..eec30f3b7d1 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube.dm @@ -13,8 +13,8 @@ var/exit_delay = 1 var/enter_delay = 0 -/obj/structure/transit_tube/New(loc, newdirection) - ..(loc) +/obj/structure/transit_tube/Initialize(mapload, newdirection) + . = ..() if(newdirection) setDir(newdirection) init_tube_dirs() diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm index 676d385d56e..d56ca0a30f3 100644 --- a/code/game/turfs/closed/_closed.dm +++ b/code/game/turfs/closed/_closed.dm @@ -60,11 +60,13 @@ plane = SPLASHSCREEN_PLANE bullet_bounce_sound = null -/turf/closed/indestructible/splashscreen/New() +INITIALIZE_IMMEDIATE(/turf/closed/indestructible/splashscreen) + +/turf/closed/indestructible/splashscreen/Initialize(mapload) + . = ..() SStitle.splash_turf = src if(SStitle.icon) icon = SStitle.icon - ..() /turf/closed/indestructible/splashscreen/vv_edit_var(var_name, var_value) . = ..() diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 4233b59a510..7192504d906 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -142,9 +142,9 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) /obj/effect/statclick/ticket_list var/current_state -/obj/effect/statclick/ticket_list/New(loc, name, state) +/obj/effect/statclick/ticket_list/Initialize(mapload, name, state) + . = ..() current_state = state - ..() /obj/effect/statclick/ticket_list/Click() GLOB.ahelp_tickets.BrowseTickets(current_state) diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 683103ba9bf..ae56200bc62 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -358,12 +358,12 @@ var/health_cost = 0 //The amount of health taken from the user when invoking the spell var/datum/action/innate/cult/blood_spell/source -/obj/item/melee/blood_magic/New(loc, spell) +/obj/item/melee/blood_magic/Initialize(mapload, spell) + . = ..() if(spell) source = spell uses = source.charges health_cost = source.health_cost - ..() /obj/item/melee/blood_magic/Destroy() if(!QDELETED(source)) diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index b62eff36af1..88674d533ac 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -44,13 +44,13 @@ var/spawn_amt_left = 20 var/spawn_fast = FALSE -/obj/effect/rend/New(loc, spawn_type, spawn_amt, desc, spawn_fast) +/obj/effect/rend/Initialize(mapload, spawn_type, spawn_amt, desc, spawn_fast) + . = ..() src.spawn_path = spawn_type src.spawn_amt_left = spawn_amt src.desc = desc src.spawn_fast = spawn_fast START_PROCESSING(SSobj, src) - return /obj/effect/rend/process() if(!spawn_fast) diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm index 875fe2caef6..b7f7b590057 100644 --- a/code/modules/atmospherics/gasmixtures/gas_types.dm +++ b/code/modules/atmospherics/gasmixtures/gas_types.dm @@ -15,7 +15,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g if(initial(gas.moles_visible) != null) gas_info[META_GAS_OVERLAY] = new /list(TOTAL_VISIBLE_STATES) for(var/i in 1 to TOTAL_VISIBLE_STATES) - gas_info[META_GAS_OVERLAY][i] = new /obj/effect/overlay/gas(initial(gas.gas_overlay), log(4, (i+0.4*TOTAL_VISIBLE_STATES) / (0.35*TOTAL_VISIBLE_STATES)) * 255) + gas_info[META_GAS_OVERLAY][i] = new /obj/effect/overlay/gas(null, initial(gas.gas_overlay), log(4, (i+0.4*TOTAL_VISIBLE_STATES) / (0.35*TOTAL_VISIBLE_STATES)) * 255) gas_info[META_GAS_FUSION_POWER] = initial(gas.fusion_power) gas_info[META_GAS_DANGER] = initial(gas.dangerous) @@ -265,7 +265,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g appearance_flags = TILE_BOUND vis_flags = NONE -/obj/effect/overlay/gas/New(state, alph) +/obj/effect/overlay/gas/Initialize(mapload, state, alph) . = ..() icon_state = state alpha = alph diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 8320f12ab12..91028822e04 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -119,8 +119,8 @@ /datum/gas/halon = new/datum/tlv/dangerous ) -/obj/machinery/airalarm/New(loc, ndir, nbuild) - ..() +/obj/machinery/airalarm/Initialize(mapload, ndir, nbuild) + . = ..() wires = new /datum/wires/airalarm(src) if(ndir) setDir(ndir) @@ -137,20 +137,18 @@ alarm_manager = new(src) update_appearance() -/obj/machinery/airalarm/Destroy() - SSradio.remove_object(src, frequency) - QDEL_NULL(wires) - QDEL_NULL(alarm_manager) - return ..() - -/obj/machinery/airalarm/Initialize(mapload) - . = ..() set_frequency(frequency) AddElement(/datum/element/connect_loc, atmos_connections) AddComponent(/datum/component/usb_port, list( /obj/item/circuit_component/air_alarm, )) +/obj/machinery/airalarm/Destroy() + SSradio.remove_object(src, frequency) + QDEL_NULL(wires) + QDEL_NULL(alarm_manager) + return ..() + /obj/machinery/airalarm/examine(mob/user) . = ..() switch(buildstage) diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 6aca86c3790..8c7713347bb 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -80,7 +80,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) var/client/C = client to_chat(C, span_notice("Sending you to [pick].")) - new /atom/movable/screen/splash(C) + new /atom/movable/screen/splash(null, C) notransform = TRUE sleep(29) //let the animation play diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 3c6d253912c..a06dac42691 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -18,7 +18,7 @@ /mob/dead/new_player/Initialize(mapload) if(client && SSticker.state == GAME_STATE_STARTUP) - var/atom/movable/screen/splash/S = new(client, TRUE, TRUE) + var/atom/movable/screen/splash/S = new(null, client, TRUE, TRUE) S.Fade(TRUE) if(length(GLOB.newplayer_start))