Files
Aurora.3/code/datums/wires/suit_storage_unit.dm
Victor 50d3341536 Fix devices shocking players repeatedly (#20325)
A fix for https://github.com/Aurorastation/Aurora.3/issues/18219

Thanks to mattatlas for figuring out the actual cause -
`/datum/wires/suit_storage_unit/interactable` proc was called every tick
when TGUI window for that element was opened, and it had code that
checked for `isElectrified()`, leading to repeated shocks.

Removal should resolve the issue, actual .shock() calls are happening
when appropriate - in `/datum/wires/<MACHINE>/on_pulse(wire)` when
interacting with wiring, or in `<MACHINE>.dm` itself when processing
interactions.
 
Could not do full testing due to a lack of experience with the game and
tooling, but no issues were encountered with what was done.

---------

Co-authored-by: color <color@WINEWEASEL>
2025-01-04 00:02:31 +00:00

53 lines
1.2 KiB
Plaintext

/datum/wires/suit_storage_unit
proper_name = "Suit Storage Unit"
holder_type = /obj/machinery/suit_cycler
/datum/wires/suit_storage_unit/New()
wires = list(
WIRE_SAFETY,
WIRE_SHOCK,
WIRE_LOCKDOWN
)
add_duds(1)
..()
/datum/wires/suit_storage_unit/interactable(mob/user)
if(!..())
return FALSE
var/obj/machinery/suit_cycler/S = holder
if(S.panel_open)
return TRUE
return FALSE
/datum/wires/suit_storage_unit/get_status()
var/obj/machinery/suit_cycler/S = holder
. += ..()
. += "The orange light is [S.electrified ? "off" : "on"]."
. += "The red light is [S.safeties ? "off" : "blinking"]."
. += "The yellow light is [S.locked ? "on" : "off"]."
/datum/wires/suit_storage_unit/on_pulse(wire, user)
var/obj/machinery/suit_cycler/S = holder
switch(wire)
if(WIRE_SAFETY)
S.safeties = !S.safeties
if(WIRE_SHOCK)
if(ismob(user))
S.shock(user, 50)
S.electrified = 30
if(WIRE_LOCKDOWN)
S.locked = !S.locked
/datum/wires/suit_storage_unit/on_cut(wire, mend, source)
var/obj/machinery/suit_cycler/S = holder
switch(wire)
if(WIRE_SAFETY)
S.safeties = mend
if(WIRE_SHOCK)
S.locked = mend
if(WIRE_LOCKDOWN)
if(mend)
S.electrified = 0
else
S.electrified = -1