From 0826a3ccc91bd231ff15c0beadd623005b3faaf4 Mon Sep 17 00:00:00 2001 From: _0Steven <42909981+00-Steven@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:12:03 +0100 Subject: [PATCH] Stop blobs from spamming the apc power down noise. (#81125) ## About The Pull Request It was mentioned to me that APCs were spamming the power down noise when broken, so I looked into it. After further questioning and testing, this turned out to be a blob-specific issue. Blobs present on the same tile as an APC were continuously calling the `set_broken()` proc: ```dm /obj/machinery/power/apc/blob_act(obj/structure/blob/B) set_broken() ``` ```dm /obj/machinery/power/apc/proc/set_broken() if(malfai && operating) malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000) operating = FALSE atom_break() if(occupier) malfvacate(TRUE) update() ``` Which was causing `update()` to be continuously called on the APC, which was in turn spamming the power down noise: ```dm /obj/machinery/power/apc/proc/update() if(operating && !shorted && !failure_timer) (...) else (...) playsound(src.loc, 'sound/machines/terminal_off.ogg', 50, FALSE) area.power_change() ``` So we fixed this by just adding an if statement to check if it's broken or not before breaking it: ```dm /obj/machinery/power/apc/blob_act(obj/structure/blob/B) if(machine_stat & BROKEN) return set_broken() ``` ## Why It's Good For The Game Fixes noise spam bug. Ough my ears. ## Changelog :cl: fix: Blobs sitting on APCs no longer break them when already broken, and so no longer spam the power down noise. /:cl: --- code/modules/power/apc/apc_attack.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/power/apc/apc_attack.dm b/code/modules/power/apc/apc_attack.dm index aaa63c05d85..509eb4f05b9 100644 --- a/code/modules/power/apc/apc_attack.dm +++ b/code/modules/power/apc/apc_attack.dm @@ -299,6 +299,8 @@ return TRUE /obj/machinery/power/apc/proc/set_broken() + if(machine_stat & BROKEN) + return if(malfai && operating) malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000) operating = FALSE