mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-24 16:41:48 +00:00
[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.  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>
54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
/datum/element/digitalcamo
|
|
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
|
|
var/list/attached_mobs = list()
|
|
|
|
/datum/element/digitalcamo/New()
|
|
. = ..()
|
|
START_PROCESSING(SSdcs, src)
|
|
|
|
/datum/element/digitalcamo/Attach(datum/target)
|
|
. = ..()
|
|
if(!isliving(target) || (target in attached_mobs))
|
|
return ELEMENT_INCOMPATIBLE
|
|
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
|
|
RegisterSignal(target, COMSIG_LIVING_CAN_TRACK, PROC_REF(can_track))
|
|
var/image/img = image(loc = target)
|
|
img.override = TRUE
|
|
attached_mobs[target] = img
|
|
HideFromAIHuds(target)
|
|
|
|
/datum/element/digitalcamo/Detach(datum/target)
|
|
. = ..()
|
|
UnregisterSignal(target, list(COMSIG_ATOM_EXAMINE, COMSIG_LIVING_CAN_TRACK))
|
|
for(var/mob/living/silicon/ai/AI in GLOB.player_list)
|
|
AI.client.images -= attached_mobs[target]
|
|
attached_mobs -= target
|
|
UnhideFromAIHuds(target)
|
|
|
|
/datum/element/digitalcamo/proc/HideFromAIHuds(mob/living/target)
|
|
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
|
|
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)
|
|
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
|
|
|
|
to_chat(M, span_warning("[source.p_their()] skin seems to be shifting like something is moving below it."))
|
|
|
|
/datum/element/digitalcamo/proc/can_track(datum/source, mob/user)
|
|
SIGNAL_HANDLER
|
|
|
|
return COMPONENT_CANT_TRACK
|
|
|
|
/datum/element/digitalcamo/process()
|
|
for(var/mob/living/silicon/ai/AI in GLOB.player_list)
|
|
for(var/mob in attached_mobs)
|
|
AI.client.images |= attached_mobs[mob]
|