From 679e3be82ba6bdefab9b4a75de07b7ce713003c9 Mon Sep 17 00:00:00 2001 From: SomeSortaSquid Date: Sun, 28 Oct 2018 11:24:56 +0100 Subject: [PATCH 1/2] Electrified Airlock Fix Previously electrified airlocks had no adjacency check, only UI. This led to remote electrocutions. --- code/datums/wires/airlock.dm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index cef139cc476..17b6ecda731 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -55,9 +55,12 @@ var/const/AIRLOCK_WIRE_LIGHT = 512 /datum/wires/airlock/CanUse(mob/living/L) var/obj/machinery/door/airlock/A = holder if(iscarbon(L)) - if(A.isElectrified()) - if(A.shock(L, 100)) - return 0 + if(A.x - L.x <= 1 && A.x - L.x >= -1 && A.y - L.y <= 1 && A.y - L.y >= -1) + if(A.isElectrified()) + if(A.shock(L, 100)) + return 0 + else + return 0 if(A.panel_open) return 1 return 0 @@ -211,4 +214,4 @@ var/const/AIRLOCK_WIRE_LIGHT = 512 A.lights = !A.lights A.update_icon() - ..() \ No newline at end of file + ..() From bfbd4213d315a2ef9275b4245c676d8b8dc91b21 Mon Sep 17 00:00:00 2001 From: SomeSortaSquid Date: Sun, 28 Oct 2018 15:04:52 +0100 Subject: [PATCH 2/2] Cleaned Up Airlock Remote Electrocution Fix Tested locally, works as expected. Airlocks only electrocute people standing next to them. --- code/datums/wires/airlock.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 17b6ecda731..3e9f488bb29 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -55,12 +55,10 @@ var/const/AIRLOCK_WIRE_LIGHT = 512 /datum/wires/airlock/CanUse(mob/living/L) var/obj/machinery/door/airlock/A = holder if(iscarbon(L)) - if(A.x - L.x <= 1 && A.x - L.x >= -1 && A.y - L.y <= 1 && A.y - L.y >= -1) + if(A.Adjacent(L)) if(A.isElectrified()) if(A.shock(L, 100)) return 0 - else - return 0 if(A.panel_open) return 1 return 0