Merge pull request #12614 from GunHog/Diag_Huds

Diagnostic HUDs
This commit is contained in:
Razharas
2015-10-30 06:25:48 +03:00
18 changed files with 205 additions and 36 deletions
+11 -6
View File
@@ -9,8 +9,12 @@
#define IMPLOYAL_HUD "5" // loyality implant
#define IMPCHEM_HUD "6" // chemical implant
#define IMPTRACK_HUD "7" // tracking implant
#define DIAG_STAT_HUD "8" // Silicon/Mech Status
#define DIAG_HUD "9" // Silicon health bar
#define DIAG_BATT_HUD "10"// Borg/Mech power meter
#define DIAG_MECH_HUD "11"// Mech health bar
//for antag huds. these are used at the /mob level
#define ANTAG_HUD "8"
#define ANTAG_HUD "12"
//data HUD (medhud, sechud) defines
//Don't forget to update human/New() if you change these!
@@ -18,10 +22,11 @@
#define DATA_HUD_SECURITY_ADVANCED 2
#define DATA_HUD_MEDICAL_BASIC 3
#define DATA_HUD_MEDICAL_ADVANCED 4
#define DATA_HUD_DIAGNOSTIC 5
//antag HUD defines
#define ANTAG_HUD_CULT 5
#define ANTAG_HUD_REV 6
#define ANTAG_HUD_OPS 7
#define ANTAG_HUD_CULT 6
#define ANTAG_HUD_REV 7
#define ANTAG_HUD_OPS 8
#define ANTAG_HUD_WIZ 8
#define ANTAG_HUD_SHADOW 9
#define ANTAG_HUD_WIZ 9
#define ANTAG_HUD_SHADOW 10
+7 -5
View File
@@ -2,10 +2,11 @@
//GLOBAL HUD LIST
var/datum/atom_hud/huds = list( \
DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/security/basic(), \
DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/security/advanced(), \
DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/medical/basic(), \
DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/medical/advanced(), \
DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/human/security/basic(), \
DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/human/security/advanced(), \
DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/human/medical/basic(), \
DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/human/medical/advanced(), \
DATA_HUD_DIAGNOSTIC = new/datum/atom_hud/data/diagnostic(), \
ANTAG_HUD_CULT = new/datum/atom_hud/antag(), \
ANTAG_HUD_REV = new/datum/atom_hud/antag(), \
ANTAG_HUD_OPS = new/datum/atom_hud/antag(), \
@@ -50,7 +51,8 @@ var/datum/atom_hud/huds = list( \
if(!M.client)
return
for(var/i in hud_icons)
M.client.images |= A.hud_list[i]
if(A.hud_list[i])
M.client.images |= A.hud_list[i]
//MOB PROCS
/mob/proc/reload_huds()
+90 -13
View File
@@ -7,44 +7,47 @@
/* DATA HUD DATUMS */
/atom/proc/add_to_all_data_huds()
for(var/datum/atom_hud/data/hud in huds) hud.add_to_hud(src)
/atom/proc/add_to_all_human_data_huds()
for(var/datum/atom_hud/data/human/hud in huds) hud.add_to_hud(src)
/atom/proc/remove_from_all_data_huds()
for(var/datum/atom_hud/data/hud in huds) hud.remove_from_hud(src)
/datum/atom_hud/data
/datum/atom_hud/data/medical
/datum/atom_hud/data/human/medical
hud_icons = list(HEALTH_HUD, STATUS_HUD)
/datum/atom_hud/data/medical/basic
/datum/atom_hud/data/human/medical/basic
/datum/atom_hud/data/medical/basic/proc/check_sensors(mob/living/carbon/human/H)
/datum/atom_hud/data/human/medical/basic/proc/check_sensors(mob/living/carbon/human/H)
if(!istype(H)) return 0
var/obj/item/clothing/under/U = H.w_uniform
if(!istype(U)) return 0
if(U.sensor_mode <= 2) return 0
return 1
/datum/atom_hud/data/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H)
/datum/atom_hud/data/human/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H)
if(check_sensors(H))
..()
/datum/atom_hud/data/medical/basic/proc/update_suit_sensors(mob/living/carbon/H)
/datum/atom_hud/data/human/medical/basic/proc/update_suit_sensors(mob/living/carbon/H)
check_sensors(H) ? add_to_hud(H) : remove_from_hud(H)
/datum/atom_hud/data/medical/advanced
/datum/atom_hud/data/human/medical/advanced
/datum/atom_hud/data/security
/datum/atom_hud/data/human/security
/datum/atom_hud/data/security/basic
/datum/atom_hud/data/human/security/basic
hud_icons = list(ID_HUD)
/datum/atom_hud/data/security/advanced
/datum/atom_hud/data/human/security/advanced
hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD)
/* MED/SEC HUD HOOKS */
/datum/atom_hud/data/diagnostic
hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD)
/* MED/SEC/DIAG HUD HOOKS */
/*
* THESE HOOKS SHOULD BE CALLED BY THE MOB SHOWING THE HUD
@@ -90,7 +93,7 @@
//called when a human changes suit sensors
/mob/living/carbon/proc/update_suit_sensors()
var/datum/atom_hud/data/medical/basic/B = huds[DATA_HUD_MEDICAL_BASIC]
var/datum/atom_hud/data/human/medical/basic/B = huds[DATA_HUD_MEDICAL_BASIC]
B.update_suit_sensors(src)
var/turf/T = get_turf(src)
@@ -132,6 +135,7 @@
if(wear_id)
holder.icon_state = "hud[ckey(wear_id.GetJobName())]"
sec_hud_set_security_status()
var/turf/T = get_turf(src)
if (T) crewmonitor.queueUpdate(T.z)
@@ -172,3 +176,76 @@
holder.icon_state = "huddischarged"
return
holder.icon_state = null
/***********************************************
Diagnostic HUDs!
************************************************/
//For Diag health and cell bars!
/proc/RoundDiagBar(value)
switch(value * 100)
if(95 to INFINITY)
return "max"
if(80 to 100)
return "good"
if(60 to 80)
return "high"
if(40 to 60)
return "med"
if(20 to 40)
return "low"
if(1 to 20)
return "crit"
else
return "dead"
return "dead"
//Sillycone hooks
/mob/living/silicon/proc/diag_hud_set_health()
var/image/holder = hud_list[DIAG_HUD]
if(stat == DEAD)
holder.icon_state = "huddiagdead"
else
holder.icon_state = "huddiag[RoundDiagBar(health/maxHealth)]"
/mob/living/silicon/proc/diag_hud_set_status()
var/image/holder = hud_list[DIAG_STAT_HUD]
switch(stat)
if(CONSCIOUS)
holder.icon_state = "hudstat"
if(UNCONSCIOUS)
holder.icon_state = "hudoffline"
else
holder.icon_state = "huddead2"
//Borgie battery tracking!
/mob/living/silicon/robot/proc/diag_hud_set_borgcell()
var/image/holder = hud_list[DIAG_BATT_HUD]
if (cell)
var/chargelvl = (cell.charge/cell.maxcharge)
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
/*~~~~~~~~~~~~~~~~~~~~
BIG STOMPY MECHS
~~~~~~~~~~~~~~~~~~~~~*/
/obj/mecha/proc/diag_hud_set_mechhealth()
var/image/holder = hud_list[DIAG_MECH_HUD]
holder.icon_state = "huddiag[RoundDiagBar(health/initial(health))]"
/obj/mecha/proc/diag_hud_set_mechcell()
var/image/holder = hud_list[DIAG_BATT_HUD]
if (cell)
var/chargelvl = cell.charge/cell.maxcharge
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
/obj/mecha/proc/diag_hud_set_mechstat()
var/image/holder = hud_list[DIAG_STAT_HUD]
holder.icon_state = null
if(internal_damage)
holder.icon_state = "hudwarn"
+15 -2
View File
@@ -76,6 +76,8 @@
var/datum/action/innate/mecha/mech_toggle_lights/lights_action = new
var/datum/action/innate/mecha/mech_view_stats/stats_action = new
hud_possible = list (DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD)
/obj/mecha/New()
..()
@@ -90,6 +92,13 @@
SSobj.processing |= src
log_message("[src.name] created.")
mechas_list += src //global mech list
prepare_huds()
var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC]
diag_hud.add_to_hud(src)
diag_hud_set_mechhealth()
diag_hud_set_mechcell()
diag_hud_set_mechstat()
return
/obj/mecha/Destroy()
@@ -314,7 +323,10 @@
var/lights_energy_drain = 2
use_power(lights_energy_drain)
//Diagnostic HUD updates
diag_hud_set_mechhealth()
diag_hud_set_mechcell()
diag_hud_set_mechstat()
/obj/mecha/proc/drop_item()//Derpfix, but may be useful in future for engineering exosuits.
@@ -482,6 +494,7 @@
internal_damage |= int_dam_flag
log_append_to_last("Internal damage of type [int_dam_flag].",1)
occupant << sound('sound/machines/warning-buzzer.ogg',wait=0)
diag_hud_set_mechstat()
return
/obj/mecha/proc/clearInternalDamage(int_dam_flag)
@@ -494,7 +507,7 @@
if(MECHA_INT_TANK_BREACH)
occupant_message("<span class='boldnotice'>Damaged internal tank has been sealed.</span>")
internal_damage &= ~int_dam_flag
diag_hud_set_mechstat()
/////////////////////////////////////
//////////// AI piloting ////////////
+2 -2
View File
@@ -16,7 +16,7 @@
if(H.glasses && istype(H.glasses, /obj/item/clothing/glasses/hud))
occupant_message("<span class='warning'>Your [H.glasses] prevent you from using the built-in medical hud.</span>")
else
var/datum/atom_hud/data/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED]
var/datum/atom_hud/data/human/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED]
A.add_hud_to(H)
builtin_hud_user = 1
return 1
@@ -26,7 +26,7 @@
/obj/mecha/medical/odysseus/go_out()
if(ishuman(occupant) && builtin_hud_user)
var/mob/living/carbon/human/H = occupant
var/datum/atom_hud/data/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED]
var/datum/atom_hud/data/human/medical/advanced/A = huds[DATA_HUD_MEDICAL_ADVANCED]
A.remove_hud_from(H)
..()
return
+15
View File
@@ -40,6 +40,21 @@
darkness_view = 8
invis_view = SEE_INVISIBLE_MINIMUM
/obj/item/clothing/glasses/hud/diagnostic
name = "Diagnostic HUD"
desc = "A heads-up display capable of analyzing the integrity and status of robotics and exosuits."
icon_state = "diagnostichud"
hud_type = DATA_HUD_DIAGNOSTIC
/obj/item/clothing/glasses/hud/diagnostic/night
name = "Night Vision Diagnostic HUD"
desc = "A robotics diagnostic HUD fitted with a light amplifier."
icon_state = "diagnostichudnight"
item_state = "glasses"
darkness_view = 8
invis_view = SEE_INVISIBLE_MINIMUM
/obj/item/clothing/glasses/hud/security
name = "Security HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and security records."
+14 -4
View File
@@ -314,16 +314,26 @@
icon_state = "hardsuit0-rd"
item_color = "rd"
unacidable = 1
var/onboard_hud_enabled = 0 //stops conflicts with another diag HUD
max_heat_protection_temperature = FIRE_SUIT_MAX_TEMP_PROTECT
armor = list(melee = 10, bullet = 5, laser = 10, energy = 5, bomb = 100, bio = 100, rad = 60)
/obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/user, slot)
user.scanner.Grant(user)
/obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/living/carbon/human/user, slot)
..(user, slot)
user.scanner.Grant(user)
if(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic))
user << ("<span class='warning'>Your [user.glasses] prevents you using [src]'s diagnostic visor HUD.</span>")
else
onboard_hud_enabled = 1
var/datum/atom_hud/DHUD = huds[DATA_HUD_DIAGNOSTIC]
DHUD.add_hud_to(user)
/obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/user)
user.scanner.devices -= 1
/obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/living/carbon/human/user)
..(user)
user.scanner.devices -= 1
if(onboard_hud_enabled && !(user.glasses && istype(user.glasses, /obj/item/clothing/glasses/hud/diagnostic)))
var/datum/atom_hud/DHUD = huds[DATA_HUD_DIAGNOSTIC]
DHUD.remove_hud_from(user)
/obj/item/clothing/suit/space/hardsuit/rd
icon_state = "hardsuit-rd"
@@ -48,7 +48,7 @@
sec_hud_set_implants()
sec_hud_set_security_status()
//...and display them.
add_to_all_data_huds()
add_to_all_human_data_huds()
/mob/living/carbon/human/Destroy()
for(var/atom/movable/organelle in organs)
@@ -39,7 +39,7 @@
//Prepare our med HUD...
..()
//...and display it.
for(var/datum/atom_hud/data/medical/hud in huds)
for(var/datum/atom_hud/data/human/medical/hud in huds)
hud.add_to_hud(src)
/mob/living/carbon/monkey/movement_delay()
@@ -177,3 +177,5 @@
health = maxHealth - getOxyLoss() - getToxLoss() - getBruteLoss()
if(!fire_res_on_core)
health -= getFireLoss()
diag_hud_set_status()
diag_hud_set_health()
@@ -31,6 +31,7 @@
uneq_all()
stat = UNCONSCIOUS
update_headlamp(1)
diag_hud_set_borgcell()
/mob/living/silicon/robot/handle_regular_status_updates()
@@ -44,6 +45,7 @@
if(health <= -maxHealth) //die only once
death()
diag_hud_set_status()
return
if(health < maxHealth*0.5) //Gradual break down of modules as more damage is sustained
@@ -62,6 +64,8 @@
if (paralysis || stunned || weakened) //Stunned etc.
stat = UNCONSCIOUS
update_headlamp()
diag_hud_set_health()
diag_hud_set_status()
return 1
@@ -68,6 +68,7 @@
var/lamp_recharging = 0 //Flag for if the lamp is on cooldown after being forcibly disabled.
var/updating = 0 //portable camera camerachunk update
hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD, DIAG_BATT_HUD)
/mob/living/silicon/robot/New(loc)
spark_system = new /datum/effect_system/spark_spread()
@@ -125,6 +126,7 @@
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
aicamera = new/obj/item/device/camera/siliconcam/robot_camera(src)
toner = 40
diag_hud_set_borgcell()
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
/mob/living/silicon/robot/Destroy()
@@ -480,6 +482,7 @@
cell = W
user << "<span class='notice'>You insert the power cell.</span>"
update_icons()
diag_hud_set_borgcell()
else if (wires.IsInteractionTool(W))
if (wiresexposed)
@@ -711,6 +714,7 @@
user << "<span class='notice'>You remove \the [cell].</span>"
cell = null
update_icons()
diag_hud_set_borgcell()
if(!opened)
if(..()) // hulk attack
+20 -1
View File
@@ -14,6 +14,8 @@
var/designation = ""
var/radiomod = "" //Radio character used before state laws/arrivals announce to allow department transmissions, default, or none at all.
var/obj/item/device/camera/siliconcam/aicamera = null //photography
//hud_possible = list(DIAG_STAT_HUD, DIAG_HUD, ANTAG_HUD)
hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD)
var/obj/item/device/radio/borg/radio = null //AIs dont use this but this is at the silicon level to advoid copypasta in say()
@@ -25,9 +27,17 @@
var/med_hud = DATA_HUD_MEDICAL_ADVANCED //Determines the med hud to use
var/sec_hud = DATA_HUD_SECURITY_ADVANCED //Determines the sec hud to use
var/d_hud = DATA_HUD_DIAGNOSTIC //There is only one kind of diag hud
var/law_change_counter = 0
/mob/living/silicon/New()
..()
var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC]
diag_hud.add_to_hud(src)
diag_hud_set_status()
diag_hud_set_health()
/mob/living/silicon/Destroy()
radio = null
aicamera = null
@@ -338,8 +348,10 @@
/mob/living/silicon/proc/remove_med_sec_hud()
var/datum/atom_hud/secsensor = huds[sec_hud]
var/datum/atom_hud/medsensor = huds[med_hud]
var/datum/atom_hud/diagsensor = huds[d_hud]
secsensor.remove_hud_from(src)
medsensor.remove_hud_from(src)
diagsensor.remove_hud_from(src)
/mob/living/silicon/proc/add_sec_hud()
var/datum/atom_hud/secsensor = huds[sec_hud]
@@ -349,9 +361,13 @@
var/datum/atom_hud/medsensor = huds[med_hud]
medsensor.add_hud_to(src)
/mob/living/silicon/proc/add_diag_hud()
var/datum/atom_hud/diagsensor = huds[d_hud]
diagsensor.add_hud_to(src)
/mob/living/silicon/proc/sensor_mode()
set name = "Set Sensor Augmentation"
var/sensor_type = input("Please select sensor type.", "Sensor Integration", null) in list("Security", "Medical","Disable")
var/sensor_type = input("Please select sensor type.", "Sensor Integration", null) in list("Security", "Medical","Diagnostic","Disable")
remove_med_sec_hud()
switch(sensor_type)
if ("Security")
@@ -360,6 +376,9 @@
if ("Medical")
add_med_hud()
src << "<span class='notice'>Life signs monitor overlay enabled.</span>"
if ("Diagnostic")
add_diag_hud()
src << "<span class='notice'>Robotics diagnostic overlay enabled.</span>"
if ("Disable")
src << "Sensor augmentations disabled."
+1 -1
View File
@@ -24,7 +24,7 @@ var/next_mob_id = 0
prepare_huds()
..()
/mob/proc/prepare_huds()
/atom/proc/prepare_huds()
for(var/hud in hud_possible)
hud_list[hud] = image('icons/mob/hud.dmi', src, "")
+18
View File
@@ -281,6 +281,24 @@ other types of metals and chemistry for reagents).
build_path = /obj/item/clothing/glasses/hud/security/night
category = list("Equipment")
datum/design/diagnostic_hud
name = "Diagnostic HUD"
desc = "A HUD used to analyze and determine faults within robotic machinery."
id = "dianostic_hud"
req_tech = list("magnets" = 3, "engineering" = 3, "powerstorage" = 2)
build_type = PROTOLATHE
materials = list("$metal" = 50, "$glass" = 50)
build_path = /obj/item/clothing/glasses/hud/diagnostic
datum/design/diagnostic_hud_night
name = "Night Vision Diagnostic HUD"
desc = "Upgraded version of the diagnostic HUD designed to function during a power failure."
id = "dianostic_hud_night"
req_tech = list("magnets" = 5, "engineering" = 4, "powerstorage" = 4)
build_type = PROTOLATHE
materials = list("$metal" = 200, "$glass" = 200, "$uranium" = 1000, "$plasma" = 300)
build_path = /obj/item/clothing/glasses/hud/diagnostic/night
/////////////////////////////////////////
//////////////////Test///////////////////
/////////////////////////////////////////
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB