From 5959ac32cc2c9f115111c464a6c35cf73cb43cac Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 23 Jan 2017 03:37:45 -0500 Subject: [PATCH] Refactors atom/Initialize. Fixes ruins being initialized twice (#22778) * Refactors atom/Initialize Captialized for compiling correctness and to be more inline with Destroy Will now be called from atom/New if the world initialization loop in SSobj has already run. Should always call the base. Now comes with the `roundstart` parameter indicating whether or not it was called by SSobj or atom/New Other fixes/tweaks: - Renamed a proc called Initialize in abduction consoles to Setup - Removed /obj/item/device/radio/headset/headset_sec/department: Broken and referenced literally nowhere in the code - Removed a spawn from the Initialize of turbine_computer which made literally zero sense - Generalized the proc which fixes RND servers with no id set Reasoning: It's better to check roundstart per function than to have to duplicate code in New and Initialize. Think of it as a safer New for atoms. If we move enough stuff to it, initial map load performance will increase due to less New calls * Fixed a thing * Actually, fuck the police * >Expecting a merge without errors * >Not calling ..() in New * Sanic * Fix the headset bug * Makes sure the map loaders dew it right * Fixes ruins being initialized twice * Rename roundstart -> mapload * Revert "Rename roundstart -> mapload" This reverts commit 667c327fd2ccfa3ce4f4db52eac03f9e8b0f6812. * Remove unrelated change * A more direct solution to map loads * And now we shouldnt need this warning * Add the new var to SSobj recovery * Revert "Revert "Rename roundstart -> mapload"" This reverts commit dee07dbd5e4696554ac43aae5b91cce743b9b9e0. * Line endings --- .../subsystem/processing/objects.dm | 21 +- code/game/area/ai_monitored.dm | 11 +- code/game/atoms.dm | 8 +- .../miniantags/abduction/abduction.dm | 2 +- .../miniantags/abduction/machinery/console.dm | 2 +- code/game/gamemodes/wizard/spellbook.dm | 8 +- code/game/machinery/airlock_control.dm | 23 +- code/game/machinery/camera/camera.dm | 5 +- code/game/machinery/computer/Operating.dm | 8 +- code/game/machinery/computer/atmos_alert.dm | 2 +- code/game/machinery/computer/atmos_control.dm | 16 +- code/game/machinery/computer/computer.dm | 5 +- code/game/machinery/computer/message.dm | 4 +- code/game/machinery/computer/pod.dm | 4 +- code/game/machinery/doors/airlock.dm | 8 +- code/game/machinery/doors/alarmlock.dm | 2 +- code/game/machinery/doors/brigdoors.dm | 22 +- .../embedded_controller/access_controller.dm | 3 +- .../embedded_controller/airlock_controller.dm | 4 +- .../embedded_controller_base.dm | 3 +- .../simple_vent_controller.dm | 4 +- .../machinery/porta_turret/portable_turret.dm | 5 +- code/game/machinery/status_display.dm | 10 +- .../machinery/telecomms/telecomunications.dm | 5 +- code/game/machinery/teleporter.dm | 13 +- code/game/mecha/mech_bay.dm | 3 +- code/game/objects/items/devices/PDA/radio.dm | 8 +- code/game/objects/items/devices/flashlight.dm | 2 +- .../game/objects/items/devices/instruments.dm | 5 +- .../items/devices/radio/electropack.dm | 9 +- .../game/objects/items/devices/radio/radio.dm | 5 +- .../structures/crates_lockers/closets.dm | 8 +- code/game/objects/structures/guncase.dm | 17 +- code/game/objects/structures/musician.dm | 5 +- code/game/objects/structures/noticeboard.dm | 7 +- code/game/objects/structures/safe.dm | 14 +- code/game/turfs/simulated/floor.dm | 5 +- .../atmospherics/machinery/airalarm.dm | 5 +- .../atmospherics/machinery/other/meter.dm | 14 +- code/modules/awaymissions/capture_the_flag.dm | 8 +- code/modules/awaymissions/gateway.dm | 9 +- code/modules/awaymissions/maploader/reader.dm | 11 +- .../awaymissions/mission_code/Cabin.dm | 5 +- code/modules/holodeck/computer.dm | 10 +- code/modules/jobs/job_types/security.dm | 5 +- code/modules/library/lib_items.dm | 5 +- code/modules/library/random_books.dm | 12 +- code/modules/mob/living/brain/MMI.dm | 4 +- .../mob/living/carbon/monkey/monkey.dm | 7 +- .../mob/living/simple_animal/hostile/mimic.dm | 7 +- code/modules/paperwork/filingcabinet.dm | 10 +- code/modules/paperwork/paperbin.dm | 281 +++++++++--------- code/modules/power/apc.dm | 5 +- code/modules/power/generator.dm | 3 +- code/modules/power/gravitygenerator.dm | 7 +- code/modules/power/port_gen.dm | 2 +- code/modules/power/rtg.dm | 3 +- code/modules/power/singularity/emitter.dm | 2 +- code/modules/power/solar.dm | 13 +- code/modules/power/turbine.dm | 9 +- code/modules/recycling/disposal-unit.dm | 5 +- code/modules/research/rdconsole.dm | 4 +- code/modules/research/server.dm | 9 +- .../objects_and_mobs/ruin_mapping_aids.dm | 2 +- code/modules/shuttle/emergency.dm | 5 +- code/modules/shuttle/shuttle.dm | 5 +- code/modules/telesci/telesci_computer.dm | 9 +- 67 files changed, 378 insertions(+), 384 deletions(-) diff --git a/code/controllers/subsystem/processing/objects.dm b/code/controllers/subsystem/processing/objects.dm index f919b0ce883..0e1a697c874 100644 --- a/code/controllers/subsystem/processing/objects.dm +++ b/code/controllers/subsystem/processing/objects.dm @@ -11,6 +11,8 @@ var/datum/subsystem/objects/SSobj init_order = 12 priority = 40 + var/initialized = FALSE + var/old_initialized var/list/atom_spawners = list() var/list/processing = list() var/list/currentrun = list() @@ -24,10 +26,18 @@ var/datum/subsystem/objects/SSobj setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation. for(var/thing in world) var/atom/A = thing - A.initialize() + A.Initialize(TRUE) CHECK_TICK + initialized = TRUE . = ..() +/datum/subsystem/objects/proc/map_loader_begin() + old_initialized = initialized + initialized = FALSE + +/datum/subsystem/objects/proc/map_loader_stop() + initialized = old_initialized + /datum/subsystem/objects/proc/trigger_atom_spawners(zlevel, ignore_z=FALSE) for(var/V in atom_spawners) var/atom/A = V @@ -58,11 +68,14 @@ var/datum/subsystem/objects/SSobj /datum/subsystem/objects/proc/setup_template_objects(list/objects) trigger_atom_spawners(0, ignore_z=TRUE) - for(var/A in objects) - var/atom/B = A - B.initialize() + if(initialized) + for(var/A in objects) + var/atom/B = A + B.Initialize(TRUE) /datum/subsystem/objects/Recover() + initialized = SSobj.initialized + old_initialized = SSobj.old_initialized if (istype(SSobj.atom_spawners)) atom_spawners = SSobj.atom_spawners if (istype(SSobj.processing)) diff --git a/code/game/area/ai_monitored.dm b/code/game/area/ai_monitored.dm index f1ad7ab8872..a89b8de9526 100644 --- a/code/game/area/ai_monitored.dm +++ b/code/game/area/ai_monitored.dm @@ -3,12 +3,13 @@ var/list/obj/machinery/camera/motioncameras = list() var/list/motionTargets = list() -/area/ai_monitored/initialize() +/area/ai_monitored/Initialize(mapload) ..() - for (var/obj/machinery/camera/M in src) - if(M.isMotion()) - motioncameras.Add(M) - M.area_motion = src + if(mapload) + for (var/obj/machinery/camera/M in src) + if(M.isMotion()) + motioncameras.Add(M) + M.area_motion = src //Only need to use one camera diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f2cd8a257b9..6034a16cc4b 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -40,6 +40,8 @@ if(luminosity) light = new(src) + if(SSobj && SSobj.initialized) + Initialize(FALSE) //. = ..() //uncomment if you are dumb enough to add a /datum/New() proc /atom/Destroy() @@ -431,8 +433,10 @@ var/list/blood_splatter_icons = list() //effects at world start up without causing runtimes /atom/proc/spawn_atom_to_world() -//This will be called after the map and objects are loaded -/atom/proc/initialize() +//Called after New if the world is not loaded with TRUE +//Called from base of New if the world is loaded with FALSE +/atom/proc/Initialize(mapload) + set waitfor = 0 return //the vision impairment to give to the mob whose perspective is set to that atom (e.g. an unfocused camera giving you an impaired vision when looking through it) diff --git a/code/game/gamemodes/miniantags/abduction/abduction.dm b/code/game/gamemodes/miniantags/abduction/abduction.dm index b38a189fee8..2ba0ceec158 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction.dm @@ -301,7 +301,7 @@ c.team = team spawn(5) // I'd do this properly when i got some time, temporary hack for mappers - c.Initialize() + c.Setup() qdel(src) diff --git a/code/game/gamemodes/miniantags/abduction/machinery/console.dm b/code/game/gamemodes/miniantags/abduction/machinery/console.dm index 5539f6a878e..e7d830e8926 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/console.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/console.dm @@ -154,7 +154,7 @@ user << "Location marked as test subject release point." -/obj/machinery/abductor/console/proc/Initialize() +/obj/machinery/abductor/console/proc/Setup() for(var/obj/machinery/abductor/pad/p in machines) if(p.team == team) diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index b30313bc207..e93e4967af1 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -568,7 +568,8 @@ else user << "It appears to have no author." -/obj/item/weapon/spellbook/proc/Initialize() +/obj/item/weapon/spellbook/Initialize() + ..() var/entry_types = subtypesof(/datum/spellbook_entry) - /datum/spellbook_entry/item - /datum/spellbook_entry/summon for(var/T in entry_types) var/datum/spellbook_entry/E = new T @@ -579,11 +580,6 @@ qdel(E) tab = categories[1] -/obj/item/weapon/spellbook/New() - ..() - Initialize() - - /obj/item/weapon/spellbook/attackby(obj/item/O, mob/user, params) if(istype(O, /obj/item/weapon/antag_spawner/contract)) var/obj/item/weapon/antag_spawner/contract/contract = O diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/airlock_control.dm index 56240c6d9b2..a9087e7bfa5 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/airlock_control.dm @@ -77,20 +77,6 @@ frequency = new_frequency radio_connection = SSradio.add_object(src, frequency, RADIO_AIRLOCK) - -/obj/machinery/door/airlock/initialize() - if(frequency) - set_frequency(frequency) - - update_icon() - - -/obj/machinery/door/airlock/New() - ..() - - if(SSradio) - set_frequency(frequency) - /obj/machinery/door/airlock/Destroy() if(frequency && SSradio) SSradio.remove_object(src,frequency) @@ -156,14 +142,9 @@ frequency = new_frequency radio_connection = SSradio.add_object(src, frequency, RADIO_AIRLOCK) -/obj/machinery/airlock_sensor/initialize() - set_frequency(frequency) - -/obj/machinery/airlock_sensor/New() +/obj/machinery/airlock_sensor/Initialize() ..() - - if(SSradio) - set_frequency(frequency) + set_frequency(frequency) /obj/machinery/airlock_sensor/Destroy() if(SSradio) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index bae828d2680..45508523412 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -54,8 +54,9 @@ world.log << "[src.c_tag] [src.x] [src.y] [src.z] conflicts with [C.c_tag] [C.x] [C.y] [C.z]" */ -/obj/machinery/camera/initialize() - if(z == 1 && prob(3) && !start_active) +/obj/machinery/camera/Initialize(mapload) + ..() + if(mapload && z == 1 && prob(3) && !start_active) toggle_cam() /obj/machinery/camera/Move() diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 0989ee50a59..e8e7f535874 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -7,13 +7,7 @@ var/mob/living/carbon/human/patient = null var/obj/structure/table/optable/table = null - -/obj/machinery/computer/operating/New() - ..() - if(ticker) - find_table() - -/obj/machinery/computer/operating/initialize() +/obj/machinery/computer/operating/Initialize() find_table() /obj/machinery/computer/operating/proc/find_table() diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 004a59d29cd..2bec71bb875 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -9,7 +9,7 @@ var/receive_frequency = 1437 var/datum/radio_frequency/radio_connection -/obj/machinery/computer/atmos_alert/initialize() +/obj/machinery/computer/atmos_alert/Initialize() ..() set_frequency(receive_frequency) diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index 0a2f345cd84..218d5ec752a 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -45,14 +45,10 @@ frequency = new_frequency radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) -/obj/machinery/air_sensor/initialize() - set_frequency(frequency) - -/obj/machinery/air_sensor/New() +/obj/machinery/air_sensor/Initialize() ..() SSair.atmos_machinery += src - if(SSradio) - set_frequency(frequency) + set_frequency(frequency) /obj/machinery/air_sensor/Destroy() SSair.atmos_machinery -= src @@ -86,10 +82,9 @@ var/list/sensor_information = list() var/datum/radio_frequency/radio_connection -/obj/machinery/computer/atmos_control/New() +/obj/machinery/computer/atmos_control/Initialize() ..() - if(SSradio) - set_frequency(frequency) + set_frequency(frequency) /obj/machinery/computer/atmos_control/Destroy() if(SSradio) @@ -136,9 +131,6 @@ frequency = new_frequency radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) -/obj/machinery/computer/atmos_control/initialize() - set_frequency(frequency) - ///////////////////////////////////////////////////////////// // LARGE TANK CONTROL ///////////////////////////////////////////////////////////// diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index d9f87430c17..d9ee17ca3b5 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -27,8 +27,6 @@ //cause a runtime else if(ispath(circuit)) circuit = new circuit(null) - power_change() - update_icon() /obj/machinery/computer/Destroy() if(circuit) @@ -36,7 +34,8 @@ circuit = null return ..() -/obj/machinery/computer/initialize() +/obj/machinery/computer/Initialize() + ..() power_change() /obj/machinery/computer/process() diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 03e0f77a636..8c470b19c9a 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -54,12 +54,12 @@ else user << "A no server error appears on the screen." -/obj/machinery/computer/message_monitor/initialize() +/obj/machinery/computer/message_monitor/Initialize() + ..() //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) linkedServer = message_servers[1] - return /obj/machinery/computer/message_monitor/attack_hand(mob/living/user) if(..()) diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm index 2b26f1e3582..49944bb8ac0 100644 --- a/code/game/machinery/computer/pod.dm +++ b/code/game/machinery/computer/pod.dm @@ -9,11 +9,11 @@ var/range = 4 -/obj/machinery/computer/pod/initialize() +/obj/machinery/computer/pod/Initialize() + ..() for(var/obj/machinery/mass_driver/M in range(range, src)) if(M.id == id) connected = M - ..() /obj/machinery/computer/pod/proc/alarm() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index cb35f0be1b3..d33b8e42627 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -115,12 +115,14 @@ var/list/airlock_overlays = list() max_integrity = normal_integrity if(damage_deflection == AIRLOCK_DAMAGE_DEFLECTION_N && security_level > AIRLOCK_SECURITY_METAL) damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R - update_icon() -/obj/machinery/door/airlock/initialize() - . = ..() +/obj/machinery/door/airlock/Initialize() + ..() if (cyclelinkeddir) cyclelinkairlock() + if(frequency) + set_frequency(frequency) + update_icon() /obj/machinery/door/airlock/proc/cyclelinkairlock() if (cyclelinkedairlock) diff --git a/code/game/machinery/doors/alarmlock.dm b/code/game/machinery/doors/alarmlock.dm index 7f26954d1a6..6169398b739 100644 --- a/code/game/machinery/doors/alarmlock.dm +++ b/code/game/machinery/doors/alarmlock.dm @@ -21,7 +21,7 @@ air_connection = null return ..() -/obj/machinery/door/airlock/alarmlock/initialize() +/obj/machinery/door/airlock/alarmlock/Initialize() ..() SSradio.remove_object(src, air_frequency) air_connection = SSradio.add_object(src, air_frequency, RADIO_TO_AIRALARM) diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 8d81f226371..1b0ecc7dc31 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -44,18 +44,20 @@ Radio = new/obj/item/device/radio(src) Radio.listening = 0 -/obj/machinery/door_timer/initialize() - for(var/obj/machinery/door/window/brigdoor/M in urange(20, src)) - if (M.id == id) - targets += M +/obj/machinery/door_timer/Initialize() + ..() + if(id != null) + for(var/obj/machinery/door/window/brigdoor/M in urange(20, src)) + if (M.id == id) + targets += M - for(var/obj/machinery/flasher/F in urange(20, src)) - if(F.id == id) - targets += F + for(var/obj/machinery/flasher/F in urange(20, src)) + if(F.id == id) + targets += F - for(var/obj/structure/closet/secure_closet/brig/C in urange(20, src)) - if(C.id == id) - targets += C + for(var/obj/structure/closet/secure_closet/brig/C in urange(20, src)) + if(C.id == id) + targets += C if(!targets.len) stat |= BROKEN diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 9ed4ea26c3c..9a7f8b4f3bb 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -19,7 +19,8 @@ /obj/machinery/doorButtons/proc/findObjsByTag() return -/obj/machinery/doorButtons/initialize() +/obj/machinery/doorButtons/Initialize() + ..() findObjsByTag() /obj/machinery/doorButtons/emag_act(mob/user) diff --git a/code/game/machinery/embedded_controller/airlock_controller.dm b/code/game/machinery/embedded_controller/airlock_controller.dm index 85468c5a944..bf5067cf143 100644 --- a/code/game/machinery/embedded_controller/airlock_controller.dm +++ b/code/game/machinery/embedded_controller/airlock_controller.dm @@ -219,8 +219,10 @@ var/sensor_tag var/sanitize_external -/obj/machinery/embedded_controller/radio/airlock_controller/initialize() +/obj/machinery/embedded_controller/radio/airlock_controller/Initialize(mapload) ..() + if(!mapload) + return var/datum/computer/file/embedded_program/airlock_controller/new_prog = new diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 5b9d1823d8e..c50f54f4f8b 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -77,7 +77,8 @@ SSradio.remove_object(src,frequency) return ..() -/obj/machinery/embedded_controller/radio/initialize() +/obj/machinery/embedded_controller/radio/Initialize() + ..() set_frequency(frequency) /obj/machinery/embedded_controller/radio/post_signal(datum/signal/signal) diff --git a/code/game/machinery/embedded_controller/simple_vent_controller.dm b/code/game/machinery/embedded_controller/simple_vent_controller.dm index b75b515f5c4..50136323132 100644 --- a/code/game/machinery/embedded_controller/simple_vent_controller.dm +++ b/code/game/machinery/embedded_controller/simple_vent_controller.dm @@ -51,9 +51,11 @@ // Setup parameters only var/airpump_tag -/obj/machinery/embedded_controller/radio/simple_vent_controller/initialize() +/obj/machinery/embedded_controller/radio/simple_vent_controller/Initialize(mapload) ..() + if(!mapload) + return var/datum/computer/file/embedded_program/simple_vent_controller/new_prog = new new_prog.airpump_tag = airpump_tag diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 18c3ea73adf..8ebdf0ba52b 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -587,7 +587,10 @@ pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 power_change() //Checks power and initial settings -/obj/machinery/turretid/initialize() //map-placed turrets autolink turrets +/obj/machinery/turretid/Initialize(mapload) //map-placed turrets autolink turrets + ..() + if(!mapload) + return if(control_area && istext(control_area)) for(var/V in sortedAreas) var/area/A = V diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index f25425d1e9a..02324c8c68f 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -44,14 +44,8 @@ // new display // register for radio system -/obj/machinery/status_display/New() - ..() - if(SSradio) - SSradio.add_object(src, frequency) - -/obj/machinery/status_display/initialize() - if(SSradio) - SSradio.add_object(src, frequency) +/obj/machinery/status_display/Initialize() + SSradio.add_object(src, frequency) /obj/machinery/status_display/Destroy() if(SSradio) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index e56ebd9e0b9..0bb9f414ed3 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -147,8 +147,9 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() if(. && T1) // Update listening Z, just in case you have telecomm relay on a shuttle listening_level = T1.z -/obj/machinery/telecomms/initialize() - if(autolinkers.len) +/obj/machinery/telecomms/Initialize(mapload) + ..() + if(mapload && autolinkers.len) // Links nearby machines if(!long_range_link) for(var/obj/machinery/telecomms/T in urange(20, src, 1)) diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 61e6fc2df1f..a5f43c7e753 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -14,11 +14,10 @@ /obj/machinery/computer/teleporter/New() src.id = "[rand(1000, 9999)]" - link_power_station() ..() - return -/obj/machinery/computer/teleporter/initialize() +/obj/machinery/computer/teleporter/Initialize() + ..() link_power_station() /obj/machinery/computer/teleporter/Destroy() @@ -235,7 +234,6 @@ /obj/machinery/teleport/hub/New() ..() - link_power_station() var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/teleporter_hub(null) B.apply_default_parts(src) @@ -248,7 +246,8 @@ /obj/item/weapon/stock_parts/matter_bin = 1) def_components = list(/obj/item/weapon/ore/bluespace_crystal = /obj/item/weapon/ore/bluespace_crystal/artificial) -/obj/machinery/teleport/hub/initialize() +/obj/machinery/teleport/hub/Initialize() + ..() link_power_station() /obj/machinery/teleport/hub/Destroy() @@ -350,7 +349,6 @@ ..() var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/teleporter_station(null) B.apply_default_parts(src) - link_console_and_hub() /obj/item/weapon/circuitboard/machine/teleporter_station name = "Teleporter Station (Machine Board)" @@ -362,7 +360,8 @@ /obj/item/weapon/stock_parts/console_screen = 1) def_components = list(/obj/item/weapon/ore/bluespace_crystal = /obj/item/weapon/ore/bluespace_crystal/artificial) -/obj/machinery/teleport/station/initialize() +/obj/machinery/teleport/station/Initialize() + ..() link_console_and_hub() /obj/machinery/teleport/station/RefreshParts() diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 419a7be6207..e25b0323584 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -147,5 +147,6 @@ return add_overlay("recharge_comp_on") -/obj/machinery/computer/mech_bay_power_console/initialize() +/obj/machinery/computer/mech_bay_power_console/Initialize() + ..() reconnect() diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index e0fb40066b4..e1ae98de1ec 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -28,18 +28,14 @@ var/last_transmission var/datum/radio_frequency/radio_connection -/obj/item/radio/integrated/signal/New() - ..() - if(SSradio) - initialize() - /obj/item/radio/integrated/signal/Destroy() if(SSradio) SSradio.remove_object(src, frequency) radio_connection = null return ..() -/obj/item/radio/integrated/signal/initialize() +/obj/item/radio/integrated/signal/Initialize() + ..() if (src.frequency < 1200 || src.frequency > 1600) src.frequency = sanitize_frequency(src.frequency) diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 65de6658ac0..5e55e396bfa 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -12,7 +12,7 @@ var/on = 0 var/brightness_on = 4 //luminosity when on -/obj/item/device/flashlight/initialize() +/obj/item/device/flashlight/Initialize() ..() if(on) icon_state = "[initial(icon_state)]-on" diff --git a/code/game/objects/items/devices/instruments.dm b/code/game/objects/items/devices/instruments.dm index d4da3dd5c14..d03e5345eac 100644 --- a/code/game/objects/items/devices/instruments.dm +++ b/code/game/objects/items/devices/instruments.dm @@ -22,9 +22,10 @@ user.visible_message("[user] begins to play 'Gloomy Sunday'! It looks like [user.p_theyre()] trying to commit suicide!") return (BRUTELOSS) -/obj/item/device/instrument/initialize() - song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded +/obj/item/device/instrument/Initialize(mapload) ..() + if(mapload) + song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded /obj/item/device/instrument/attack_self(mob/user) if(!user.IsAdvancedToolUser()) diff --git a/code/game/objects/items/devices/radio/electropack.dm b/code/game/objects/items/devices/radio/electropack.dm index f842304a8c6..87c97636ab5 100644 --- a/code/game/objects/items/devices/radio/electropack.dm +++ b/code/game/objects/items/devices/radio/electropack.dm @@ -17,14 +17,9 @@ user.visible_message("[user] hooks [user.p_them()]self to the electropack and spams the trigger! It looks like [user.p_theyre()] trying to commit suicide!") return (FIRELOSS) -/obj/item/device/electropack/initialize() - if(SSradio) - SSradio.add_object(src, frequency, RADIO_CHAT) - -/obj/item/device/electropack/New() - if(SSradio) - SSradio.add_object(src, frequency, RADIO_CHAT) +/obj/item/device/electropack/Initialize() ..() + SSradio.add_object(src, frequency, RADIO_CHAT) /obj/item/device/electropack/Destroy() if(SSradio) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index e27fd99416f..1a9bbeba017 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -54,8 +54,6 @@ wires.cut(WIRE_TX) // OH GOD WHY secure_radio_connections = new ..() - if(SSradio) - initialize() /obj/item/device/radio/proc/recalculateChannels() channels = list() @@ -100,7 +98,8 @@ keyslot = null return ..() -/obj/item/device/radio/initialize() +/obj/item/device/radio/Initialize() + ..() frequency = sanitize_frequency(frequency, freerange) set_frequency(frequency) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 8db02b56f8a..dd90343981e 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -34,14 +34,12 @@ var/material_drop_amount = 2 var/delivery_icon = "deliverycloset" //which icon to use when packagewrapped. null to be unwrappable. -/obj/structure/closet/New() - ..() - update_icon() -/obj/structure/closet/initialize() +/obj/structure/closet/Initialize(mapload) ..() - if(!opened) // if closed, any item at the crate's loc is put in the contents + if(mapload && !opened) // if closed, any item at the crate's loc is put in the contents take_contents() + update_icon() /obj/structure/closet/Destroy() dump_contents() diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index 6f33866175e..d52153f9f46 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -12,17 +12,14 @@ var/open = 1 var/capacity = 4 -/obj/structure/guncase/New() +/obj/structure/guncase/Initialize(mapload) ..() - update_icon() - -/obj/structure/guncase/initialize() - ..() - for(var/obj/item/I in loc.contents) - if(istype(I, gun_category)) - I.loc = src - if(contents.len >= capacity) - break + if(mapload) + for(var/obj/item/I in loc.contents) + if(istype(I, gun_category)) + I.loc = src + if(contents.len >= capacity) + break update_icon() /obj/structure/guncase/update_icon() diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index 5dabd381870..98b394262fb 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -325,9 +325,10 @@ song = null return ..() -/obj/structure/piano/initialize() - song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded +/obj/structure/piano/Initialize(mapload) ..() + if(mapload) + song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded /obj/structure/piano/attack_hand(mob/user) if(!user.IsAdvancedToolUser()) diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 348128def51..061599ae73c 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -9,7 +9,12 @@ max_integrity = 150 var/notices = 0 -/obj/structure/noticeboard/initialize() +/obj/structure/noticeboard/Initialize(mapload) + ..() + + if(!mapload) + return + for(var/obj/item/I in loc) if(notices > 4) break if(istype(I, /obj/item/weapon/paper)) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 2bf64c55366..b563467dad7 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -32,7 +32,12 @@ FLOOR SAFES tumbler_2_open = rand(0, 71) -/obj/structure/safe/initialize() +/obj/structure/safe/Initialize(mapload) + ..() + + if(!mapload) + return + for(var/obj/item/I in loc) if(space >= maxspace) return @@ -185,10 +190,11 @@ FLOOR SAFES layer = LOW_OBJ_LAYER -/obj/structure/safe/floor/initialize() +/obj/structure/safe/floor/Initialize(mapload) ..() - var/turf/T = loc - hide(T.intact) + if(mapload) + var/turf/T = loc + hide(T.intact) /obj/structure/safe/floor/hide(var/intact) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 11ec431d618..8d1a4131cdb 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -179,9 +179,10 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," if(.) ChangeTurf(/turf/open/floor/clockwork) -/turf/open/floor/initialize() +/turf/open/floor/Initialize(mapload) ..() - MakeDirty() + if(mapload) + MakeDirty() /turf/open/floor/acid_melt() ChangeTurf(baseturf) diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 0a50265fa8c..ac72db5df55 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -138,8 +138,6 @@ name = "[A.name] Air Alarm" update_icon() - if(ticker && ticker.current_state == 3)//if the game is running - initialize() /obj/machinery/airalarm/Destroy() if(SSradio) @@ -148,7 +146,8 @@ wires = null return ..() -/obj/machinery/airalarm/initialize() +/obj/machinery/airalarm/Initialize(mapload) + ..() set_frequency(frequency) /obj/machinery/airalarm/ui_status(mob/user) diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 826a519bc89..d48d55dac51 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -27,8 +27,9 @@ src.target = null return ..() -/obj/machinery/meter/initialize() - if (!target) +/obj/machinery/meter/Initialize(mapload) + ..() + if (mapload && !target) src.target = locate(/obj/machinery/atmospherics/pipe) in loc /obj/machinery/meter/process_atmos() @@ -131,13 +132,8 @@ // TURF METER - REPORTS A TILE'S AIR CONTENTS // why are you yelling? +/obj/machinery/meter/turf -/obj/machinery/meter/turf/New() +/obj/machinery/meter/turf/Initialize() ..() src.target = loc - return 1 - - -/obj/machinery/meter/turf/initialize() - if (!target) - src.target = loc diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 22994212a21..0c9a98397dc 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -27,18 +27,14 @@ var/obj/effect/ctf/flag_reset/reset var/reset_path = /obj/effect/ctf/flag_reset -/obj/item/weapon/twohanded/ctf/New() - ..() - if(!reset) - reset = new reset_path(get_turf(src)) - /obj/item/weapon/twohanded/ctf/Destroy() if(reset) qdel(reset) reset = null . = ..() -/obj/item/weapon/twohanded/ctf/initialize() +/obj/item/weapon/twohanded/ctf/Initialize() + ..() if(!reset) reset = new reset_path(get_turf(src)) diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index adfad411a9d..ff1e4539ae3 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -23,7 +23,8 @@ var/obj/machinery/gateway/centerstation/the_gateway = null return ..() -/obj/machinery/gateway/initialize() +/obj/machinery/gateway/Initialize() + ..() update_icon() switch(dir) if(SOUTH,SOUTHEAST,SOUTHWEST) @@ -52,7 +53,8 @@ var/obj/machinery/gateway/centerstation/the_gateway = null var/wait = 0 //this just grabs world.time at world start var/obj/machinery/gateway/centeraway/awaygate = null -/obj/machinery/gateway/centerstation/initialize() +/obj/machinery/gateway/centerstation/Initialize() + ..() update_icon() wait = world.time + config.gateway_delay //+ thirty minutes default awaygate = locate(/obj/machinery/gateway/centeraway) @@ -179,7 +181,8 @@ var/obj/machinery/gateway/centerstation/the_gateway = null var/obj/machinery/gateway/centeraway/stationgate = null -/obj/machinery/gateway/centeraway/initialize() +/obj/machinery/gateway/centeraway/Initialize() + ..() update_icon() stationgate = locate(/obj/machinery/gateway/centerstation) diff --git a/code/modules/awaymissions/maploader/reader.dm b/code/modules/awaymissions/maploader/reader.dm index 69b3add44e9..fab32c7ffdb 100644 --- a/code/modules/awaymissions/maploader/reader.dm +++ b/code/modules/awaymissions/maploader/reader.dm @@ -242,6 +242,8 @@ var/global/dmm_suite/preloader/_preloader = new while(!ispath(members[first_turf_index],/turf)) //find first /turf object in members first_turf_index++ + //turn off base new Initialization until the whole thing is loaded + SSobj.map_loader_begin() //instanciate the first /turf var/turf/T if(members[first_turf_index] != /turf/template_noop) @@ -259,7 +261,14 @@ var/global/dmm_suite/preloader/_preloader = new //finally instance all remainings objects/mobs for(index in 1 to first_turf_index-1) instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd) - CHECK_TICK + + //custom CHECK_TICK here because we don't want things created while we're sleeping to not initialize + if(world.tick_usage > CURRENT_TICKLIMIT) + SSobj.map_loader_stop() + stoplag() + SSobj.map_loader_begin() + //Restore initialization to the previous value + SSobj.map_loader_stop() //////////////// //Helpers procs diff --git a/code/modules/awaymissions/mission_code/Cabin.dm b/code/modules/awaymissions/mission_code/Cabin.dm index 0b39818adbc..3a33c4ac992 100644 --- a/code/modules/awaymissions/mission_code/Cabin.dm +++ b/code/modules/awaymissions/mission_code/Cabin.dm @@ -7,7 +7,7 @@ density = 0 var/active = 1 -/obj/structure/firepit/initialize() +/obj/structure/firepit/Initialize() ..() toggleFirepit() @@ -18,7 +18,6 @@ else ..() - /obj/structure/firepit/attackby(obj/item/W,mob/living/user,params) if(!active) var/msg = W.ignition_effect(src, user) @@ -90,7 +89,7 @@ if(istype(T,/turf/open/floor/plating/asteroid/snow)) return ..(T) return 0 - + /datum/mapGeneratorModule/bottomlayer/snow spawnableTurfs = list(/turf/open/floor/plating/asteroid/snow/atmosphere = 100) diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index 10349f42d3f..3f513f0a7db 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -58,15 +58,15 @@ world.log << "Holodeck computer cannot be in a holodeck." world.log << "This would cause circular power dependency." qdel(src) // todo handle constructed computers - return + return //l-lewd... else linked.linked = src // todo detect multiple/constructed computers - - if(ticker && ticker.current_state >= GAME_STATE_PLAYING) - initialize() ..() -/obj/machinery/computer/holodeck/initialize() +/obj/machinery/computer/holodeck/Initialize(mapload) + ..() + if(!mapload && ticker.current_state < GAME_STATE_PLAYING) + return program_cache = list() emag_programs = list() for(var/typekey in subtypesof(program_type)) diff --git a/code/modules/jobs/job_types/security.dm b/code/modules/jobs/job_types/security.dm index e1a02020d08..c3a02d2cf80 100644 --- a/code/modules/jobs/job_types/security.dm +++ b/code/modules/jobs/job_types/security.dm @@ -281,12 +281,11 @@ var/list/sec_departments = list("engineering", "supply", "medical", "science") implants = list(/obj/item/weapon/implant/mindshield) -/obj/item/device/radio/headset/headset_sec/department/New() +/obj/item/device/radio/headset/headset_sec/alt/department/New() wires = new(src) secure_radio_connections = new - - initialize() recalculateChannels() + ..() /obj/item/device/radio/headset/headset_sec/alt/department/engi keyslot = new /obj/item/device/encryptionkey/headset_sec diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 2fef96919e9..a9257551f05 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -25,7 +25,10 @@ var/list/allowed_books = list(/obj/item/weapon/book, /obj/item/weapon/spellbook, /obj/item/weapon/storage/book) //Things allowed in the bookcase -/obj/structure/bookcase/initialize() +/obj/structure/bookcase/Initialize(mapload) + ..() + if(!mapload) + return state = 2 icon_state = "book-0" anchored = 1 diff --git a/code/modules/library/random_books.dm b/code/modules/library/random_books.dm index ff3bd42b3ff..1d5a3c3df6a 100644 --- a/code/modules/library/random_books.dm +++ b/code/modules/library/random_books.dm @@ -20,12 +20,9 @@ var/book_count = 2 anchored = 1 state = 2 -/obj/structure/bookcase/random/New() - ..() - if(ticker && ticker.current_state >= GAME_STATE_PLAYING) - initialize() -/obj/structure/bookcase/random/initialize() +/obj/structure/bookcase/random/Initialize(mapload) + ..() if(!book_count || !isnum(book_count)) update_icon() return @@ -77,8 +74,9 @@ name = "bookcase (Reference)" category = "Reference" var/ref_book_prob = 20 -/obj/structure/bookcase/random/reference/initialize() + +/obj/structure/bookcase/random/reference/Initialize(mapload) + ..() while(book_count > 0 && prob(ref_book_prob)) book_count-- new /obj/item/weapon/book/manual/random(src) - ..() diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index a7da9d3312d..f26894fd167 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -37,10 +37,8 @@ ..() radio = new(src) //Spawns a radio inside the MMI. radio.broadcasting = 0 //researching radio mmis turned the robofabs into radios because this didnt start as 0. - if(config) - laws.set_laws_config() -/obj/item/device/mmi/initialize() +/obj/item/device/mmi/Initialize() ..() laws.set_laws_config() diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 15af40fa62a..d0cc88e67fe 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -29,18 +29,15 @@ //initialize limbs create_bodyparts() - if(good_mutations.len) //genetic mutations have been set up. - initialize() //initialize monkey dna - create_internal_organs() ..() -/mob/living/carbon/monkey/initialize() +/mob/living/carbon/monkey/Initialize() + ..() create_dna(src) dna.initialize_dna(random_blood_type()) - /mob/living/carbon/monkey/create_internal_organs() internal_organs += new /obj/item/organ/appendix internal_organs += new /obj/item/organ/lungs diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index c2faba04b33..d144a04b098 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -39,10 +39,11 @@ var/attempt_open = 0 // Pickup loot -/mob/living/simple_animal/hostile/mimic/crate/initialize() +/mob/living/simple_animal/hostile/mimic/crate/Initialize(mapload) ..() - for(var/obj/item/I in loc) - I.loc = src + if(mapload) //eat shit + for(var/obj/item/I in loc) + I.loc = src /mob/living/simple_animal/hostile/mimic/crate/DestroySurroundings() ..() diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index d1a0eb18d24..b5e14821164 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -31,10 +31,12 @@ icon_state = "tallcabinet" -/obj/structure/filingcabinet/initialize() - for(var/obj/item/I in loc) - if(istype(I, /obj/item/weapon/paper) || istype(I, /obj/item/weapon/folder) || istype(I, /obj/item/weapon/photo)) - I.loc = src +/obj/structure/filingcabinet/Initialize(mapload) + ..() + if(mapload) + for(var/obj/item/I in loc) + if(istype(I, /obj/item/weapon/paper) || istype(I, /obj/item/weapon/folder) || istype(I, /obj/item/weapon/photo)) + I.loc = src /obj/structure/filingcabinet/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index cb472a44a3a..79878af7a21 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -1,139 +1,142 @@ -/obj/item/weapon/paper_bin - name = "paper bin" - desc = "Contains all the paper you'll never need." - icon = 'icons/obj/bureaucracy.dmi' - icon_state = "paper_bin1" - item_state = "sheet-metal" - throwforce = 0 - w_class = WEIGHT_CLASS_NORMAL - throw_speed = 3 - throw_range = 7 - pressure_resistance = 8 - var/total_paper = 30 - var/list/papers = list() - var/obj/item/weapon/pen/bin_pen - -/obj/item/weapon/paper_bin/initialize() - var/obj/item/weapon/pen/P = locate(/obj/item/weapon/pen) in src.loc - if(P && !bin_pen) - P.loc = src - bin_pen = P - update_icon() - var/static/warned = FALSE - if(!warned) - warning("one or more paperbins ate a pen duing initialize()") - warned = TRUE - -/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume) - if(!total_paper) - return - ..() - -/obj/item/weapon/paper_bin/Destroy() - if(papers) - for(var/i in papers) - qdel(i) - papers = null - . = ..() - -/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume) - if(total_paper) - total_paper = 0 - update_icon() - ..() - -/obj/item/weapon/paper_bin/MouseDrop(atom/over_object) - var/mob/living/M = usr - if(!istype(M) || M.incapacitated() || !Adjacent(M)) - return - - if(over_object == M) - M.put_in_hands(src) - - else if(istype(over_object, /obj/screen/inventory/hand)) - var/obj/screen/inventory/hand/H = over_object - if(!remove_item_from_storage(M)) - if(!M.unEquip(src)) - return - M.put_in_hand(src, H.held_index) - - add_fingerprint(M) - - -/obj/item/weapon/paper_bin/attack_paw(mob/user) - return attack_hand(user) - - -/obj/item/weapon/paper_bin/attack_hand(mob/user) - if(user.lying) - return - user.changeNext_move(CLICK_CD_MELEE) - if(bin_pen) - var/obj/item/weapon/pen/P = bin_pen - P.loc = user.loc - user.put_in_hands(P) - user << "You take [P] out of \the [src]." - bin_pen = null - update_icon() - else if(total_paper >= 1) - total_paper-- - update_icon() - // If there's any custom paper on the stack, use that instead of creating a new paper. - var/obj/item/weapon/paper/P - if(papers.len > 0) - P = papers[papers.len] - papers.Remove(P) - else - P = new /obj/item/weapon/paper - if(SSevent.holidays && SSevent.holidays[APRIL_FOOLS]) - if(prob(30)) - P.info = "HONK HONK HONK HONK HONK HONK HONK
HOOOOOOOOOOOOOOOOOOOOOONK
APRIL FOOLS
" - P.rigged = 1 - P.updateinfolinks() - - P.loc = user.loc - user.put_in_hands(P) - user << "You take [P] out of \the [src]." - else - user << "[src] is empty!" - - add_fingerprint(user) - - -/obj/item/weapon/paper_bin/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/weapon/paper)) - var/obj/item/weapon/paper/P = I - if(!user.unEquip(P)) - return - P.loc = src - user << "You put [P] in [src]." - papers.Add(P) - total_paper++ - update_icon() - else if(istype(I, /obj/item/weapon/pen)) - var/obj/item/weapon/pen/P = I - if(!user.unEquip(P)) - return - P.loc = src - user << "You put [P] in [src]." - bin_pen = P - update_icon() - else - return ..() - -/obj/item/weapon/paper_bin/examine(mob/user) - ..() - if(total_paper) - user << "It contains " + (total_paper > 1 ? "[total_paper] papers" : " one paper")+"." - else - user << "It doesn't contain anything." - - -/obj/item/weapon/paper_bin/update_icon() - if(total_paper < 1) - icon_state = "paper_bin0" - else - icon_state = "paper_bin1" - cut_overlays() - if(bin_pen) - add_overlay(image(icon=bin_pen.icon,icon_state=bin_pen.icon_state)) +/obj/item/weapon/paper_bin + name = "paper bin" + desc = "Contains all the paper you'll never need." + icon = 'icons/obj/bureaucracy.dmi' + icon_state = "paper_bin1" + item_state = "sheet-metal" + throwforce = 0 + w_class = WEIGHT_CLASS_NORMAL + throw_speed = 3 + throw_range = 7 + pressure_resistance = 8 + var/total_paper = 30 + var/list/papers = list() + var/obj/item/weapon/pen/bin_pen + +/obj/item/weapon/paper_bin/Initialize(mapload) + ..() + if(!mapload) + return + var/obj/item/weapon/pen/P = locate(/obj/item/weapon/pen) in src.loc + if(P && !bin_pen) + P.loc = src + bin_pen = P + update_icon() + var/static/warned = FALSE + if(!warned) + warning("one or more paperbins ate a pen duing initialize()") + warned = TRUE + +/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume) + if(!total_paper) + return + ..() + +/obj/item/weapon/paper_bin/Destroy() + if(papers) + for(var/i in papers) + qdel(i) + papers = null + . = ..() + +/obj/item/weapon/paper_bin/fire_act(exposed_temperature, exposed_volume) + if(total_paper) + total_paper = 0 + update_icon() + ..() + +/obj/item/weapon/paper_bin/MouseDrop(atom/over_object) + var/mob/living/M = usr + if(!istype(M) || M.incapacitated() || !Adjacent(M)) + return + + if(over_object == M) + M.put_in_hands(src) + + else if(istype(over_object, /obj/screen/inventory/hand)) + var/obj/screen/inventory/hand/H = over_object + if(!remove_item_from_storage(M)) + if(!M.unEquip(src)) + return + M.put_in_hand(src, H.held_index) + + add_fingerprint(M) + + +/obj/item/weapon/paper_bin/attack_paw(mob/user) + return attack_hand(user) + + +/obj/item/weapon/paper_bin/attack_hand(mob/user) + if(user.lying) + return + user.changeNext_move(CLICK_CD_MELEE) + if(bin_pen) + var/obj/item/weapon/pen/P = bin_pen + P.loc = user.loc + user.put_in_hands(P) + user << "You take [P] out of \the [src]." + bin_pen = null + update_icon() + else if(total_paper >= 1) + total_paper-- + update_icon() + // If there's any custom paper on the stack, use that instead of creating a new paper. + var/obj/item/weapon/paper/P + if(papers.len > 0) + P = papers[papers.len] + papers.Remove(P) + else + P = new /obj/item/weapon/paper + if(SSevent.holidays && SSevent.holidays[APRIL_FOOLS]) + if(prob(30)) + P.info = "HONK HONK HONK HONK HONK HONK HONK
HOOOOOOOOOOOOOOOOOOOOOONK
APRIL FOOLS
" + P.rigged = 1 + P.updateinfolinks() + + P.loc = user.loc + user.put_in_hands(P) + user << "You take [P] out of \the [src]." + else + user << "[src] is empty!" + + add_fingerprint(user) + + +/obj/item/weapon/paper_bin/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/weapon/paper)) + var/obj/item/weapon/paper/P = I + if(!user.unEquip(P)) + return + P.loc = src + user << "You put [P] in [src]." + papers.Add(P) + total_paper++ + update_icon() + else if(istype(I, /obj/item/weapon/pen)) + var/obj/item/weapon/pen/P = I + if(!user.unEquip(P)) + return + P.loc = src + user << "You put [P] in [src]." + bin_pen = P + update_icon() + else + return ..() + +/obj/item/weapon/paper_bin/examine(mob/user) + ..() + if(total_paper) + user << "It contains " + (total_paper > 1 ? "[total_paper] papers" : " one paper")+"." + else + user << "It doesn't contain anything." + + +/obj/item/weapon/paper_bin/update_icon() + if(total_paper < 1) + icon_state = "paper_bin0" + else + icon_state = "paper_bin1" + cut_overlays() + if(bin_pen) + add_overlay(image(icon=bin_pen.icon,icon_state=bin_pen.icon_state)) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index c70277ce155..c5f5283c54a 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -169,7 +169,10 @@ terminal.setDir(tdir) terminal.master = src -/obj/machinery/power/apc/initialize() +/obj/machinery/power/apc/Initialize(mapload) + ..() + if(!mapload) + return has_electronics = 2 //installed and secured // is starting with a power cell installed, create it and set its charge level if(cell_type) diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index a27f6f9bf5e..f28fae197f1 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -27,7 +27,8 @@ var/lastcirc = "00" -/obj/machinery/power/generator/initialize() +/obj/machinery/power/generator/Initialize(mapload) + ..() var/obj/machinery/atmospherics/components/binary/circulator/circpath = /obj/machinery/atmospherics/components/binary/circulator cold_circ = locate(circpath) in get_step(src, cold_dir) hot_circ = locate(circpath) in get_step(src, hot_dir) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index b8d9f7b182b..c0e0380d5aa 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -98,7 +98,8 @@ var/const/GRAV_NEEDS_WRENCH = 3 // Generator which spawns with the station. // -/obj/machinery/gravity_generator/main/station/initialize() +/obj/machinery/gravity_generator/main/station/Initialize() + ..() setup_parts() middle.add_overlay("activated") update_list() @@ -109,10 +110,6 @@ var/const/GRAV_NEEDS_WRENCH = 3 /obj/machinery/gravity_generator/main/station/admin use_power = 0 -/obj/machinery/gravity_generator/main/station/admin/New() - ..() - initialize() - // // Main Generator with the main code // diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index be4edcae7c4..a58a90f6f80 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -99,7 +99,7 @@ display round(lastgen) and plasmatank amount var/time_per_sheet = 260 var/current_heat = 0 -/obj/machinery/power/port_gen/pacman/initialize() +/obj/machinery/power/port_gen/pacman/Initialize() ..() if(anchored) connect_to_network() diff --git a/code/modules/power/rtg.dm b/code/modules/power/rtg.dm index 6117d88035d..d4522c93b37 100644 --- a/code/modules/power/rtg.dm +++ b/code/modules/power/rtg.dm @@ -23,7 +23,6 @@ ..() var/obj/item/weapon/circuitboard/machine/B = new board_path(null) B.apply_default_parts(src) - connect_to_network() /obj/item/weapon/circuitboard/machine/rtg name = "RTG (Machine Board)" @@ -34,7 +33,7 @@ /obj/item/weapon/stock_parts/capacitor = 1, /obj/item/stack/sheet/mineral/uranium = 10) // We have no Pu-238, and this is the closest thing to it. -/obj/machinery/power/rtg/initialize() +/obj/machinery/power/rtg/Initialize() ..() connect_to_network() diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 10d617e4670..ecd3c09664d 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -81,7 +81,7 @@ else rotate() -/obj/machinery/power/emitter/initialize() +/obj/machinery/power/emitter/Initialize() ..() if(state == 2 && anchored) connect_to_network() diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 068ec6bbe61..cad9ba44e16 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -281,11 +281,10 @@ var/obj/machinery/power/tracker/connected_tracker = null var/list/connected_panels = list() - -/obj/machinery/power/solar_control/New() +/obj/machinery/power/solar_control/Initialize() ..() - if(ticker) - initialize() + if(powernet) + set_panels(currentdir) connect_to_network() /obj/machinery/power/solar_control/Destroy() @@ -335,12 +334,6 @@ set_panels(currentdir) updateDialog() - -/obj/machinery/power/solar_control/initialize() - ..() - if(!powernet) return - set_panels(currentdir) - /obj/machinery/power/solar_control/update_icon() cut_overlays() if(stat & NOPOWER) diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 387179ff766..cfea73c623f 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -85,7 +85,7 @@ /obj/item/stack/cable_coil = 5, /obj/item/weapon/stock_parts/manipulator = 6) -/obj/machinery/power/compressor/initialize() +/obj/machinery/power/compressor/Initialize() ..() locate_machinery() if(!turbine) @@ -201,7 +201,7 @@ /obj/item/stack/cable_coil = 5, /obj/item/weapon/stock_parts/capacitor = 6) -/obj/machinery/power/turbine/initialize() +/obj/machinery/power/turbine/Initialize() ..() locate_machinery() if(!compressor) @@ -337,10 +337,9 @@ -/obj/machinery/computer/turbine_computer/initialize() +/obj/machinery/computer/turbine_computer/Initialize() ..() - spawn(10) - locate_machinery() + locate_machinery() /obj/machinery/computer/turbine_computer/locate_machinery() compressor = locate(/obj/machinery/power/compressor) in range(5, src) diff --git a/code/modules/recycling/disposal-unit.dm b/code/modules/recycling/disposal-unit.dm index 03ae6756cb0..dd001cfa404 100644 --- a/code/modules/recycling/disposal-unit.dm +++ b/code/modules/recycling/disposal-unit.dm @@ -61,7 +61,10 @@ if(current_size >= STAGE_FIVE) deconstruct() -/obj/machinery/disposal/initialize() +/obj/machinery/disposal/Initialize(mapload) + ..() + if(!mapload) + return //this will get a copy of the air turf and take a SEND PRESSURE amount of air from it var/atom/L = loc var/datum/gas_mixture/env = new diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index c34beaa7515..2e33749f708 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -105,9 +105,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, files = new /datum/research(src) //Setup the research data holder. matching_designs = list() if(!id) - for(var/obj/machinery/r_n_d/server/centcom/S in machines) - S.initialize() - break + fix_noid_research_servers() /* Instead of calling this every tick, it is only being called when needed /obj/machinery/computer/rdconsole/process() diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index a20239a618e..237344366c4 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -18,7 +18,6 @@ ..() var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/rdserver(null) B.apply_default_parts(src) - initialize() //Agouri /obj/item/weapon/circuitboard/machine/rdserver name = "R&D Server (Machine Board)" @@ -38,7 +37,8 @@ tot_rating += SP.rating heat_gen /= max(1, tot_rating) -/obj/machinery/r_n_d/server/initialize() +/obj/machinery/r_n_d/server/Initialize(mapload) + ..() if(!files) files = new /datum/research(src) var/list/temp_list if(!id_with_upload.len) @@ -136,8 +136,11 @@ name = "Centcom Central R&D Database" server_id = -1 -/obj/machinery/r_n_d/server/centcom/initialize() +/obj/machinery/r_n_d/server/centcom/Initialize() ..() + fix_noid_research_servers() + +/proc/fix_noid_research_servers() var/list/no_id_servers = list() var/list/server_ids = list() for(var/obj/machinery/r_n_d/server/S in machines) diff --git a/code/modules/ruins/objects_and_mobs/ruin_mapping_aids.dm b/code/modules/ruins/objects_and_mobs/ruin_mapping_aids.dm index 0e7a6268ac0..4db811604d8 100644 --- a/code/modules/ruins/objects_and_mobs/ruin_mapping_aids.dm +++ b/code/modules/ruins/objects_and_mobs/ruin_mapping_aids.dm @@ -6,7 +6,7 @@ icon_state = "syndballoon" var/baseturf = /turf/open/floor/plating/lava/smooth/lava_land_surface -/obj/effect/baseturf_helper/initialize() +/obj/effect/baseturf_helper/Initialize() ..() var/area/thearea = get_area(src) for(var/turf/T in get_area_turfs(thearea, z)) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 0f36e7e2b14..079c16671ec 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -426,8 +426,11 @@ var/edge_distance = 16 // Minimal distance from the map edge, setting this too low can result in shuttle landing on the edge and getting "sliced" -/obj/docking_port/stationary/random/initialize() +/obj/docking_port/stationary/random/Initialize(mapload) ..() + if(!mapload) + return + var/list/turfs = get_area_turfs(target_area) var/turf/T = pick(turfs) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 7c21400b645..4e43edea999 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -237,7 +237,10 @@ areaInstance = null . = ..() -/obj/docking_port/mobile/initialize() +/obj/docking_port/mobile/Initialize(mapload) + ..() + if(!mapload) + return var/area/A = get_area(src) if(istype(A, /area/shuttle)) areaInstance = A diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index 2ed4638a322..9ddd993c7e6 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -31,8 +31,8 @@ var/obj/item/device/gps/inserted_gps /obj/machinery/computer/telescience/New() - ..() recalibrate() + ..() /obj/machinery/computer/telescience/Destroy() eject() @@ -45,10 +45,11 @@ ..() user << "There are [crystals.len ? crystals.len : "no"] bluespace crystal\s in the crystal slots." -/obj/machinery/computer/telescience/initialize() +/obj/machinery/computer/telescience/Initialize(mapload) ..() - for(var/i = 1; i <= starting_crystals; i++) - crystals += new /obj/item/weapon/ore/bluespace_crystal/artificial(null) // starting crystals + if(mapload) + for(var/i = 1; i <= starting_crystals; i++) + crystals += new /obj/item/weapon/ore/bluespace_crystal/artificial(null) // starting crystals /obj/machinery/computer/telescience/attack_paw(mob/user) user << "You are too primitive to use this computer!"