Skip to content

Commit 707c1aa

Browse files
authored
More things use trait huds over raw hud management (#790)
1 parent 103b8fc commit 707c1aa

39 files changed

Lines changed: 171 additions & 169 deletions

File tree

code/__DEFINES/traits/declarations.dm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,14 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
338338
#define TRAIT_UNSTABLE "unstable"
339339
#define TRAIT_OIL_FRIED "oil_fried"
340340
#define TRAIT_MEDICAL_HUD "med_hud"
341+
#define TRAIT_MEDICAL_HUD_SENSOR_ONLY "med_hud_lesser"
341342
#define TRAIT_SECURITY_HUD "sec_hud"
343+
#define TRAIT_SECURITY_HUD_ID_ONLY "sec_hud_lesser"
344+
#define TRAIT_ABDUCTOR_HUD "abductor_hud"
345+
/// Stop the user from seeing the sechud. Only works for trait handled sechuds.
346+
#define TRAIT_BLOCK_SECHUD "block_sechud"
347+
/// Stop the user from seeing the medhud. Only works for trait handled medhuds.
348+
#define TRAIT_BLOCK_MEDHUD "block_medhud"
342349
/// for something granting you a diagnostic hud
343350
#define TRAIT_DIAGNOSTIC_HUD "diag_hud"
344351
#define TRAIT_BOT_PATH_HUD "bot_path_hud"

code/_globalvars/traits/_traits.dm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
115115
"TRAIT_WALLMOUNTED" = TRAIT_WALLMOUNTED,
116116
),
117117
/mob = list(
118+
"TRAIT_ABDUCTOR_HUD" = TRAIT_ABDUCTOR_HUD,
118119
"TRAIT_ABDUCTOR_SCIENTIST_TRAINING" = TRAIT_ABDUCTOR_SCIENTIST_TRAINING,
119120
"TRAIT_ABDUCTOR_TRAINING" = TRAIT_ABDUCTOR_TRAINING,
120121
"TRAIT_ADAMANTINE_EXTRACT_ARMOR" = TRAIT_ADAMANTINE_EXTRACT_ARMOR,
@@ -142,6 +143,8 @@ GLOBAL_LIST_INIT(traits_by_type, list(
142143
"TRAIT_BEAST_EMPATHY" = TRAIT_BEAST_EMPATHY,
143144
"TRAIT_BEING_BLADE_SHIELDED" = TRAIT_BEING_BLADE_SHIELDED,
144145
"TRAIT_BLOB_ALLY" = TRAIT_BLOB_ALLY,
146+
"TRAIT_BLOCK_MEDHUD" = TRAIT_BLOCK_MEDHUD,
147+
"TRAIT_BLOCK_SECHUD" = TRAIT_BLOCK_SECHUD,
145148
"TRAIT_BLOODSHOT_EYES" = TRAIT_BLOODSHOT_EYES,
146149
"TRAIT_BLOODY_MESS" = TRAIT_BLOODY_MESS,
147150
"TRAIT_BLOOD_CLANS" = TRAIT_BLOOD_CLANS,
@@ -302,6 +305,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
302305
"TRAIT_MEDIBOTCOMINGTHROUGH" = TRAIT_MEDIBOTCOMINGTHROUGH,
303306
"TRAIT_MEDIBOTCOMINGTHROUGH" = TRAIT_MEDIBOTCOMINGTHROUGH,
304307
"TRAIT_MEDICAL_HUD" = TRAIT_MEDICAL_HUD,
308+
"TRAIT_MEDICAL_HUD_SENSOR_ONLY" = TRAIT_MEDICAL_HUD_SENSOR_ONLY,
305309
"TRAIT_MESON_VISION" = TRAIT_MESON_VISION,
306310
"TRAIT_MIME_FAN" = TRAIT_MIME_FAN,
307311
"TRAIT_MIMING" = TRAIT_MIMING,
@@ -421,6 +425,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
421425
"TRAIT_ROUGHRIDER" = TRAIT_ROUGHRIDER,
422426
"TRAIT_SABRAGE_PRO" = TRAIT_SABRAGE_PRO,
423427
"TRAIT_SECURITY_HUD" = TRAIT_SECURITY_HUD,
428+
"TRAIT_SECURITY_HUD_ID_ONLY" = TRAIT_SECURITY_HUD_ID_ONLY,
424429
"TRAIT_SEE_WORN_COLOURS" = TRAIT_SEE_WORN_COLOURS,
425430
"TRAIT_SELF_AWARE" = TRAIT_SELF_AWARE,
426431
"TRAIT_SETTLER" = TRAIT_SETTLER,

code/_globalvars/traits/admin_tooling.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
124124
"TRAIT_LIVERLESS_METABOLISM" = TRAIT_LIVERLESS_METABOLISM,
125125
"TRAIT_LIVERLESS_METABOLISM" = TRAIT_LIVERLESS_METABOLISM,
126126
"TRAIT_MEDICAL_HUD" = TRAIT_MEDICAL_HUD,
127+
"TRAIT_MEDICAL_HUD_SENSOR_ONLY" = TRAIT_MEDICAL_HUD_SENSOR_ONLY,
127128
"TRAIT_MIME_FAN" = TRAIT_MIME_FAN,
128129
"TRAIT_MIMING" = TRAIT_MIMING,
129130
"TRAIT_MINDSHIELD" = TRAIT_MINDSHIELD,
@@ -194,6 +195,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
194195
"TRAIT_RESTRAINED" = TRAIT_RESTRAINED,
195196
"TRAIT_ROUGHRIDER" = TRAIT_ROUGHRIDER,
196197
"TRAIT_SECURITY_HUD" = TRAIT_SECURITY_HUD,
198+
"TRAIT_SECURITY_HUD_ID_ONLY" = TRAIT_SECURITY_HUD_ID_ONLY,
197199
"TRAIT_SELF_AWARE" = TRAIT_SELF_AWARE,
198200
"TRAIT_SETTLER" = TRAIT_SETTLER,
199201
"TRAIT_SHIFTY_EYES" = TRAIT_SHIFTY_EYES,

code/datums/elements/digitalcamo.dm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727

2828
/datum/element/digitalcamo/proc/HideFromAIHuds(mob/living/target)
2929
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
30-
for (var/hud_type in AI.silicon_huds)
31-
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
30+
for (var/hud_trait in AI.silicon_huds)
31+
var/datum/atom_hud/silicon_hud = GLOB.huds[GLOB.trait_to_hud[hud_trait]]
3232
silicon_hud.hide_single_atomhud_from(AI,target)
3333

3434
/datum/element/digitalcamo/proc/UnhideFromAIHuds(mob/living/target)
3535
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
36-
for (var/hud_type in AI.silicon_huds)
37-
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
36+
for (var/hud_trait in AI.silicon_huds)
37+
var/datum/atom_hud/silicon_hud = GLOB.huds[GLOB.trait_to_hud[hud_trait]]
3838
silicon_hud.unhide_single_atomhud_from(AI,target)
3939

4040
/datum/element/digitalcamo/proc/on_examine(datum/source, mob/M, list/examine_list)

code/datums/hud.dm

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,23 @@ GLOBAL_LIST_INIT(huds, list(
2121
DATA_HUD_MALF_APC = new /datum/atom_hud/data/malf_apc(),
2222
))
2323

24+
/// Assoc list of traits to the huds they give.
2425
GLOBAL_LIST_INIT(trait_to_hud, list(
2526
TRAIT_SECURITY_HUD = DATA_HUD_SECURITY_ADVANCED,
27+
TRAIT_SECURITY_HUD_ID_ONLY = DATA_HUD_SECURITY_BASIC,
2628
TRAIT_MEDICAL_HUD = DATA_HUD_MEDICAL_ADVANCED,
29+
TRAIT_MEDICAL_HUD_SENSOR_ONLY = DATA_HUD_MEDICAL_BASIC,
2730
TRAIT_DIAGNOSTIC_HUD = DATA_HUD_DIAGNOSTIC,
28-
TRAIT_BOT_PATH_HUD = DATA_HUD_BOT_PATH
31+
TRAIT_BOT_PATH_HUD = DATA_HUD_BOT_PATH,
32+
TRAIT_CLOWN_ENJOYER = DATA_HUD_FAN,
33+
TRAIT_MIME_FAN = DATA_HUD_FAN,
34+
TRAIT_ABDUCTOR_HUD = DATA_HUD_ABDUCTOR,
35+
))
36+
37+
/// Assoc list of traits that block other traits' huds to list of hud (traits) that they block
38+
GLOBAL_LIST_INIT(trait_blockers_to_hud, list(
39+
TRAIT_BLOCK_SECHUD = list(TRAIT_SECURITY_HUD, TRAIT_SECURITY_HUD_ID_ONLY),
40+
TRAIT_BLOCK_MEDHUD = list(TRAIT_MEDICAL_HUD, TRAIT_MEDICAL_HUD_SENSOR_ONLY),
2941
))
3042

3143
/datum/atom_hud

code/datums/quirks/positive_quirks/clown_enjoyer.dm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,3 @@
2525

2626
/datum/quirk/item_quirk/clown_enjoyer/add_unique(client/client_source)
2727
give_item_to_holder(/obj/item/clothing/accessory/clown_enjoyer_pin, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
28-
29-
/datum/quirk/item_quirk/clown_enjoyer/add(client/client_source)
30-
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
31-
fan.show_to(quirk_holder)

code/datums/quirks/positive_quirks/mime_fan.dm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,3 @@
2323

2424
/datum/quirk/item_quirk/mime_fan/add_unique(client/client_source)
2525
give_item_to_holder(/obj/item/clothing/accessory/mime_fan_pin, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
26-
27-
/datum/quirk/item_quirk/mime_fan/add(client/client_source)
28-
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
29-
fan.show_to(quirk_holder)

code/datums/status_effects/buffs.dm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,13 @@
281281

282282
//Makes the user passive, it's in their oath not to harm!
283283
ADD_TRAIT(owner, TRAIT_PACIFISM, HIPPOCRATIC_OATH_TRAIT)
284-
var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
285-
med_hud.show_to(owner)
284+
ADD_TRAIT(owner, TRAIT_MEDICAL_HUD, HIPPOCRATIC_OATH_TRAIT)
286285
return ..()
287286

288287
/datum/status_effect/hippocratic_oath/on_remove()
289288
QDEL_NULL(aura_healing)
290289
REMOVE_TRAIT(owner, TRAIT_PACIFISM, HIPPOCRATIC_OATH_TRAIT)
291-
var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
292-
med_hud.hide_from(owner)
290+
REMOVE_TRAIT(owner, TRAIT_MEDICAL_HUD, HIPPOCRATIC_OATH_TRAIT)
293291

294292
/datum/status_effect/hippocratic_oath/get_examine_text()
295293
return span_notice("[owner.p_They()] seem[owner.p_s()] to have an aura of healing and helpfulness about [owner.p_them()].")

code/game/data_huds.dm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/datum/atom_hud/data/human/medical
2121
hud_icons = list(STATUS_HUD, HEALTH_HUD)
2222

23+
/// Sees health (0-100) status (alive, dead), but relies on suit sensors being on
2324
/datum/atom_hud/data/human/medical/basic
2425

2526
/datum/atom_hud/data/human/medical/basic/proc/check_sensors(mob/living/carbon/human/H)
@@ -39,13 +40,16 @@
3940
/datum/atom_hud/data/human/medical/basic/proc/update_suit_sensors(mob/living/carbon/H)
4041
check_sensors(H) ? add_atom_to_hud(H) : remove_atom_from_hud(H)
4142

43+
/// Sees health (0-100) status (alive, dead), always
4244
/datum/atom_hud/data/human/medical/advanced
4345

4446
/datum/atom_hud/data/human/security
4547

48+
/// Only sees ID card job
4649
/datum/atom_hud/data/human/security/basic
4750
hud_icons = list(ID_HUD)
4851

52+
/// Sees ID card job, implants, and wanted status
4953
/datum/atom_hud/data/human/security/advanced
5054
hud_icons = list(ID_HUD, IMPSEC_FIRST_HUD, IMPLOYAL_HUD, IMPSEC_SECOND_HUD, WANTED_HUD)
5155

code/modules/admin/verbs/admingame.dm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,17 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.
355355
log_admin("[key_name(user)] toggled their admin combo HUD [user.combo_hud_enabled ? "ON" : "OFF"].")
356356
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Toggle Combo HUD", "[user.combo_hud_enabled ? "Enabled" : "Disabled"]")) // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
357357

358+
/// List of hud traits in the admin combo hud
359+
#define ADMIN_HUDS list(TRAIT_SECURITY_HUD, TRAIT_MEDICAL_HUD, TRAIT_DIAGNOSTIC_HUD, TRAIT_BOT_PATH_HUD)
360+
358361
/client/proc/enable_combo_hud()
359362
if (combo_hud_enabled)
360363
return
361364

362365
combo_hud_enabled = TRUE
363366

364-
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
365-
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
366-
atom_hud.show_to(mob)
367+
for (var/hudtrait in ADMIN_HUDS)
368+
ADD_TRAIT(mob, hudtrait, ADMIN_TRAIT)
367369

368370
for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances)
369371
antag_hud.show_to(mob)
@@ -377,16 +379,17 @@ ADMIN_VERB(combo_hud, R_ADMIN, "Toggle Combo HUD", "Toggles the Admin Combo HUD.
377379

378380
combo_hud_enabled = FALSE
379381

380-
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH))
381-
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
382-
atom_hud.hide_from(mob)
382+
for (var/hudtrait in ADMIN_HUDS)
383+
REMOVE_TRAIT(mob, hudtrait, ADMIN_TRAIT)
383384

384385
for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances)
385386
antag_hud.hide_from(mob)
386387

387388
mob.lighting_cutoff = mob.default_lighting_cutoff()
388389
mob.update_sight()
389390

391+
#undef ADMIN_HUDS
392+
390393
ADMIN_VERB(show_traitor_panel, R_ADMIN, "Show Traitor Panel", "Edit mobs's memory and role", ADMIN_CATEGORY_GAME, mob/target_mob)
391394
var/datum/mind/target_mind = target_mob.mind
392395
if(!target_mind)

0 commit comments

Comments
 (0)