Skip to content

Commit

Permalink
[MIRROR] HUD traits now apply their corresponding hud automatically. …
Browse files Browse the repository at this point in the history
…Most clothing/item/etc sources of HUDs now only use traits (#4687)

* [MIRROR] HUD traits now apply their corresponding hud automatically. Most clothing/item/etc sources of HUDs now only use traits [MDB IGNORE] (#3861)

* HUD traits now apply their corresponding hud automatically. Most clothing/item/etc sources of HUDs now only use traits (#84984)

Currently if you want to apply a HUD you usually add both its trait and
the HUD itself. Only exceptions are things like simplemobs where you
should avoid adding the hud trait since it adds security/med DB access
and such, but there is no cases where you'd want to apply the trait and
not apply the hud.

Requested by Melbert about a week ago.

![image](https://github.com/user-attachments/assets/8af3e9cc-ea22-4cee-86ec-54c397291727)

This makes working with HUDs significantly easier, as you no longer have
to bother with manually adding/removing them. Also potentially removes
an edge case where if your hud could get removed while keeping the
trait.

:cl:
refactor: HUD traits now apply their corresponding hud automatically
/:cl:

* Modular changes

* rest of the modular stuff

* no bot path hud actually

standard diag glasses don't give this, for some reason

---------

Co-authored-by: SmArtKar <[email protected]>
Co-authored-by: Mal <[email protected]>
Co-authored-by: Fluffles <[email protected]>

* [MIRROR] HUD traits now apply their corresponding hud automatically. Most clothing/item/etc sources of HUDs now only use traits

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: SmArtKar <[email protected]>
Co-authored-by: Mal <[email protected]>
Co-authored-by: Fluffles <[email protected]>
Co-authored-by: StealsThePRs <[email protected]>
  • Loading branch information
6 people authored Jul 24, 2024
1 parent e274861 commit 05675b7
Show file tree
Hide file tree
Showing 30 changed files with 112 additions and 200 deletions.
5 changes: 2 additions & 3 deletions code/__DEFINES/atom_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@
#define DATA_HUD_SECURITY_ADVANCED 2
#define DATA_HUD_MEDICAL_BASIC 3
#define DATA_HUD_MEDICAL_ADVANCED 4
#define DATA_HUD_DIAGNOSTIC_BASIC 5
#define DATA_HUD_DIAGNOSTIC_ADVANCED 6
#define DATA_HUD_DIAGNOSTIC 5
#define DATA_HUD_BOT_PATH 6
#define DATA_HUD_ABDUCTOR 7
#define DATA_HUD_SENTIENT_DISEASE 8
#define DATA_HUD_AI_DETECT 9
#define DATA_HUD_FAN 10
#define DATA_HUD_MALF_APC 11
#define DATA_HUD_PERMIT 12 //NOVA EDIT
#define DATA_HUD_DNR 13 // NOVA EDIT

/// cooldown for being shown the images for any particular data hud
#define ADD_HUD_TO_COOLDOWN 20
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_SECURITY_HUD "sec_hud"
/// for something granting you a diagnostic hud
#define TRAIT_DIAGNOSTIC_HUD "diag_hud"
#define TRAIT_BOT_PATH_HUD "bot_path_hud"
/// Is a medbot healing you
#define TRAIT_MEDIBOTCOMINGTHROUGH "medbot"
#define TRAIT_PASSTABLE "passtable"
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/~nova_defines/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
#define SLIPPERY_MIN 5
/// The maximum amount of tiles a TRAIT_SLIPPERY haver will slide on slip
#define SLIPPERY_MAX 9
/// Permit hud clothing trait
#define TRAIT_PERMIT_HUD "permit_hud"
2 changes: 2 additions & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_DETECTIVES_TASTE" = TRAIT_DETECTIVES_TASTE,
"TRAIT_DETECT_STORM" = TRAIT_DETECT_STORM,
"TRAIT_DIAGNOSTIC_HUD" = TRAIT_DIAGNOSTIC_HUD,
"TRAIT_BOT_PATH_HUD" = TRAIT_BOT_PATH_HUD,
"TRAIT_DISCOORDINATED_TOOL_USER" = TRAIT_DISCOORDINATED_TOOL_USER,
"TRAIT_DISEASELIKE_SEVERITY_MEDIUM" = TRAIT_DISEASELIKE_SEVERITY_MEDIUM,
"TRAIT_DISFIGURED" = TRAIT_DISFIGURED,
Expand Down Expand Up @@ -700,6 +701,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_PERSONALSPACE" = TRAIT_PERSONALSPACE,
"TRAIT_QUICKREFLEXES" = TRAIT_QUICKREFLEXES,
"TRAIT_PET_OWNER" = TRAIT_PET_OWNER,
"TRAIT_PERMIT_HUD" = TRAIT_PERMIT_HUD,
"TRAIT_R_UNIQUEWRECK" = TRAIT_R_UNIQUEWRECK,
"TRAIT_R_UNIQUETIP" = TRAIT_R_UNIQUETIP,
"TRAIT_R_WIDE" = TRAIT_R_WIDE,
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_DEFIB_BLACKLISTED" = TRAIT_DEFIB_BLACKLISTED,
"TRAIT_DEPRESSION" = TRAIT_DEPRESSION,
"TRAIT_DIAGNOSTIC_HUD" = TRAIT_DIAGNOSTIC_HUD,
"TRAIT_BOT_PATH_HUD" = TRAIT_BOT_PATH_HUD,
"TRAIT_DISCOORDINATED_TOOL_USER" = TRAIT_DISCOORDINATED_TOOL_USER,
"TRAIT_DISFIGURED" = TRAIT_DISFIGURED,
"TRAIT_DISK_VERIFIER" = TRAIT_DISK_VERIFIER,
Expand Down Expand Up @@ -329,6 +330,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_NORUNNING" = TRAIT_NORUNNING,
"TRAIT_OVERSIZED" = TRAIT_OVERSIZED,
"TRAIT_OXYIMMUNE" = TRAIT_OXYIMMUNE,
"TRAIT_PERMIT_HUD" = TRAIT_PERMIT_HUD,
"TRAIT_PERSONALSPACE" = TRAIT_PERSONALSPACE,
"TRAIT_QUICKREFLEXES" = TRAIT_QUICKREFLEXES,
"TRAIT_PET_OWNER" = TRAIT_PET_OWNER,
Expand Down
14 changes: 6 additions & 8 deletions code/datums/elements/digitalcamo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@

/datum/element/digitalcamo/proc/HideFromAIHuds(mob/living/target)
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
var/datum/atom_hud/M = GLOB.huds[AI.med_hud]
M.hide_single_atomhud_from(AI,target)
var/datum/atom_hud/S = GLOB.huds[AI.sec_hud]
S.hide_single_atomhud_from(AI,target)
for (var/hud_type in AI.silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.hide_single_atomhud_from(AI,target)

/datum/element/digitalcamo/proc/UnhideFromAIHuds(mob/living/target)
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
var/datum/atom_hud/M = GLOB.huds[AI.med_hud]
M.unhide_single_atomhud_from(AI,target)
var/datum/atom_hud/S = GLOB.huds[AI.sec_hud]
S.unhide_single_atomhud_from(AI,target)
for (var/hud_type in AI.silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.unhide_single_atomhud_from(AI,target)

/datum/element/digitalcamo/proc/on_examine(datum/source, mob/M)
SIGNAL_HANDLER
Expand Down
31 changes: 19 additions & 12 deletions code/datums/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ GLOBAL_LIST_EMPTY(huds_by_category)

//GLOBAL HUD LIST
GLOBAL_LIST_INIT(huds, list(
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_BASIC = new/datum/atom_hud/data/diagnostic/basic(),
DATA_HUD_DIAGNOSTIC_ADVANCED = new/datum/atom_hud/data/diagnostic/advanced(),
DATA_HUD_ABDUCTOR = new/datum/atom_hud/abductor(),
DATA_HUD_SENTIENT_DISEASE = new/datum/atom_hud/sentient_disease(),
DATA_HUD_AI_DETECT = new/datum/atom_hud/ai_detector(),
DATA_HUD_FAN = new/datum/atom_hud/data/human/fan_hud(),
DATA_HUD_MALF_APC = new/datum/atom_hud/data/malf_apc(),
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(),
DATA_HUD_BOT_PATH = new /datum/atom_hud/data/bot_path(),
DATA_HUD_ABDUCTOR = new /datum/atom_hud/abductor(),
DATA_HUD_SENTIENT_DISEASE = new /datum/atom_hud/sentient_disease(),
DATA_HUD_AI_DETECT = new /datum/atom_hud/ai_detector(),
DATA_HUD_FAN = new /datum/atom_hud/data/human/fan_hud(),
DATA_HUD_MALF_APC = new /datum/atom_hud/data/malf_apc(),
DATA_HUD_PERMIT = new/datum/atom_hud/data/human/permit(), // NOVA EDIT ADDITION
DATA_HUD_DNR = new/datum/atom_hud/data/human/dnr(), // NOVA EDIT ADDITION
))

GLOBAL_LIST_INIT(trait_to_hud, list(
TRAIT_SECURITY_HUD = DATA_HUD_SECURITY_ADVANCED,
TRAIT_MEDICAL_HUD = DATA_HUD_MEDICAL_ADVANCED,
TRAIT_DIAGNOSTIC_HUD = DATA_HUD_DIAGNOSTIC,
TRAIT_BOT_PATH_HUD = DATA_HUD_BOT_PATH, // NOVA EDIT CHANGE - ADD TRAILING COMMA
TRAIT_PERMIT_HUD = DATA_HUD_PERMIT, // NOVA EDIT ADDITION
))

/datum/atom_hud
Expand Down
10 changes: 3 additions & 7 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,14 @@
hud_icons = list(FAN_HUD)

/datum/atom_hud/data/diagnostic

/datum/atom_hud/data/diagnostic/basic
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD, DIAG_CAMERA_HUD, DIAG_AIRLOCK_HUD, DIAG_LAUNCHPAD_HUD)

/datum/atom_hud/data/diagnostic/advanced
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_HUD, DIAG_CAMERA_HUD, DIAG_AIRLOCK_HUD, DIAG_LAUNCHPAD_HUD, DIAG_PATH_HUD)

/datum/atom_hud/data/bot_path
// This hud exists so the bot can see itself, that's all
uses_global_hud_category = FALSE
hud_icons = list(DIAG_PATH_HUD)

/datum/atom_hud/data/bot_path/private
uses_global_hud_category = FALSE

/datum/atom_hud/abductor
hud_icons = list(GLAND_HUD)

Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/busts_and_figurines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@
..()
if(!(slot & ITEM_SLOT_HANDS))
return
var/datum/atom_hud/our_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
our_hud.show_to(user)
ADD_TRAIT(user, TRAIT_MEDICAL_HUD, type)

/obj/item/statuebust/hippocratic/dropped(mob/living/carbon/human/user)
..()
if(HAS_TRAIT_NOT_FROM(user, TRAIT_MEDICAL_HUD, type))
return
var/datum/atom_hud/our_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
our_hud.hide_from(user)
REMOVE_TRAIT(user, TRAIT_MEDICAL_HUD, type)

/obj/item/statuebust/hippocratic/attack_self(mob/user)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/verbs/admingame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.

combo_hud_enabled = TRUE

for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
atom_hud.show_to(mob)

Expand All @@ -395,7 +395,7 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.

combo_hud_enabled = FALSE

for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
atom_hud.hide_from(mob)

Expand Down
21 changes: 1 addition & 20 deletions code/modules/antagonists/nukeop/equipment/overwatch_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,4 @@ Happy hunting!
icon_state = "sunhudmed"
flags_cover = GLASSESCOVERSEYES
flash_protect = FLASH_PROTECTION_WELDER
clothing_traits = list(TRAIT_REAGENT_SCANNER)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED, DATA_HUD_SECURITY_ADVANCED)

/obj/item/clothing/glasses/overwatch/equipped(mob/user, slot)
. = ..()
if(!(slot & ITEM_SLOT_EYES) || !ishuman(user))
return
for(var/hud in hudlist)
var/datum/atom_hud/our_hud = GLOB.huds[hud]
our_hud.show_to(user)
user.add_traits(list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, TRAIT_DIAGNOSTIC_HUD), GLASSES_TRAIT)

/obj/item/clothing/glasses/overwatch/dropped(mob/user)
. = ..()
user.remove_traits(list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, TRAIT_DIAGNOSTIC_HUD), GLASSES_TRAIT)
if(!ishuman(user))
return
for(var/hud in hudlist)
var/datum/atom_hud/our_hud = GLOB.huds[hud]
our_hud.hide_from(user)
clothing_traits = list(TRAIT_REAGENT_SCANNER, TRAIT_SECURITY_HUD, TRAIT_MEDICAL_HUD, TRAIT_DIAGNOSTIC_HUD)
2 changes: 1 addition & 1 deletion code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@
glass_colour_type = FALSE
vision_flags = SEE_TURFS
clothing_traits = list(TRAIT_REAGENT_SCANNER, TRAIT_MADNESS_IMMUNE)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED, DATA_HUD_SECURITY_ADVANCED)
var/list/hudlist = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_SECURITY_ADVANCED, DATA_HUD_BOT_PATH)
var/xray = FALSE

/obj/item/clothing/glasses/debug/equipped(mob/user, slot)
Expand Down
54 changes: 15 additions & 39 deletions code/modules/clothing/glasses/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@
name = "HUD"
desc = "A heads-up display that provides important info in (almost) real time."
flags_1 = null //doesn't protect eyes because it's a monocle, duh
///A list of atom hud types added to the mob when the glasses are worn on the appropriate slot.
var/list/hud_types

// NOTE: Just because you have a HUD display doesn't mean you should be able to interact with stuff on examine, that's where the associated trait (TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, etc) is necessary.

/obj/item/clothing/glasses/hud/equipped(mob/living/carbon/human/user, slot)
..()
if(!(slot & ITEM_SLOT_EYES))
return
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.show_to(user)

/obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user)
..()
if(!istype(user) || user.glasses != src)
return
for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.hide_from(user)

/obj/item/clothing/glasses/hud/emp_act(severity)
. = ..()
Expand Down Expand Up @@ -56,15 +36,13 @@
name = "health scanner HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their health status."
icon_state = "healthhud"
hud_types = list(DATA_HUD_MEDICAL_ADVANCED)
clothing_traits = list(TRAIT_MEDICAL_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightblue

/obj/item/clothing/glasses/hud/medsechud
name = "health scanner security HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their health status, ID status and security records."
icon_state = "medsechud"
hud_types = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD)

/obj/item/clothing/glasses/hud/health/night
Expand Down Expand Up @@ -118,7 +96,6 @@
name = "diagnostic HUD"
desc = "A heads-up display capable of analyzing the integrity and status of robotics and exosuits."
icon_state = "diagnostichud"
hud_types = list(DATA_HUD_DIAGNOSTIC_BASIC)
clothing_traits = list(TRAIT_DIAGNOSTIC_HUD)
glass_colour_type = /datum/client_colour/glass_colour/lightorange

Expand Down Expand Up @@ -161,7 +138,6 @@
name = "security HUD"
desc = "A heads-up display that scans the humanoids in view and provides accurate data about their ID status and security records."
icon_state = "securityhud"
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_SECURITY_HUD)
glass_colour_type = /datum/client_colour/glass_colour/red

Expand Down Expand Up @@ -251,20 +227,18 @@
if (wearer.glasses != src)
return

for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.hide_from(user)
for(var/trait in clothing_traits)
REMOVE_CLOTHING_TRAIT(user, trait)

if (DATA_HUD_MEDICAL_ADVANCED in hud_types)
hud_types = null
else if (DATA_HUD_SECURITY_ADVANCED in hud_types)
hud_types = list(DATA_HUD_MEDICAL_ADVANCED)
if (TRAIT_MEDICAL_HUD in clothing_traits)
clothing_traits = null
else if (TRAIT_SECURITY_HUD in clothing_traits)
clothing_traits = list(TRAIT_MEDICAL_HUD)
else
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
clothing_traits = list(TRAIT_SECURITY_HUD)

for(var/hud_type in hud_types)
var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
our_hud.show_to(user)
for(var/trait in clothing_traits)
ADD_CLOTHING_TRAIT(user, trait)

/datum/action/item_action/switch_hud
name = "Switch HUD"
Expand All @@ -273,20 +247,22 @@
name = "thermal HUD scanner"
desc = "Thermal imaging HUD in the shape of glasses."
icon_state = "thermal"
hud_types = list(DATA_HUD_SECURITY_ADVANCED)
vision_flags = SEE_MOBS
color_cutoffs = list(25, 8, 5)
glass_colour_type = /datum/client_colour/glass_colour/red
clothing_traits = list(TRAIT_SECURITY_HUD)

/obj/item/clothing/glasses/hud/toggle/thermal/attack_self(mob/user)
..()
var/hud_type = hud_types[1]
var/hud_type
if (!isnull(clothing_traits) && clothing_traits.len)
hud_type = clothing_traits[1]
switch (hud_type)
if (DATA_HUD_MEDICAL_ADVANCED)
if (TRAIT_MEDICAL_HUD)
icon_state = "meson"
color_cutoffs = list(5, 15, 5)
change_glass_color(/datum/client_colour/glass_colour/green)
if (DATA_HUD_SECURITY_ADVANCED)
if (TRAIT_SECURITY_HUD)
icon_state = "thermal"
color_cutoffs = list(25, 8, 5)
change_glass_color(/datum/client_colour/glass_colour/red)
Expand Down
4 changes: 0 additions & 4 deletions code/modules/clothing/suits/ablativecoat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,11 @@
/obj/item/clothing/suit/hooded/ablative/on_hood_up(obj/item/clothing/head/hooded/hood)
. = ..()
var/mob/living/carbon/user = loc
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
ADD_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
hud.show_to(user)
balloon_alert(user, "hud enabled")

/obj/item/clothing/suit/hooded/ablative/on_hood_down(obj/item/clothing/head/hooded/hood)
var/mob/living/carbon/user = loc
var/datum/atom_hud/sec_hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
REMOVE_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
sec_hud.hide_from(user)
balloon_alert(user, "hud disabled")
return ..()
17 changes: 9 additions & 8 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/health_scan = FALSE //Are health scans currently enabled?
var/chem_scan = FALSE //Are chem scans currently enabled?
var/gas_scan = FALSE //Are gas scans currently enabled?
var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED) //list of data HUDs shown to ghosts.
var/ghost_orbit = GHOST_ORBIT_CIRCLE

//These variables store hair data if the ghost originates from a species with head and/or facial hair.
Expand All @@ -63,6 +62,13 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
/// The POI we're orbiting (orbit menu)
var/orbiting_ref

var/static/list/observer_hud_traits = list(
TRAIT_SECURITY_HUD,
TRAIT_MEDICAL_HUD,
TRAIT_DIAGNOSTIC_HUD,
TRAIT_BOT_PATH_HUD
)

/mob/dead/observer/Initialize(mapload)
set_invisibility(GLOB.observer_default_invisibility)

Expand Down Expand Up @@ -149,7 +155,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)

SSpoints_of_interest.make_point_of_interest(src)
ADD_TRAIT(src, TRAIT_HEAR_THROUGH_DARKNESS, ref(src))
ADD_TRAIT(src, TRAIT_SECURITY_HUD, ref(src))

/mob/dead/observer/get_photo_description(obj/item/camera/camera)
if(!invisibility || camera.see_ghosts)
Expand Down Expand Up @@ -774,14 +779,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return

/mob/dead/observer/proc/show_data_huds()
for(var/hudtype in datahuds)
var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
data_hud.show_to(src)
add_traits(observer_hud_traits, REF(src))

/mob/dead/observer/proc/remove_data_huds()
for(var/hudtype in datahuds)
var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
data_hud.hide_from(src)
remove_traits(observer_hud_traits, REF(src))

/mob/dead/observer/verb/toggle_data_huds()
set name = "Toggle Sec/Med/Diag HUD"
Expand Down
Loading

0 comments on commit 05675b7

Please sign in to comment.