Skip to content

Commit 50d3341

Browse files
victorShchagincolor
and
color
authored
Fix devices shocking players repeatedly (#20325)
A fix for #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>
1 parent 6fcebd4 commit 50d3341

File tree

5 files changed

+70
-20
lines changed

5 files changed

+70
-20
lines changed

code/datums/wires/airlock.dm

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
if(!..())
3333
return FALSE
3434
var/obj/machinery/door/airlock/A = holder
35-
if(!istype(user, /mob/living/silicon))
36-
if(A.isElectrified())
37-
if(A.shock(user, 100))
38-
return FALSE
3935
if(!A.p_open)
4036
return FALSE
4137
return TRUE
@@ -137,7 +133,7 @@
137133
A.update_icon()
138134

139135

140-
/datum/wires/airlock/on_pulse(wire)
136+
/datum/wires/airlock/on_pulse(wire, user)
141137

142138
var/obj/machinery/door/airlock/A = holder
143139
switch(wire)
@@ -170,6 +166,8 @@
170166

171167
if(WIRE_SHOCK)
172168
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
169+
if(ismob(user))
170+
A.shock(user, 100)
173171
A.electrify(30)
174172

175173
if(WIRE_OPEN)

code/datums/wires/smartfridge.dm

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
if(!..())
2121
return FALSE
2222
var/obj/machinery/smartfridge/S = holder
23-
if(!istype(user, /mob/living/silicon))
24-
if(S.seconds_electrified)
25-
if(S.shock(user, 100))
26-
return FALSE
2723
if(S.panel_open)
2824
return TRUE
2925
return FALSE
@@ -37,12 +33,14 @@
3733
. += "The cyan light is [S.cooling ? "on" : "off"]."
3834
. += "The blue light is [S.heating ? "on" : "off"]."
3935

40-
/datum/wires/smartfridge/on_pulse(wire)
36+
/datum/wires/smartfridge/on_pulse(wire, user)
4137
var/obj/machinery/smartfridge/S = holder
4238
switch(wire)
4339
if(WIRE_THROW)
4440
S.shoot_inventory = !S.shoot_inventory
4541
if(WIRE_SHOCK)
42+
if(ismob(user))
43+
S.shock(user, 100)
4644
S.seconds_electrified = 30
4745
if(WIRE_IDSCAN)
4846
S.scan_id = !S.scan_id

code/datums/wires/suit_storage_unit.dm

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
if(!..())
1616
return FALSE
1717
var/obj/machinery/suit_cycler/S = holder
18-
if(!istype(user, /mob/living/silicon))
19-
if(S.electrified)
20-
if(S.shock(user, 100))
21-
return FALSE
2218
if(S.panel_open)
2319
return TRUE
2420
return FALSE
@@ -30,12 +26,14 @@
3026
. += "The red light is [S.safeties ? "off" : "blinking"]."
3127
. += "The yellow light is [S.locked ? "on" : "off"]."
3228

33-
/datum/wires/suit_storage_unit/on_pulse(wire)
29+
/datum/wires/suit_storage_unit/on_pulse(wire, user)
3430
var/obj/machinery/suit_cycler/S = holder
3531
switch(wire)
3632
if(WIRE_SAFETY)
3733
S.safeties = !S.safeties
3834
if(WIRE_SHOCK)
35+
if(ismob(user))
36+
S.shock(user, 50)
3937
S.electrified = 30
4038
if(WIRE_LOCKDOWN)
4139
S.locked = !S.locked

code/datums/wires/vending.dm

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
if(!..())
2121
return FALSE
2222
var/obj/machinery/vending/V = holder
23-
if(!istype(user, /mob/living/silicon))
24-
if(V.seconds_electrified)
25-
if(V.shock(user, 100))
26-
return FALSE
2723
if(V.panel_open)
2824
return TRUE
2925
return FALSE
@@ -38,14 +34,16 @@
3834
. += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"]."
3935
. += "The blue light is [V.temperature_setting == 1 ? "on" : "off"]."
4036

41-
/datum/wires/vending/on_pulse(wire)
37+
/datum/wires/vending/on_pulse(wire, user)
4238
var/obj/machinery/vending/V = holder
4339
switch(wire)
4440
if(WIRE_THROW)
4541
V.shoot_inventory = !V.shoot_inventory
4642
if(WIRE_CONTRABAND)
4743
V.categories ^= CAT_HIDDEN
4844
if(WIRE_SHOCK)
45+
if(ismob(user))
46+
V.shock(user, 50)
4947
V.seconds_electrified = 30
5048
if(WIRE_IDSCAN)
5149
V.scan_id = !V.scan_id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
################################
2+
# Example Changelog File
3+
#
4+
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
5+
#
6+
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
7+
# When it is, any changes listed below will disappear.
8+
#
9+
# Valid Prefixes:
10+
# bugfix
11+
# - (fixes bugs)
12+
# wip
13+
# - (work in progress)
14+
# qol
15+
# - (quality of life)
16+
# soundadd
17+
# - (adds a sound)
18+
# sounddel
19+
# - (removes a sound)
20+
# rscadd
21+
# - (adds a feature)
22+
# rscdel
23+
# - (removes a feature)
24+
# imageadd
25+
# - (adds an image or sprite)
26+
# imagedel
27+
# - (removes an image or sprite)
28+
# spellcheck
29+
# - (fixes spelling or grammar)
30+
# experiment
31+
# - (experimental change)
32+
# balance
33+
# - (balance changes)
34+
# code_imp
35+
# - (misc internal code change)
36+
# refactor
37+
# - (refactors code)
38+
# config
39+
# - (makes a change to the config files)
40+
# admin
41+
# - (makes changes to administrator tools)
42+
# server
43+
# - (miscellaneous changes to server)
44+
#################################
45+
46+
# Your name.
47+
author: victorShchagin
48+
49+
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
50+
delete-after: True
51+
52+
# Any changes you've made. See valid prefix list above.
53+
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
54+
# SCREW THIS UP AND IT WON'T WORK.
55+
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
56+
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
57+
changes:
58+
- bugfix: "Airlocks, vendors, and other machinery no longer cause continuous shocks to the user while the TGUI window is open."

0 commit comments

Comments
 (0)