mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
More things use trait huds over raw hud management (#93084)
This commit is contained in:
+33
-2
@@ -1665,13 +1665,44 @@
|
||||
for(var/hud_trait in GLOB.trait_to_hud)
|
||||
RegisterSignal(src, SIGNAL_ADDTRAIT(hud_trait), PROC_REF(hud_trait_enabled))
|
||||
RegisterSignal(src, SIGNAL_REMOVETRAIT(hud_trait), PROC_REF(hud_trait_disabled))
|
||||
for(var/hud_trait in GLOB.trait_blockers_to_hud)
|
||||
RegisterSignal(src, SIGNAL_ADDTRAIT(hud_trait), PROC_REF(hud_trait_blocker_gained))
|
||||
RegisterSignal(src, SIGNAL_REMOVETRAIT(hud_trait), PROC_REF(hud_trait_blocker_lost))
|
||||
|
||||
/mob/proc/hud_trait_enabled(datum/source, new_trait)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
for(var/blocker, blocked_traits in GLOB.trait_blockers_to_hud)
|
||||
if(HAS_TRAIT(src, blocker) && (new_trait in blocked_traits))
|
||||
return
|
||||
|
||||
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[new_trait]]
|
||||
datahud.show_to(src)
|
||||
|
||||
/mob/proc/hud_trait_disabled(datum/source, new_trait)
|
||||
/mob/proc/hud_trait_disabled(datum/source, lost_trait)
|
||||
SIGNAL_HANDLER
|
||||
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[new_trait]]
|
||||
|
||||
for(var/blocker, blocked_traits in GLOB.trait_blockers_to_hud)
|
||||
if(HAS_TRAIT(src, blocker) && (lost_trait in blocked_traits))
|
||||
return // it may seem counterintuitive to check for blockers on trait removal, the blocker now has total reign over whether the hud should come back
|
||||
|
||||
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[lost_trait]]
|
||||
datahud.hide_from(src)
|
||||
|
||||
/mob/proc/hud_trait_blocker_gained(datum/source, new_trait)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
for(var/trait in GLOB.trait_blockers_to_hud[new_trait])
|
||||
if(!HAS_TRAIT(src, trait))
|
||||
continue
|
||||
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[trait]]
|
||||
datahud.hide_from(src)
|
||||
|
||||
/mob/proc/hud_trait_blocker_lost(datum/source, new_trait)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
for(var/trait in GLOB.trait_blockers_to_hud[new_trait])
|
||||
if(!HAS_TRAIT(src, trait))
|
||||
continue
|
||||
var/datum/atom_hud/datahud = GLOB.huds[GLOB.trait_to_hud[trait]]
|
||||
datahud.show_to(src)
|
||||
|
||||
Reference in New Issue
Block a user