diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 817b8b1cae..02e87cdd59 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -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, "Unable to interface. Airlock control panel damaged.")
return
- //Separate interface for the AI.
- user.set_machine(src)
- var/t1 = text("Airlock Control
\n")
- if(src.secondsMainPowerLost > 0)
- if(!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2))
- t1 += text("Main power is offline for [] seconds.
\n", src.secondsMainPowerLost)
- else
- t1 += text("Main power is offline indefinitely.
\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.
\n", src.secondsBackupPowerLost)
- else
- t1 += text("Backup power is offline indefinitely.
\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 += "
\n"
-
- if(wires.is_cut(WIRE_IDSCAN))
- t1 += text("IdScan wire is cut.
\n")
- else if(src.aiDisabledIdScanner)
- t1 += "IdScan disabled. Enable?
\n"
- else
- t1 += "IdScan enabled. Disable?
\n"
-
- if(src.emergency)
- t1 += "Emergency Access Override is enabled. Disable?
\n"
- else
- t1 += "Emergency Access Override is disabled. Enable?
\n"
-
- if(wires.is_cut(WIRE_POWER1))
- t1 += text("Main Power Input wire is cut.
\n")
- if(wires.is_cut(WIRE_POWER2))
- t1 += text("Main Power Output wire is cut.
\n")
- if(!secondsMainPowerLost)
- t1 += "Temporarily disrupt main power?.
\n"
- if(!secondsBackupPowerLost)
- t1 += "Temporarily disrupt backup power?.
\n"
-
- if(wires.is_cut(WIRE_BACKUP1))
- t1 += text("Backup Power Input wire is cut.
\n")
- if(wires.is_cut(WIRE_BACKUP2))
- t1 += text("Backup Power Output wire is cut.
\n")
-
- if(wires.is_cut(WIRE_BOLTS))
- t1 += text("Door bolt drop wire is cut.
\n")
- else if(!src.locked)
- t1 += "Door bolts are up. Drop them?
\n"
- else
- t1 += text("Door bolts are down.")
- if(src.hasPower())
- t1 += " Raise?
\n"
- else
- t1 += text(" Cannot raise door bolts due to power failure.
\n")
-
- if(wires.is_cut(WIRE_LIGHT))
- t1 += text("Door bolt lights wire is cut.
\n")
- else if(!src.lights)
- t1 += "Door bolt lights are off. Enable?
\n"
- else
- t1 += "Door bolt lights are on. Disable?
\n"
-
- if(wires.is_cut(WIRE_SHOCK))
- t1 += text("Electrification wire is cut.
\n")
- if(secondsElectrified==ELECTRIFIED_PERMANENT)
- t1 += "Door is electrified indefinitely. Un-electrify it?
\n"
- else if(secondsElectrified>NOT_ELECTRIFIED)
- t1 += text("Door is electrified temporarily ([] seconds). Un-electrify it?
\n", secondsElectrified)
- else
- t1 += "Door is not electrified. Electrify it for 30 seconds? Or, Electrify it indefinitely until someone cancels the electrification?
\n"
-
- if(wires.is_cut(WIRE_SAFETY))
- t1 += text("Door force sensors not responding.
\n")
- else if(src.safe)
- t1 += "Door safeties operating normally. Override?
\n"
- else
- t1 += "Danger. Door safeties disabled. Restore?
\n"
-
- if(wires.is_cut(WIRE_TIMING))
- t1 += text("Door timing circuitry not responding.
\n")
- else if(src.normalspeed)
- t1 += "Door timing circuitry operating normally. Override?
\n"
- else
- t1 += "Warning. Door timing circuitry operating abnormally. Restore?
\n"
-
- if(src.welded)
- t1 += text("Door appears to have been welded shut.
\n")
- else if(!src.locked)
- if(src.density)
- t1 += "Open door
\n"
- else
- t1 += "Close door
\n"
-
- t1 += "
Close
\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."))
- 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.
\n"))
- else if(!src.locked)
- to_chat(usr, text("The door bolts are already up.
\n"))
- else
- if(src.hasPower())
- unbolt()
- else
- to_chat(usr, text("Cannot raise door bolts due to power failure.
\n"))
-
- if(5)
- //electrify door for 30 seconds
- if(wires.is_cut(WIRE_SHOCK))
- to_chat(usr, text("The electrification wire has been cut.
\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.
\n"))
- else if(isElectrified())
- to_chat(usr, text("The door is already electrified. You can't re-electrify it while it's already electrified.
\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.
\n"))
- else if(secondsElectrified==ELECTRIFIED_PERMANENT)
- to_chat(usr, text("The door is already indefinitely electrified.
\n"))
- else if(isElectrified())
- to_chat(usr, text("The door is already electrified. You can't re-electrify it while it's already electrified.
\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."))
- 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."))
+ 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."))
+ 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
diff --git a/tgui/package.json b/tgui/package.json
index 47d839193b..007ee04ab9 100644
--- a/tgui/package.json
+++ b/tgui/package.json
@@ -1,6 +1,10 @@
{
"name": "tgui",
"private": true,
+ "scripts": {
+ "build": "gulp --min",
+ "watch": "gulp watch"
+ },
"dependencies": {
"autoprefixer": "6.7.7",
"babel-core": "6.5.2",
diff --git a/tgui/src/components/button.ract b/tgui/src/components/button.ract
index 79e9c54506..bc8640a243 100644
--- a/tgui/src/components/button.ract
+++ b/tgui/src/components/button.ract
@@ -19,7 +19,7 @@
styles () {
let extra = ''
if (this.get('class'))
- extra += ' ' + this.get('class');
+ extra += ' ' + this.get('class');
if (this.get('tooltip-side'))
extra = ` tooltip-${this.get('tooltip-side')}`
if (this.get('grid'))
diff --git a/tgui/src/interfaces/ai_airlock.ract b/tgui/src/interfaces/ai_airlock.ract
new file mode 100644
index 0000000000..2b624ed4ac
--- /dev/null
+++ b/tgui/src/interfaces/ai_airlock.ract
@@ -0,0 +1,121 @@
+
+
+
+
+ {{data.power.main ? "Online" : "Offline"}}
+ {{#if !data.wires.main_1 || !data.wires.main_2}}
+ [ Wires have been cut ]
+ {{else}}
+ {{#if data.power.main_timeleft > 0}}
+ [ {{data.power.main_timeleft}} seconds left ]
+ {{/if}}
+ {{/if}}
+
+ Disrupt
+
+
+
+ {{data.power.backup ? "Online" : "Offline"}}
+ {{#if !data.wires.backup_1 || !data.wires.backup_2}}
+ [ Wires have been cut ]
+ {{else}}
+ {{#if data.power.backup_timeleft > 0}}
+ [ {{data.power.backup_timeleft}} seconds left ]
+ {{/if}}
+ {{/if}}
+
+ Disrupt
+
+
+
+ {{data.shock == 2 ? "Safe" : "Electrified"}}
+ {{#if !data.wires.shock}}
+ [ Wires have been cut ]
+ {{else}}
+ {{#if data.shock_timeleft > 0}}
+ [ {{data.shock_timeleft}} seconds left ]
+ {{/if}}
+ {{#if data.shock_timeleft == -1}}
+ [ Permanent ]
+ {{/if}}
+ {{/if}}
+
+ Restore
+ Set (Temporary)
+ Set (Permanent)
+
+
+
+
+
+ {{#if !data.wires.id_scanner}}
+ [ Wires have been cut ]
+ {{/if}}
+
+ Enabled
+ Disabled
+
+
+
+
+ Enabled
+ Disabled
+
+
+
+
+ {{#if !data.wires.bolts}}
+ [ Wires have been cut ]
+ {{/if}}
+
+ Raised
+ Dropped
+
+
+
+ {{#if !data.wires.lights}}
+ [ Wires have been cut ]
+ {{/if}}
+
+ Enabled
+ Disabled
+
+
+
+ {{#if !data.wires.safe}}
+ [ Wires have been cut ]
+ {{/if}}
+
+ Enabled
+ Disabled
+
+
+
+ {{#if !data.wires.timing}}
+ [ Wires have been cut ]
+ {{/if}}
+
+ Enabled
+ Disabled
+
+
+
diff --git a/tgui/src/tgui.js b/tgui/src/tgui.js
index e85610cd5b..30ae17084d 100644
--- a/tgui/src/tgui.js
+++ b/tgui/src/tgui.js
@@ -14,8 +14,8 @@ Object.assign(Math, require('util/math'))
// inline, or called by the server if it was not.
import TGUI from 'tgui.ract'
window.initialize = (dataString) => {
- if (window.tgui) return // Don't run twice.
- window.tgui = new TGUI({
+ // Don't run twice.
+ window.tgui = window.tgui || new TGUI({
el: '#container',
data () {
const initial = JSON.parse(dataString)