From 1b0eeb79e4349f16ead20636345f0f1a6bfcf8fe Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 19 Apr 2020 19:54:49 -0400 Subject: [PATCH 1/5] Firedoors should only process when they are closed. --- code/game/machinery/doors/firedoor.dm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index c681a34edb5..361cbfdffed 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -350,7 +350,9 @@ /obj/machinery/door/firedoor/process() ..() - if(density && next_process_time <= world.time) + if(!density) + return PROCESS_KILL + if(next_process_time <= world.time) next_process_time = world.time + 100 // 10 second delays between process updates var/changed = 0 lockdown=0 @@ -406,7 +408,10 @@ /obj/machinery/door/firedoor/close() latetoggle() - return ..() + . = ..() + // Queue us for processing when we are closed! + if(density) + START_MACHINE_PROCESSING(src) /obj/machinery/door/firedoor/open(var/forced = 0) if(hatch_open) From 5b28bbd5367a530671ad887075e022c9a3bafb29 Mon Sep 17 00:00:00 2001 From: Leshana Date: Tue, 21 Apr 2020 21:51:05 -0400 Subject: [PATCH 2/5] Doors only need to process when they are attempting to autoclose. --- code/game/machinery/doors/airlock.dm | 5 ++--- code/game/machinery/doors/door.dm | 14 ++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index bd1d6637202..6b0de8eda6c 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1142,7 +1142,7 @@ About the new airlock wires panel: if(!has_beeped) playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0) has_beeped = 1 - close_door_at = world.time + 6 + autoclose_in(6) return for(var/turf/turf in locs) @@ -1160,8 +1160,7 @@ About the new airlock wires panel: var/obj/structure/window/killthis = (locate(/obj/structure/window) in turf) if(killthis) killthis.ex_act(2)//Smashin windows - ..() - return + return ..() /obj/machinery/door/airlock/proc/lock(var/forced=0) if(locked) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 4793bbf41d3..bf60a7dc1cf 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -82,11 +82,17 @@ /obj/machinery/door/process() if(close_door_at && world.time >= close_door_at) if(autoclose) - close_door_at = next_close_time() + close_door_at = world.time + next_close_wait() spawn(0) close() else close_door_at = 0 + if (..() == PROCESS_KILL && !close_door_at) + return PROCESS_KILL + +/obj/machinery/door/proc/autoclose_in(wait) + close_door_at = world.time + wait + START_MACHINE_PROCESSING(src) /obj/machinery/door/proc/can_open() if(!density || operating || !ticker) @@ -427,12 +433,12 @@ operating = 0 if(autoclose) - close_door_at = next_close_time() + autoclose_in(next_close_wait()) return 1 -/obj/machinery/door/proc/next_close_time() - return world.time + (normalspeed ? 150 : 5) +/obj/machinery/door/proc/next_close_wait() + return (normalspeed ? 150 : 5) /obj/machinery/door/proc/close(var/forced = 0) if(!can_close(forced)) From 86e41f7dd67e5415ae0b4dffce23ae6d507d3279 Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 19 Apr 2020 20:46:23 -0400 Subject: [PATCH 3/5] Airlocks only need to process when they are obeying a command or counting down a timer. --- code/game/machinery/doors/airlock.dm | 12 +++++++++++- code/game/machinery/doors/airlock_control.dm | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 6b0de8eda6c..2a14c17bdb4 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -390,7 +390,8 @@ else if(electrified_until > 0 && world.time >= electrified_until) electrify(0) - ..() + if (..() == PROCESS_KILL && !(main_power_lost_until > 0 || backup_power_lost_until > 0 || electrified_until > 0)) + . = PROCESS_KILL /obj/machinery/door/airlock/uranium/process() if(world.time > last_event+20) @@ -580,6 +581,9 @@ About the new airlock wires panel: if(backup_power_lost_until == -1 && !backupPowerCablesCut()) backup_power_lost_until = world.time + SecondsToTicks(10) + if(main_power_lost_until > 0 || backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + // Disable electricity if required if(electrified_until && isAllPowerLoss()) electrify(0) @@ -589,6 +593,9 @@ About the new airlock wires panel: /obj/machinery/door/airlock/proc/loseBackupPower() backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + if(backup_power_lost_until > 0) + START_MACHINE_PROCESSING(src) + // Disable electricity if required if(electrified_until && isAllPowerLoss()) electrify(0) @@ -631,6 +638,9 @@ About the new airlock wires panel: message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]." src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration) + if(electrified_until > 0) + START_MACHINE_PROCESSING(src) + if(feedback && message) to_chat(usr,message) diff --git a/code/game/machinery/doors/airlock_control.dm b/code/game/machinery/doors/airlock_control.dm index ca7092708d3..521f07cf674 100644 --- a/code/game/machinery/doors/airlock_control.dm +++ b/code/game/machinery/doors/airlock_control.dm @@ -9,7 +9,8 @@ obj/machinery/door/airlock var/cur_command = null //the command the door is currently attempting to complete obj/machinery/door/airlock/process() - ..() + if (..() == PROCESS_KILL && !cur_command) + . = PROCESS_KILL if (arePowerSystemsOn()) execute_current_command() @@ -22,6 +23,9 @@ obj/machinery/door/airlock/receive_signal(datum/signal/signal) cur_command = signal.data["command"] execute_current_command() + if(cur_command) + START_MACHINE_PROCESSING(src) + obj/machinery/door/airlock/proc/execute_current_command() if(operating) From 4c6e6bc04c40125c978ba197762edb854e04a9ca Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 19 Apr 2020 21:01:06 -0400 Subject: [PATCH 4/5] Terminals do not need to process! global.machines is a separate list from processing_machines --- code/modules/power/terminal.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index 2c01476a7a8..1ce14059d4c 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -33,11 +33,6 @@ /obj/machinery/power/terminal/hides_under_flooring() return 1 -// Needed so terminals are not removed from machines list. -// Powernet rebuilds need this to work properly. -/obj/machinery/power/terminal/process() - return 1 - /obj/machinery/power/terminal/overload(var/obj/machinery/power/source) if(master) master.overload(source) From ea0fc2d20561b8cec448cecba982404c06942a33 Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 19 Apr 2020 21:05:47 -0400 Subject: [PATCH 5/5] Holopads only need to process when someone is using them. --- code/game/machinery/hologram.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index ab86d71df28..76686aacce9 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -127,6 +127,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ set_light(2) //pad lighting icon_state = "holopad1" A.holo = src + if(LAZYLEN(masters)) + START_MACHINE_PROCESSING(src) return 1 /obj/machinery/hologram/holopad/proc/clear_holo(mob/living/silicon/ai/user) @@ -147,7 +149,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ continue use_power(power_per_hologram) - return 1 + if(..() == PROCESS_KILL && !LAZYLEN(masters)) + return PROCESS_KILL /obj/machinery/hologram/holopad/proc/move_hologram(mob/living/silicon/ai/user) if(masters[user])