diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm
index a548abf750f3f..b9b821bf46b73 100644
--- a/code/datums/wires/airlock.dm
+++ b/code/datums/wires/airlock.dm
@@ -53,7 +53,7 @@
var/list/status = list()
status += "The door bolts [A.locked ? "have fallen!" : "look up."]"
status += "The test light is [A.hasPower() ? (A.isElectrified() ? "bright and flicking" : "on") : "off"]."
- status += "The AI connection light is [A.aiControlDisabled || (A.obj_flags & EMAGGED) ? "off" : "on"]."
+ status += "The AI connection light is [A.aiControlDisabled ? "off" : "on"]."
status += "The check wiring light is [A.safe ? "off" : "on"]."
status += "The timer is powered [A.autoclose ? "on" : "off"]."
status += "The speed light is [A.normalspeed ? "on" : "off"]."
@@ -68,15 +68,14 @@
if(isliving(usr) && A.hasPower() && A.isElectrified())
if (A.shock(usr, 100))
return
- if(A.hasPower()) //Multitool has no effect at all if the door has lost power
+ switch(wire)
+ if(WIRE_POWER1, WIRE_POWER2) // Pulse to lose power, or reset the delay before restoring power if already lost
+ A.loseMainPower()
+ if(WIRE_BACKUP1, WIRE_BACKUP2) // Pulse to lose backup power, or reset the delay before restoring power if already lost
+ A.loseBackupPower()
+ if(A.hasPower()) //Multitool has no effect on other wires if the door has no power
switch(wire)
- if(WIRE_POWER1, WIRE_POWER2) // Pulse to loose power.
- A.loseMainPower()
- if(WIRE_BACKUP1, WIRE_BACKUP2) // Pulse to loose backup power.
- A.loseBackupPower()
- if(WIRE_OPEN) // Pulse to open door (only works not emagged and ID wire is cut or no access is required).
- if(A.obj_flags & EMAGGED)
- return
+ if(WIRE_OPEN) // Pulse to open door
if(A.id_scan_hacked() || A.check_access(null))
if(A.density)
INVOKE_ASYNC(A, TYPE_PROC_REF(/obj/machinery/door/airlock, open))
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 78f1e89468a66..9df5f25bcb8d8 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -383,7 +383,7 @@
update_icon()
/obj/machinery/door/airlock/Bumped(atom/movable/AM)
- if(operating || (obj_flags & EMAGGED))
+ if(operating)
return
if(ismecha(AM))
var/obj/mecha/mecha = AM
@@ -493,19 +493,20 @@
ui_update()
update_icon()
-/obj/machinery/door/airlock/proc/loseMainPower()
- if(secondsMainPowerLost <= 0)
+/obj/machinery/door/airlock/proc/loseMainPower(emagged_powerloss)
+ if(emagged_powerloss)
+ secondsMainPowerLost = 36000 //Ten hours, effectively indefinite - may be reset by power cycling the airlock with a multitool or wirecutters
+ secondsBackupPowerLost = 36000
+ else
secondsMainPowerLost = 60
- if(secondsBackupPowerLost < 10)
- secondsBackupPowerLost = 10
+ secondsBackupPowerLost = clamp(10, secondsBackupPowerLost, 60)
if(!spawnPowerRestoreRunning)
spawnPowerRestoreRunning = TRUE
handlePowerRestoreLoop()
update_icon()
/obj/machinery/door/airlock/proc/loseBackupPower()
- if(secondsBackupPowerLost < 60)
- secondsBackupPowerLost = 60
+ secondsBackupPowerLost = 60
if(!spawnPowerRestoreRunning)
spawnPowerRestoreRunning = TRUE
handlePowerRestoreLoop()
@@ -710,8 +711,6 @@
/obj/machinery/door/airlock/examine(mob/user)
. = ..()
- if(obj_flags & EMAGGED)
- . += "Its access panel is smoking slightly."
if(charge && !panel_open && in_range(user, src))
. += "The maintenance panel seems haphazardly fastened."
if(charge && panel_open)
@@ -758,9 +757,6 @@
return
else
to_chat(user, "Airlock AI control has been blocked with a firewall. Unable to hack.")
- if(obj_flags & EMAGGED)
- to_chat(user, "Unable to interface: Airlock is unresponsive.")
- return
if(detonated)
to_chat(user, "Unable to interface. Airlock control panel damaged.")
return
@@ -1047,8 +1043,6 @@
if(!panel_open || security_level)
to_chat(user, "The maintenance panel must be open to apply [C]!")
return
- if(obj_flags & EMAGGED)
- return
if(charge && !detonated)
to_chat(user, "There's already a charge hooked up to this door!")
return
@@ -1151,7 +1145,7 @@
charge.forceMove(get_turf(user))
charge = null
return
- if(!security_level && (beingcrowbarred && panel_open && ((obj_flags & EMAGGED) || (density && welded && !operating && !hasPower() && !locked))))
+ if(!security_level && (beingcrowbarred && panel_open && (density && welded && !operating && !hasPower() && !locked)))
user.visible_message("[user] removes the electronics from the airlock assembly.", \
"You start to remove electronics from the airlock assembly...")
if(I.use_tool(src, user, 40, volume=100))
@@ -1170,7 +1164,7 @@
INVOKE_ASYNC(src, (density ? PROC_REF(open) : PROC_REF(close)), 2)
-/obj/machinery/door/airlock/open(forced=0, ignore_emagged = FALSE)
+/obj/machinery/door/airlock/open(forced=0)
if( operating || welded || locked )
return FALSE
if(!forced)
@@ -1191,8 +1185,6 @@
H.apply_damage(40, BRUTE, BODY_ZONE_CHEST)
return
if(forced < 2)
- if(!ignore_emagged && (obj_flags & EMAGGED))
- return FALSE
if(!protected_door)
use_power(50)
playsound(src, doorOpen, 30, 1)
@@ -1243,8 +1235,6 @@
return
if(forced < 2)
- if(obj_flags & EMAGGED)
- return
if(!protected_door)
use_power(50)
playsound(src, doorClose, 30, TRUE)
@@ -1286,8 +1276,6 @@
return TRUE
/obj/machinery/door/airlock/proc/prison_open()
- if(obj_flags & EMAGGED)
- return
locked = FALSE
open()
locked = TRUE
@@ -1329,9 +1317,8 @@
//Airlock is passable if it is open (!density), bot has access, and is not bolted shut or powered off)
return !density || (check_access(ID) && !locked && hasPower())
+///This does not call parent because airlocks should be possible to emag multiple times. We only care that the door is closed, not protected and has power.
/obj/machinery/door/airlock/should_emag(mob/user)
- if(!..())
- return FALSE
if(protected_door)
to_chat(user, "[src] has no maintenance panel!")
return FALSE
@@ -1351,12 +1338,10 @@
if(QDELETED(src))
return
operating = FALSE
- if(!open(ignore_emagged = TRUE))
+ if(!open())
update_icon(AIRLOCK_CLOSED, 1)
- lights = FALSE
- locked = TRUE
- loseMainPower()
- loseBackupPower()
+ bolt()
+ loseMainPower(TRUE)
/obj/machinery/door/airlock/attack_alien(mob/living/carbon/alien/humanoid/user)
add_fingerprint(user)
@@ -1451,9 +1436,6 @@
if(!disassembled)
if(A)
A.obj_integrity = A.max_integrity * 0.5
- else if(obj_flags & EMAGGED)
- if(user)
- to_chat(user, "You discard the damaged electronics.")
else
if(user)
to_chat(user, "You remove the airlock electronics.")
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index 688acdea2fcde..39af859b4576a 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -93,7 +93,7 @@
/obj/machinery/door/Bumped(atom/movable/AM)
. = ..()
- if(operating || (obj_flags & EMAGGED))
+ if(operating)
return
if(ismob(AM))
var/mob/B = AM
@@ -148,7 +148,7 @@
/// Helper method for bumpopen() and try_to_activate_door(). Don't override.
/obj/machinery/door/proc/activate_door_base(mob/user, can_close_door)
add_fingerprint(user)
- if(operating || (obj_flags & EMAGGED))
+ if(operating)
return
// Cutting WIRE_IDSCAN disables normal entry
if(!id_scan_hacked() && allowed(user))