Diagnostic HUDs can see shocked doors

This commit is contained in:
XDTM
2017-02-26 16:54:31 +01:00
parent d4625dbefb
commit 1e7825903c
5 changed files with 34 additions and 15 deletions

View File

@@ -15,8 +15,9 @@
#define DIAG_MECH_HUD "11"// Mech health bar #define DIAG_MECH_HUD "11"// Mech health bar
#define DIAG_BOT_HUD "12"// Bot HUDs #define DIAG_BOT_HUD "12"// Bot HUDs
#define DIAG_TRACK_HUD "13"// Mech tracking beacon #define DIAG_TRACK_HUD "13"// Mech tracking beacon
#define DIAG_AIRLOCK_HUD "14"//Airlock shock overlay
//for antag huds. these are used at the /mob level //for antag huds. these are used at the /mob level
#define ANTAG_HUD "14" #define ANTAG_HUD "15"
//data HUD (medhud, sechud) defines //data HUD (medhud, sechud) defines
//Don't forget to update human/New() if you change these! //Don't forget to update human/New() if you change these!

View File

@@ -78,7 +78,7 @@
A.aiControlDisabled = -1 A.aiControlDisabled = -1
if(WIRE_SHOCK) // Pulse to shock the door for 10 ticks. if(WIRE_SHOCK) // Pulse to shock the door for 10 ticks.
if(!A.secondsElectrified) if(!A.secondsElectrified)
A.secondsElectrified = 30 A.set_electrified(30)
if(usr) if(usr)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])") A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified") add_logs(usr, A, "electrified")
@@ -87,7 +87,7 @@
while (A.secondsElectrified > 0) while (A.secondsElectrified > 0)
A.secondsElectrified -= 1 A.secondsElectrified -= 1
if(A.secondsElectrified < 0) if(A.secondsElectrified < 0)
A.secondsElectrified = 0 A.set_electrified(0)
sleep(10) sleep(10)
if(WIRE_SAFETY) if(WIRE_SAFETY)
A.safe = !A.safe A.safe = !A.safe
@@ -137,10 +137,10 @@
if(WIRE_SHOCK) // Cut to shock the door, mend to unshock. if(WIRE_SHOCK) // Cut to shock the door, mend to unshock.
if(mend) if(mend)
if(A.secondsElectrified) if(A.secondsElectrified)
A.secondsElectrified = 0 A.set_electrified(0)
else else
if(A.secondsElectrified != -1) if(A.secondsElectrified != -1)
A.secondsElectrified = -1 A.set_electrified(-1)
if(usr) if(usr)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])") A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, A, "electrified") add_logs(usr, A, "electrified")

View File

@@ -45,7 +45,7 @@
hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD) hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD)
/datum/atom_hud/data/diagnostic /datum/atom_hud/data/diagnostic
hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD) hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD, DIAG_AIRLOCK_HUD)
/* MED/SEC/DIAG HUD HOOKS */ /* MED/SEC/DIAG HUD HOOKS */
@@ -380,3 +380,13 @@
holder.icon_state = "hudmove" holder.icon_state = "hudmove"
else else
holder.icon_state = "" holder.icon_state = ""
/*~~~~~~~~~~~~
Airlocks!
~~~~~~~~~~~~~*/
/obj/machinery/door/airlock/proc/diag_hud_set_electrified()
var/image/holder = hud_list[DIAG_AIRLOCK_HUD]
if(secondsElectrified != 0)
holder.icon_state = "electrified"
else
holder.icon_state = ""

View File

@@ -87,6 +87,7 @@ var/list/airlock_overlays = list()
var/delayed_close_requested = FALSE // TRUE means the door will automatically close the next time it's opened. var/delayed_close_requested = FALSE // TRUE means the door will automatically close the next time it's opened.
explosion_block = 1 explosion_block = 1
hud_possible = list(DIAG_AIRLOCK_HUD)
/obj/machinery/door/airlock/New() /obj/machinery/door/airlock/New()
..() ..()
@@ -107,6 +108,10 @@ var/list/airlock_overlays = list()
max_integrity = normal_integrity max_integrity = normal_integrity
if(damage_deflection == AIRLOCK_DAMAGE_DEFLECTION_N && security_level > AIRLOCK_SECURITY_METAL) if(damage_deflection == AIRLOCK_DAMAGE_DEFLECTION_N && security_level > AIRLOCK_SECURITY_METAL)
damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R
prepare_huds()
var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC]
diag_hud.add_to_hud(src)
diag_hud_set_electrified()
/obj/machinery/door/airlock/Initialize() /obj/machinery/door/airlock/Initialize()
..() ..()
@@ -759,10 +764,10 @@ var/list/airlock_overlays = list()
//un-electrify door //un-electrify door
if(wires.is_cut(WIRE_SHOCK)) if(wires.is_cut(WIRE_SHOCK))
usr << text("Can't un-electrify the airlock - The electrification wire is cut.") usr << text("Can't un-electrify the airlock - The electrification wire is cut.")
else if(src.secondsElectrified==-1) else if(secondsElectrified==-1)
src.secondsElectrified = 0 set_electrified(0)
else if(src.secondsElectrified>0) else if(secondsElectrified>0)
src.secondsElectrified = 0 set_electrified(0)
if(8) if(8)
// Safeties! We don't need no stinking safeties! // Safeties! We don't need no stinking safeties!
@@ -845,12 +850,12 @@ var/list/airlock_overlays = list()
else else
shockedby += "\[[time_stamp()]\][usr](ckey:[usr.ckey])" shockedby += "\[[time_stamp()]\][usr](ckey:[usr.ckey])"
add_logs(usr, src, "electrified") add_logs(usr, src, "electrified")
src.secondsElectrified = 30 set_electrified(30)
spawn(10) spawn(10)
while (src.secondsElectrified>0) while (src.secondsElectrified>0)
src.secondsElectrified-=1 src.secondsElectrified-=1
if(src.secondsElectrified<0) if(src.secondsElectrified<0)
src.secondsElectrified = 0 set_electrified(0)
src.updateUsrDialog() src.updateUsrDialog()
sleep(10) sleep(10)
if(6) if(6)
@@ -864,7 +869,7 @@ var/list/airlock_overlays = list()
else else
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])") shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
add_logs(usr, src, "electrified") add_logs(usr, src, "electrified")
src.secondsElectrified = -1 set_electrified(-1)
if (8) // Not in order >.> if (8) // Not in order >.>
// Safeties! Maybe we do need some stinking safeties! // Safeties! Maybe we do need some stinking safeties!
@@ -1417,7 +1422,7 @@ var/list/airlock_overlays = list()
safe = FALSE //DOOR CRUSH safe = FALSE //DOOR CRUSH
close() close()
bolt() //Bolt it! bolt() //Bolt it!
secondsElectrified = -1 //Shock it! set_electrified(-1) //Shock it!
if(origin) if(origin)
shockedby += "\[[time_stamp()]\][origin](ckey:[origin.ckey])" shockedby += "\[[time_stamp()]\][origin](ckey:[origin.ckey])"
@@ -1426,7 +1431,7 @@ var/list/airlock_overlays = list()
// Must be powered and have working AI wire. // Must be powered and have working AI wire.
if(canAIControl(src) && !stat) if(canAIControl(src) && !stat)
unbolt() unbolt()
secondsElectrified = 0 set_electrified(0)
open() open()
safe = TRUE safe = TRUE
@@ -1439,6 +1444,9 @@ var/list/airlock_overlays = list()
wires.cut_all() wires.cut_all()
update_icon() update_icon()
/obj/machinery/door/airlock/proc/set_electrified(seconds)
secondsElectrified = seconds
diag_hud_set_electrified()
/obj/machinery/door/airlock/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) /obj/machinery/door/airlock/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
. = ..() . = ..()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB