diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm
index c586f962512..6f7291a3a69 100644
--- a/code/datums/wires/airlock.dm
+++ b/code/datums/wires/airlock.dm
@@ -100,8 +100,7 @@
A.autoclose = mend
if(mend)
if(!A.density)
- spawn(0)
- A.close()
+ INVOKE_ASYNC(A, /obj/machinery/door/airlock/.proc/close)
if(WIRE_BOLT_LIGHT)
A.lights = mend
@@ -118,9 +117,11 @@
if(A.emergency)
A.emergency = 0
A.update_icon()
+
if(WIRE_MAIN_POWER1)
//Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter).
A.loseMainPower()
+
if(WIRE_DOOR_BOLTS)
//one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not),
//raises them if they are down (only if power's on)
@@ -133,18 +134,13 @@
if(WIRE_BACKUP_POWER1)
//two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter).
A.loseBackupPower()
+
if(WIRE_AI_CONTROL)
if(A.aiControlDisabled == 0)
A.aiControlDisabled = 1
else if(A.aiControlDisabled == -1)
A.aiControlDisabled = 2
-
- spawn(10)
- if(A)
- if(A.aiControlDisabled == 1)
- A.aiControlDisabled = 0
- else if(A.aiControlDisabled == 2)
- A.aiControlDisabled = -1
+ addtimer(CALLBACK(A, /obj/machinery/door/airlock/.proc/ai_control_callback), 1 SECONDS)
if(WIRE_ELECTRIFY)
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
@@ -155,16 +151,15 @@
//will succeed only if the ID wire is cut or the door requires no access and it's not emagged
if(A.emagged) return
if(!A.requiresID() || A.check_access(null))
- spawn(0)
- if(A.density)
- A.open()
- else
- A.close()
+ if(A.density)
+ INVOKE_ASYNC(A, /obj/machinery/door/airlock/.proc/open)
+ else
+ INVOKE_ASYNC(A, /obj/machinery/door/airlock/.proc/close)
+
if(WIRE_SAFETY)
A.safe = !A.safe
if(!A.density)
- spawn(0)
- A.close()
+ INVOKE_ASYNC(A, /obj/machinery/door/airlock/.proc/close)
if(WIRE_SPEED)
A.normalspeed = !A.normalspeed
diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm
index 824009701ab..cd13c9fe1d8 100644
--- a/code/datums/wires/alarm.dm
+++ b/code/datums/wires/alarm.dm
@@ -62,20 +62,14 @@
if(!A.shorted)
A.shorted = TRUE
A.update_icon()
-
- spawn(12000)
- if(A.shorted)
- A.shorted = FALSE
- A.update_icon()
-
+ addtimer(CALLBACK(A, /obj/machinery/alarm/.proc/unshort_callback), 120 SECONDS)
if(WIRE_AI_CONTROL)
if(!A.aidisabled)
A.aidisabled = TRUE
A.updateDialog()
- spawn(100)
- if(A.aidisabled)
- A.aidisabled = FALSE
+ addtimer(CALLBACK(A, /obj/machinery/alarm/.proc/enable_ai_control_callback), 10 SECONDS)
+
if(WIRE_SYPHON)
if(A.mode == 1) // AALARM_MODE_SCRUB
diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm
index 658b4a685d8..49931d8fa31 100644
--- a/code/datums/wires/apc.dm
+++ b/code/datums/wires/apc.dm
@@ -30,29 +30,19 @@
switch(wire)
if(WIRE_IDSCAN)
A.locked = FALSE
+ addtimer(CALLBACK(A, /obj/machinery/power/apc/.proc/relock_callback), 30 SECONDS)
- spawn(300)
- if(A)
- A.locked = TRUE
- A.updateDialog()
if(WIRE_MAIN_POWER1, WIRE_MAIN_POWER2)
if(!A.shorted)
A.shorted = TRUE
+ addtimer(CALLBACK(A, /obj/machinery/power/apc/.proc/check_main_power_callback), 120 SECONDS)
- spawn(1200)
- if(A && !is_cut(WIRE_MAIN_POWER1) && !is_cut(WIRE_MAIN_POWER2))
- A.shorted = FALSE
- A.updateDialog()
if(WIRE_AI_CONTROL)
if(!A.aidisabled)
A.aidisabled = TRUE
-
- spawn(10)
- if(A && !is_cut(WIRE_AI_CONTROL))
- A.aidisabled = FALSE
- A.updateDialog()
+ addtimer(CALLBACK(A, /obj/machinery/power/apc/.proc/check_ai_control_callback), 1 SECONDS)
..()
diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm
index a2730bc68ce..0d2aab5a81f 100644
--- a/code/datums/wires/autolathe.dm
+++ b/code/datums/wires/autolathe.dm
@@ -42,17 +42,12 @@
switch(wire)
if(WIRE_AUTOLATHE_HACK)
A.adjust_hacked(!A.hacked)
- spawn(50)
- if(A && !is_cut(wire))
- A.adjust_hacked(0)
+ addtimer(CALLBACK(A, /obj/machinery/autolathe/.proc/check_hacked_callback), 5 SECONDS)
+
if(WIRE_ELECTRIFY)
A.shocked = !A.shocked
- spawn(50)
- if(A && !is_cut(wire))
- A.shocked = FALSE
+ addtimer(CALLBACK(A, /obj/machinery/autolathe/.proc/check_electrified_callback), 5 SECONDS)
+
if(WIRE_AUTOLATHE_DISABLE)
A.disabled = !A.disabled
- spawn(50)
- if(A && !is_cut(wire))
- A.disabled = FALSE
-
+ addtimer(CALLBACK(A, /obj/machinery/autolathe/.proc/check_disabled_callback), 5 SECONDS)
diff --git a/code/datums/wires/nuclearbomb.dm b/code/datums/wires/nuclearbomb.dm
index f9c23533218..51918c02ff4 100644
--- a/code/datums/wires/nuclearbomb.dm
+++ b/code/datums/wires/nuclearbomb.dm
@@ -28,25 +28,16 @@
switch(wire)
if(WIRE_BOMB_LIGHT)
N.lighthack = !N.lighthack
- spawn(100)
- N.lighthack = !N.lighthack
+ addtimer(CALLBACK(N, /obj/machinery/nuclearbomb/.proc/reset_lighthack_callback), 10 SECONDS)
+
if(WIRE_BOMB_TIMING)
if(N.timing)
message_admins("[key_name_admin(usr)] pulsed a nuclear bomb's detonation wire, causing it to explode (JMP)")
N.explode()
+
if(WIRE_BOMB_SAFETY)
N.safety = !N.safety
- spawn(100)
- N.safety = !N.safety
- if(N.safety == 1)
- if(!N.is_syndicate)
- set_security_level(N.previous_level)
- N.visible_message("The [N] quiets down.")
- if(!N.lighthack)
- if(N.icon_state == "nuclearbomb2")
- N.icon_state = "nuclearbomb1"
- else
- N.visible_message("The [N] emits a quiet whirling noise!")
+ addtimer(CALLBACK(N, /obj/machinery/nuclearbomb/.proc/reset_safety_callback), 10 SECONDS)
/datum/wires/nuclearbomb/on_cut(wire, mend)
var/obj/machinery/nuclearbomb/N = holder
@@ -55,11 +46,13 @@
if(N.timing)
message_admins("[key_name_admin(usr)] cut a nuclear bomb's timing wire, causing it to explode (JMP)")
N.explode()
+
if(WIRE_BOMB_TIMING)
if(!N.lighthack)
if(N.icon_state == "nuclearbomb2")
N.icon_state = "nuclearbomb1"
N.timing = 0
- GLOB.bomb_set = 0
+ GLOB.bomb_set = FALSE
+
if(WIRE_BOMB_LIGHT)
N.lighthack = !N.lighthack
diff --git a/code/datums/wires/particle_accelerator.dm b/code/datums/wires/particle_accelerator.dm
index 013372a889c..e285f4cf898 100644
--- a/code/datums/wires/particle_accelerator.dm
+++ b/code/datums/wires/particle_accelerator.dm
@@ -39,7 +39,7 @@
C.toggle_power()
if(WIRE_PARTICLE_STRENGTH)
- for(var/i = 1; i < 3; i++)
+ for(var/i in 1 to 2)
C.remove_strength()
if(WIRE_PARTICLE_INTERFACE)
diff --git a/code/datums/wires/suitstorage.dm b/code/datums/wires/suitstorage.dm
index 3aaa21ff344..828e56884bf 100644
--- a/code/datums/wires/suitstorage.dm
+++ b/code/datums/wires/suitstorage.dm
@@ -30,11 +30,14 @@ datum/wires/suitstorage/interactable(mob/user)
switch(wire)
if(WIRE_IDSCAN)
A.secure = mend
+
if(WIRE_SAFETY)
A.safeties = mend
+
if(WIRE_ELECTRIFY)
A.shocked = !mend
A.shock(usr, 50)
+
if(WIRE_SSU_UV)
A.uv_super = !mend
..()
@@ -46,15 +49,16 @@ datum/wires/suitstorage/on_pulse(wire)
switch(wire)
if(WIRE_IDSCAN)
A.secure = !A.secure
+
if(WIRE_SAFETY)
A.safeties = !A.safeties
+
if(WIRE_ELECTRIFY)
A.shocked = !A.shocked
if(A.shocked)
A.shock(usr, 100)
- spawn(50)
- if(A && !is_cut(wire))
- A.shocked = FALSE
+ addtimer(CALLBACK(A, /obj/machinery/suit_storage_unit/.proc/check_electrified_callback), 5 SECONDS)
+
if(WIRE_SSU_UV)
A.uv_super = !A.uv_super
..()
diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm
index 491b5c93fda..bd996f72fcc 100644
--- a/code/datums/wires/syndicatebomb.dm
+++ b/code/datums/wires/syndicatebomb.dm
@@ -7,7 +7,7 @@
window_y = 22
/datum/wires/syndicatebomb/New(atom/_holder)
- wires = list(WIRE_EXPLODE, WIRE_BOMB_UNBOLT,WIRE_BOMB_PROCEED, WIRE_BOMB_ACTIVATE)
+ wires = list(WIRE_BOMB_DELAY, WIRE_EXPLODE, WIRE_BOMB_UNBOLT,WIRE_BOMB_PROCEED, WIRE_BOMB_ACTIVATE)
return ..()
/datum/wires/syndicatebomb/interactable(mob/user)
diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm
index 3a3b7df0261..c73293da519 100644
--- a/code/game/gamemodes/nuclear/nuclearbomb.dm
+++ b/code/game/gamemodes/nuclear/nuclearbomb.dm
@@ -408,6 +408,20 @@ GLOBAL_VAR(bomb_set)
return
return
+/obj/machinery/nuclearbomb/proc/reset_lighthack_callback()
+ lighthack = !lighthack
+
+/obj/machinery/nuclearbomb/proc/reset_safety_callback()
+ safety = !safety
+ if(safety == 1)
+ if(!is_syndicate)
+ set_security_level(previous_level)
+ visible_message("The [src] quiets down.")
+ if(!lighthack)
+ if(icon_state == "nuclearbomb2")
+ icon_state = "nuclearbomb1"
+ else
+ visible_message("The [src] emits a quiet whirling noise!")
//==========DAT FUKKEN DISK===============
/obj/item/disk/nuclear
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index bbbe31e9199..951f2a1e9cf 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -1084,6 +1084,15 @@
if(buildstage < 1)
. += "The circuit is missing."
+/obj/machinery/alarm/proc/unshort_callback()
+ if(shorted)
+ shorted = FALSE
+ update_icon()
+
+/obj/machinery/alarm/proc/enable_ai_control_callback()
+ if(aidisabled)
+ aidisabled = FALSE
+
/obj/machinery/alarm/all_access
name = "all-access air alarm"
desc = "This particular atmos control unit appears to have no access restrictions."
diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index f03495489f9..5c1b84d8cba 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -468,3 +468,15 @@
for(var/datum/design/D in files.known_designs)
if("hacked" in D.category)
files.known_designs -= D.id
+
+/obj/machinery/autolathe/proc/check_hacked_callback()
+ if(!wires.is_cut(WIRE_AUTOLATHE_HACK))
+ adjust_hacked(FALSE)
+
+/obj/machinery/autolathe/proc/check_electrified_callback()
+ if(!wires.is_cut(WIRE_ELECTRIFY))
+ shocked = FALSE
+
+/obj/machinery/autolathe/proc/check_disabled_callback()
+ if(!wires.is_cut(WIRE_AUTOLATHE_DISABLE))
+ disabled = FALSE
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 58d2bb4535e..d2e983b3eb3 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -1398,6 +1398,12 @@ About the new airlock wires panel:
A.name = name
qdel(src)
+/obj/machinery/door/airlock/proc/ai_control_callback()
+ if(aiControlDisabled == 1)
+ aiControlDisabled = 0
+ else if(aiControlDisabled == 2)
+ aiControlDisabled = -1
+
#undef AIRLOCK_CLOSED
#undef AIRLOCK_CLOSING
#undef AIRLOCK_OPEN
diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm
index e5e3a32d388..822c4af3e1a 100644
--- a/code/game/machinery/suit_storage_unit.dm
+++ b/code/game/machinery/suit_storage_unit.dm
@@ -803,3 +803,7 @@
/obj/machinery/suit_storage_unit/attack_ai(mob/user as mob)
return attack_hand(user)
+
+/obj/machinery/suit_storage_unit/proc/check_electrified_callback()
+ if(!wires.is_cut(WIRE_ELECTRIFY))
+ shocked = FALSE
diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm
index 1d27bf86d8e..6567dd62ede 100644
--- a/code/modules/assembly/assembly.dm
+++ b/code/modules/assembly/assembly.dm
@@ -1,7 +1,7 @@
-#define WIRE_RECEIVE (1<<0) //Allows pulsed(0) to call Activate()
+#define WIRE_RECEIVE (1<<0) //Allows pulse(0) to call Activate()
#define WIRE_PULSE (1<<1) //Allows pulse(0) to act on the holder
#define WIRE_PULSE_SPECIAL (1<<2) //Allows pulse(0) to act on the holders special assembly
-#define WIRE_RADIO_RECEIVE (1<<3) //Allows pulsed(1) to call Activate()
+#define WIRE_RADIO_RECEIVE (1<<3) //Allows pulse(1) to call Activate()
#define WIRE_RADIO_PULSE (1<<4) //Allows pulse(1) to send a radio message
/obj/item/assembly
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 2d5e75d6a2b..cc3fccb2a01 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -1368,4 +1368,18 @@
L.update(FALSE)
CHECK_TICK
+/obj/machinery/power/apc/proc/relock_callback()
+ locked = TRUE
+ updateDialog()
+
+/obj/machinery/power/apc/proc/check_main_power_callback()
+ if(!wires.is_cut(WIRE_MAIN_POWER1) && !wires.is_cut(WIRE_MAIN_POWER2))
+ shorted = FALSE
+ updateDialog()
+
+/obj/machinery/power/apc/proc/check_ai_control_callback()
+ if(!wires.is_cut(WIRE_AI_CONTROL))
+ aidisabled = FALSE
+ updateDialog()
+
#undef APC_UPDATE_ICON_COOLDOWN