Fixes AI door hotkeys & other weirdness

This commit is contained in:
AnturK
2017-11-15 09:02:13 +01:00
committed by CitadelStationBot
parent 809951c56c
commit 13ebff97df
4 changed files with 122 additions and 72 deletions

View File

@@ -138,36 +138,35 @@
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors
if(emagged)
return
if(locked)
Topic("aiEnable=4", list("aiEnable"="4"), 1)// 1 meaning no window (consistency!)
bolt_raise(usr)
else
Topic("aiDisable=4", list("aiDisable"="4"), 1)
bolt_drop(usr)
/obj/machinery/door/airlock/AIAltClick() // Eletrifies doors.
if(emagged)
return
if(!secondsElectrified)
// permanent shock
Topic("aiEnable=6", list("aiEnable"="6"), 1) // 1 meaning no window (consistency!)
shock_perm(usr)
else
// disable/6 is not in Topic; disable/5 disables both temporary and permenant shock
Topic("aiDisable=5", list("aiDisable"="5"), 1)
shock_restore(usr)
/obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors!
if(emagged)
return
if(density)
Topic("aiEnable=7", list("aiEnable"="7"), 1) // 1 meaning no window (consistency!)
else
Topic("aiDisable=7", list("aiDisable"="7"), 1)
user_toggle_open(usr)
/obj/machinery/door/airlock/AICtrlShiftClick() // Sets/Unsets Emergency Access Override
if(emagged)
return
if(!emergency)
Topic("aiEnable=11", list("aiEnable"="11"), 1) // 1 meaning no window (consistency!)
emergency_on(usr)
else
Topic("aiDisable=11", list("aiDisable"="11"), 1)
emergency_off(usr)
/* APC */
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.

View File

@@ -1371,6 +1371,8 @@
power["backup_timeleft"] = src.secondsBackupPowerLost
data["power"] = power
data["density"] = density
data["welded"] = welded
data["shock"] = secondsElectrified == 0 ? 2 : 0
data["shock_timeleft"] = secondsElectrified
data["id_scanner"] = !aiDisabledIdScanner
@@ -1398,7 +1400,7 @@
/obj/machinery/door/airlock/ui_act(action, params)
if(..())
return
if(!(issilicon(usr) && src.canAIControl(usr)) || IsAdminGhost(usr))
if(!user_allowed(usr))
return
switch(action)
if("disrupt-main")
@@ -1416,26 +1418,13 @@
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)
shock_restore(usr)
. = 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)
shock_temp(usr)
. = 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)
shock_perm(usr)
. = TRUE
if("idscan-on")
if(wires.is_cut(WIRE_IDSCAN))
@@ -1454,39 +1443,20 @@
aiDisabledIdScanner = TRUE
. = TRUE
if("emergency-on")
if (!src.emergency)
emergency = TRUE
update_icon()
else
to_chat(usr, text("Emergency access is already enabled!"))
emergency_on(usr)
. = TRUE
if("emergency-off")
if (emergency)
emergency = FALSE
update_icon()
else
to_chat(usr, text("Emergency access is already disabled!"))
emergency_off(usr)
. = 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"))
bolt_raise(usr)
. = 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()
bolt_drop(usr)
. = TRUE
if("light-on")
if(wires.is_cut(WIRE_LIGHT))
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
to_chat(usr, "Control to door bolt lights has been severed.")
else if (!src.lights)
lights = TRUE
update_icon()
@@ -1495,58 +1465,131 @@
. = TRUE
if("light-off")
if(wires.is_cut(WIRE_LIGHT))
to_chat(usr, text("Control to door bolt lights has been severed.</a>"))
to_chat(usr, "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!"))
to_chat(usr, "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."))
to_chat(usr, "Control to door sensors is disabled.")
else if (!src.safe)
safe = TRUE
else
to_chat(usr, text("Firmware reports safeties already in place."))
to_chat(usr, "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."))
to_chat(usr, "Control to door sensors is disabled.")
else if (safe)
safe = FALSE
else
to_chat(usr, text("Firmware reports safeties already overriden."))
to_chat(usr, "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."))
to_chat(usr, "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."))
to_chat(usr,"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."))
to_chat(usr, "Control to door timing circuitry has been severed.")
else if (normalspeed)
normalspeed = 0
else
to_chat(usr, text("Door timing circuitry already accelerated."))
to_chat(usr, "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()
user_toggle_open(usr)
. = TRUE
/obj/machinery/door/airlock/proc/user_allowed(mob/user)
return (issilicon(user) && canAIControl(user)) || IsAdminGhost(user)
/obj/machinery/door/airlock/proc/shock_restore(mob/user)
if(!user_allowed(user))
return
if(wires.is_cut(WIRE_SHOCK))
to_chat(user, "Can't un-electrify the airlock - The electrification wire is cut.")
else if(isElectrified())
set_electrified(0)
/obj/machinery/door/airlock/proc/shock_temp(mob/user)
if(!user_allowed(user))
return
if(wires.is_cut(WIRE_SHOCK))
to_chat(user, "The electrification wire has been cut")
else
shockedby += "\[[time_stamp()]\][user](ckey:[user.ckey])"
add_logs(user, src, "electrified")
set_electrified(AI_ELECTRIFY_DOOR_TIME)
/obj/machinery/door/airlock/proc/shock_perm(mob/user)
if(!user_allowed(user))
return
if(wires.is_cut(WIRE_SHOCK))
to_chat(user, "The electrification wire has been cut")
else
shockedby += text("\[[time_stamp()]\][user](ckey:[user.ckey])")
add_logs(user, src, "electrified")
set_electrified(ELECTRIFIED_PERMANENT)
/obj/machinery/door/airlock/proc/emergency_on(mob/user)
if(!user_allowed(user))
return
if (!emergency)
emergency = TRUE
update_icon()
else
to_chat(user, "Emergency access is already enabled!")
/obj/machinery/door/airlock/proc/emergency_off(mob/user)
if(!user_allowed(user))
return
if (emergency)
emergency = FALSE
update_icon()
else
to_chat(user, "Emergency access is already disabled!")
/obj/machinery/door/airlock/proc/bolt_raise(mob/user)
if(!user_allowed(user))
return
if(wires.is_cut(WIRE_BOLTS))
to_chat(user, "The door bolt drop wire is cut - you can't raise the door bolts")
else if(!src.locked)
to_chat(user, "The door bolts are already up")
else
if(src.hasPower())
unbolt()
else
to_chat(user, "Cannot raise door bolts due to power failure")
/obj/machinery/door/airlock/proc/bolt_drop(mob/user)
if(!user_allowed(user))
return
if(wires.is_cut(WIRE_BOLTS))
to_chat(user, "You can't drop the door bolts - The door bolt dropping wire has been cut.")
else
bolt()
/obj/machinery/door/airlock/proc/user_toggle_open(mob/user)
if(!user_allowed(user))
return
if(welded)
to_chat(user, text("The airlock has been welded shut!"))
else if(locked)
to_chat(user, text("The door bolts are down!"))
else if(!density)
close()
else
open()
#undef AIRLOCK_CLOSED
#undef AIRLOCK_CLOSING

File diff suppressed because one or more lines are too long

View File

@@ -66,6 +66,14 @@ component.exports = {
</ui-section>
</ui-display>
<ui-display title='Access & Door Control'>
<ui-section label='Open'>
{{#if data.welded}}
[ <span class="bad">Door has been welded</span> ]
{{/if}}
<div style='float:right'>
<ui-button icon='sign-out' action='open-close' style='{{data.density ? "selected" : ""}}'>Toggle</ui-button>
</div>
</ui-section>
<ui-section label='ID Scan'>
{{#if !data.wires.id_scanner}}
[ <span class="bad">Wires have been cut</span> ]