More things use trait huds over raw hud management (#93084)

This commit is contained in:
MrMelbert
2025-10-02 14:36:40 -05:00
committed by GitHub
parent 3d0cdfeac0
commit 44acefa73f
47 changed files with 249 additions and 236 deletions
-4
View File
@@ -59,12 +59,8 @@
var/master_name
/// DNA string for owner verification
var/master_dna
/// Toggles whether the Medical HUD is active or not
var/medHUD = FALSE
/// Used as currency to purchase different abilities
var/ram = 100
/// Toggles whether the Security HUD is active or not
var/secHUD = FALSE
/// The current leash to the owner
var/datum/component/leash/leash
+13 -12
View File
@@ -219,6 +219,9 @@
stack_trace("Invalid mode passed to host scan: [mode || "null"]")
return FALSE
/// Huds from PAI software
#define PAI_HUD_TRAIT "pai_hud"
/**
* Proc that toggles any active huds based on the option.
*
@@ -227,18 +230,16 @@
/mob/living/silicon/pai/proc/toggle_hud(mode)
if(isnull(mode))
return FALSE
var/datum/atom_hud/hud
var/hud_on
if(mode == PAI_TOGGLE_MEDICAL_HUD)
hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medHUD = !medHUD
hud_on = medHUD
if(HAS_TRAIT_FROM(src, TRAIT_MEDICAL_HUD, PAI_HUD_TRAIT))
REMOVE_TRAIT(src, TRAIT_MEDICAL_HUD, PAI_HUD_TRAIT)
else
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, PAI_HUD_TRAIT)
if(mode == PAI_TOGGLE_SECURITY_HUD)
hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
secHUD = !secHUD
hud_on = secHUD
if(hud_on)
hud.show_to(src)
else
hud.hide_from(src)
if(HAS_TRAIT_FROM(src, TRAIT_SECURITY_HUD, PAI_HUD_TRAIT))
REMOVE_TRAIT(src, TRAIT_SECURITY_HUD, PAI_HUD_TRAIT)
else
ADD_TRAIT(src, TRAIT_SECURITY_HUD, PAI_HUD_TRAIT)
return TRUE
#undef PAI_HUD_TRAIT