Files
Bubberstation/code/modules/power/apc
SkyratBot e5d7e0157f [MIRROR] Stop blobs from spamming the apc power down noise. (#26270)
* 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
🆑
fix: Blobs sitting on APCs no longer break them when already broken, and
so no longer spam the power down noise.
/🆑

* Stop blobs from spamming the apc power down noise.

---------

Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
2024-01-29 02:14:08 +01:00
..