mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 20:43:10 +01:00
Adds new mechanics to AI/stationbound control of airlocks - allows AIs to bolt airlocks again, sort of (#10310)
* Refactors airlock wire messages Makes it more straightforward to see that all the lights are off (i.e. no power). Also differentiates between showing bolt status when the indicators are on vs. off, as one is just a simple visual check while the other would supposedly require a more close-up inspection. It also makes it much easier to modify the conditions and text however needed instead of using a bunch of ternaries for everything. Additionally index_to_type uses the proper constants instead of hardcoded numbers. * Lights up the airlock indicator lights Also does minor refactor of the wires file. * Adds mechanics to toggle if AIs can bolt doors using AI control wire * Moves most AI "welcome text" to a separate pop-up window and adds it as a verb Also adds list of channels to the Radio-Settings verb. * Moves Initialize, Destroy to beginning, merges the two Initializes * Adds explicit override for admins and malfs, this allows them to (un)bolt stealthily should they choose to do so Also adds name and area of the airlock to the UI and refactors it some. * More better.
This commit is contained in:
@@ -40,15 +40,33 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on.
|
||||
|
||||
. += ..()
|
||||
. += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]",
|
||||
(A.locked ? "The door bolts have fallen!" : "The door bolts look up."),
|
||||
((A.lights && haspower) ? "The door bolt lights are on." : "The door bolt lights are off!"),
|
||||
((haspower) ? "The test light is on." : "The test light is off!"),
|
||||
((A.backup_power_lost_until) ? "The backup power light is off!" : "The backup power light is on."),
|
||||
((A.aiControlDisabled==0 && !A.emagged && haspower)? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."),
|
||||
((A.safe==0 && haspower)? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."),
|
||||
((A.normalspeed==0 && haspower)? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."),
|
||||
((A.aiDisabledIdScanner==0 && haspower)? "The IDScan light is on." : "The IDScan light is off."))
|
||||
var/list/text = list()
|
||||
|
||||
if(!haspower)
|
||||
text += "The test light and all the other indicator lights are [SPAN_BAD("off")]!"
|
||||
text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up."
|
||||
else
|
||||
text += "The test light is [SPAN_GOOD("on")]."
|
||||
text += A.backup_power_lost_until ? "The backup power light is [SPAN_BAD("off")]!" : "The backup power light is [SPAN_GOOD("on")]."
|
||||
if(A.lights) // show different bolt message depending on whether we have lights
|
||||
text += "The door bolt indicator lights are [SPAN_GOOD("on")]."
|
||||
text += "They show the bolts are [A.locked ? SPAN_BAD("down") : SPAN_GOOD("up")]."
|
||||
else
|
||||
text += "The door bolt indicator lights are [SPAN_BAD("off")]!"
|
||||
text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." // this is a closer inspection
|
||||
if(A.aiControlDisabled==0)
|
||||
if(A.emagged)
|
||||
text += "The 'AI control allowed' light is <span style='color:red'>red</span>."
|
||||
else if(A.aiBolting)
|
||||
text += "The 'AI control allowed' light is <span style='color:green'>green</span>."
|
||||
else
|
||||
text += "The 'AI control allowed' light is <span style='color:orange'>orange</span>."
|
||||
else
|
||||
text += "The 'AI control allowed' light is [SPAN_BAD("off")]."
|
||||
text += A.safe==0 ? "The 'Check Wiring' light is [SPAN_GOOD("on")]." : "The 'Check Wiring' light is [SPAN_BAD("off")]."
|
||||
text += A.normalspeed==0 ? "The 'Check Timing Mechanism' light is [SPAN_GOOD("on")]." : "The 'Check Timing Mechanism' light is [SPAN_BAD("off")]."
|
||||
text += A.aiDisabledIdScanner==0 ? "The IDScan light is [SPAN_GOOD("on")]." : "The IDScan light is [SPAN_BAD("off")]."
|
||||
. += "<br>\n" + jointext(text, "<br>\n")
|
||||
|
||||
/datum/wires/airlock/UpdateCut(var/index, var/mended)
|
||||
|
||||
@@ -56,8 +74,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
A.aiDisabledIdScanner = !mended
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
if(!mended)
|
||||
//Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be crowbarred open, but bolts-raising will not work. Cutting these wires may electocute the user.
|
||||
A.loseMainPower()
|
||||
@@ -67,7 +85,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
|
||||
if(!mended)
|
||||
//Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user.
|
||||
A.loseBackupPower()
|
||||
@@ -77,14 +94,12 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
|
||||
if(!mended)
|
||||
//Cutting this wire also drops the door bolts, and mending it does not raise them. (This is what happens now, except there are a lot more wires going to door bolts at present)
|
||||
A.lock(1)
|
||||
A.update_icon()
|
||||
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
|
||||
if(!mended)
|
||||
//one wire for AI control. Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all.
|
||||
//aiControlDisabled: If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in.
|
||||
@@ -128,9 +143,11 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
//Sending a pulse through flashes the red light on the door (if the door has power).
|
||||
if(A.arePowerSystemsOn() && A.density)
|
||||
A.do_animate("deny")
|
||||
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
//Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter).
|
||||
A.loseMainPower()
|
||||
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
//one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not),
|
||||
//raises them if they are down (only if power's on)
|
||||
@@ -142,29 +159,32 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
//two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter).
|
||||
A.loseBackupPower()
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
if(A.aiControlDisabled == 0)
|
||||
A.aiControlDisabled = 1
|
||||
else if(A.aiControlDisabled == -1)
|
||||
A.aiControlDisabled = 2
|
||||
|
||||
spawn(10)
|
||||
if(A)
|
||||
if(A.aiControlDisabled == 1)
|
||||
A.aiControlDisabled = 0
|
||||
else if(A.aiControlDisabled == 2)
|
||||
A.aiControlDisabled = -1
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
//Sending a pulse toggles whether AI can bolt the doors (if allowed by the door type and not emagged)
|
||||
if(A.emagged)
|
||||
return
|
||||
switch(A.aiBoltingSetup)
|
||||
if(AIRLOCK_AI_BOLTING_ALLOW, AIRLOCK_AI_BOLTING_DENY, AIRLOCK_AI_BOLTING_NEVER) // these doors don't allow change
|
||||
return
|
||||
else
|
||||
A.aiBolting = !A.aiBolting
|
||||
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
|
||||
A.electrify(30)
|
||||
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
//tries to open the door without ID
|
||||
//will succeed only if the ID wire is cut or the door requires no access and it's not emagged
|
||||
if(A.emagged) return
|
||||
if(A.emagged)
|
||||
return
|
||||
if(!A.requiresID() || A.check_access(null))
|
||||
if(A.density) A.open()
|
||||
else A.close()
|
||||
if(A.density)
|
||||
A.open()
|
||||
else
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
A.safe = !A.safe
|
||||
if(!A.density)
|
||||
@@ -188,27 +208,27 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
|
||||
/datum/wires/airlock/proc/index_to_type(var/index)
|
||||
switch(index)
|
||||
if(1)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
return "ID Scan"
|
||||
if(2)
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1)
|
||||
return "Power"
|
||||
if(4)
|
||||
if(AIRLOCK_WIRE_MAIN_POWER2)
|
||||
return "Power"
|
||||
if(8)
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
return "Bolts"
|
||||
if(16)
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1)
|
||||
return "Backup Power"
|
||||
if(32)
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
return "Backup Power"
|
||||
if(64)
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
return "Actuation"
|
||||
if(128)
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
return "AI Control"
|
||||
if(256)
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
return "Anti-tampering"
|
||||
if(512)
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
return "Safety"
|
||||
if(1024)
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
return "Speed"
|
||||
if(2048)
|
||||
return "Bolt Lights"
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
return "Bolt Lights"
|
||||
|
||||
Reference in New Issue
Block a user