NanoUI synth airlock controller

This commit is contained in:
Markolie
2015-03-03 04:51:32 +01:00
parent 62b3912e41
commit 1deef3104e
12 changed files with 327 additions and 488 deletions
+4 -1
View File
@@ -455,4 +455,7 @@ proc/isInSight(var/atom/A, var/atom/B)
return 1
/proc/MinutesToTicks(var/minutes as num)
return minutes * 60 * 10
return minutes * 60 * 10
/proc/SecondsToTicks(var/seconds)
return seconds * 10
+14 -19
View File
@@ -125,22 +125,20 @@
return
/obj/machinery/door/airlock/AIAltShiftClick() // Sets/Unsets Emergency Access Override
if(emagged)
return
if(!emergency)
Topic("aiEnable=11", list("aiEnable"="11"), 1) // 1 meaning no window (consistency!)
if(density)
Topic(src, list("src"= "\ref[src]", "command"="emergency", "activate" = "1"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=11", list("aiDisable"="11"), 1)
Topic(src, list("src"= "\ref[src]", "command"="emergency", "activate" = "0"), 1)
return
/atom/proc/AIShiftClick()
return
/obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors!
if(density)
Topic("aiEnable=7", list("aiEnable"="7"), 1) // 1 meaning no window (consistency!)
Topic(src, list("src"= "\ref[src]", "command"="open", "activate" = "1"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=7", list("aiDisable"="7"), 1)
Topic(src, list("src"= "\ref[src]", "command"="open", "activate" = "0"), 1)
return
/atom/proc/AICtrlClick(var/mob/living/silicon/ai/user)
@@ -151,9 +149,9 @@
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors
if(locked)
Topic("aiEnable=4", list("aiEnable"="4"), 1)// 1 meaning no window (consistency!)
Topic(src, list("src"= "\ref[src]", "command"="bolts", "activate" = "0"), 1)// 1 meaning no window (consistency!)
else
Topic("aiDisable=4", list("aiDisable"="4"), 1)
Topic(src, list("src"= "\ref[src]", "command"="bolts", "activate" = "1"), 1)
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency! wait...)
@@ -165,16 +163,12 @@
AltClick(A)
/obj/machinery/door/airlock/AIAltClick() // Electrifies doors.
if(emagged)
return
if(!secondsElectrified)
if(!electrified_until)
// permanent shock
Topic("aiEnable=6", list("aiEnable"="6"), 1) // 1 meaning no window (consistency!)
use_log += text("\[[time_stamp()]\] <font color='red'>[usr.name] ([usr.ckey]) electrified [src].</font>")
Topic(src, list("src"= "\ref[src]", "command"="electrify_permanently", "activate" = "1"), 1) // 1 meaning no window (consistency!)
else
// disable/6 is not in Topic; disable/5 disables both temporary and permanent shock
Topic("aiDisable=5", list("aiDisable"="5"), 1)
use_log += text("\[[time_stamp()]\] <font color='orange'>[usr.name] ([usr.ckey]) toggled turned off the [src]'s electrification.</font>")
Topic(src, list("src"= "\ref[src]", "command"="electrify_permanently", "activate" = "0"), 1)
return
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
@@ -185,11 +179,12 @@
/obj/machinery/door/airlock/AIMiddleClick() // Toggles door bolt lights.
if(!src.lights)
Topic("aiEnable=10", list("aiEnable"="10"), 1) // 1 meaning no window (consistency!)
Topic(src, list("src"= "\ref[src]", "command"="lights", "activate" = "1"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=10", list("aiDisable"="10"), 1)
Topic(src, list("src"= "\ref[src]", "command"="lights", "activate" = "0"), 1)
return
//
// Override AdjacentQuick for AltClicking
//
+20 -33
View File
@@ -42,13 +42,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
((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.emergency==0 && haspower) ? "The emergency lights are off." : "The emergency lights are on."))
((A.emergency && haspower) ? "The emergency lights are on." : "The emergency lights are off."))
/datum/wires/airlock/UpdateCut(var/index, var/mended)
var/obj/machinery/door/airlock/A = holder
switch(index)
if(AIRLOCK_WIRE_IDSCAN)
A.aiDisabledIdScanner = !mended
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
if(!mended)
@@ -56,9 +57,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.loseMainPower()
A.shock(usr, 50)
else
if((!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER2)))
A.regainMainPower()
A.shock(usr, 50)
A.regainMainPower()
A.shock(usr, 50)
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
@@ -67,9 +67,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.loseBackupPower()
A.shock(usr, 50)
else
if((!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER2)))
A.regainBackupPower()
A.shock(usr, 50)
A.regainBackupPower()
A.shock(usr, 50)
if(AIRLOCK_WIRE_DOOR_BOLTS)
@@ -95,16 +94,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.aiControlDisabled = -1
if(AIRLOCK_WIRE_ELECTRIFY)
if(!mended)
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
if(A.secondsElectrified != -1)
if(A.electrified_until != -1)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified", null, addition="at [A.x],[A.y],[A.z]")
A.secondsElectrified = -1
A.electrified_until = -1
else
if(A.secondsElectrified == -1)
A.secondsElectrified = 0
A.electrified_until = 0
return // Don't update the dialog.
if (AIRLOCK_WIRE_SAFETY)
@@ -120,15 +117,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.lights = mended
A.update_icon()
/datum/wires/airlock/UpdatePulsed(var/index)
var/obj/machinery/door/airlock/A = holder
switch(index)
if(AIRLOCK_WIRE_IDSCAN)
//Sending a pulse through this disables emergency access and flashes the red light on the door (if the door has power).
if((A.arePowerSystemsOn()) && A.density)
A.door_animate("deny")
//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(A.emergency)
A.emergency = 0
A.update_icon()
@@ -140,13 +136,11 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
//raises them if they are down (only if power's on)
if(!A.locked)
A.locked = 1
for(var/mob/M in range(1, A))
M << "You hear a click from the bottom of the door."
A.audible_message("You hear a click from the bottom of the door.", null, 1)
else
if(A.arePowerSystemsOn()) //only can raise bolts if power's on
A.locked = 0
for(var/mob/M in range(1, A))
M << "You hear a click from the bottom of the door."
A.audible_message("You hear a click from the bottom of the door.", null, 1)
A.update_icon()
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2)
@@ -167,22 +161,15 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(AIRLOCK_WIRE_ELECTRIFY)
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
if(A.secondsElectrified==0)
if(A.electrified_until >= 0)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified", null, addition="at [A.x],[A.y],[A.z]")
A.secondsElectrified = 30
spawn(10)
if(A)
//TODO: Move this into process() and make pulsing reset secondsElectrified to 30
while (A.secondsElectrified>0)
A.secondsElectrified-=1
if(A.secondsElectrified<0)
A.secondsElectrified = 0
sleep(10)
A.electrified_until = world.time + SecondsToTicks(30)
return
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
//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.requiresID() || A.check_access(null))
if(A.density) A.open()
else A.close()
@@ -196,4 +183,4 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(AIRLOCK_WIRE_LIGHT)
A.lights = !A.lights
A.update_icon()
A.update_icon()
@@ -109,7 +109,7 @@ rcd light flash thingy on matter drain
AL.close()
AL.locked = 1 //Bolt it!
AL.lights = 0 //Stealth bolt for a classic AI door trap.
AL.secondsElectrified = -1 //Shock it!
AL.electrified_until = -1 //Shock it!
else if(!D.stat) //So that only powered doors are closed.
D.close() //Close ALL the doors!
@@ -140,7 +140,7 @@ rcd light flash thingy on matter drain
AL = D
if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire.
AL.locked = 0
AL.secondsElectrified = 0
AL.electrified_until = 0
AL.open()
AL.safe = 1
AL.lights = 1 //Essentially reset the airlock to normal.
+2 -2
View File
@@ -117,7 +117,7 @@
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Cooling System", 520, 300)
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Cooling System", 540, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
@@ -272,7 +272,7 @@
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Heating System", 520, 300)
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Heating System", 540, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
+2 -2
View File
@@ -98,7 +98,7 @@
if(specialfunctions & BOLTS)
D.lock()
if(specialfunctions & SHOCK)
D.secondsElectrified = -1
D.electrified_until = -1
if(specialfunctions & SAFE)
D.safe = 0
else
@@ -108,7 +108,7 @@
if(!D.isWireCut(4) && D.arePowerSystemsOn())
D.unlock()
if(specialfunctions & SHOCK)
D.secondsElectrified = 0
D.electrified_until = 0
if(specialfunctions & SAFE)
D.safe = 1
+179 -403
View File
@@ -28,14 +28,13 @@
explosion_resistance = 15
var/aiControlDisabled = 0 //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.
var/hackProof = 0 // if 1, this door can't be hacked by the AI
var/secondsMainPowerLost = 0 //The number of seconds until power is restored.
var/secondsBackupPowerLost = 0 //The number of seconds until power is restored.
var/main_power_lost_until = 0 //World time when main power is restored.
var/backup_power_lost_until = -1 //World time when backup power is restored.
var/spawnPowerRestoreRunning = 0
var/welded = null
var/locked = 0
var/lights = 1 // bolt lights show by default
var/datum/wires/airlock/wires = null
secondsElectrified = 0 //How many seconds remain until the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
var/aiDisabledIdScanner = 0
var/aiHacking = 0
var/obj/machinery/door/airlock/closeOther = null
@@ -208,6 +207,25 @@
icon = 'icons/obj/doors/Dooruranium.dmi'
mineral = "uranium"
var/last_event = 0
/obj/machinery/door/airlock/process()
// Deliberate no call to parent
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
main_power_lost_until = -1
else if(main_power_lost_until > 0 && world.time > main_power_lost_until)
regainMainPower()
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
backup_power_lost_until = -1
if(backup_power_lost_until > 0&& world.time > backup_power_lost_until)
regainBackupPower()
if(electrified_until && !arePowerSystemsOn())
electrified_until = 0
else if(isWireCut(AIRLOCK_WIRE_ELECTRIFY))
electrified_until = -1
else if(electrified_until > 0 && world.time > electrified_until)
electrified_until = 0
/obj/machinery/door/airlock/uranium/process()
if(world.time > last_event+20)
@@ -308,6 +326,8 @@
else
user << "You do not know how to operate this airlock's mechanism."
return
/*
About the new airlock wires panel:
@@ -347,7 +367,7 @@ About the new airlock wires panel:
..(user)
/obj/machinery/door/airlock/proc/isElectrified()
if(src.secondsElectrified != 0)
if(src.electrified_until != 0)
return 1
return 0
@@ -364,7 +384,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/proc/arePowerSystemsOn()
if (stat & (NOPOWER|BROKEN))
return 0
return (src.secondsMainPowerLost==0 || src.secondsBackupPowerLost==0)
return (src.main_power_lost_until==0 || src.backup_power_lost_until==0)
/obj/machinery/door/airlock/requiresID()
return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || aiDisabledIdScanner)
@@ -377,43 +397,25 @@ About the new airlock wires panel:
return 1
return 0
/obj/machinery/door/airlock/proc/regainMainPower()
if(src.secondsMainPowerLost > 0)
src.secondsMainPowerLost = 0
/obj/machinery/door/airlock/proc/loseMainPower()
if(src.secondsMainPowerLost <= 0)
src.secondsMainPowerLost = 60
if(src.secondsBackupPowerLost < 10)
src.secondsBackupPowerLost = 10
if(!src.spawnPowerRestoreRunning)
src.spawnPowerRestoreRunning = 1
spawn(0)
var/cont = 1
while (cont)
sleep(10)
cont = 0
if(src.secondsMainPowerLost>0)
if((!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)))
src.secondsMainPowerLost -= 1
src.updateDialog()
cont = 1
if(src.secondsBackupPowerLost>0)
if((!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)))
src.secondsBackupPowerLost -= 1
src.updateDialog()
cont = 1
src.spawnPowerRestoreRunning = 0
src.updateDialog()
// process() will handle the case of cut power cables
main_power_lost_until = world.time + SecondsToTicks(60)
backup_power_lost_until = max(backup_power_lost_until, world.time + SecondsToTicks(10))
/obj/machinery/door/airlock/proc/loseBackupPower()
if(src.secondsBackupPowerLost < 60)
src.secondsBackupPowerLost = 60
// process() will handle the case of cut power cables
backup_power_lost_until = world.time + SecondsToTicks(60)
/obj/machinery/door/airlock/proc/regainMainPower()
if(!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) && !src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
main_power_lost_until = 0
backup_power_lost_until = -1
update_icon()
/obj/machinery/door/airlock/proc/regainBackupPower()
if(src.secondsBackupPowerLost > 0)
src.secondsBackupPowerLost = 0
if(!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) && !src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
backup_power_lost_until = 0
update_icon()
// shock user with probability prb (if all connections & power are working)
// returns 1 if shocked, 0 otherwise
@@ -440,7 +442,8 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/update_icon()
if(overlays) overlays.Cut()
overlays = list()
if(emergency) overlays += image('icons/obj/doors/doorint.dmi', "elights")
if(emergency && arePowerSystemsOn())
overlays += image('icons/obj/doors/doorint.dmi', "elights")
if(density)
if(locked && lights)
icon_state = "door_locked"
@@ -458,144 +461,64 @@ About the new airlock wires panel:
icon_state = "door_open"
return
/obj/machinery/door/airlock/door_animate(animation)
/obj/machinery/door/airlock/do_animate(animation)
switch(animation)
if("opening")
if(overlays) overlays.Cut()
if(p_open)
spawn(2) // The only work around that works. Downside is that the door will be gone for a millisecond.
flick("o_door_opening", src) //can not use flick due to BYOND bug updating overlays right before flicking
update_icon()
else
flick("door_opening", src)
flick("door_opening", src)//[stat ? "_stat":]
update_icon()
if("closing")
if(overlays) overlays.Cut()
if(p_open)
flick("o_door_closing", src)
spawn(2)
flick("o_door_closing", src)
update_icon()
else
flick("door_closing", src)
update_icon()
if("spark")
flick("door_spark", src)
if(density)
flick("door_spark", src)
if("deny")
if(density && src.arePowerSystemsOn())
flick("door_deny", src)
return
/obj/machinery/door/airlock/attack_ai(mob/user as mob)
if (!check_synth_access(user))
return
ui_interact(user)
//Separate interface for the AI.
user.set_machine(src)
var/t1 = text("<B>Airlock Control</B><br>\n")
if(src.secondsMainPowerLost > 0)
if((!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)))
t1 += text("Main power is offline for [] seconds.<br>\n", src.secondsMainPowerLost)
else
t1 += text("Main power is offline indefinitely.<br>\n")
else
t1 += text("Main power is online.")
/obj/machinery/door/airlock/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
if(src.secondsBackupPowerLost > 0)
if((!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)))
t1 += text("Backup power is offline for [] seconds.<br>\n", src.secondsBackupPowerLost)
else
t1 += text("Backup power is offline indefinitely.<br>\n")
else if(src.secondsMainPowerLost > 0)
t1 += text("Backup power is online.")
else
t1 += text("Backup power is offline, but will turn on if main power fails.")
t1 += "<br>\n"
data["main_power_loss"] = round(main_power_lost_until > 0 ? max(main_power_lost_until - world.time, 0) / 10 : main_power_lost_until, 1)
data["backup_power_loss"] = round(backup_power_lost_until > 0 ? max(backup_power_lost_until - world.time, 0) / 10 : backup_power_lost_until, 1)
data["electrified"] = round(electrified_until > 0 ? max(electrified_until - world.time, 0) / 10 : electrified_until, 1)
data["open"] = !density
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
t1 += text("IdScan wire is cut.<br>\n")
else if(src.aiDisabledIdScanner)
t1 += text("IdScan disabled. <A href='?src=\ref[];aiEnable=1'>Enable?</a><br>\n", src)
else
t1 += text("IdScan enabled. <A href='?src=\ref[];aiDisable=1'>Disable?</a><br>\n", src)
var/commands[0]
commands[++commands.len] = list("name" = "IdScan", "command"= "idscan", "active" = !aiDisabledIdScanner, "enabled" = "Enabled", "disabled" = "Disable", "danger" = 0, "act" = 1)
commands[++commands.len] = list("name" = "Bolts", "command"= "bolts", "active" = !locked, "enabled" = "Raised ", "disabled" = "Dropped", "danger" = 0, "act" = 0)
commands[++commands.len] = list("name" = "Bolt Lights", "command"= "lights", "active" = lights, "enabled" = "Enabled", "disabled" = "Disable", "danger" = 0, "act" = 1)
commands[++commands.len] = list("name" = "Safeties", "command"= "safeties", "active" = safe, "enabled" = "Nominal", "disabled" = "Overridden", "danger" = 1, "act" = 0)
commands[++commands.len] = list("name" = "Timing", "command"= "timing", "active" = normalspeed, "enabled" = "Nominal", "disabled" = "Overridden", "danger" = 1, "act" = 0)
commands[++commands.len] = list("name" = "Door State", "command"= "open", "active" = density, "enabled" = "Closed", "disabled" = "Opened", "danger" = 0, "act" = 0)
commands[++commands.len] = list("name" = "Emergency Access", "command"= "emergency", "active" = emergency, "enabled" = "Enabled", "disabled" = "Disabled", "danger" = 0, "act" = 0)
if(src.emergency)
t1 += text("Emergency Access Override is enabled. <A href='?src=\ref[];aiDisable=11'>Disable?</a><br>\n", src)
else
t1 += text("Emergency Access Override is disabled. <A href='?src=\ref[];aiEnable=11'>Enable?</a><br>\n", src)
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1))
t1 += text("Main Power Input wire is cut.<br>\n")
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
t1 += text("Main Power Output wire is cut.<br>\n")
if(src.secondsMainPowerLost == 0)
t1 += text("<A href='?src=\ref[];aiDisable=2'>Temporarily disrupt main power?</a>.<br>\n", src)
if(src.secondsBackupPowerLost == 0)
t1 += text("<A href='?src=\ref[];aiDisable=3'>Temporarily disrupt backup power?</a>.<br>\n", src)
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1))
t1 += text("Backup Power Input wire is cut.<br>\n")
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
t1 += text("Backup Power Output wire is cut.<br>\n")
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
t1 += text("Door bolt control wire is cut.<br>\n")
else if(!src.locked)
t1 += text("Door bolts are up. <A href='?src=\ref[];aiDisable=4'>Drop them?</a><br>\n", src)
else
t1 += text("Door bolts are down.")
if(src.arePowerSystemsOn())
t1 += text(" <A href='?src=\ref[];aiEnable=4'>Raise?</a><br>\n", src)
else
t1 += text(" Cannot raise door bolts due to power failure.<br>\n")
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
t1 += text("Door bolt lights wire is cut.<br>\n")
else if(!src.lights)
t1 += text("Door lights are off. <A href='?src=\ref[];aiEnable=10'>Enable?</a><br>\n", src)
else
t1 += text("Door lights are on. <A href='?src=\ref[];aiDisable=10'>Disable?</a><br>\n", src)
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
t1 += text("Electrification wire is cut.<br>\n")
if(src.secondsElectrified==-1)
t1 += text("Door is electrified indefinitely. <A href='?src=\ref[];aiDisable=5'>Un-electrify it?</a><br>\n", src)
else if(src.secondsElectrified>0)
t1 += text("Door is electrified temporarily ([] seconds). <A href='?src=\ref[];aiDisable=5'>Un-electrify it?</a><br>\n", src.secondsElectrified, src)
else
t1 += text("Door is not electrified. <A href='?src=\ref[];aiEnable=5'>Electrify it for 30 seconds?</a> Or, <A href='?src=\ref[];aiEnable=6'>Electrify it indefinitely until someone cancels the electrification?</a><br>\n", src, src)
if(src.isWireCut(AIRLOCK_WIRE_SAFETY))
t1 += text("Door force sensors not responding.</a><br>\n")
else if(src.safe)
t1 += text("Door safeties operating normally. <A href='?src=\ref[];aiDisable=8'> Override?</a><br>\n",src)
else
t1 += text("Danger. Door safeties disabled. <A href='?src=\ref[];aiEnable=8'> Restore?</a><br>\n",src)
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
t1 += text("Door timing circuitry not responding.</a><br>\n")
else if(src.normalspeed)
t1 += text("Door timing circuitry operating normally. <A href='?src=\ref[];aiDisable=9'> Override?</a><br>\n",src)
else
t1 += text("Warning. Door timing circuitry operating abnormally. <A href='?src=\ref[];aiEnable=9'> Restore?</a><br>\n",src)
if(src.welded)
if(frozen)
t1 += text("Door appears to have been frozen shut.<br>\n")
else
t1 += text("Door appears to have been welded shut.<br>\n")
else if(!src.locked)
if(src.density)
t1 += text("<A href='?src=\ref[];aiEnable=7'>Open door</a><br>\n", src)
else
t1 += text("<A href='?src=\ref[];aiDisable=7'>Close door</a><br>\n", src)
t1 += text("<p><a href='?src=\ref[];close=1'>Close</a></p>\n", src)
user << browse(t1, "window=airlock")
onclose(user, "airlock")
//aiDisable - 1 idscan, 2 disrupt main power, 3 disrupt backup power, 4 drop door bolts, 5 un-electrify door, 7 close door
//aiEnable - 1 idscan, 4 raise door bolts, 5 electrify door for 30 seconds, 6 electrify door indefinitely, 7 open door
data["commands"] = commands
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "door_control.tmpl", "Door Controls - [src]", 600, 375)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/door/airlock/proc/hack(mob/user as mob)
if(src.aiHacking==0)
@@ -684,268 +607,121 @@ About the new airlock wires panel:
..(user)
return
/obj/machinery/door/airlock/proc/check_synth_access(mob/user as mob)
if(emagged)
user << "<span class='warning'>Unable to interface: Airlock is unresponsive.</span>"
return 0
/obj/machinery/door/airlock/CanUseTopic(var/mob/user, href_list)
if(!issilicon(user))
return STATUS_CLOSE
if(operating < 0) //emagged
user << "<span class='warning'>Unable to interface: Internal error.</span>"
return STATUS_CLOSE
if(!src.canAIControl())
if(src.canAIHack(user))
src.hack(user)
else
user << "<span class='warning'>Airlock AI control has been blocked with a firewall.</span>"
return 0
return 1
if (src.isAllPowerLoss()) //don't really like how this gets checked a second time, but not sure how else to do it.
user << "<span class='warning'>Unable to interface: Connection timed out.</span>"
else
user << "<span class='warning'>Unable to interface: Connection refused.</span>"
return STATUS_CLOSE
return STATUS_INTERACTIVE
/obj/machinery/door/airlock/Topic(href, href_list, var/nowindow = 0)
//AI
//aiDisable - 1 idscan, 2 disrupt main power, 3 disrupt backup power, 4 drop door bolts, 5 un-electrify door, 7 close door, 8 door safties, 9 door speed, 11 emergency access
//aiEnable - 1 idscan, 4 raise door bolts, 5 electrify door for 30 seconds, 6 electrify door indefinitely, 7 open door, 8 door safties, 9 door speed, 11 emergency access
if(..())
return 1
if(href_list["close"])
usr << browse(null, "window=airlock")
if(usr.machine==src)
usr.unset_machine()
return 1
if((in_range(src, usr) && istype(src.loc, /turf)) && src.p_open)
usr.set_machine(src)
var/activate = text2num(href_list["activate"])
switch (href_list["command"])
if("idscan")
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
usr << "The IdScan wire has been cut - IdScan feature permanently disabled."
else if(activate && src.aiDisabledIdScanner)
src.aiDisabledIdScanner = 0
usr << "IdScan feature has been enabled."
else if(!activate && !src.aiDisabledIdScanner)
src.aiDisabledIdScanner = 1
usr << "IdScan feature has been disabled."
if("main_power")
if(!main_power_lost_until)
src.loseMainPower()
if("backup_power")
if(!backup_power_lost_until)
src.loseBackupPower()
if("bolts")
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
usr << "The door bolt control wire has been cut - Door bolts permanently dropped."
else if(activate && src.lock())
usr << "The door bolts have been dropped."
else if(!activate && src.unlock())
usr << "The door bolts have been raised."
if("electrify_temporary")
if(activate && src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
usr << text("The electrification wire is cut - Door permanently electrified.")
else if(!activate && electrified_until != 0)
usr << "The door is now un-electrified."
src.electrified_until = 0
else if(activate) //electrify door for 30 seconds
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
usr << "The door is now electrified for thirty seconds."
src.electrified_until = world.time + SecondsToTicks(30)
if("electrify_permanently")
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
usr << text("The electrification wire is cut - Cannot electrify the door.")
else if(!activate && electrified_until != 0)
usr << "The door is now un-electrified."
src.electrified_until = 0
else if(activate)
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
usr << "The door is now electrified."
electrified_until = -1
if("open")
if(src.welded)
usr << text("The airlock has been welded shut!")
else if(src.locked)
usr << text("The door bolts are down!")
else if(activate && density)
open()
else if(!activate && !density)
close()
if("safeties")
// Safeties! We don't need no stinking safeties!
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
usr << text("The safety wire is cut - Cannot secure the door.")
else if (activate && src.safe)
safe = 0
else if (!activate && !src.safe)
safe = 1
if("timing")
// Door speed control
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
usr << text("The timing wire is cut - Cannot alter timing.")
else if (activate && src.normalspeed)
normalspeed = 0
else if (!activate && !src.normalspeed)
normalspeed = 1
if("lights")
// Bolt lights
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
usr << "The bolt lights wire has been cut - The door bolt lights are permanently disabled."
else if (!activate && src.lights)
lights = 0
usr << "The door bolt lights have been disabled."
else if (activate && !src.lights)
lights = 1
usr << "The door bolt lights have been enabled."
if("emergency")
// Emergency access
if (src.emergency)
emergency = 0
usr << "Emergency access has been disabled."
else
emergency = 1
usr << "Emergency access has been enabled."
if(!p_open)
if(!issilicon(usr))
if(!istype(usr.get_active_hand(), /obj/item/device/multitool))
testing("Not silicon, not using a multitool.")
return
var/obj/item/device/multitool/P = get_multitool(usr)
if("set_tag" in href_list)
if(!(href_list["set_tag"] in vars))
usr << "\red Something went wrong: Unable to find [href_list["set_tag"]] in vars!"
return 1
var/current_tag = src.vars[href_list["set_tag"]]
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag", src, current_tag) as null|text),1,MAX_MESSAGE_LEN)
if(newid)
vars[href_list["set_tag"]] = newid
initialize()
if("set_freq" in href_list)
var/newfreq=frequency
if(href_list["set_freq"]!="-1")
newfreq=text2num(href_list["set_freq"])
else
newfreq = input(usr, "Specify a new frequency (GHz). Decimals assigned automatically.", src, frequency) as null|num
if(newfreq)
if(findtext(num2text(newfreq), "."))
newfreq *= 10 // shift the decimal one place
if(newfreq < 10000)
frequency = newfreq
initialize()
if(href_list["unlink"])
P.visible_message("\The [P] buzzes in an annoying tone.","You hear a buzz.")
if(href_list["link"])
P.visible_message("\The [P] buzzes in an annoying tone.","You hear a buzz.")
if(href_list["buffer"])
P.buffer = src
if(istype(usr, /mob/living/silicon))
if (!check_synth_access(usr))
return 1
//AI
//aiDisable - 1 idscan, 2 disrupt main power, 3 disrupt backup power, 4 drop door bolts, 5 un-electrify door, 7 close door, 8 door safties, 9 door speed
//aiEnable - 1 idscan, 4 raise door bolts, 5 electrify door for 30 seconds, 6 electrify door indefinitely, 7 open door, 8 door safties, 9 door speed
if(href_list["aiDisable"])
var/code = text2num(href_list["aiDisable"])
switch (code)
if(1)
//disable idscan
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
usr << "The IdScan wire has been cut - The IdScan feature is already disabled."
else if(src.aiDisabledIdScanner)
usr << "The IdScan feature is already disabled."
else
usr << "The IdScan feature has been disabled."
src.aiDisabledIdScanner = 1
if(2)
//disrupt main power
if(src.secondsMainPowerLost == 0)
src.loseMainPower()
else
usr << "Main power is already offline."
if(3)
//disrupt backup power
if(src.secondsBackupPowerLost == 0)
src.loseBackupPower()
else
usr << "Backup power is already offline."
if(4)
//drop door bolts
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
usr << "The door bolt control wire has been cut - The door bolts are already dropped."
else if(src.locked)
usr << "The door bolts are already dropped."
else
src.lock()
usr << "The door bolts have been dropped."
if(5)
//un-electrify door
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
usr << text("The electrification wire is cut - Cannot un-electrify the door.")
else if(secondsElectrified != 0)
usr << "The door is now un-electrified."
src.secondsElectrified = 0
if(7)
//close door
if(src.welded)
usr << text("The airlock has been welded shut!")
else if(src.locked)
usr << text("The door bolts are down!")
else if(!src.density)
close()
else
open()
if(8)
// Safeties! We don't need no stinking safeties!
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
usr << text("Control to door sensors is disabled.")
else if (src.safe)
safe = 0
else
usr << text("Firmware reports safeties already overridden.")
if(9)
// Door speed control
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
usr << text("Control to door timing circuitry has been severed.")
else if (src.normalspeed)
normalspeed = 0
else
usr << text("Door timing circuity already accelerated.")
if(10)
// Bolt lights
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
usr << "The bolt lights wire has been cut - The door bolt lights are already disabled."
else if (src.lights)
lights = 0
usr << "The door bolt lights have been disabled."
else
usr << "The door bolt lights are already disabled!"
if(11)
// Emergency access
if (src.emergency)
emergency = 0
else
usr << text("Emergency access is already disabled!")
else if(href_list["aiEnable"])
var/code = text2num(href_list["aiEnable"])
switch (code)
if(1)
//enable idscan
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
usr << "The IdScan wire has been cut - The IdScan feature cannot be enabled."
else if(src.aiDisabledIdScanner)
usr << "The IdScan feature has been enabled."
src.aiDisabledIdScanner = 0
else
usr << "The IdScan feature is already enabled."
if(4)
//raise door bolts
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
usr << "The door bolt control wire has been cut - The door bolts cannot be raised."
else if(!src.locked)
usr << "The door bolts are already raised."
else
if(src.unlock())
usr << "The door bolts have been raised."
else
usr << "Unable to raise door bolts."
if(5)
//electrify door for 30 seconds
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
usr << text("The electrification wire has been cut.<br>\n")
else if(src.secondsElectrified==-1)
usr << text("The door is already indefinitely electrified. You'd have to un-electrify it before you can re-electrify it with a non-forever duration.<br>\n")
else if(src.secondsElectrified!=0)
usr << text("The door is already electrified. Cannot re-electrify it while it's already electrified.<br>\n")
else
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
usr << "The door is now electrified for thirty seconds."
src.secondsElectrified = 30
spawn(10)
while (src.secondsElectrified>0)
src.secondsElectrified-=1
if(src.secondsElectrified<0)
src.secondsElectrified = 0
sleep(10)
if(6)
//electrify door indefinitely
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
usr << text("The electrification wire has been cut.<br>\n")
else if(src.secondsElectrified==-1)
usr << text("The door is already indefinitely electrified.<br>\n")
else if(src.secondsElectrified!=0)
usr << text("The door is already electrified. You can't re-electrify it while it's already electrified.<br>\n")
else
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
usr << "The door is now electrified."
src.secondsElectrified = -1
if(7)
//open door
if(src.welded)
usr << text("The airlock has been welded shut!")
else if(src.locked)
usr << text("The door bolts are down!")
else if(src.density)
open()
else
close()
if (8)
// Safeties! Maybe we do need some stinking safeties!
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
usr << text("Control to door sensors is disabled.")
else if (!src.safe)
safe = 1
else
usr << text("Firmware reports safeties already in place.")
if(9)
// Door speed control
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
usr << text("Control to door timing circuitry has been severed.")
else if (!src.normalspeed)
normalspeed = 1
else
usr << text("Door timing circuity currently operating normally.")
if(10)
// Bolt lights
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
usr << "The bolt lights wire has been cut - The door bolt lights cannot be enabled."
else if (!src.lights)
lights = 1
usr << "The door bolt lights have been enabled"
else
usr << "The door bolt lights are already enabled!"
if(11)
// Emergency access
if (!src.emergency)
emergency = 1
else
usr << text("Emergency access is already enabled!")
add_fingerprint(usr)
update_icon()
if(!nowindow)
updateUsrDialog()
return 0
return 1
/obj/machinery/door/airlock/attackby(C as obj, mob/user as mob, params)
//world << text("airlock attackby src [] obj [] mob []", src, C, user)
@@ -1119,7 +895,7 @@ About the new airlock wires panel:
if(density)
return 1
operating = 1
door_animate("closing")
do_animate("closing")
src.layer = 3.1
sleep(5)
src.density = 1
+9 -13
View File
@@ -10,7 +10,7 @@
density = 1
layer = 2.7
var/secondsElectrified = 0
var/electrified_until = 0 // World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
var/visible = 1
var/p_open = 0
var/operating = 0
@@ -57,8 +57,9 @@
..()
return
//process()
//return
/obj/machinery/door/process()
if(electrified_until > 0 && world.time > electrified_until)
electrified_until = 0
/obj/machinery/door/Bumped(atom/AM)
if(p_open || operating) return
@@ -184,10 +185,7 @@
if(prob(20/severity) && (istype(src,/obj/machinery/door/airlock) || istype(src,/obj/machinery/door/window)) )
open()
if(prob(40/severity))
if(secondsElectrified == 0)
secondsElectrified = -1
spawn(300)
secondsElectrified = 0
electrified_until = max(electrified_until, world.time + SecondsToTicks(30 / severity))
..()
@@ -213,8 +211,7 @@
icon_state = "door0"
return
/obj/machinery/door/proc/door_animate(animation)
/obj/machinery/door/proc/do_animate(animation)
switch(animation)
if("opening")
if(p_open)
@@ -228,8 +225,7 @@
flick("doorc1", src)
if("deny")
flick("door_deny", src)
return
return
/obj/machinery/door/proc/open()
if(!density)
@@ -240,7 +236,7 @@
return 0
if(!operating) operating = 1
door_animate("opening")
do_animate("opening")
icon_state = "door0"
src.SetOpacity(0)
sleep(5)
@@ -270,7 +266,7 @@
return
operating = 1
door_animate("closing")
do_animate("closing")
explosion_resistance = initial(explosion_resistance)
src.layer = 3.1
sleep(5)
+8 -12
View File
@@ -391,17 +391,6 @@
latetoggle()
layer = 2.6
/obj/machinery/door/firedoor/door_animate(animation)
switch(animation)
if("opening")
flick("door_opening", src)
if("closing")
flick("door_closing", src)
return
/obj/machinery/door/firedoor/update_icon()
overlays = 0
if(density)
@@ -423,7 +412,14 @@
overlays += "welded_open"
return
/obj/machinery/door/firedoor/do_animate(animation)
switch(animation)
if("opening")
flick("door_opening", src)
if("closing")
flick("door_closing", src)
return
/obj/machinery/door/firedoor/border_only
//These are playing merry hell on ZAS. Sorry fellas :(
/*
+28
View File
@@ -82,6 +82,34 @@
/atom/proc/visible_message(var/message, var/blind_message)
for(var/mob/M in viewers(src))
M.show_message( message, 1, blind_message, 2)
// Show a message to all mobs in earshot of this one
// This would be for audible actions by the src mob
// message is the message output to anyone who can hear.
// self_message (optional) is what the src mob hears.
// deaf_message (optional) is what deaf people will see.
// hearing_distance (optional) is the range, how many tiles away the message can be heard.
/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message)
var/range = 7
if(hearing_distance)
range = hearing_distance
var/msg = message
for(var/mob/M in get_mobs_in_view(range, src))
if(self_message && M==src)
msg = self_message
M.show_message( msg, 2, deaf_message, 1)
// Show a message to all mobs in earshot of this atom
// Use for objects performing audible actions
// message is the message output to anyone who can hear.
// deaf_message (optional) is what deaf people will see.
// hearing_distance (optional) is the range, how many tiles away the message can be heard.
/atom/proc/audible_message(var/message, var/deaf_message, var/hearing_distance)
var/range = 7
if(hearing_distance)
range = hearing_distance
for(var/mob/M in get_mobs_in_view(range, src))
M.show_message( message, 2, deaf_message, 1)
/mob/proc/findname(msg)
for(var/mob/M in mob_list)