mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
airlock/arePowerSystemsOn() refactor
airlock/arePowerSystemsOn() now checks if the airlock has power in addition to the wires being intact.
This commit is contained in:
@@ -538,23 +538,26 @@ About the new airlock wires panel:
|
||||
return ((src.wires & wireFlag) == 0)
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIControl()
|
||||
return ((src.aiControlDisabled!=1) && (!src.isAllPowerCut()));
|
||||
return ((src.aiControlDisabled!=1) && (!src.isAllPowerLoss()));
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIHack()
|
||||
return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerCut()));
|
||||
return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerLoss()));
|
||||
|
||||
/obj/machinery/door/airlock/proc/arePowerSystemsOn()
|
||||
if (stat & NOPOWER)
|
||||
return 0
|
||||
return (src.secondsMainPowerLost==0 || src.secondsBackupPowerLost==0)
|
||||
|
||||
/obj/machinery/door/airlock/requiresID()
|
||||
return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || aiDisabledIdScanner)
|
||||
|
||||
/obj/machinery/door/airlock/proc/isAllPowerCut()
|
||||
var/retval=0
|
||||
/obj/machinery/door/airlock/proc/isAllPowerLoss()
|
||||
if(stat & NOPOWER)
|
||||
return 1
|
||||
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
|
||||
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
|
||||
retval=1
|
||||
return retval
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/airlock/proc/regainMainPower()
|
||||
if(src.secondsMainPowerLost > 0)
|
||||
@@ -878,7 +881,7 @@ About the new airlock wires panel:
|
||||
t1 += "<a href='?src=\ref[src];signaler=[wires[wiredesc]]'>Attach signaler</a>"
|
||||
t1 += "<br>"
|
||||
|
||||
t1 += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]", (src.locked ? "The door bolts have fallen!" : "The door bolts look up."), (src.lights ? "The door bolt lights are on." : "The door bolt lights are off!"), ((src.arePowerSystemsOn() && !(stat & NOPOWER)) ? "The test light is on." : "The test light is off!"), (src.aiControlDisabled==0 ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), (src.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), (src.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."))
|
||||
t1 += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]", (src.locked ? "The door bolts have fallen!" : "The door bolts look up."), (src.lights ? "The door bolt lights are on." : "The door bolt lights are off!"), ((src.arePowerSystemsOn()) ? "The test light is on." : "The test light is off!"), (src.aiControlDisabled==0 ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), (src.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), (src.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."))
|
||||
|
||||
t1 += text("<p><a href='?src=\ref[];close=1'>Close</a></p>\n", src)
|
||||
|
||||
@@ -1173,7 +1176,7 @@ About the new airlock wires panel:
|
||||
beingcrowbarred = 1 //derp, Agouri
|
||||
else
|
||||
beingcrowbarred = 0
|
||||
if( beingcrowbarred && (operating == -1 || density && welded && operating != 1 && src.p_open && (!src.arePowerSystemsOn() || stat & NOPOWER) && !src.locked) )
|
||||
if( beingcrowbarred && src.p_open && (operating == -1 || (density && welded && operating != 1 && !src.arePowerSystemsOn() && !src.locked)) )
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
|
||||
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove electronics from the airlock assembly.")
|
||||
if(do_after(user,40))
|
||||
@@ -1213,7 +1216,7 @@ About the new airlock wires panel:
|
||||
|
||||
del(src)
|
||||
return
|
||||
else if(arePowerSystemsOn() && !(stat & NOPOWER))
|
||||
else if(arePowerSystemsOn())
|
||||
user << "\blue The airlock's motors resist your efforts to force it."
|
||||
else if(locked)
|
||||
user << "\blue The airlock's bolts prevent it from being forced."
|
||||
@@ -1250,7 +1253,7 @@ About the new airlock wires panel:
|
||||
if( operating || welded || locked )
|
||||
return 0
|
||||
if(!forced)
|
||||
if( !arePowerSystemsOn() || (stat & NOPOWER) || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
|
||||
if( !arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
|
||||
return 0
|
||||
use_power(50)
|
||||
if(istype(src, /obj/machinery/door/airlock/glass))
|
||||
@@ -1265,7 +1268,7 @@ About the new airlock wires panel:
|
||||
if(operating || welded || locked)
|
||||
return
|
||||
if(!forced)
|
||||
if( !arePowerSystemsOn() || (stat & NOPOWER) || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS) )
|
||||
if( !arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS) )
|
||||
return
|
||||
if(safe)
|
||||
for(var/turf/turf in locs)
|
||||
@@ -1317,7 +1320,7 @@ About the new airlock wires panel:
|
||||
/obj/machinery/door/airlock/proc/unlock(var/forced=0)
|
||||
if (operating || !src.locked) return
|
||||
|
||||
if (forced || (src.arePowerSystemsOn() && !(stat & NOPOWER))) //only can raise bolts if power's on
|
||||
if (forced || (src.arePowerSystemsOn())) //only can raise bolts if power's on
|
||||
src.locked = 0
|
||||
for(var/mob/M in range(1,src))
|
||||
M.show_message("You hear a click from the bottom of the door.", 2)
|
||||
|
||||
@@ -9,17 +9,17 @@ obj/machinery/door/airlock
|
||||
var/cur_command = null //the command the door is currently attempting to complete
|
||||
|
||||
obj/machinery/door/airlock/proc/can_radio()
|
||||
if( !arePowerSystemsOn() || (stat & NOPOWER) || isWireCut(AIRLOCK_WIRE_AI_CONTROL) )
|
||||
if(!arePowerSystemsOn())
|
||||
return 0
|
||||
return 1
|
||||
|
||||
obj/machinery/door/airlock/process()
|
||||
..()
|
||||
if (arePowerSystemsOn() && !(stat & NOPOWER))
|
||||
if (arePowerSystemsOn())
|
||||
execute_current_command()
|
||||
|
||||
obj/machinery/door/airlock/receive_signal(datum/signal/signal)
|
||||
if (arePowerSystemsOn() && !(stat & NOPOWER)) return //no power
|
||||
if (!arePowerSystemsOn()) return //no power
|
||||
|
||||
if (!can_radio()) return //no radio
|
||||
|
||||
|
||||
Reference in New Issue
Block a user