diff --git a/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm b/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm
index a7c8fd6d38..7ef1858b2f 100644
--- a/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/pipeturbine.dm
@@ -237,10 +237,9 @@
var/kin_to_el_ratio = 0.1 //How much kinetic energy will be taken from turbine and converted into electricity
var/obj/machinery/atmospherics/pipeturbine/turbine
-/obj/machinery/power/turbinemotor/New()
- ..()
- spawn(1)
- updateConnection()
+/obj/machinery/power/turbinemotor/Initialize()
+ . = ..()
+ updateConnection()
/obj/machinery/power/turbinemotor/proc/updateConnection()
turbine = null
diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm
index ca862dbf3e..33b50af54b 100644
--- a/code/_helpers/global_lists.dm
+++ b/code/_helpers/global_lists.dm
@@ -28,9 +28,6 @@ var/list/mannequins_
var/global/list/poster_designs = list()
var/global/list/NT_poster_designs = list()
-// Uplinks
-var/list/obj/item/device/uplink/world_uplinks = list()
-
//Preferences stuff
//Hairstyles
var/global/list/hair_styles_list = list() //stores /datum/sprite_accessory/hair indexed by name
diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm
index 9a0ab5c9c1..ae218f750e 100644
--- a/code/_helpers/unsorted.dm
+++ b/code/_helpers/unsorted.dm
@@ -1417,7 +1417,7 @@ var/mob/dview/dview_mob = new
#define VARSET_LIST_CALLBACK(target, var_name, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##target, ##var_name, ##var_value)
//dupe code because dm can't handle 3 level deep macros
#define VARSET_CALLBACK(datum, var, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##datum, NAMEOF(##datum, ##var), ##var_value)
-//the 3 level deep myth DEBUNKED
+//we'll see about those 3-level deep macros
#define VARSET_IN(datum, var, var_value, time) addtimer(VARSET_CALLBACK(datum, var, var_value), time)
/proc/___callbackvarset(list_or_datum, var_name, var_value)
@@ -1586,4 +1586,4 @@ var/mob/dview/dview_mob = new
// Note that object refs will be converted to text, as if \ref[thing] was done. To get the ref back on Topic() side, you will need to use locate().
// Third one is the text that will be clickable.
/proc/href(href_src, list/href_params, href_text)
- return "[href_text]"
\ No newline at end of file
+ return "[href_text]"
diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm
index 6b4794dff4..c79a0e94be 100644
--- a/code/game/dna/dna_modifier.dm
+++ b/code/game/dna/dna_modifier.dm
@@ -293,19 +293,15 @@
else
return
-/obj/machinery/computer/scan_consolenew/New()
- ..()
+/obj/machinery/computer/scan_consolenew/Initialize()
+ . = ..()
for(var/i=0;i<3;i++)
buffers[i+1]=new /datum/dna2/record
- spawn(5)
- for(dir in list(NORTH,EAST,SOUTH,WEST))
- connected = locate(/obj/machinery/dna_scannernew, get_step(src, dir))
- if(!isnull(connected))
- break
- spawn(250)
- src.injector_ready = 1
- return
- return
+ for(dir in list(NORTH,EAST,SOUTH,WEST))
+ connected = locate(/obj/machinery/dna_scannernew, get_step(src, dir))
+ if(connected)
+ break
+ VARSET_IN(src, injector_ready, TRUE, 25 SECONDS)
/obj/machinery/computer/scan_consolenew/proc/all_dna_blocks(var/list/buffer)
var/list/arr = list()
diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm
index 7ce4b2e86d..b9d434902e 100644
--- a/code/game/gamemodes/cult/cult_structures.dm
+++ b/code/game/gamemodes/cult/cult_structures.dm
@@ -153,11 +153,14 @@
/obj/effect/gateway/active/cult/cultify()
return
-/obj/effect/gateway/active/New()
- spawn(rand(30,60) SECONDS)
+/obj/effect/gateway/active/Initialize()
+ addtimer(CALLBACK(src, .proc/spawn_and_qdel), rand(30, 60) SECONDS)
+
+/obj/effect/gateway/active/proc/spawn_and_qdel()
+ if(LAZYLEN(spawnable))
var/t = pick(spawnable)
- new t(src.loc)
- qdel(src)
+ new t(get_turf(src))
+ qdel(src)
/obj/effect/gateway/active/Crossed(var/atom/A)
if(A.is_incorporeal())
diff --git a/code/game/gamemodes/technomancer/spells/chroma.dm b/code/game/gamemodes/technomancer/spells/chroma.dm
index 6033d69466..b87a82a0ae 100644
--- a/code/game/gamemodes/technomancer/spells/chroma.dm
+++ b/code/game/gamemodes/technomancer/spells/chroma.dm
@@ -18,23 +18,20 @@
..()
set_light(6, 5, l_color = color_to_use)
-/obj/effect/chroma
+/obj/effect/temporary_effect/chroma
name = "chroma"
desc = "How are you examining what which cannot be seen?"
invisibility = 101
- var/time_to_die = 2 MINUTES //Despawn after this time, if set.
+ time_to_die = 2 MINUTES //Despawn after this time, if set.
-/obj/effect/chroma/New(var/newloc, var/new_color = "#FFFFFF")
- ..()
+/obj/effect/temporary_effect/chroma/Initialize(var/mapload, var/new_color = "#FFFFFF")
+ . = ..()
set_light(6, 5, l_color = new_color)
- if(time_to_die)
- spawn(time_to_die)
- qdel(src)
/obj/item/weapon/spell/chroma/on_ranged_cast(atom/hit_atom, mob/user)
var/turf/T = get_turf(hit_atom)
if(T)
- new /obj/effect/chroma(T, color_to_use)
+ new /obj/effect/temporary_effect/chroma(T, color_to_use)
to_chat(user, "You shift the light onto \the [T].")
qdel(src)
diff --git a/code/game/gamemodes/technomancer/spells/reflect.dm b/code/game/gamemodes/technomancer/spells/reflect.dm
index 8d54ebafc8..47ed0663f2 100644
--- a/code/game/gamemodes/technomancer/spells/reflect.dm
+++ b/code/game/gamemodes/technomancer/spells/reflect.dm
@@ -21,13 +21,12 @@
set_light(3, 2, l_color = "#006AFF")
spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
- to_chat(owner, "Your shield will expire in 3 seconds!")
- spawn(5 SECONDS)
- if(src)
- to_chat(owner, "Your shield expires!")
- qdel(src)
+ to_chat(owner, "Your shield will expire in 5 seconds!")
+ QDEL_IN(src, 5 SECONDS)
/obj/item/weapon/spell/reflect/Destroy()
+ if(owner)
+ to_chat(owner, "Your shield expires!")
spark_system = null
return ..()
diff --git a/code/game/gamemodes/technomancer/spells/spawner/destablize.dm b/code/game/gamemodes/technomancer/spells/spawner/destablize.dm
index 29381701ca..aee8d2557b 100644
--- a/code/game/gamemodes/technomancer/spells/spawner/destablize.dm
+++ b/code/game/gamemodes/technomancer/spells/spawner/destablize.dm
@@ -35,12 +35,13 @@
var/instability_power = 5
var/instability_range = 6
-/obj/effect/temporary_effect/destablize/New()
- ..()
- spawn(0)
- radiate_loop()
+/obj/effect/temporary_effect/destablize/Initialize()
+ . = ..()
+ radiate_loop()
/obj/effect/temporary_effect/destablize/proc/radiate_loop()
+ set waitfor = FALSE
+
while(pulses_remaining)
sleep(5)
for(var/mob/living/L in range(src, instability_range) )
diff --git a/code/game/gamemodes/technomancer/spells/spawner/pulsar.dm b/code/game/gamemodes/technomancer/spells/spawner/pulsar.dm
index 6dcd2cf4b2..b56ea64e9c 100644
--- a/code/game/gamemodes/technomancer/spells/spawner/pulsar.dm
+++ b/code/game/gamemodes/technomancer/spells/spawner/pulsar.dm
@@ -31,11 +31,15 @@
var/pulse_delay = 2 SECONDS
/obj/effect/temporary_effect/pulse/Initialize()
- spawn(0)
- pulse_loop()
- return ..()
+ ..()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/effect/temporary_effect/pulse/LateInitialize()
+ pulse_loop()
/obj/effect/temporary_effect/pulse/proc/pulse_loop()
+ set waitfor = FALSE
+
while(pulses_remaining)
sleep(pulse_delay)
on_pulse()
diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm
index ef74905a50..3833c72ee4 100644
--- a/code/game/machinery/atmoalter/canister.dm
+++ b/code/game/machinery/atmoalter/canister.dm
@@ -395,16 +395,13 @@ update_flag
return 1
//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0
-/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/New()
- ..()
+/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/Initialize()
+ . = ..()
air_contents.gas["sleeping_agent"] = 9*4000
- spawn(10)
- var/turf/simulated/location = src.loc
- if (istype(src.loc))
- while (!location.air)
- sleep(10)
- location.assume_air(air_contents)
- air_contents = new
+ var/turf/simulated/location = src.loc
+ if (istype(src.loc))
+ location.assume_air(air_contents)
+ air_contents = new
return 1
/obj/machinery/portable_atmospherics/canister/nitrogen/New()
diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm
index 180dde355d..915fb8fac1 100644
--- a/code/game/machinery/atmoalter/portable_atmospherics.dm
+++ b/code/game/machinery/atmoalter/portable_atmospherics.dm
@@ -21,18 +21,20 @@
return 1
+/obj/machinery/portable_atmospherics/Initialize()
+ ..()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/portable_atmospherics/LateInitialize()
+ var/obj/machinery/atmospherics/portables_connector/port = locate() in loc
+ if(port)
+ connect(port)
+ update_icon()
+
/obj/machinery/portable_atmospherics/Destroy()
QDEL_NULL(air_contents)
QDEL_NULL(holding)
- . = ..()
-
-/obj/machinery/portable_atmospherics/Initialize()
- . = ..()
- spawn()
- var/obj/machinery/atmospherics/portables_connector/port = locate() in loc
- if(port)
- connect(port)
- update_icon()
+ return ..()
/obj/machinery/portable_atmospherics/process()
if(!connected_port) //only react when pipe_network will ont it do it for you
diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm
index 206dffaa43..911e128984 100644
--- a/code/game/machinery/camera/presets.dm
+++ b/code/game/machinery/camera/presets.dm
@@ -156,24 +156,31 @@ var/global/list/engineering_networks = list(
// AUTONAME
/obj/machinery/camera/autoname
- var/number = 0 //camera number in area
-
-//This camera type automatically sets it's name to whatever the area that it's in is called.
-/obj/machinery/camera/autoname/New()
- ..()
- spawn(10)
- number = 1
- var/area/A = get_area(src)
- if(A)
- for(var/obj/machinery/camera/autoname/C in machines)
- if(C == src) continue
- var/area/CA = get_area(C)
- if(CA.type == A.type)
- if(C.number)
- number = max(number, C.number+1)
- c_tag = "[A.name] #[number]"
- invalidateCameraCache()
+ var/static/list/by_area
+/obj/machinery/camera/autoname/Initialize()
+ . = ..()
+ var/area/A = get_area(src)
+ if(!A)
+ return .
+ if(!by_area)
+ by_area = list()
+ if(!by_area[A.name])
+ by_area[A.name] = list()
+ var/list/my_area = by_area[A.name]
+ my_area += src
+ var/number = my_area.len
+
+ c_tag = "[A.name] #[number]"
+ invalidateCameraCache()
+
+/obj/machinery/camera/autoname/Destroy()
+ var/area/A = get_area(src)
+ if(!A || !by_area || !by_area[A.name])
+ return ..()
+ var/list/my_area = by_area[A.name]
+ my_area -= src
+ return ..()
// CHECKS
diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm
index 3aa01abcf3..2416a0cd35 100644
--- a/code/game/machinery/computer/message.dm
+++ b/code/game/machinery/computer/message.dm
@@ -503,20 +503,18 @@
return src.attack_hand(usr)
-
/obj/item/weapon/paper/monitorkey
- //..()
name = "Monitor Decryption Key"
- var/obj/machinery/message_server/server = null
-/obj/item/weapon/paper/monitorkey/New()
- ..()
- spawn(10)
- if(message_servers)
- for(var/obj/machinery/message_server/server in message_servers)
- if(!isnull(server))
- if(!isnull(server.decryptkey))
- info = "
Daily Key Reset
The new message monitor key is '[server.decryptkey]'.
Please keep this a secret and away from the clown.
If necessary, change the password to a more secure one."
- info_links = info
- icon_state = "paper_words"
- break
+/obj/item/weapon/paper/monitorkey/Initialize()
+ ..() //Late init
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/item/weapon/paper/monitorkey/LateInitialize()
+ if(message_servers)
+ for(var/obj/machinery/message_server/server in message_servers)
+ if(!isnull(server.decryptkey))
+ info = "Daily Key Reset
The new message monitor key is '[server.decryptkey]'.
Please keep this a secret and away from the clown.
If necessary, change the password to a more secure one."
+ info_links = info
+ icon_state = "paper_words"
+ break
diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm
index f40fb734dc..441970a8cb 100644
--- a/code/game/machinery/computer/pod.dm
+++ b/code/game/machinery/computer/pod.dm
@@ -12,17 +12,15 @@
var/time = 30.0
var/title = "Mass Driver Controls"
+/obj/machinery/computer/pod/Initialize()
+ ..() //Not returning parent because lateload
+ return INITIALIZE_HINT_LATELOAD
-/obj/machinery/computer/pod/New()
- ..()
- spawn( 5 )
- for(var/obj/machinery/mass_driver/M in machines)
- if(M.id == id)
- connected = M
- else
- return
- return
-
+/obj/machinery/computer/pod/LateInitialize()
+ for(var/obj/machinery/mass_driver/M in machines)
+ if(M.id == id)
+ connected = M
+ break
/obj/machinery/computer/pod/proc/alarm()
if(stat & (NOPOWER|BROKEN))
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index 4ad97c9066..22debea238 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -50,13 +50,14 @@
"cold"
)
-/obj/machinery/door/firedoor/New()
+/obj/machinery/door/firedoor/Initialize()
. = ..()
+ //Delete ourselves if we find extra mapped in firedoors
for(var/obj/machinery/door/firedoor/F in loc)
if(F != src)
- spawn(1)
- qdel(src)
- return .
+ log_debug("Duplicate firedoors at [x],[y],[z]")
+ return INITIALIZE_HINT_QDEL
+
var/area/A = get_area(src)
ASSERT(istype(A))
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index ccfd1a3730..afa853c41a 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -15,19 +15,24 @@
var/otherarea = null
var/image/overlay
-/obj/machinery/light_switch/New()
- ..()
- spawn(5)
- area = get_area(src)
+/obj/machinery/light_switch/Initialize()
+ . = ..()
- if(otherarea)
- area = locate(text2path("/area/[otherarea]"))
+ area = get_area(src)
- if(!name)
- name = "light switch ([area.name])"
+ if(otherarea)
+ area = locate(text2path("/area/[otherarea]"))
- on = area.lightswitch
- updateicon()
+ if(!name)
+ name = "light switch ([area.name])"
+
+ on = area.lightswitch
+ updateicon()
+
+/obj/machinery/light_switch/Destroy()
+ area = null
+ overlay = null
+ return ..()
/obj/machinery/light_switch/proc/updateicon()
if(!overlay)
diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm
index 10ae286276..883a963fa2 100644
--- a/code/game/machinery/newscaster.dm
+++ b/code/game/machinery/newscaster.dm
@@ -120,8 +120,7 @@
var/datum/feed_network/news_network = new /datum/feed_network //The global news-network, which is coincidentally a global list.
-var/list/obj/machinery/newscaster/allCasters = list() //Global list that will contain reference to all newscasters in existence.
-
+GLOBAL_LIST_BOILERPLATE(allCasters, /obj/machinery/newscaster)
/obj/machinery/newscaster
name = "newscaster"
desc = "A standard newsfeed handler for use on commercial space stations. All the news you absolutely have no use for, in one place!"
@@ -151,7 +150,8 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
var/securityCaster = 0
// 0 = Caster cannot be used to issue wanted posters
// 1 = the opposite
- var/unit_no = 0 //Each newscaster has a unit number
+ var/static/unit_no_cur = 0 //Each newscaster has a unit number
+ var/unit_no
//var/datum/feed_message/wanted //We're gonna use a feed_message to store data of the wanted person because fields are similar
//var/wanted_issue = 0 //OBSOLETE
// 0 = there's no WANTED issued, we don't need a special icon_state
@@ -176,19 +176,21 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
name = "Security Newscaster"
securityCaster = 1
-/obj/machinery/newscaster/New() //Constructor, ho~
+/obj/machinery/newscaster/Initialize()
+ ..() //Not returning . because lateload below
allCasters += src
- paper_remaining = 15 // Will probably change this to something better
- for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) // Let's give it an appropriate unit number
- unit_no++
- update_icon() //for any custom ones on the map...
- spawn(10) //Should be enough time for the node to spawn at tcomms.
- node = get_exonet_node()
- ..() //I just realised the newscasters weren't in the global machines list. The superconstructor call will tend to that
+ unit_no = ++unit_no_cur
+ paper_remaining = 15
+ update_icon()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/newscaster/LateInitialize()
+ node = get_exonet_node()
/obj/machinery/newscaster/Destroy()
allCasters -= src
- ..()
+ node = null
+ return ..()
/obj/machinery/newscaster/update_icon()
if(!ispowered || isbroken)
@@ -325,11 +327,11 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
if(6)
dat+="ERROR: Could not submit Feed story to Network.
"
if(channel_name=="")
- dat+="•Invalid receiving channel name.
"
+ dat+="•Invalid receiving channel name.
"
if(scanned_user=="Unknown")
- dat+="•Channel author unverified.
"
+ dat+="•Channel author unverified.
"
if(msg == "" || msg == "\[REDACTED\]")
- dat+="•Invalid message body.
"
+ dat+="•Invalid message body.
"
dat+="
Return
"
if(7)
@@ -341,18 +343,18 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
else
existing_authors += FC.author
if(scanned_user in existing_authors)
- dat+="•There already exists a Feed channel under your name.
"
+ dat+="•There already exists a Feed channel under your name.
"
if(channel_name=="" || channel_name == "\[REDACTED\]")
- dat+="•Invalid channel name.
"
+ dat+="•Invalid channel name.
"
var/check = 0
for(var/datum/feed_channel/FC in news_network.network_channels)
if(FC.channel_name == channel_name)
check = 1
break
if(check)
- dat+="•Channel name already in use.
"
+ dat+="•Channel name already in use.
"
if(scanned_user=="Unknown")
- dat+="•Channel author unverified.
"
+ dat+="•Channel author unverified.
"
dat+="
Return
"
if(8)
var/total_num=length(news_network.network_channels)
@@ -466,11 +468,11 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
if(16)
dat+="ERROR: Wanted Issue rejected by Network.
"
if(channel_name=="" || channel_name == "\[REDACTED\]")
- dat+="•Invalid name for person wanted.
"
+ dat+="•Invalid name for person wanted.
"
if(scanned_user=="Unknown")
- dat+="•Issue author unverified.
"
+ dat+="•Issue author unverified.
"
if(msg == "" || msg == "\[REDACTED\]")
- dat+="•Invalid description.
"
+ dat+="•Invalid description.
"
dat+="
Return
"
if(17)
dat+="Wanted Issue successfully deleted from Circulation
"
@@ -817,7 +819,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob)
switch(screen)
if(0) //Cover
dat+="The Griffon
"
- dat+="[using_map.company_name]-standard newspaper, for use on [using_map.company_name]© Space Facilities
"
+ dat+="[using_map.company_name]-standard newspaper, for use on [using_map.company_name]© Space Facilities
"
if(isemptylist(news_content))
if(important_message)
dat+="Contents:
**Important Security Announcement** \[page [pages+2]\]
"
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index fec24c137a..8e92dcee6f 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -70,20 +70,19 @@
/obj/machinery/vending/Initialize()
. = ..()
wires = new(src)
- spawn(4)
- if(product_slogans)
- slogan_list += splittext(product_slogans, ";")
+ if(product_slogans)
+ slogan_list += splittext(product_slogans, ";")
- // So not all machines speak at the exact same time.
- // The first time this machine says something will be at slogantime + this random value,
- // so if slogantime is 10 minutes, it will say it at somewhere between 10 and 20 minutes after the machine is crated.
- last_slogan = world.time + rand(0, slogan_delay)
+ // So not all machines speak at the exact same time.
+ // The first time this machine says something will be at slogantime + this random value,
+ // so if slogantime is 10 minutes, it will say it at somewhere between 10 and 20 minutes after the machine is crated.
+ last_slogan = world.time + rand(0, slogan_delay)
- if(product_ads)
- ads_list += splittext(product_ads, ";")
+ if(product_ads)
+ ads_list += splittext(product_ads, ";")
- build_inventory()
- power_change()
+ build_inventory()
+ power_change()
/**
* Build produdct_records from the products lists
diff --git a/code/game/objects/effects/chem/foam.dm b/code/game/objects/effects/chem/foam.dm
index f51dc9e4b1..5a461e1525 100644
--- a/code/game/objects/effects/chem/foam.dm
+++ b/code/game/objects/effects/chem/foam.dm
@@ -15,25 +15,30 @@
var/expand = 1
var/metal = 0
-/obj/effect/effect/foam/New(var/loc, var/ismetal = 0)
- ..(loc)
+/obj/effect/effect/foam/Initialize(var/mapload, var/ismetal = 0)
+ . = ..()
icon_state = "[ismetal? "m" : ""]foam"
metal = ismetal
playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3)
- spawn(3 + metal * 3)
- process()
- checkReagents()
- spawn(120)
- STOP_PROCESSING(SSobj, src)
- sleep(30)
- if(metal)
- var/obj/structure/foamedmetal/M = new(src.loc)
- M.metal = metal
- M.updateicon()
- flick("[icon_state]-disolve", src)
- sleep(5)
- qdel(src)
- return
+
+ addtimer(CALLBACK(src, .proc/post_spread), 3 + metal * 3)
+ addtimer(CALLBACK(src, .proc/pre_harden), 12 SECONDS)
+ addtimer(CALLBACK(src, .proc/harden), 15 SECONDS)
+
+/obj/effect/effect/foam/proc/post_spread()
+ process()
+ checkReagents()
+
+/obj/effect/effect/foam/proc/pre_harden()
+ STOP_PROCESSING(SSobj, src)
+
+/obj/effect/effect/foam/proc/harden()
+ if(metal)
+ var/obj/structure/foamedmetal/M = new(src.loc)
+ M.metal = metal
+ M.updateicon()
+ flick("[icon_state]-disolve", src)
+ QDEL_IN(src, 5)
/obj/effect/effect/foam/proc/checkReagents() // transfer any reagents to the floor
if(!metal && reagents)
diff --git a/code/game/objects/effects/chem/water.dm b/code/game/objects/effects/chem/water.dm
index ee1c75980c..7de9b9f8ff 100644
--- a/code/game/objects/effects/chem/water.dm
+++ b/code/game/objects/effects/chem/water.dm
@@ -5,11 +5,9 @@
mouse_opacity = 0
pass_flags = PASSTABLE | PASSGRILLE | PASSBLOB
-/obj/effect/effect/water/New(loc)
- ..()
- spawn(150) // In case whatever made it forgets to delete it
- if(src)
- qdel(src)
+/obj/effect/effect/water/Initialize()
+ . = ..()
+ QDEL_IN(src, 15 SECONDS)
/obj/effect/effect/water/proc/set_color() // Call it after you move reagents to it
icon += reagents.get_color()
diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm
index 1d740abb68..fba219e924 100644
--- a/code/game/objects/effects/decals/Cleanable/humans.dm
+++ b/code/game/objects/effects/decals/Cleanable/humans.dm
@@ -20,7 +20,6 @@ var/global/list/image/splatter_cache=list()
var/synthblood = 0
var/list/datum/disease2/disease/virus2 = list()
var/amount = 5
- var/drytime
/obj/effect/decal/cleanable/blood/reveal_blood()
if(!fluorescent)
@@ -33,13 +32,8 @@ var/global/list/image/splatter_cache=list()
if(invisibility != 100)
invisibility = 100
amount = 0
- STOP_PROCESSING(SSobj, src)
..(ignore=1)
-/obj/effect/decal/cleanable/blood/Destroy()
- STOP_PROCESSING(SSobj, src)
- return ..()
-
/obj/effect/decal/cleanable/blood/New()
..()
update_icon()
@@ -52,12 +46,7 @@ var/global/list/image/splatter_cache=list()
if (B.blood_DNA)
blood_DNA |= B.blood_DNA.Copy()
qdel(B)
- drytime = world.time + DRYING_TIME * (amount+1)
- START_PROCESSING(SSobj, src)
-
-/obj/effect/decal/cleanable/blood/process()
- if(world.time > drytime)
- dry()
+ addtimer(CALLBACK(src, .proc/dry), DRYING_TIME * (amount+1))
/obj/effect/decal/cleanable/blood/update_icon()
if(basecolor == "rainbow") basecolor = "#[get_random_colour(1)]"
@@ -116,7 +105,6 @@ var/global/list/image/splatter_cache=list()
desc = drydesc
color = adjust_brightness(color, -50)
amount = 0
- STOP_PROCESSING(SSobj, src)
/obj/effect/decal/cleanable/blood/attack_hand(mob/living/carbon/human/user)
..()
@@ -241,14 +229,18 @@ var/global/list/image/splatter_cache=list()
random_icon_states = list("mucus")
var/list/datum/disease2/disease/virus2 = list()
- var/dry=0 // Keeps the lag down
+ var/dry = 0 // Keeps the lag down
-/obj/effect/decal/cleanable/mucus/New()
- spawn(DRYING_TIME * 2)
- dry=1
+/obj/effect/decal/cleanable/mucus/Initialize()
+ . = ..()
+ VARSET_IN(src, dry, TRUE, DRYING_TIME * 2)
//This version should be used for admin spawns and pre-mapped virus vectors (e.g. in PoIs), this version does not dry
-/obj/effect/decal/cleanable/mucus/mapped/New()
- ..()
+/obj/effect/decal/cleanable/mucus/mapped/Initialize()
+ . = ..()
virus2 |= new /datum/disease2/disease
virus2[1].makerandom()
+
+/obj/effect/decal/cleanable/mucus/mapped/Destroy()
+ virus2.Cut()
+ return ..()
diff --git a/code/game/objects/effects/map_effects/beam_point.dm b/code/game/objects/effects/map_effects/beam_point.dm
index 524686874c..c10e8b0315 100644
--- a/code/game/objects/effects/map_effects/beam_point.dm
+++ b/code/game/objects/effects/map_effects/beam_point.dm
@@ -36,8 +36,7 @@ GLOBAL_LIST_EMPTY(all_beam_points)
if(make_beams_on_init)
create_beams()
if(use_timer)
- spawn(initial_delay)
- handle_beam_timer()
+ addtimer(CALLBACK(src, .proc/handle_beam_timer), initial_delay)
return ..()
/obj/effect/map_effect/beam_point/Destroy()
diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm
index 5fca6fbecf..98f10d6040 100644
--- a/code/game/objects/effects/misc.dm
+++ b/code/game/objects/effects/misc.dm
@@ -14,11 +14,10 @@
invisibility = 0
var/time_to_die = 10 SECONDS // Afer which, it will delete itself.
-/obj/effect/temporary_effect/New()
- ..()
+/obj/effect/temporary_effect/Initialize()
+ . = ..()
if(time_to_die)
- spawn(time_to_die)
- qdel(src)
+ QDEL_IN(src, time_to_die)
// Shown really briefly when attacking with axes.
/obj/effect/temporary_effect/cleave_attack
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index 514385b774..c549a7e3d1 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -38,12 +38,9 @@ GLOBAL_LIST_BOILERPLATE(all_portals, /obj/effect/portal)
return
return
-/obj/effect/portal/New()
- ..() // Necessary for the list boilerplate to work
- spawn(300)
- qdel(src)
- return
- return
+/obj/effect/portal/Initialize()
+ . = ..()
+ QDEL_IN(src, 30 SECONDS)
/obj/effect/portal/proc/teleport(atom/movable/M as mob|obj)
if(istype(M, /obj/effect)) //sparks don't teleport
diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm
index f34ca86c27..fae2d4586f 100644
--- a/code/game/objects/items/devices/communicator/communicator.dm
+++ b/code/game/objects/items/devices/communicator/communicator.dm
@@ -78,8 +78,8 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
// Parameters: None
// Description: Adds the new communicator to the global list of all communicators, sorts the list, obtains a reference to the Exonet node, then tries to
// assign the device to the holder's name automatically in a spectacularly shitty way.
-/obj/item/device/communicator/New()
- ..()
+/obj/item/device/communicator/Initialize()
+ . = ..()
all_communicators += src
all_communicators = sortAtom(all_communicators)
node = get_exonet_node()
@@ -87,16 +87,22 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
camera = new(src)
camera.name = "[src] #[rand(100,999)]"
camera.c_tag = camera.name
+
//This is a pretty terrible way of doing this.
- spawn(5 SECONDS) //Wait for our mob to finish spawning.
- if(ismob(loc))
- register_device(loc.name)
- initialize_exonet(loc)
- else if(istype(loc, /obj/item/weapon/storage))
- var/obj/item/weapon/storage/S = loc
- if(ismob(S.loc))
- register_device(S.loc.name)
- initialize_exonet(S.loc)
+ addtimer(CALLBACK(src, .proc/register_to_holder), 5 SECONDS)
+
+// Proc: register_to_holder()
+// Parameters: None
+// Description: Tries to register ourselves to the mob that we've presumably spawned in. Not the most amazing way of doing this.
+/obj/item/device/communicator/proc/register_to_holder()
+ if(ismob(loc))
+ register_device(loc.name)
+ initialize_exonet(loc)
+ else if(istype(loc, /obj/item/weapon/storage))
+ var/obj/item/weapon/storage/S = loc
+ if(ismob(S.loc))
+ register_device(S.loc.name)
+ initialize_exonet(S.loc)
// Proc: examine()
// Parameters: user - the user doing the examining
@@ -275,14 +281,13 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
// Proc: New()
// Parameters: None
// Description: Gives ghosts an exonet address based on their key and ghost name.
-/mob/observer/dead/New()
+/mob/observer/dead/Initialize()
. = ..()
- spawn(20)
- exonet = new(src)
- if(client)
- exonet.make_address("communicator-[src.client]-[src.client.prefs.real_name]")
- else
- exonet.make_address("communicator-[key]-[src.real_name]")
+ exonet = new(src)
+ if(client)
+ exonet.make_address("communicator-[src.client]-[src.client.prefs.real_name]")
+ else
+ exonet.make_address("communicator-[key]-[src.real_name]")
// Proc: Destroy()
// Parameters: None
diff --git a/code/game/objects/items/devices/uplink.dm b/code/game/objects/items/devices/uplink.dm
index ea7006a73b..8fc70a14e6 100644
--- a/code/game/objects/items/devices/uplink.dm
+++ b/code/game/objects/items/devices/uplink.dm
@@ -1,3 +1,5 @@
+GLOBAL_LIST_BOILERPLATE(world_uplinks, /obj/item/device/uplink)
+
/obj/item/device/uplink
var/welcome = "Welcome, Operative" // Welcoming menu message
var/uses // Numbers of crystals
@@ -12,32 +14,29 @@
var/datum/mind/uplink_owner = null
var/used_TC = 0
var/offer_time = 10 MINUTES //The time increment per discount offered
- var/next_offer_time //The time a discount will next be offered
+ var/next_offer_time
var/datum/uplink_item/discount_item //The item to be discounted
var/discount_amount //The amount as a percent the item will be discounted by
/obj/item/device/uplink/nano_host()
return loc
-/obj/item/device/uplink/New(var/location, var/datum/mind/owner = null, var/telecrystals = DEFAULT_TELECRYSTAL_AMOUNT)
- ..()
- src.uplink_owner = owner
+/obj/item/device/uplink/Initialize(var/mapload, var/datum/mind/owner = null, var/telecrystals = DEFAULT_TELECRYSTAL_AMOUNT)
+ . = ..()
+ uplink_owner = owner
purchase_log = list()
- world_uplinks += src
if(owner)
uses = owner.tcrystals
else
uses = telecrystals
- START_PROCESSING(SSobj, src)
-
-/obj/item/device/uplink/Destroy()
- world_uplinks -= src
- STOP_PROCESSING(SSobj, src)
- return ..()
+ addtimer(CALLBACK(src, .proc/next_offer), offer_time) //It seems like only the /hidden type actually makes use of this...
/obj/item/device/uplink/get_item_cost(var/item_type, var/item_cost)
return (discount_item && (item_type == discount_item)) ? max(1, round(item_cost*discount_amount)) : item_cost
+/obj/item/device/uplink/proc/next_offer()
+ return //Stub, used on children.
+
// HIDDEN UPLINK - Can be stored in anything but the host item has to have a trigger for it.
/* How to create an uplink in 3 easy steps!
@@ -58,21 +57,20 @@
var/exploit_id // Id of the current exploit record we are viewing
// The hidden uplink MUST be inside an obj/item's contents.
-/obj/item/device/uplink/hidden/New()
- spawn(2)
- if(!istype(src.loc, /obj/item))
- qdel(src)
- ..()
+/obj/item/device/uplink/hidden/Initialize()
+ . = ..()
+ if(!isitem(loc))
+ return INITIALIZE_HINT_QDEL
nanoui_data = list()
update_nano_data()
-/obj/item/device/uplink/hidden/process()
- if(world.time > next_offer_time)
- discount_item = default_uplink_selection.get_random_item(INFINITY)
- discount_amount = pick(90;0.9, 80;0.8, 70;0.7, 60;0.6, 50;0.5, 40;0.4, 30;0.3, 20;0.2, 10;0.1)
- next_offer_time = world.time + offer_time
- update_nano_data()
- SSnanoui.update_uis(src)
+/obj/item/device/uplink/hidden/next_offer()
+ discount_item = default_uplink_selection.get_random_item(INFINITY)
+ discount_amount = pick(90;0.9, 80;0.8, 70;0.7, 60;0.6, 50;0.5, 40;0.4, 30;0.3, 20;0.2, 10;0.1)
+ update_nano_data()
+ SSnanoui.update_uis(src)
+ next_offer_time = world.time + offer_time
+ addtimer(CALLBACK(src, .proc/next_offer), offer_time)
// Toggles the uplink on and off. Normally this will bypass the item's normal functions and go to the uplink menu, if activated.
/obj/item/device/uplink/hidden/proc/toggle()
diff --git a/code/game/objects/items/stacks/fifty_spawner.dm b/code/game/objects/items/stacks/fifty_spawner.dm
index 0be33e5829..6cd9051c6f 100644
--- a/code/game/objects/items/stacks/fifty_spawner.dm
+++ b/code/game/objects/items/stacks/fifty_spawner.dm
@@ -4,21 +4,15 @@
desc = "This item spawns stack of 50 of a given material."
icon = 'icons/misc/mark.dmi'
icon_state = "x4"
-// var/material = ""
var/obj/item/stack/type_to_spawn = null
-/obj/fiftyspawner/New()
- spawn()
- //spawns the 50-stack and qdels self
- ..()
- if(istype(src.loc, /obj/structure/loot_pile)) //Spawning from a lootpile is weird, need to wait until we're out of it to do our work.
- while(istype(src.loc, /obj/structure/loot_pile))
- sleep(1)
- // var/obj_path = text2path("/obj/item/stack/[material]")
- var/obj/item/stack/M = new type_to_spawn(src.loc)
- M.amount = M.max_amount //some stuff spawns with 60, we're still calling it fifty
- M.update_icon() // Some stacks have different sprites depending on how full they are.
- qdel(src)
+/obj/fiftyspawner/Initialize()
+ ..() //We're not returning . because we're going to ask to be deleted.
+
+ var/obj/item/stack/M = new type_to_spawn(get_turf(src))
+ M.amount = M.max_amount //some stuff spawns with 60, we're still calling it fifty
+ M.update_icon() // Some stacks have different sprites depending on how full they are.
+ return INITIALIZE_HINT_QDEL //Bye!
/obj/fiftyspawner/rods
name = "stack of rods" //this needs to be defined for cargo
diff --git a/code/game/objects/structures/crates_lockers/largecrate.dm b/code/game/objects/structures/crates_lockers/largecrate.dm
index 79bd5e2949..29f1b231aa 100644
--- a/code/game/objects/structures/crates_lockers/largecrate.dm
+++ b/code/game/objects/structures/crates_lockers/largecrate.dm
@@ -64,10 +64,9 @@
icon_state = "vehiclecrate"
/obj/structure/largecrate/vehicle/Initialize()
- ..()
- spawn(1)
- for(var/obj/O in contents)
- O.update_icon()
+ . = ..()
+ for(var/obj/O in contents)
+ O.update_icon()
/obj/structure/largecrate/vehicle/bike
name = "spacebike crate"
diff --git a/code/game/objects/structures/ghost_pods/ghost_pods.dm b/code/game/objects/structures/ghost_pods/ghost_pods.dm
index 7413b4b9d4..12cfe24dc2 100644
--- a/code/game/objects/structures/ghost_pods/ghost_pods.dm
+++ b/code/game/objects/structures/ghost_pods/ghost_pods.dm
@@ -65,18 +65,13 @@
/obj/structure/ghost_pod/automatic/Initialize()
. = ..()
- spawn(delay_to_self_open)
- if(src)
- trigger()
+ addtimer(CALLBACK(src, .proc/trigger), delay_to_self_open)
/obj/structure/ghost_pod/automatic/trigger()
. = ..()
if(. == FALSE) // If we failed to get a volunteer, try again later if allowed to.
if(delay_to_try_again)
- spawn(delay_to_try_again)
- if(src)
- trigger()
-
+ addtimer(CALLBACK(src, .proc/trigger), delay_to_try_again)
// This type is triggered by a ghost clicking on it, as opposed to a living player. A ghost query type isn't needed.
/obj/structure/ghost_pod/ghost_activated
diff --git a/code/game/objects/structures/props/beam_prism.dm b/code/game/objects/structures/props/beam_prism.dm
index f5c4c3d3c0..b0122ace47 100644
--- a/code/game/objects/structures/props/beam_prism.dm
+++ b/code/game/objects/structures/props/beam_prism.dm
@@ -197,16 +197,18 @@
P.rotate_auto(new_bearing)
/obj/structure/prop/prismcontrol/Initialize()
- ..()
+ . = ..()
if(my_turrets.len) //Preset controls.
for(var/obj/structure/prop/prism/P in my_turrets)
P.remote_dial = src
- return
- spawn()
- for(var/obj/structure/prop/prism/P in orange(src, world.view)) //Don't search a huge area.
- if(P.dialID == dialID && !P.remote_dial && P.external_control_lock)
- my_turrets |= P
- P.remote_dial = src
+ else
+ . = INITIALIZE_HINT_LATELOAD
+
+/obj/structure/prop/prismcontrol/LateInitialize()
+ for(var/obj/structure/prop/prism/P in orange(src, world.view)) //Don't search a huge area.
+ if(P.dialID == dialID && !P.remote_dial && P.external_control_lock)
+ my_turrets |= P
+ P.remote_dial = src
/obj/structure/prop/prismcontrol/Destroy()
for(var/obj/structure/prop/prism/P in my_turrets)
diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm
index 0c03d4fb5d..5be1d6d198 100644
--- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm
+++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm
@@ -9,11 +9,9 @@
buckle_lying = 0 //force people to sit up in chairs when buckled
var/propelled = 0 // Check for fire-extinguisher-driven chairs
-/obj/structure/bed/chair/New()
- ..() //Todo make metal/stone chairs display as thrones
- spawn(3) //sorry. i don't think there's a better way to do this.
- update_layer()
- return
+/obj/structure/bed/chair/Initialize()
+ . = ..()
+ update_layer()
/obj/structure/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm
index 5c93a5c6dd..3d45fb4e62 100644
--- a/code/modules/assembly/signaler.dm
+++ b/code/modules/assembly/signaler.dm
@@ -17,12 +17,9 @@
var/datum/radio_frequency/radio_connection
var/deadman = FALSE
-/obj/item/device/assembly/signaler/New()
- ..()
- spawn(40)
- set_frequency(frequency)
- return
-
+/obj/item/device/assembly/signaler/Initialize()
+ . = ..()
+ set_frequency(frequency)
/obj/item/device/assembly/signaler/activate()
if(!process_cooldown())
diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm
index 1eaa75619f..986ec2766e 100644
--- a/code/modules/economy/EFTPOS.dm
+++ b/code/modules/economy/EFTPOS.dm
@@ -12,56 +12,45 @@
var/access_code = 0
var/datum/money_account/linked_account
-/obj/item/device/eftpos/New()
- ..()
- machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]"
- access_code = rand(1111,111111)
- spawn(0)
- print_reference()
-
- //create a short manual as well
- var/obj/item/weapon/paper/R = new(src.loc)
- R.name = "Steps to success: Correct EFTPOS Usage"
- /*
- R.info += "When first setting up your EFTPOS device:"
- R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
"
- R.info += "2. Confirm that your EFTPOS device is connected to your local accounts database. For additional assistance with this step, contact NanoTrasen IT Support
"
- R.info += "3. Confirm that your EFTPOS device has been linked to the account that you wish to recieve funds for all transactions processed on this device.
"
- R.info += "When starting a new transaction with your EFTPOS device:"
- R.info += "1. Ensure the device is UNLOCKED so that new data may be entered.
"
- R.info += "2. Enter a sum of money and reference message for the new transaction.
"
- R.info += "3. Lock the transaction, it is now ready for your customer.
"
- R.info += "4. If at this stage you wish to modify or cancel your transaction, you may simply reset (unlock) your EFTPOS device.
"
- R.info += "5. Give your EFTPOS device to the customer, they must authenticate the transaction by swiping their ID card and entering their PIN number.
"
- R.info += "6. If done correctly, the transaction will be logged to both accounts with the reference you have entered, the terminal ID of your EFTPOS device and the money transferred across accounts.
"
- */
- //Temptative new manual:
- R.info += "First EFTPOS setup:
"
- R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
"
- R.info += "2. Connect the EFTPOS to the account in which you want to receive the funds.
"
- R.info += "When starting a new transaction:
"
- R.info += "1. Enter the amount of money you want to charge and a purpose message for the new transaction.
"
- R.info += "2. Lock the new transaction. If you want to modify or cancel the transaction, you simply have to reset your EFTPOS device.
"
- R.info += "3. Give the EFTPOS device to your customer, he/she must finish the transaction by swiping their ID card or a charge card with enough funds.
"
- R.info += "4. If everything is done correctly, the money will be transferred. To unlock the device you will have to reset the EFTPOS device.
"
-
-
- //stamp the paper
- var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
- stampoverlay.icon_state = "paper_stamp-cent"
- if(!R.stamped)
- R.stamped = new
- R.offset_x += 0
- R.offset_y += 0
- R.ico += "paper_stamp-cent"
- R.stamped += /obj/item/weapon/stamp
- R.overlays += stampoverlay
- R.stamps += "
This paper has been stamped by the EFTPOS device."
-
+/obj/item/device/eftpos/Initialize()
+ . = ..()
//by default, connect to the station account
//the user of the EFTPOS device can change the target account though, and no-one will be the wiser (except whoever's being charged)
linked_account = station_account
+ machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]"
+ access_code = rand(1111,111111)
+ print_reference()
+
+ //create a short manual as well
+ var/obj/item/weapon/paper/R = new(src.loc)
+ R.name = "Steps to success: Correct EFTPOS Usage"
+ //Temptative new manual:
+ R.info += "First EFTPOS setup:
"
+ R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
"
+ R.info += "2. Connect the EFTPOS to the account in which you want to receive the funds.
"
+ R.info += "When starting a new transaction:
"
+ R.info += "1. Enter the amount of money you want to charge and a purpose message for the new transaction.
"
+ R.info += "2. Lock the new transaction. If you want to modify or cancel the transaction, you simply have to reset your EFTPOS device.
"
+ R.info += "3. Give the EFTPOS device to your customer, he/she must finish the transaction by swiping their ID card or a charge card with enough funds.
"
+ R.info += "4. If everything is done correctly, the money will be transferred. To unlock the device you will have to reset the EFTPOS device.
"
+
+ //stamp the paper
+ var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
+ stampoverlay.icon_state = "paper_stamp-cent"
+ if(!R.stamped)
+ R.stamped = new
+ R.offset_x += 0
+ R.offset_y += 0
+ R.ico += "paper_stamp-cent"
+ R.stamped += /obj/item/weapon/stamp
+ R.overlays += stampoverlay
+ R.stamps += "
This paper has been stamped by the EFTPOS device."
+
+/obj/item/device/eftpos/Destroy()
+ linked_account = null
+ return ..()
+
/obj/item/device/eftpos/proc/print_reference()
var/obj/item/weapon/paper/R = new(src.loc)
R.name = "Reference: [eftpos_name]"
diff --git a/code/modules/food/food/snacks.dm b/code/modules/food/food/snacks.dm
index 7d93e3ba2e..395e4fe372 100644
--- a/code/modules/food/food/snacks.dm
+++ b/code/modules/food/food/snacks.dm
@@ -4338,11 +4338,10 @@
icon_state = "bagelplain"
/obj/item/weapon/reagent_containers/food/snacks/bageltwo/Initialize()
- . = ..()
+ ..() //Not returning . because asking to be qdel'd below.
spawn_bagels()
spawn_bagels()
- sleep(30)
- qdel(src)
+ return INITIALIZE_HINT_QDEL
/obj/item/weapon/reagent_containers/food/snacks/bageltwo/proc/spawn_bagels()
var/build_path = /obj/item/weapon/reagent_containers/food/snacks/bagelplain
diff --git a/code/modules/food/kitchen/gibber.dm b/code/modules/food/kitchen/gibber.dm
index a325356005..e44c484c54 100644
--- a/code/modules/food/kitchen/gibber.dm
+++ b/code/modules/food/kitchen/gibber.dm
@@ -22,21 +22,27 @@
/obj/machinery/gibber/autogibber
var/turf/input_plate
-/obj/machinery/gibber/autogibber/New()
- ..()
- spawn(5)
- for(var/i in cardinal)
- var/obj/machinery/mineral/input/input_obj = locate( /obj/machinery/mineral/input, get_step(src.loc, i) )
- if(input_obj)
- if(isturf(input_obj.loc))
- input_plate = input_obj.loc
- gib_throw_dir = i
- qdel(input_obj)
- break
+/obj/machinery/gibber/autogibber/Initialize()
+ . = ..()
+ for(var/i in cardinal)
+ var/obj/machinery/mineral/input/input_obj = locate( /obj/machinery/mineral/input, get_step(src.loc, i) )
+ if(input_obj)
+ if(isturf(input_obj.loc))
+ input_plate = input_obj.loc
+ gib_throw_dir = i
+ qdel(input_obj)
+ break
- if(!input_plate)
- log_misc("a [src] didn't find an input plate.")
- return
+ if(!input_plate)
+ log_misc("a [src] didn't find an input plate.")
+
+/obj/machinery/gibber/Destroy()
+ occupant = null
+ return ..()
+
+/obj/machinery/gibber/autogibber/Destroy()
+ input_plate = null
+ return ..()
/obj/machinery/gibber/autogibber/Bumped(var/atom/A)
if(!input_plate) return
diff --git a/code/modules/holomap/station_holomap.dm b/code/modules/holomap/station_holomap.dm
index 4d4e500a8f..39a1c30452 100644
--- a/code/modules/holomap/station_holomap.dm
+++ b/code/modules/holomap/station_holomap.dm
@@ -33,16 +33,15 @@
/obj/machinery/station_map/New()
..()
- holomap_datum = new()
- original_zLevel = loc.z
- SSholomaps.station_holomaps += src
flags |= ON_BORDER // Why? It doesn't help if its not density
/obj/machinery/station_map/Initialize()
. = ..()
+ holomap_datum = new()
+ original_zLevel = loc.z
+ SSholomaps.station_holomaps += src
if(SSholomaps.holomaps_initialized)
- spawn(1) // Tragically we need to spawn this in order to give the frame construcing us time to set pixel_x/y
- setup_holomap()
+ setup_holomap()
/obj/machinery/station_map/Destroy()
SSholomaps.station_holomaps -= src
@@ -64,14 +63,12 @@
holomap_datum.initialize_holomap(T, reinit = TRUE)
small_station_map = image(SSholomaps.extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[original_zLevel]"], dir = dir)
- // small_station_map.plane = LIGHTING_PLANE // Not until we do planes ~Leshana
- // small_station_map.layer = LIGHTING_LAYER+1 // Weird things will happen!
floor_markings = image('icons/obj/machines/stationmap.dmi', "decal_station_map")
floor_markings.dir = src.dir
- // floor_markings.plane = ABOVE_TURF_PLANE // Not until we do planes ~Leshana
- // floor_markings.layer = DECAL_LAYER
- update_icon()
+
+ spawn(1) //When built from frames, need to allow time for it to set pixel_x and pixel_y
+ update_icon()
/obj/machinery/station_map/attack_hand(var/mob/user)
if(watching_mob && (watching_mob != user))
@@ -172,6 +169,9 @@
update_icon()
/obj/machinery/station_map/update_icon()
+ if(!holomap_datum)
+ return //Not yet.
+
overlays.Cut()
if(stat & BROKEN)
icon_state = "station_mapb"
diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm
index 2058fc9e68..982f44e794 100644
--- a/code/modules/hydroponics/grown.dm
+++ b/code/modules/hydroponics/grown.dm
@@ -13,46 +13,37 @@
var/datum/seed/seed
var/potency = -1
-/obj/item/weapon/reagent_containers/food/snacks/grown/Initialize(newloc,planttype)
- ..()
+/obj/item/weapon/reagent_containers/food/snacks/grown/Initialize(var/mapload, var/planttype)
+ . = ..()
+
if(!dried_type)
dried_type = type
- src.pixel_x = rand(-5.0, 5)
- src.pixel_y = rand(-5.0, 5)
+
+ pixel_x = rand(-5.0, 5)
+ pixel_y = rand(-5.0, 5)
- // Fill the object up with the appropriate reagents.
if(planttype)
plantname = planttype
-/obj/item/weapon/reagent_containers/food/snacks/grown/Initialize()
- ..()
- spawn()
- if(!plantname)
- return
+ if(!plantname)
+ log_debug("Plantname not provided and and [src] requires it at [x],[y],[z]")
+ return INITIALIZE_HINT_QDEL
- if(!plant_controller)
- sleep(250) // ugly hack, should mean roundstart plants are fine.
- if(!plant_controller)
- to_world("Plant controller does not exist and [src] requires it. Aborting.")
- qdel(src)
- return
+ seed = plant_controller.seeds[plantname]
- seed = plant_controller.seeds[plantname]
+ if(!seed)
+ log_debug("Plant name '[plantname]' does not exist and [src] requires it at [x],[y],[z]")
+ return INITIALIZE_HINT_QDEL
- if(!seed)
- return
+ name = "[seed.seed_name]"
+ trash = seed.get_trash_type()
- name = "[seed.seed_name]"
- trash = seed.get_trash_type()
+ update_icon()
- update_icon()
-
- if(!seed.chems)
- return
-
- potency = seed.get_trait(TRAIT_POTENCY)
+ potency = seed.get_trait(TRAIT_POTENCY)
+ if(seed.chems)
for(var/rid in seed.chems)
var/list/reagent_data = seed.chems[rid]
if(reagent_data && reagent_data.len)
diff --git a/code/modules/integrated_electronics/core/tools.dm b/code/modules/integrated_electronics/core/tools.dm
index 23e8e3f24b..79533bfe25 100644
--- a/code/modules/integrated_electronics/core/tools.dm
+++ b/code/modules/integrated_electronics/core/tools.dm
@@ -276,60 +276,54 @@
)
cant_hold = list(/obj/item/weapon/tool/screwdriver/power)
-/obj/item/weapon/storage/bag/circuits/basic/New()
- ..()
- spawn(2 SECONDS) // So the list has time to initialize.
-// for(var/obj/item/integrated_circuit/IC in all_integrated_circuits)
-// if(IC.spawn_flags & IC_SPAWN_DEFAULT)
-// for(var/i = 1 to 4)
-// new IC.type(src)
- new /obj/item/weapon/storage/bag/circuits/mini/arithmetic(src)
- new /obj/item/weapon/storage/bag/circuits/mini/trig(src)
- new /obj/item/weapon/storage/bag/circuits/mini/input(src)
- new /obj/item/weapon/storage/bag/circuits/mini/output(src)
- new /obj/item/weapon/storage/bag/circuits/mini/memory(src)
- new /obj/item/weapon/storage/bag/circuits/mini/logic(src)
- new /obj/item/weapon/storage/bag/circuits/mini/time(src)
- new /obj/item/weapon/storage/bag/circuits/mini/reagents(src)
- new /obj/item/weapon/storage/bag/circuits/mini/transfer(src)
- new /obj/item/weapon/storage/bag/circuits/mini/converter(src)
- new /obj/item/weapon/storage/bag/circuits/mini/power(src)
+/obj/item/weapon/storage/bag/circuits/basic/Initialize()
+ . = ..()
+ new /obj/item/weapon/storage/bag/circuits/mini/arithmetic(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/trig(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/input(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/output(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/memory(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/logic(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/time(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/reagents(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/transfer(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/converter(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/power(src)
- new /obj/item/device/electronic_assembly(src)
- new /obj/item/device/assembly/electronic_assembly(src)
- new /obj/item/device/assembly/electronic_assembly(src)
- new /obj/item/device/multitool(src)
- new /obj/item/weapon/tool/screwdriver(src)
- new /obj/item/weapon/tool/crowbar(src)
- make_exact_fit()
+ new /obj/item/device/electronic_assembly(src)
+ new /obj/item/device/assembly/electronic_assembly(src)
+ new /obj/item/device/assembly/electronic_assembly(src)
+ new /obj/item/device/multitool(src)
+ new /obj/item/weapon/tool/screwdriver(src)
+ new /obj/item/weapon/tool/crowbar(src)
+ make_exact_fit()
-/obj/item/weapon/storage/bag/circuits/all/New()
- ..()
- spawn(2 SECONDS) // So the list has time to initialize.
- new /obj/item/weapon/storage/bag/circuits/mini/arithmetic/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/trig/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/input/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/output/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/memory/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/logic/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/smart/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/manipulation/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/time/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/reagents/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/transfer/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/converter/all(src)
- new /obj/item/weapon/storage/bag/circuits/mini/power/all(src)
+/obj/item/weapon/storage/bag/circuits/all/Initialize()
+ . = ..()
+ new /obj/item/weapon/storage/bag/circuits/mini/arithmetic/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/trig/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/input/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/output/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/memory/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/logic/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/smart/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/manipulation/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/time/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/reagents/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/transfer/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/converter/all(src)
+ new /obj/item/weapon/storage/bag/circuits/mini/power/all(src)
- new /obj/item/device/electronic_assembly(src)
- new /obj/item/device/electronic_assembly/medium(src)
- new /obj/item/device/electronic_assembly/large(src)
- new /obj/item/device/electronic_assembly/drone(src)
- new /obj/item/device/integrated_electronics/wirer(src)
- new /obj/item/device/integrated_electronics/debugger(src)
- new /obj/item/weapon/tool/crowbar(src)
- make_exact_fit()
+ new /obj/item/device/electronic_assembly(src)
+ new /obj/item/device/electronic_assembly/medium(src)
+ new /obj/item/device/electronic_assembly/large(src)
+ new /obj/item/device/electronic_assembly/drone(src)
+ new /obj/item/device/integrated_electronics/wirer(src)
+ new /obj/item/device/integrated_electronics/debugger(src)
+ new /obj/item/weapon/tool/crowbar(src)
+ make_exact_fit()
-/obj/item/weapon/storage/bag/circuits/mini/
+/obj/item/weapon/storage/bag/circuits/mini
name = "circuit box"
desc = "Used to partition categories of circuits, for a neater workspace."
w_class = 2
diff --git a/code/modules/mining/machine_unloading.dm b/code/modules/mining/machine_unloading.dm
index d54aa01761..613190ef64 100644
--- a/code/modules/mining/machine_unloading.dm
+++ b/code/modules/mining/machine_unloading.dm
@@ -11,17 +11,16 @@
var/obj/machinery/mineral/output = null
-/obj/machinery/mineral/unloading_machine/New()
- ..()
- spawn( 5 )
- for (var/dir in cardinal)
- src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
- if(src.input) break
- for (var/dir in cardinal)
- src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
- if(src.output) break
- return
- return
+/obj/machinery/mineral/unloading_machine/Initialize()
+ . = ..()
+ for(var/dir in cardinal)
+ input = locate(/obj/machinery/mineral/input, get_step(src, dir))
+ if(input)
+ break
+ for(var/dir in cardinal)
+ output = locate(/obj/machinery/mineral/output, get_step(src, dir))
+ if(output)
+ break
/obj/machinery/mineral/unloading_machine/process()
if (src.output && src.input)
diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm
index 3172496414..e3e72693fe 100644
--- a/code/modules/mining/mint.dm
+++ b/code/modules/mining/mint.dm
@@ -1,6 +1,4 @@
/**********************Mint**************************/
-
-
/obj/machinery/mineral/mint
name = "Coin press"
icon = 'icons/obj/stationobjs.dmi'
@@ -21,43 +19,43 @@
var/coinsToProduce = 10
-/obj/machinery/mineral/mint/New()
- ..()
- spawn( 5 )
- for (var/dir in cardinal)
- src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
- if(src.input) break
- for (var/dir in cardinal)
- src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
- if(src.output) break
- START_PROCESSING(SSobj, src)
- return
- return
-
+/obj/machinery/mineral/mint/Initialize()
+ . = ..()
+ for (var/dir in cardinal)
+ input = locate(/obj/machinery/mineral/input, get_step(src, dir))
+ if(input)
+ break
+ for (var/dir in cardinal)
+ output = locate(/obj/machinery/mineral/output, get_step(src, dir))
+ if(output)
+ break
/obj/machinery/mineral/mint/process()
- if ( src.input)
- var/obj/item/stack/O
- O = locate(/obj/item/stack, input.loc)
- if(O)
- var/processed = 1
- switch(O.get_material_name())
- if("gold")
- amt_gold += 100 * O.get_amount()
- if("silver")
- amt_silver += 100 * O.get_amount()
- if("diamond")
- amt_diamond += 100 * O.get_amount()
- if("phoron")
- amt_phoron += 100 * O.get_amount()
- if("uranium")
- amt_uranium += 100 * O.get_amount()
- if(DEFAULT_WALL_MATERIAL)
- amt_iron += 100 * O.get_amount()
- else
- processed = 0
- if(processed)
- qdel(O)
+ if(!input)
+ return
+
+ var/obj/item/stack/O = locate(/obj/item/stack, input.loc)
+ if(!O)
+ return
+
+ var/processed = 1
+ switch(O.get_material_name())
+ if("gold")
+ amt_gold += 100 * O.get_amount()
+ if("silver")
+ amt_silver += 100 * O.get_amount()
+ if("diamond")
+ amt_diamond += 100 * O.get_amount()
+ if("phoron")
+ amt_phoron += 100 * O.get_amount()
+ if("uranium")
+ amt_uranium += 100 * O.get_amount()
+ if(DEFAULT_WALL_MATERIAL)
+ amt_iron += 100 * O.get_amount()
+ else
+ processed = 0
+ if(processed)
+ qdel(O)
/obj/machinery/mineral/mint/attack_hand(user as mob)
diff --git a/code/modules/mining/resonator.dm b/code/modules/mining/resonator.dm
index bfbd29b830..dbee1668b2 100644
--- a/code/modules/mining/resonator.dm
+++ b/code/modules/mining/resonator.dm
@@ -63,9 +63,7 @@
transform = matrix()*0.75
animate(src, transform = matrix()*1.5, time = timetoburst)
// Queue the actual bursting
- spawn(timetoburst)
- if(!QDELETED(src))
- burst(creator)
+ addtimer(CALLBACK(src, ./proc/burst, creator), timetoburst)
/obj/effect/resonance/proc/burst(var/creator = null)
var/turf/T = get_turf(src)
diff --git a/code/modules/mob/freelook/ai/eye.dm b/code/modules/mob/freelook/ai/eye.dm
index 6325cec1ec..c79417cb86 100644
--- a/code/modules/mob/freelook/ai/eye.dm
+++ b/code/modules/mob/freelook/ai/eye.dm
@@ -41,21 +41,23 @@
client.eye = new_eye
/mob/living/silicon/ai/proc/create_eyeobj(var/newloc)
- if(eyeobj) destroy_eyeobj()
- if(!newloc) newloc = src.loc
+ if(eyeobj)
+ destroy_eyeobj()
+ if(!newloc)
+ newloc = src.loc
eyeobj = new /mob/observer/eye/aiEye(newloc)
eyeobj.owner = src
eyeobj.name = "[src.name] (AI Eye)" // Give it a name
- if(client) client.eye = eyeobj
+ if(client)
+ client.eye = eyeobj
SetName(src.name)
// Intiliaze the eye by assigning it's "ai" variable to us. Then set it's loc to us.
-/mob/living/silicon/ai/New()
- ..()
+/mob/living/silicon/ai/Initialize()
+ . = ..()
create_eyeobj()
- spawn(5)
- if(eyeobj)
- eyeobj.loc = src.loc
+ if(eyeobj)
+ eyeobj.loc = src.loc
/mob/living/silicon/ai/Destroy()
destroy_eyeobj()
diff --git a/code/modules/mob/living/bot/medbot.dm b/code/modules/mob/living/bot/medbot.dm
index 6914e434e6..edb7486fd1 100644
--- a/code/modules/mob/living/bot/medbot.dm
+++ b/code/modules/mob/living/bot/medbot.dm
@@ -394,11 +394,10 @@
var/skin = null //Same as medbot, set to tox or ointment for the respective kits.
w_class = ITEMSIZE_NORMAL
-/obj/item/weapon/firstaid_arm_assembly/New()
- ..()
- spawn(5) // Terrible. TODO: fix
- if(skin)
- overlays += image('icons/obj/aibots.dmi', "kit_skin_[src.skin]")
+/obj/item/weapon/firstaid_arm_assembly/Initialize()
+ . = ..()
+ if(skin)
+ overlays += image('icons/obj/aibots.dmi', "kit_skin_[src.skin]")
/obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
diff --git a/code/modules/mob/living/carbon/metroid/items.dm b/code/modules/mob/living/carbon/metroid/items.dm
index 0f1e664d1c..45c30cb3e3 100644
--- a/code/modules/mob/living/carbon/metroid/items.dm
+++ b/code/modules/mob/living/carbon/metroid/items.dm
@@ -360,8 +360,7 @@
. = ..()
reagents.add_reagent("nutriment", 4)
reagents.add_reagent("slimejelly", 1)
- spawn(rand(1200,1500))//the egg takes a while to "ripen"
- Grow()
+ addtimer(CALLBACK(src, ./proc/Grow), rand(120 SECONDS, 150 SECONDS))
/obj/item/weapon/reagent_containers/food/snacks/egg/slime/proc/Grow()
grown = 1
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index 5e4493d476..91ff81947e 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -27,9 +27,11 @@
/obj/machinery/power/generator/Initialize()
soundloop = new(list(src), FALSE)
desc = initial(desc) + " Rated for [round(max_power/1000)] kW."
- spawn(1)
- reconnect()
- return ..()
+ ..() //Not returned, because...
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/power/generator/LateInitialize()
+ reconnect()
/obj/machinery/power/generator/Destroy()
QDEL_NULL(soundloop)
diff --git a/code/modules/power/generator_type2.dm b/code/modules/power/generator_type2.dm
index 1271287796..a52675b706 100644
--- a/code/modules/power/generator_type2.dm
+++ b/code/modules/power/generator_type2.dm
@@ -13,15 +13,13 @@
var/lastgenlev = -1
-/obj/machinery/power/generator_type2/New()
- ..()
- spawn(5)
- input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, 90))
- input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, -90))
- if(!input1 || !input2)
- stat |= BROKEN
- updateicon()
-
+/obj/machinery/power/generator_type2/Initialize()
+ . = ..()
+ input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, 90))
+ input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,turn(dir, -90))
+ if(!input1 || !input2)
+ stat |= BROKEN
+ updateicon()
/obj/machinery/power/generator_type2/proc/updateicon()
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index ad8af4352c..d71da42e9e 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -24,27 +24,17 @@
var/effectiverange = 25
// Borrows code from cloning computer
-/obj/machinery/computer/gravity_control_computer/New()
- ..()
- spawn(5)
- updatemodules()
- return
- return
-
-/obj/machinery/gravity_generator/New()
- ..()
- spawn(5)
- locatelocalareas()
- return
- return
-
-
+/obj/machinery/computer/gravity_control_computer/Initialize()
+ . = ..()
+ updatemodules()
+/obj/machinery/gravity_generator/Initialize()
+ . = ..()
+ locatelocalareas()
+
/obj/machinery/computer/gravity_control_computer/proc/updatemodules()
src.gravity_generator = findgenerator()
-
-
/obj/machinery/gravity_generator/proc/locatelocalareas()
for(var/area/A in range(src,effectiverange))
if(A.name == "Space")
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index 783a6691b4..a3ee1a2033 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -56,36 +56,32 @@
charge -= smes_amt
return smes_amt / SMESRATE
+/obj/machinery/power/smes/Initialize()
+ . = ..()
+ if(!powernet)
+ connect_to_network()
-/obj/machinery/power/smes/New()
- ..()
- spawn(5)
- if(!powernet)
- connect_to_network()
+ dir_loop:
+ for(var/d in cardinal)
+ var/turf/T = get_step(src, d)
+ for(var/obj/machinery/power/terminal/term in T)
+ if(term && term.dir == turn(d, 180))
+ terminal = term
+ break dir_loop
+ if(!terminal)
+ stat |= BROKEN
+ return
+ terminal.master = src
+ if(!terminal.powernet)
+ terminal.connect_to_network()
+ update_icon()
- dir_loop:
- for(var/d in cardinal)
- var/turf/T = get_step(src, d)
- for(var/obj/machinery/power/terminal/term in T)
- if(term && term.dir == turn(d, 180))
- terminal = term
- break dir_loop
- if(!terminal)
- stat |= BROKEN
- return
- terminal.master = src
- if(!terminal.powernet)
- terminal.connect_to_network()
- update_icon()
-
-
-
-
- if(!should_be_mapped)
- warning("Non-buildable or Non-magical SMES at [src.x]X [src.y]Y [src.z]Z")
-
- return
+ if(!should_be_mapped)
+ warning("Non-buildable or Non-magical SMES at [src.x]X [src.y]Y [src.z]Z")
+/obj/machinery/power/smes/Destroy()
+ terminal = null
+ return ..()
/obj/machinery/power/smes/disconnect_terminal()
if(terminal)
diff --git a/code/modules/random_map/drop/droppod_doors.dm b/code/modules/random_map/drop/droppod_doors.dm
index afabe1335b..7c7075f45f 100644
--- a/code/modules/random_map/drop/droppod_doors.dm
+++ b/code/modules/random_map/drop/droppod_doors.dm
@@ -10,11 +10,10 @@
var/deploying
var/deployed
-/obj/structure/droppod_door/New(var/newloc, var/autoopen)
- ..(newloc)
+/obj/structure/droppod_door/Initialize(var/mapload, var/autoopen)
+ . = ..()
if(autoopen)
- spawn(100)
- deploy()
+ addtimer(CALLBACK(src, .proc/deploy), 10 SECONDS)
/obj/structure/droppod_door/attack_ai(var/mob/user)
if(!user.Adjacent(src))
diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm
index b8aba13939..f3dd0fa384 100644
--- a/code/modules/recycling/disposal.dm
+++ b/code/modules/recycling/disposal.dm
@@ -29,23 +29,24 @@
// create a new disposal
// find the attached trunk (if present) and init gas resvr.
-/obj/machinery/disposal/New()
- ..()
- spawn(5)
- trunk = locate() in src.loc
- if(!trunk)
- mode = 0
- flush = 0
- else
- trunk.linked = src // link the pipe trunk to self
+/obj/machinery/disposal/Initialize()
+ . = ..()
+
+ trunk = locate() in loc
+ if(!trunk)
+ mode = 0
+ flush = 0
+ else
+ trunk.linked = src // link the pipe trunk to self
- air_contents = new/datum/gas_mixture(PRESSURE_TANK_VOLUME)
- update()
+ air_contents = new/datum/gas_mixture(PRESSURE_TANK_VOLUME)
+ update()
/obj/machinery/disposal/Destroy()
eject()
if(trunk)
trunk.linked = null
+ trunk = null
return ..()
// attack by item places it in to disposal
@@ -1308,46 +1309,39 @@
icon_state = "pipe-t"
var/obj/linked // the linked obj/machinery/disposal or obj/disposaloutlet
-/obj/structure/disposalpipe/trunk/New()
- ..()
+/obj/structure/disposalpipe/trunk/Initialize()
+ ..() //Lateload below
dpdir = dir
- spawn(1)
- getlinked()
+ return INITIALIZE_HINT_LATELOAD
+/obj/structure/disposalpipe/trunk/LateInitialize()
+ if(!linked)
+ getlinked()
update()
- return
+
+/obj/structure/disposalpipe/trunk/Destroy()
+ if(linked)
+ if(istype(linked, /obj/machinery/disposal))
+
+ var/obj/machinery/disposal/D = linked
+ D.trunk = null
+ linked = null
+ return ..()
/obj/structure/disposalpipe/trunk/proc/getlinked()
linked = null
- var/obj/machinery/disposal/D = locate() in src.loc
+ var/obj/machinery/disposal/D = locate() in loc
if(D)
linked = D
- if (!D.trunk)
+ if(!D.trunk)
D.trunk = src
- var/obj/structure/disposaloutlet/O = locate() in src.loc
+ var/obj/structure/disposaloutlet/O = locate() in loc
if(O)
linked = O
- update()
- return
-
- // Override attackby so we disallow trunkremoval when somethings ontop
+// Override attackby so we disallow trunkremoval when somethings ontop
/obj/structure/disposalpipe/trunk/attackby(var/obj/item/I, var/mob/user)
-
- //Disposal bins or chutes
- /*
- These shouldn't be required
- var/obj/machinery/disposal/D = locate() in src.loc
- if(D && D.anchored)
- return
-
- //Disposal outlet
- var/obj/structure/disposaloutlet/O = locate() in src.loc
- if(O && O.anchored)
- return
- */
-
//Disposal constructors
var/obj/structure/disposalconstruct/C = locate() in src.loc
if(C && C.anchored)
@@ -1439,72 +1433,70 @@
var/turf/target // this will be where the output objects are 'thrown' to.
var/mode = 0
- New()
- ..()
+/obj/structure/disposaloutlet/Initialize()
+ . = ..()
- spawn(1)
- target = get_ranged_target_turf(src, dir, 10)
+ target = get_ranged_target_turf(src, dir, 10)
- var/obj/structure/disposalpipe/trunk/trunk = locate() in src.loc
- if(trunk)
- trunk.linked = src // link the pipe trunk to self
+ var/obj/structure/disposalpipe/trunk/trunk = locate() in loc
+ if(trunk)
+ trunk.linked = src // link the pipe trunk to self
// expel the contents of the holder object, then delete it
// called when the holder exits the outlet
- proc/expel(var/obj/structure/disposalholder/H)
+/obj/structure/disposaloutlet/proc/expel(var/obj/structure/disposalholder/H)
+ flick("outlet-open", src)
+ playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, 0)
+ sleep(20) //wait until correct animation frame
+ playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
- flick("outlet-open", src)
- playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, 0)
- sleep(20) //wait until correct animation frame
- playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
+ if(H)
+ for(var/atom/movable/AM in H)
+ AM.forceMove(src.loc)
+ AM.pipe_eject(dir)
+ if(!istype(AM,/mob/living/silicon/robot/drone)) //Drones keep smashing windows from being fired out of chutes. Bad for the station. ~Z
+ spawn(5)
+ AM.throw_at(target, 3, 1)
+ H.vent_gas(src.loc)
+ qdel(H)
- if(H)
- for(var/atom/movable/AM in H)
- AM.forceMove(src.loc)
- AM.pipe_eject(dir)
- if(!istype(AM,/mob/living/silicon/robot/drone)) //Drones keep smashing windows from being fired out of chutes. Bad for the station. ~Z
- spawn(5)
- AM.throw_at(target, 3, 1)
- H.vent_gas(src.loc)
- qdel(H)
+ return
+/obj/structure/disposaloutlet/attackby(var/obj/item/I, var/mob/user)
+ if(!I || !user)
return
-
- attackby(var/obj/item/I, var/mob/user)
- if(!I || !user)
+ src.add_fingerprint(user)
+ if(I.is_screwdriver())
+ if(mode==0)
+ mode=1
+ to_chat(user, "You remove the screws around the power connection.")
+ playsound(src, I.usesound, 50, 1)
+ return
+ else if(mode==1)
+ mode=0
+ to_chat(user, "You attach the screws around the power connection.")
+ playsound(src, I.usesound, 50, 1)
+ return
+ else if(istype(I, /obj/item/weapon/weldingtool) && mode==1)
+ var/obj/item/weapon/weldingtool/W = I
+ if(W.remove_fuel(0,user))
+ playsound(src, W.usesound, 100, 1)
+ to_chat(user, "You start slicing the floorweld off the disposal outlet.")
+ if(do_after(user,20 * W.toolspeed))
+ if(!src || !W.isOn()) return
+ to_chat(user, "You sliced the floorweld off the disposal outlet.")
+ var/obj/structure/disposalconstruct/C = new (src.loc)
+ src.transfer_fingerprints_to(C)
+ C.ptype = 7 // 7 = outlet
+ C.update()
+ C.anchored = 1
+ C.density = 1
+ qdel(src)
+ return
+ else
+ to_chat(user, "You need more welding fuel to complete this task.")
return
- src.add_fingerprint(user)
- if(I.is_screwdriver())
- if(mode==0)
- mode=1
- to_chat(user, "You remove the screws around the power connection.")
- playsound(src, I.usesound, 50, 1)
- return
- else if(mode==1)
- mode=0
- to_chat(user, "You attach the screws around the power connection.")
- playsound(src, I.usesound, 50, 1)
- return
- else if(istype(I, /obj/item/weapon/weldingtool) && mode==1)
- var/obj/item/weapon/weldingtool/W = I
- if(W.remove_fuel(0,user))
- playsound(src, W.usesound, 100, 1)
- to_chat(user, "You start slicing the floorweld off the disposal outlet.")
- if(do_after(user,20 * W.toolspeed))
- if(!src || !W.isOn()) return
- to_chat(user, "You sliced the floorweld off the disposal outlet.")
- var/obj/structure/disposalconstruct/C = new (src.loc)
- src.transfer_fingerprints_to(C)
- C.ptype = 7 // 7 = outlet
- C.update()
- C.anchored = 1
- C.density = 1
- qdel(src)
- return
- else
- to_chat(user, "You need more welding fuel to complete this task.")
- return
// called when movable is expelled from a disposal pipe or outlet
// by default does nothing, override for special behaviour
diff --git a/code/modules/xenoarcheaology/tools/artifact_harvester.dm b/code/modules/xenoarcheaology/tools/artifact_harvester.dm
index 3d71aef155..8222eaa1f0 100644
--- a/code/modules/xenoarcheaology/tools/artifact_harvester.dm
+++ b/code/modules/xenoarcheaology/tools/artifact_harvester.dm
@@ -13,12 +13,11 @@
var/obj/machinery/artifact_scanpad/owned_scanner = null
var/last_process = 0
-/obj/machinery/artifact_harvester/New()
- ..()
- spawn(50) //Delay so the scan pad has time to actually spawn in
- owned_scanner = locate(/obj/machinery/artifact_scanpad) in get_step(src, dir) //connect to a nearby scanner pad
- if(!owned_scanner)
- owned_scanner = locate(/obj/machinery/artifact_scanpad) in orange(1, src)
+/obj/machinery/artifact_harvester/Initialize()
+ . = ..()
+ owned_scanner = locate(/obj/machinery/artifact_scanpad) in get_step(src, dir)
+ if(!owned_scanner)
+ owned_scanner = locate(/obj/machinery/artifact_scanpad) in orange(1, src)
/obj/machinery/artifact_harvester/attackby(var/obj/I as obj, var/mob/user as mob)
if(istype(I,/obj/item/weapon/anobattery))