Update AI Airlock UI to use TGUI
This commit is contained in:
committed by
CitadelStationBot
parent
4afc4f5b39
commit
d486d784ad
@@ -39,8 +39,7 @@
|
||||
|
||||
#define NOT_ELECTRIFIED 0
|
||||
#define ELECTRIFIED_PERMANENT -1
|
||||
|
||||
|
||||
#define AI_ELECTRIFY_DOOR_TIME 30
|
||||
|
||||
/obj/machinery/door/airlock
|
||||
name = "airlock"
|
||||
@@ -68,7 +67,7 @@
|
||||
var/justzap = FALSE
|
||||
normalspeed = 1
|
||||
var/obj/item/electronics/airlock/electronics = null
|
||||
var/hasShocked = FALSE //Prevents multiple shocks from happening
|
||||
var/shockCooldown = FALSE //Prevents multiple shocks from happening
|
||||
autoclose = TRUE
|
||||
var/obj/item/device/doorCharge/charge = null //If applied, causes an explosion upon opening the door
|
||||
var/obj/item/note //Any papers pinned to the airlock
|
||||
@@ -364,6 +363,9 @@
|
||||
/obj/machinery/door/airlock/proc/loseBackupPower()
|
||||
if(src.secondsBackupPowerLost < 60)
|
||||
src.secondsBackupPowerLost = 60
|
||||
if(!spawnPowerRestoreRunning)
|
||||
spawnPowerRestoreRunning = TRUE
|
||||
INVOKE_ASYNC(src, .proc/handlePowerRestore)
|
||||
|
||||
/obj/machinery/door/airlock/proc/regainBackupPower()
|
||||
if(src.secondsBackupPowerLost > 0)
|
||||
@@ -375,14 +377,14 @@
|
||||
/obj/machinery/door/airlock/proc/shock(mob/user, prb)
|
||||
if(!hasPower()) // unpowered, no shock
|
||||
return FALSE
|
||||
if(hasShocked > world.time)
|
||||
if(shockCooldown > world.time)
|
||||
return FALSE //Already shocked someone recently?
|
||||
if(!prob(prb))
|
||||
return FALSE //you lucked out, no shock for you
|
||||
do_sparks(5, TRUE, src)
|
||||
var/tmp/check_range = TRUE
|
||||
if(electrocute_mob(user, get_area(src), src, 1, check_range))
|
||||
hasShocked = world.time + 10
|
||||
shockCooldown = world.time + 10
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
@@ -612,110 +614,7 @@
|
||||
to_chat(user, "<span class='warning'>Unable to interface. Airlock control panel damaged.</span>")
|
||||
return
|
||||
|
||||
//Separate interface for the AI.
|
||||
user.set_machine(src)
|
||||
var/t1 = text("<B>Airlock Control</B><br>\n")
|
||||
if(src.secondsMainPowerLost > 0)
|
||||
if(!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_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.")
|
||||
|
||||
if(src.secondsBackupPowerLost > 0)
|
||||
if(!wires.is_cut(WIRE_BACKUP1) && !wires.is_cut(WIRE_BACKUP2))
|
||||
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"
|
||||
|
||||
if(wires.is_cut(WIRE_IDSCAN))
|
||||
t1 += text("IdScan wire is cut.<br>\n")
|
||||
else if(src.aiDisabledIdScanner)
|
||||
t1 += "IdScan disabled. <A href='?src=[REF(src)];aiEnable=1'>Enable?</a><br>\n"
|
||||
else
|
||||
t1 += "IdScan enabled. <A href='?src=[REF(src)];aiDisable=1'>Disable?</a><br>\n"
|
||||
|
||||
if(src.emergency)
|
||||
t1 += "Emergency Access Override is enabled. <A href='?src=[REF(src)];aiDisable=11'>Disable?</a><br>\n"
|
||||
else
|
||||
t1 += "Emergency Access Override is disabled. <A href='?src=[REF(src)];aiEnable=11'>Enable?</a><br>\n"
|
||||
|
||||
if(wires.is_cut(WIRE_POWER1))
|
||||
t1 += text("Main Power Input wire is cut.<br>\n")
|
||||
if(wires.is_cut(WIRE_POWER2))
|
||||
t1 += text("Main Power Output wire is cut.<br>\n")
|
||||
if(!secondsMainPowerLost)
|
||||
t1 += "<A href='?src=[REF(src)];aiDisable=2'>Temporarily disrupt main power?</a>.<br>\n"
|
||||
if(!secondsBackupPowerLost)
|
||||
t1 += "<A href='?src=[REF(src)];aiDisable=3'>Temporarily disrupt backup power?</a>.<br>\n"
|
||||
|
||||
if(wires.is_cut(WIRE_BACKUP1))
|
||||
t1 += text("Backup Power Input wire is cut.<br>\n")
|
||||
if(wires.is_cut(WIRE_BACKUP2))
|
||||
t1 += text("Backup Power Output wire is cut.<br>\n")
|
||||
|
||||
if(wires.is_cut(WIRE_BOLTS))
|
||||
t1 += text("Door bolt drop wire is cut.<br>\n")
|
||||
else if(!src.locked)
|
||||
t1 += "Door bolts are up. <A href='?src=[REF(src)];aiDisable=4'>Drop them?</a><br>\n"
|
||||
else
|
||||
t1 += text("Door bolts are down.")
|
||||
if(src.hasPower())
|
||||
t1 += " <A href='?src=[REF(src)];aiEnable=4'>Raise?</a><br>\n"
|
||||
else
|
||||
t1 += text(" Cannot raise door bolts due to power failure.<br>\n")
|
||||
|
||||
if(wires.is_cut(WIRE_LIGHT))
|
||||
t1 += text("Door bolt lights wire is cut.<br>\n")
|
||||
else if(!src.lights)
|
||||
t1 += "Door bolt lights are off. <A href='?src=[REF(src)];aiEnable=10'>Enable?</a><br>\n"
|
||||
else
|
||||
t1 += "Door bolt lights are on. <A href='?src=[REF(src)];aiDisable=10'>Disable?</a><br>\n"
|
||||
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
t1 += text("Electrification wire is cut.<br>\n")
|
||||
if(secondsElectrified==ELECTRIFIED_PERMANENT)
|
||||
t1 += "Door is electrified indefinitely. <A href='?src=[REF(src)];aiDisable=5'>Un-electrify it?</a><br>\n"
|
||||
else if(secondsElectrified>NOT_ELECTRIFIED)
|
||||
t1 += text("Door is electrified temporarily ([] seconds). <A href='?src=[REF(src)];aiDisable=5'>Un-electrify it?</a><br>\n", secondsElectrified)
|
||||
else
|
||||
t1 += "Door is not electrified. <A href='?src=[REF(src)];aiEnable=5'>Electrify it for 30 seconds?</a> Or, <A href='?src=[REF(src)];aiEnable=6'>Electrify it indefinitely until someone cancels the electrification?</a><br>\n"
|
||||
|
||||
if(wires.is_cut(WIRE_SAFETY))
|
||||
t1 += text("Door force sensors not responding.</a><br>\n")
|
||||
else if(src.safe)
|
||||
t1 += "Door safeties operating normally. <A href='?src=[REF(src)];aiDisable=8'>Override?</a><br>\n"
|
||||
else
|
||||
t1 += "Danger. Door safeties disabled. <A href='?src=[REF(src)];aiEnable=8'>Restore?</a><br>\n"
|
||||
|
||||
if(wires.is_cut(WIRE_TIMING))
|
||||
t1 += text("Door timing circuitry not responding.</a><br>\n")
|
||||
else if(src.normalspeed)
|
||||
t1 += "Door timing circuitry operating normally. <A href='?src=[REF(src)];aiDisable=9'>Override?</a><br>\n"
|
||||
else
|
||||
t1 += "Warning. Door timing circuitry operating abnormally. <A href='?src=[REF(src)];aiEnable=9'>Restore?</a><br>\n"
|
||||
|
||||
if(src.welded)
|
||||
t1 += text("Door appears to have been welded shut.<br>\n")
|
||||
else if(!src.locked)
|
||||
if(src.density)
|
||||
t1 += "<A href='?src=[REF(src)];aiEnable=7'>Open door</a><br>\n"
|
||||
else
|
||||
t1 += "<A href='?src=[REF(src)];aiDisable=7'>Close door</a><br>\n"
|
||||
|
||||
t1 += "<p><a href='?src=[REF(src)];close=1'>Close</a></p>\n"
|
||||
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, 11 lift access override
|
||||
//aiEnable - 1 idscan, 4 raise door bolts, 5 electrify door for 30 seconds, 6 electrify door indefinitely, 7 open door, 11 enable access override
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/door/airlock/proc/hack(mob/user)
|
||||
set waitfor = 0
|
||||
@@ -802,11 +701,18 @@
|
||||
|
||||
/obj/machinery/door/airlock/proc/electrified_loop()
|
||||
while (secondsElectrified > 0)
|
||||
secondsElectrified--
|
||||
if(secondsElectrified <= 0)
|
||||
set_electrified(NOT_ELECTRIFIED)
|
||||
updateUsrDialog()
|
||||
sleep(10)
|
||||
sleep(10)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
|
||||
secondsElectrified -= 1
|
||||
updateDialog()
|
||||
// This is to protect against changing to permanent, mid loop.
|
||||
if(secondsElectrified==0)
|
||||
set_electrified(NOT_ELECTRIFIED)
|
||||
else
|
||||
set_electrified(ELECTRIFIED_PERMANENT)
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/door/airlock/Topic(href, href_list, var/nowindow = 0)
|
||||
// If you add an if(..()) check you must first remove the var/nowindow parameter.
|
||||
@@ -816,206 +722,16 @@
|
||||
if(!usr.canUseTopic(src) && !IsAdminGhost(usr))
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=airlock")
|
||||
if(usr.machine==src)
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
if((in_range(src, usr) && isturf(loc)) && panel_open)
|
||||
usr.set_machine(src)
|
||||
|
||||
|
||||
|
||||
if((issilicon(usr) && src.canAIControl(usr)) || IsAdminGhost(usr))
|
||||
//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(href_list["aiDisable"])
|
||||
var/code = text2num(href_list["aiDisable"])
|
||||
switch (code)
|
||||
if(1)
|
||||
//disable idscan
|
||||
if(wires.is_cut(WIRE_IDSCAN))
|
||||
to_chat(usr, "The IdScan wire has been cut - So, you can't disable it, but it is already disabled anyways.")
|
||||
else if(src.aiDisabledIdScanner)
|
||||
to_chat(usr, "You've already disabled the IdScan feature.")
|
||||
else
|
||||
aiDisabledIdScanner = TRUE
|
||||
if(2)
|
||||
//disrupt main power
|
||||
if(!secondsMainPowerLost)
|
||||
src.loseMainPower()
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "Main power is already offline.")
|
||||
if(3)
|
||||
//disrupt backup power
|
||||
if(!secondsBackupPowerLost)
|
||||
src.loseBackupPower()
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "Backup power is already offline.")
|
||||
if(4)
|
||||
//drop door bolts
|
||||
if(wires.is_cut(WIRE_BOLTS))
|
||||
to_chat(usr, "You can't drop the door bolts - The door bolt dropping wire has been cut.")
|
||||
else
|
||||
bolt()
|
||||
if(5)
|
||||
//un-electrify door
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("Can't un-electrify the airlock - The electrification wire is cut."))
|
||||
else if(isElectrified())
|
||||
set_electrified(0)
|
||||
|
||||
if(8)
|
||||
// Safeties! We don't need no stinking safeties!
|
||||
if(wires.is_cut(WIRE_SAFETY))
|
||||
to_chat(usr, text("Control to door sensors is disabled."))
|
||||
else if (src.safe)
|
||||
safe = FALSE
|
||||
else
|
||||
to_chat(usr, text("Firmware reports safeties already overriden."))
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(wires.is_cut(WIRE_TIMING))
|
||||
to_chat(usr, text("Control to door timing circuitry has been severed."))
|
||||
else if (src.normalspeed)
|
||||
normalspeed = 0
|
||||
else
|
||||
to_chat(usr, text("Door timing circuitry already accelerated."))
|
||||
if(7)
|
||||
//close door
|
||||
if(src.welded)
|
||||
to_chat(usr, text("The airlock has been welded shut!"))
|
||||
else if(src.locked)
|
||||
to_chat(usr, text("The door bolts are down!"))
|
||||
else if(!src.density)
|
||||
close()
|
||||
else
|
||||
open()
|
||||
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(wires.is_cut(WIRE_LIGHT))
|
||||
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
|
||||
else if (src.lights)
|
||||
lights = FALSE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Door bolt lights are already disabled!"))
|
||||
|
||||
if(11)
|
||||
// Emergency access
|
||||
if (src.emergency)
|
||||
emergency = FALSE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(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(wires.is_cut(WIRE_IDSCAN))
|
||||
to_chat(usr, "You can't enable IdScan - The IdScan wire has been cut.")
|
||||
else if(src.aiDisabledIdScanner)
|
||||
aiDisabledIdScanner = FALSE
|
||||
else
|
||||
to_chat(usr, "The IdScan feature is not disabled.")
|
||||
if(4)
|
||||
//raise door bolts
|
||||
if(wires.is_cut(WIRE_BOLTS))
|
||||
to_chat(usr, text("The door bolt drop wire is cut - you can't raise the door bolts.<br>\n"))
|
||||
else if(!src.locked)
|
||||
to_chat(usr, text("The door bolts are already up.<br>\n"))
|
||||
else
|
||||
if(src.hasPower())
|
||||
unbolt()
|
||||
else
|
||||
to_chat(usr, text("Cannot raise door bolts due to power failure.<br>\n"))
|
||||
|
||||
if(5)
|
||||
//electrify door for 30 seconds
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("The electrification wire has been cut.<br>\n"))
|
||||
else if(secondsElectrified==ELECTRIFIED_PERMANENT)
|
||||
to_chat(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(isElectrified())
|
||||
to_chat(usr, text("The door is already electrified. You can't re-electrify it while it's already electrified.<br>\n"))
|
||||
else
|
||||
shockedby += "\[[time_stamp()]\][usr](ckey:[usr.ckey])"
|
||||
add_logs(usr, src, "electrified")
|
||||
set_electrified(30)
|
||||
addtimer(CALLBACK(src, .proc/electrified_loop), 10)
|
||||
if(6)
|
||||
//electrify door indefinitely
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("The electrification wire has been cut.<br>\n"))
|
||||
else if(secondsElectrified==ELECTRIFIED_PERMANENT)
|
||||
to_chat(usr, text("The door is already indefinitely electrified.<br>\n"))
|
||||
else if(isElectrified())
|
||||
to_chat(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])")
|
||||
add_logs(usr, src, "electrified")
|
||||
set_electrified(ELECTRIFIED_PERMANENT)
|
||||
|
||||
if (8) // Not in order >.>
|
||||
// Safeties! Maybe we do need some stinking safeties!
|
||||
if(wires.is_cut(WIRE_SAFETY))
|
||||
to_chat(usr, text("Control to door sensors is disabled."))
|
||||
else if (!src.safe)
|
||||
safe = TRUE
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
to_chat(usr, text("Firmware reports safeties already in place."))
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(wires.is_cut(WIRE_TIMING))
|
||||
to_chat(usr, text("Control to door timing circuitry has been severed."))
|
||||
else if (!src.normalspeed)
|
||||
normalspeed = 1
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
to_chat(usr, text("Door timing circuitry currently operating normally."))
|
||||
|
||||
if(7)
|
||||
//open door
|
||||
if(src.welded)
|
||||
to_chat(usr, text("The airlock has been welded shut!"))
|
||||
else if(src.locked)
|
||||
to_chat(usr, text("The door bolts are down!"))
|
||||
else if(src.density)
|
||||
open()
|
||||
else
|
||||
close()
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(wires.is_cut(WIRE_LIGHT))
|
||||
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
|
||||
else if (!src.lights)
|
||||
lights = TRUE
|
||||
update_icon()
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
to_chat(usr, text("Door bolt lights are already enabled!"))
|
||||
if(11)
|
||||
// Emergency access
|
||||
if (!src.emergency)
|
||||
emergency = TRUE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Emergency access is already enabled!"))
|
||||
|
||||
add_fingerprint(usr)
|
||||
if(!nowindow)
|
||||
updateUsrDialog()
|
||||
else
|
||||
updateDialog()
|
||||
|
||||
|
||||
/obj/machinery/door/airlock/attackby(obj/item/C, mob/user, params)
|
||||
if(!issilicon(user) && !IsAdminGhost(user))
|
||||
@@ -1571,6 +1287,8 @@
|
||||
/obj/machinery/door/airlock/proc/set_electrified(seconds)
|
||||
secondsElectrified = seconds
|
||||
diag_hud_set_electrified()
|
||||
if(secondsElectrified > 0)
|
||||
INVOKE_ASYNC(src, .proc/electrified_loop)
|
||||
|
||||
/obj/machinery/door/airlock/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
|
||||
. = ..()
|
||||
@@ -1636,6 +1354,200 @@
|
||||
else if(istype(note, /obj/item/photo))
|
||||
return "photo"
|
||||
|
||||
/obj/machinery/door/airlock/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ai_airlock", name, 550, 430, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/door/airlock/ui_data()
|
||||
var/list/data = list()
|
||||
|
||||
var/list/power = list()
|
||||
power["main"] = src.secondsMainPowerLost ? 0 : 2 // boolean
|
||||
power["main_timeleft"] = src.secondsMainPowerLost
|
||||
power["backup"] = src.secondsBackupPowerLost ? 0 : 2 // boolean
|
||||
power["backup_timeleft"] = src.secondsBackupPowerLost
|
||||
data["power"] = power
|
||||
|
||||
data["shock"] = secondsElectrified == 0 ? 2 : 0
|
||||
data["shock_timeleft"] = secondsElectrified
|
||||
data["id_scanner"] = !aiDisabledIdScanner
|
||||
data["emergency"] = emergency // access
|
||||
data["locked"] = locked // bolted
|
||||
data["lights"] = lights // bolt lights
|
||||
data["safe"] = safe // safeties
|
||||
data["speed"] = normalspeed // safe speed
|
||||
|
||||
var/list/wire = list()
|
||||
wire["main_1"] = !wires.is_cut(WIRE_POWER1)
|
||||
wire["main_2"] = !wires.is_cut(WIRE_POWER2)
|
||||
wire["backup_1"] = !wires.is_cut(WIRE_BACKUP1)
|
||||
wire["backup_2"] = !wires.is_cut(WIRE_BACKUP2)
|
||||
wire["shock"] = !wires.is_cut(WIRE_SHOCK)
|
||||
wire["id_scanner"] = !wires.is_cut(WIRE_IDSCAN)
|
||||
wire["bolts"] = !wires.is_cut(WIRE_BOLTS)
|
||||
wire["lights"] = !wires.is_cut(WIRE_LIGHT)
|
||||
wire["safe"] = !wires.is_cut(WIRE_SAFETY)
|
||||
wire["timing"] = !wires.is_cut(WIRE_TIMING)
|
||||
|
||||
data["wires"] = wire
|
||||
return data
|
||||
|
||||
/obj/machinery/door/airlock/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!(issilicon(usr) && src.canAIControl(usr)) || IsAdminGhost(usr))
|
||||
return
|
||||
switch(action)
|
||||
if("disrupt-main")
|
||||
if(!secondsMainPowerLost)
|
||||
loseMainPower()
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "Main power is already offline.")
|
||||
. = TRUE
|
||||
if("disrupt-backup")
|
||||
if(!secondsBackupPowerLost)
|
||||
loseBackupPower()
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "Backup power is already offline.")
|
||||
. = TRUE
|
||||
if("shock-restore")
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("Can't un-electrify the airlock - The electrification wire is cut."))
|
||||
else if(isElectrified())
|
||||
set_electrified(0)
|
||||
. = TRUE
|
||||
if("shock-temp")
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("The electrification wire has been cut"))
|
||||
else
|
||||
shockedby += "\[[time_stamp()]\][usr](ckey:[usr.ckey])"
|
||||
add_logs(usr, src, "electrified")
|
||||
set_electrified(AI_ELECTRIFY_DOOR_TIME)
|
||||
. = TRUE
|
||||
if("shock-perm")
|
||||
if(wires.is_cut(WIRE_SHOCK))
|
||||
to_chat(usr, text("The electrification wire has been cut"))
|
||||
else
|
||||
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
add_logs(usr, src, "electrified")
|
||||
set_electrified(ELECTRIFIED_PERMANENT)
|
||||
. = TRUE
|
||||
if("idscan-on")
|
||||
if(wires.is_cut(WIRE_IDSCAN))
|
||||
to_chat(usr, "You can't enable IdScan - The IdScan wire has been cut.")
|
||||
else if(src.aiDisabledIdScanner)
|
||||
aiDisabledIdScanner = FALSE
|
||||
else
|
||||
to_chat(usr, "The IdScan feature is not disabled.")
|
||||
. = TRUE
|
||||
if("idscan-off")
|
||||
if(wires.is_cut(WIRE_IDSCAN))
|
||||
to_chat(usr, "The IdScan wire has been cut - So, you can't disable it, but it is already disabled anyways.")
|
||||
else if(aiDisabledIdScanner)
|
||||
to_chat(usr, "You've already disabled the IdScan feature.")
|
||||
else
|
||||
aiDisabledIdScanner = TRUE
|
||||
. = TRUE
|
||||
if("emergency-on")
|
||||
if (!src.emergency)
|
||||
emergency = TRUE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Emergency access is already enabled!"))
|
||||
. = TRUE
|
||||
if("emergency-off")
|
||||
if (emergency)
|
||||
emergency = FALSE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Emergency access is already disabled!"))
|
||||
. = TRUE
|
||||
if("bolt-raise")
|
||||
if(wires.is_cut(WIRE_BOLTS))
|
||||
to_chat(usr, text("The door bolt drop wire is cut - you can't raise the door bolts"))
|
||||
else if(!src.locked)
|
||||
to_chat(usr, text("The door bolts are already up"))
|
||||
else
|
||||
if(src.hasPower())
|
||||
unbolt()
|
||||
else
|
||||
to_chat(usr, text("Cannot raise door bolts due to power failure"))
|
||||
. = TRUE
|
||||
if("bolt-drop")
|
||||
if(wires.is_cut(WIRE_BOLTS))
|
||||
to_chat(usr, "You can't drop the door bolts - The door bolt dropping wire has been cut.")
|
||||
else
|
||||
bolt()
|
||||
. = TRUE
|
||||
if("light-on")
|
||||
if(wires.is_cut(WIRE_LIGHT))
|
||||
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
|
||||
else if (!src.lights)
|
||||
lights = TRUE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Door bolt lights are already enabled!"))
|
||||
. = TRUE
|
||||
if("light-off")
|
||||
if(wires.is_cut(WIRE_LIGHT))
|
||||
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
|
||||
else if (lights)
|
||||
lights = FALSE
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, text("Door bolt lights are already disabled!"))
|
||||
. = TRUE
|
||||
if("safe-on")
|
||||
if(wires.is_cut(WIRE_SAFETY))
|
||||
to_chat(usr, text("Control to door sensors is disabled."))
|
||||
else if (!src.safe)
|
||||
safe = TRUE
|
||||
else
|
||||
to_chat(usr, text("Firmware reports safeties already in place."))
|
||||
. = TRUE
|
||||
if("safe-off")
|
||||
if(wires.is_cut(WIRE_SAFETY))
|
||||
to_chat(usr, text("Control to door sensors is disabled."))
|
||||
else if (safe)
|
||||
safe = FALSE
|
||||
else
|
||||
to_chat(usr, text("Firmware reports safeties already overriden."))
|
||||
. = TRUE
|
||||
if("speed-on")
|
||||
if(wires.is_cut(WIRE_TIMING))
|
||||
to_chat(usr, text("Control to door timing circuitry has been severed."))
|
||||
else if (!src.normalspeed)
|
||||
normalspeed = 1
|
||||
else
|
||||
to_chat(usr, text("Door timing circuitry currently operating normally."))
|
||||
. = TRUE
|
||||
if("speed-off")
|
||||
if(wires.is_cut(WIRE_TIMING))
|
||||
to_chat(usr, text("Control to door timing circuitry has been severed."))
|
||||
else if (normalspeed)
|
||||
normalspeed = 0
|
||||
else
|
||||
to_chat(usr, text("Door timing circuitry already accelerated."))
|
||||
|
||||
. = TRUE
|
||||
if("open-close")
|
||||
if(welded)
|
||||
to_chat(usr, text("The airlock has been welded shut!"))
|
||||
else if(locked)
|
||||
to_chat(usr, text("The door bolts are down!"))
|
||||
else if(!density)
|
||||
close()
|
||||
else
|
||||
open()
|
||||
. = TRUE
|
||||
|
||||
|
||||
|
||||
#undef AIRLOCK_CLOSED
|
||||
#undef AIRLOCK_CLOSING
|
||||
#undef AIRLOCK_OPEN
|
||||
@@ -1658,3 +1570,4 @@
|
||||
|
||||
#undef NOT_ELECTRIFIED
|
||||
#undef ELECTRIFIED_PERMANENT
|
||||
#undef AI_ELECTRIFY_DOOR_TIME
|
||||
|
||||
Reference in New Issue
Block a user