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

[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.

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

* 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: NovaBot <154629622+NovaBot13@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Mal <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Fluffles <piecopresident@gmail.com>
This commit is contained in:
SpaceLoveSs13
2024-07-27 21:45:47 +05:30
committed by GitHub
co-authored by NovaBot SmArtKar Mal Fluffles
parent 7050b8ac7f
commit a1be42f412
30 changed files with 132 additions and 218 deletions
+9 -8
View File
@@ -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.
@@ -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)
@@ -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)
@@ -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"