From 635e4b170eb09c7fe69de61081d371c465368b81 Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 28 Aug 2026 23:44:05 +0000 Subject: [PATCH] Refactor atom HUDs to track source of HUD gain/loss. (#32091) * Refactor atom HUDs to track source of HUD gain/loss. * Retain shared images from different huds on removal. * Fix some ghost HUD toggles. * Add HUD sources to more hud add/remove calls. * Apply suggestions from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan * Check if a user has a hud before removing it, autodoc. --------- Signed-off-by: Alan Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> --- code/controllers/subsystem/SSticker.dm | 2 +- code/datums/ai_laws_datums.dm | 4 +- code/datums/atom_hud.dm | 48 ++++++++++++------- code/datums/status_effects/buffs.dm | 4 +- code/game/data_huds.dm | 2 +- .../miniantags/guardian/types/healer.dm | 2 +- code/game/mecha/janitor/nkarrdem.dm | 15 +++--- code/game/mecha/medical/odysseus.dm | 15 +++--- code/modules/antagonists/_common/antag_hud.dm | 10 ++-- .../antagonists/heretic/heretic_antag.dm | 4 +- .../antagonists/traitor/datum_traitor.dm | 8 ++-- code/modules/clothing/glasses/hudglasses.dm | 4 +- code/modules/clothing/glasses/tajblind.dm | 4 +- .../mob/dead/observer/observer_base.dm | 8 ++-- .../mob/living/basic/friendly/lightgeist.dm | 4 +- .../carbon/human/species/abductor_species.dm | 4 +- .../living/carbon/human/species/machine.dm | 2 +- .../mob/living/silicon/robot/robot_mob.dm | 5 +- .../modules/mob/living/silicon/silicon_mob.dm | 16 +++---- .../mob/living/simple_animal/bot/bot.dm | 4 +- .../hostile/terror_spiders/terror_spiders.dm | 4 +- code/modules/mod/modules/modules_visor.dm | 4 +- code/modules/surgery/organs/augments_eyes.dm | 4 +- code/modules/tgui/modules/ghost_hud_panel.dm | 8 ++-- 24 files changed, 98 insertions(+), 87 deletions(-) diff --git a/code/controllers/subsystem/SSticker.dm b/code/controllers/subsystem/SSticker.dm index 4c575f6bbbe..f6f5da9a918 100644 --- a/code/controllers/subsystem/SSticker.dm +++ b/code/controllers/subsystem/SSticker.dm @@ -676,7 +676,7 @@ SUBSYSTEM_DEF(ticker) continue for(var/m in GLOB.player_list) var/mob/M = m - antag_hud.add_hud_to(M) + antag_hud.add_hud_to(M, "round end") var/static/list/base_encouragement_messages = list( "Keep on keeping on!", diff --git a/code/datums/ai_laws_datums.dm b/code/datums/ai_laws_datums.dm index 979c2546296..3cb983fa3ec 100644 --- a/code/datums/ai_laws_datums.dm +++ b/code/datums/ai_laws_datums.dm @@ -98,13 +98,13 @@ if(zeroth_law_borg) laws.set_zeroth_law(zeroth_law_borg.law) var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.add_hud_to(src) + H.add_hud_to(src, "zeroth law") else if(zeroth_law) laws.set_zeroth_law(zeroth_law.law) else laws.clear_zeroth_laws() var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.remove_hud_from(src) + H.remove_hud_from(src, "zeroth law") /mob/living/silicon/ai/sync_zeroth(datum/ai_law/zeroth_law, datum/ai_law/zeroth_law_borg) if(zeroth_law) diff --git a/code/datums/atom_hud.dm b/code/datums/atom_hud.dm index 6c7c77eb631..4d11ecf7d53 100644 --- a/code/datums/atom_hud.dm +++ b/code/datums/atom_hud.dm @@ -36,9 +36,12 @@ GLOBAL_LIST_INIT(huds, alist( )) /datum/atom_hud - var/list/atom/hudatoms = list() //list of all atoms which display this hud - var/list/mob/hudusers = list() //list with all mobs who can see the hud - var/list/hud_icons = list() //these will be the indexes for the atom's hud_list + /// All the atoms that display this hud. + var/list/atom/hudatoms = list() + /// All the mobs who can see this hud, and their sources. each_mob = list(source/1, source/2). + var/list/mob/hudusers = list() + /// Indexes for the atom's hud_list. + var/list/hud_icons = list() /// Do we ignore the invisibility check? Used by anom huds so we can see our stuff. var/ignore_invisibility_check = FALSE @@ -54,43 +57,57 @@ GLOBAL_LIST_INIT(huds, alist( GLOB.all_huds -= src return ..() -/datum/atom_hud/proc/remove_hud_from(mob/M) +/// Removes `source` from mob's hud sources, and if mob has no hud sources, removes their ability to see this hud +/datum/atom_hud/proc/remove_hud_from(mob/M, atom/source) if(!M) return if(src in M.permanent_huds) return - for(var/atom/A in hudatoms) - remove_from_single_hud(M, A) - hudusers -= M + if(hudusers[M]) + hudusers[M] -= source + if(hudusers[M] && length(hudusers[M])) + return + for(var/atom/A in hudatoms) + remove_hud_images(M, A) + hudusers -= M + M.reload_huds() + +/// Removes a single item from being displayed on this hud, for example, removes one mess from janihud. /datum/atom_hud/proc/remove_from_hud(atom/A) if(!A) return for(var/mob/M in hudusers) - remove_from_single_hud(M, A) + remove_hud_images(M, A) hudatoms -= A -/datum/atom_hud/proc/remove_from_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client +/// Removes all of the hud pictures that `A` produces from mob `M`'s view. +/datum/atom_hud/proc/remove_hud_images(mob/M, atom/A) // Unsafe, no sanity apart from client. if(!M || !M.client || !A) return for(var/i in hud_icons) M.client.images -= A.hud_list[i] -/datum/atom_hud/proc/add_hud_to(mob/M) +/// Adds `source` to mob's sources of this hud, and shows them all the pictures on the hud +/datum/atom_hud/proc/add_hud_to(mob/M, atom/source) if(!M) return - hudusers |= M + if(!(M in hudusers)) + hudusers[M] = list() + hudusers[M] |= source for(var/atom/A in hudatoms) - add_to_single_hud(M, A) + add_hud_images(M, A) +/// Adds single atom `A` to the list of pictures this hud will display. Shows them to mobs with this hud. /datum/atom_hud/proc/add_to_hud(atom/A) if(!A) return hudatoms |= A for(var/mob/M in hudusers) - add_to_single_hud(M, A) + add_hud_images(M, A) -/datum/atom_hud/proc/add_to_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client +/// Adds all hud images that `A` produces to player `M`'s view. +/datum/atom_hud/proc/add_hud_images(mob/M, atom/A) // Unsafe, no sanity apart from client. if(!M || !M.client || !A) return if((A.invisibility > M.see_invisible) && !ignore_invisibility_check) // yee yee ass snowflake check for our yee yee ass snowflake huds @@ -111,10 +128,9 @@ GLOBAL_LIST_INIT(huds, alist( for(var/datum/mindslaves/serv in (SSticker.mode.vampires | SSticker.mode.traitors)) serv_huds += serv.thrallhud - for(var/datum/atom_hud/hud in (GLOB.all_huds|serv_huds))//|gang_huds)) if(src in hud.hudusers) - hud.add_hud_to(src) + hud.add_hud_to(src, hud.hudusers[src][1]) /mob/new_player/reload_huds() return diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 93bafeddeb8..eb15733ccdb 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -337,7 +337,7 @@ //Makes the user passive, it's in their oath not to harm! ADD_TRAIT(owner, TRAIT_PACIFISM, "hippocraticOath") var/datum/atom_hud/H = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - H.add_hud_to(owner) + H.add_hud_to(owner, src) owner.permanent_huds |= H return ..() @@ -345,7 +345,7 @@ REMOVE_TRAIT(owner, TRAIT_PACIFISM, "hippocraticOath") var/datum/atom_hud/H = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] owner.permanent_huds ^= H - H.remove_hud_from(owner) + H.remove_hud_from(owner, src) /datum/status_effect/hippocratic_oath/tick() // Death transforms you into a snake after a short grace period diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 33dbc0d7256..c34a7150b6a 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -34,7 +34,7 @@ if(U.sensor_mode <= SENSOR_VITALS) return return TRUE -/datum/atom_hud/data/human/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H) +/datum/atom_hud/data/human/medical/basic/add_hud_images(mob/M, mob/living/carbon/H) if(check_sensors(H) || isobserver(M)) ..() diff --git a/code/game/gamemodes/miniantags/guardian/types/healer.dm b/code/game/gamemodes/miniantags/guardian/types/healer.dm index caaaf525e6d..69d95a2202d 100644 --- a/code/game/gamemodes/miniantags/guardian/types/healer.dm +++ b/code/game/gamemodes/miniantags/guardian/types/healer.dm @@ -40,7 +40,7 @@ /mob/living/simple_animal/hostile/guardian/healer/Life(seconds, times_fired) ..() var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - medsensor.add_hud_to(src) + medsensor.add_hud_to(src, "guardian healer") /mob/living/simple_animal/hostile/guardian/healer/get_status_tab_items() var/list/status_tab_data = ..() diff --git a/code/game/mecha/janitor/nkarrdem.dm b/code/game/mecha/janitor/nkarrdem.dm index 5c9842c7d02..1461a36c1a5 100644 --- a/code/game/mecha/janitor/nkarrdem.dm +++ b/code/game/mecha/janitor/nkarrdem.dm @@ -30,31 +30,28 @@ /obj/mecha/nkarrdem/moved_inside(mob/living/carbon/human/H) . = ..() if(. && ishuman(H)) - if(istype(H.glasses, /obj/item/clothing/glasses/hud)) - occupant_message(SPAN_WARNING("[H.glasses] prevent you from using [src]'s built-in janitorial HUD.")) - else - var/datum/atom_hud/data/janitor/jani_hud = GLOB.huds[DATA_HUD_JANITOR] - jani_hud.add_hud_to(H) - builtin_hud_user = TRUE + var/datum/atom_hud/data/janitor/jani_hud = GLOB.huds[DATA_HUD_JANITOR] + jani_hud.add_hud_to(H, src) + builtin_hud_user = TRUE /obj/mecha/nkarrdem/mmi_moved_inside(obj/item/mmi/mmi_as_oc, mob/user) . = ..() if(.) if(occupant.client) var/datum/atom_hud/data/janitor/jani_hud = GLOB.huds[DATA_HUD_JANITOR] - jani_hud.add_hud_to(occupant) + jani_hud.add_hud_to(occupant, src) builtin_hud_user = TRUE /obj/mecha/nkarrdem/go_out() if(ishuman(occupant) && builtin_hud_user) var/mob/living/carbon/human/H = occupant var/datum/atom_hud/data/janitor/jani_hud = GLOB.huds[DATA_HUD_JANITOR] - jani_hud.remove_hud_from(H) + jani_hud.remove_hud_from(H, src) builtin_hud_user = FALSE else if((isbrain(occupant) || pilot_is_mmi()) && builtin_hud_user) var/mob/living/brain/H = occupant var/datum/atom_hud/data/janitor/jani_hud = GLOB.huds[DATA_HUD_JANITOR] - jani_hud.remove_hud_from(H) + jani_hud.remove_hud_from(H, src) builtin_hud_user = FALSE return ..() diff --git a/code/game/mecha/medical/odysseus.dm b/code/game/mecha/medical/odysseus.dm index 4b0e3d9cb22..4967fce0e98 100644 --- a/code/game/mecha/medical/odysseus.dm +++ b/code/game/mecha/medical/odysseus.dm @@ -16,31 +16,28 @@ /obj/mecha/medical/odysseus/moved_inside(mob/living/carbon/human/H) . = ..() if(. && ishuman(H)) - if(istype(H.glasses, /obj/item/clothing/glasses/hud)) - occupant_message(SPAN_WARNING("[H.glasses] prevent you from using the built-in medical hud.")) - else - var/datum/atom_hud/data/human/medical/advanced/A = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - A.add_hud_to(H) - builtin_hud_user = 1 + var/datum/atom_hud/data/human/medical/advanced/A = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] + A.add_hud_to(H, src) + builtin_hud_user = 1 /obj/mecha/medical/odysseus/mmi_moved_inside(obj/item/mmi/mmi_as_oc, mob/user) . = ..() if(.) if(occupant.client) var/datum/atom_hud/A = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - A.add_hud_to(occupant) + A.add_hud_to(occupant, src) builtin_hud_user = 1 /obj/mecha/medical/odysseus/go_out() if(ishuman(occupant) && builtin_hud_user) var/mob/living/carbon/human/H = occupant var/datum/atom_hud/data/human/medical/advanced/A = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - A.remove_hud_from(H) + A.remove_hud_from(H, src) builtin_hud_user = 0 else if((isbrain(occupant) || pilot_is_mmi()) && builtin_hud_user) var/mob/living/brain/H = occupant var/datum/atom_hud/A = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - A.remove_hud_from(H) + A.remove_hud_from(H, src) builtin_hud_user = 0 . = ..() diff --git a/code/modules/antagonists/_common/antag_hud.dm b/code/modules/antagonists/_common/antag_hud.dm index 35293ef2dd2..6d0a9db7de2 100644 --- a/code/modules/antagonists/_common/antag_hud.dm +++ b/code/modules/antagonists/_common/antag_hud.dm @@ -13,7 +13,7 @@ M.mind.antag_hud.leave_hud(M) add_to_hud(M) if(self_visible) - add_hud_to(M) + add_hud_to(M, "antag") M.mind.antag_hud = src /datum/atom_hud/antag/proc/leave_hud(mob/M) @@ -22,7 +22,7 @@ if(!istype(M)) CRASH("leave_hud(): [M] ([M.type]) is not a mob!") remove_from_hud(M) - remove_hud_from(M) + remove_hud_from(M, "antag") if(M.mind) M.mind.antag_hud = null @@ -31,13 +31,13 @@ CRASH("join_hud(): [M] ([M.type]) is not a mob!") add_to_hud(M) if(self_visible) - add_hud_to(M) + add_hud_to(M, "antag") /datum/atom_hud/antag/hidden/secondary/leave_hud(mob/M) if(!istype(M)) CRASH("leave_hud(): [M] ([M.type]) is not a mob!") remove_from_hud(M) - remove_hud_from(M) + remove_hud_from(M, "antag") //GAME_MODE PROCS //called to set a mob's antag icon state @@ -71,7 +71,7 @@ if(!istype(data_hud)) continue if(current in data_hud.hudusers) - data_hud.remove_hud_from(current) + data_hud.remove_hud_from(current, "antag") ///Master Servent Datum Sytems,Based on TG Gang system// diff --git a/code/modules/antagonists/heretic/heretic_antag.dm b/code/modules/antagonists/heretic/heretic_antag.dm index 6d7481caf3e..d7380553174 100644 --- a/code/modules/antagonists/heretic/heretic_antag.dm +++ b/code/modules/antagonists/heretic/heretic_antag.dm @@ -279,7 +279,7 @@ if(!issilicon(our_mob)) GLOB.reality_smash_track.add_tracked_mind(owner) var/datum/atom_hud/data/heretic/h_hud = GLOB.huds[DATA_HUD_HERETIC] - h_hud.add_hud_to(our_mob) + h_hud.add_hud_to(our_mob, src) ADD_TRAIT(our_mob, TRAIT_MANSUS_TOUCHED, src.UID()) RegisterSignal(our_mob, COMSIG_LIVING_CULT_SACRIFICED, PROC_REF(on_cult_sacrificed)) RegisterSignal(our_mob, COMSIG_MOB_BEFORE_SPELL_CAST, PROC_REF(on_spell_cast)) @@ -293,7 +293,7 @@ if(owner in GLOB.reality_smash_track.tracked_heretics) GLOB.reality_smash_track.remove_tracked_mind(owner) var/datum/atom_hud/data/heretic/h_hud = GLOB.huds[DATA_HUD_HERETIC] - h_hud.remove_hud_from(our_mob) + h_hud.remove_hud_from(our_mob, src) REMOVE_TRAIT(our_mob, TRAIT_MANSUS_TOUCHED, src.UID()) UnregisterSignal(our_mob, list( diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 22c68740fa9..1a3b7c26ba9 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -56,9 +56,9 @@ RESTRICT_TYPE(/datum/antagonist/traitor) A.remove_malf_abilities() QDEL_NULL(A.malf_picker) var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.remove_hud_from(usr) + H.remove_hud_from(usr, src) for(var/mob/living/silicon/robot/borg in A.connected_robots) - H.remove_hud_from(borg) + H.remove_hud_from(borg, src) // Leave the mindslave hud. if(owner.som) @@ -250,9 +250,9 @@ RESTRICT_TYPE(/datum/antagonist/traitor) to_chat(killer, "Your radio has been upgraded! Use :t to speak on an encrypted channel with Syndicate Agents!") killer.add_malf_picker() var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.add_hud_to(killer) + H.add_hud_to(killer, src) for(var/mob/living/silicon/robot/borg in killer.connected_robots) - H.add_hud_to(borg) + H.add_hud_to(borg, src) /** * Gives a traitor human their uplink, and uplink code. diff --git a/code/modules/clothing/glasses/hudglasses.dm b/code/modules/clothing/glasses/hudglasses.dm index 94716afcdc9..9df260d0711 100644 --- a/code/modules/clothing/glasses/hudglasses.dm +++ b/code/modules/clothing/glasses/hudglasses.dm @@ -24,7 +24,7 @@ return for(var/new_hud in hud_types) var/datum/atom_hud/H = GLOB.huds[new_hud] - H.add_hud_to(user) + H.add_hud_to(user, src) /obj/item/clothing/glasses/hud/dropped(mob/living/carbon/human/user) ..() @@ -32,7 +32,7 @@ return for(var/new_hud in hud_types) var/datum/atom_hud/H = GLOB.huds[new_hud] - H.remove_hud_from(user) + H.remove_hud_from(user, src) /obj/item/clothing/glasses/hud/emp_act(severity) if(!emagged) diff --git a/code/modules/clothing/glasses/tajblind.dm b/code/modules/clothing/glasses/tajblind.dm index 2cb37d78571..d37538dc038 100644 --- a/code/modules/clothing/glasses/tajblind.dm +++ b/code/modules/clothing/glasses/tajblind.dm @@ -75,7 +75,7 @@ return for(var/new_hud in hud_types) var/datum/atom_hud/H = GLOB.huds[new_hud] - H.remove_hud_from(user) + H.remove_hud_from(user, src) hud_types = null return electronics = TRUE @@ -85,7 +85,7 @@ return for(var/new_hud in hud_types) var/datum/atom_hud/H = GLOB.huds[new_hud] - H.add_hud_to(user) + H.add_hud_to(user, src) /obj/item/clothing/glasses/hud/tajblind/meson name = "\improper Tajaran engineering meson veil" diff --git a/code/modules/mob/dead/observer/observer_base.dm b/code/modules/mob/dead/observer/observer_base.dm index 6794abf1c69..6469f181e8c 100644 --- a/code/modules/mob/dead/observer/observer_base.dm +++ b/code/modules/mob/dead/observer/observer_base.dm @@ -331,13 +331,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/proc/show_me_the_hud(hud_index) var/datum/atom_hud/H = GLOB.huds[hud_index] - H.add_hud_to(src) + H.add_hud_to(src, "observer") data_hud_seen |= hud_index // remove old huds /mob/dead/observer/proc/remove_the_hud(hud_index) var/datum/atom_hud/H = GLOB.huds[hud_index] - H.remove_hud_from(src) + H.remove_hud_from(src, "observer") data_hud_seen -= hud_index /mob/dead/observer/verb/open_hud_panel() @@ -432,7 +432,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/datum/atom_hud/antag/chosen_hud = hud if(!istype(chosen_hud)) continue - chosen_hud.add_hud_to(src) + chosen_hud.add_hud_to(src, "observer") /** * Toggles off all HUDs for the ghost player. @@ -448,7 +448,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/datum/atom_hud/antag/chosen_hud = hud if(!istype(chosen_hud)) continue - chosen_hud.remove_hud_from(src) + chosen_hud.remove_hud_from(src, "observer") /mob/dead/observer/proc/toggle_rad_view() ghost_flags ^= GHOST_SEE_RADS diff --git a/code/modules/mob/living/basic/friendly/lightgeist.dm b/code/modules/mob/living/basic/friendly/lightgeist.dm index f2cbc0e52ed..d3141c09cd2 100644 --- a/code/modules/mob/living/basic/friendly/lightgeist.dm +++ b/code/modules/mob/living/basic/friendly/lightgeist.dm @@ -39,11 +39,11 @@ remove_verb(src, /mob/living/verb/pulled) remove_verb(src, /mob/verb/me_verb) var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - med_hud.add_hud_to(src) + med_hud.add_hud_to(src, "lightgeist") /mob/living/basic/lightgeist/Destroy() var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - med_hud.remove_hud_from(src) + med_hud.remove_hud_from(src, "lightgeist") return ..() /mob/living/basic/lightgeist/melee_attack(atom/target, list/modifiers, ignore_cooldown) diff --git a/code/modules/mob/living/carbon/human/species/abductor_species.dm b/code/modules/mob/living/carbon/human/species/abductor_species.dm index 3f9862f383d..ab6b61eb3ce 100644 --- a/code/modules/mob/living/carbon/human/species/abductor_species.dm +++ b/code/modules/mob/living/carbon/human/species/abductor_species.dm @@ -40,9 +40,9 @@ H.languages.Cut() //Under no condition should you be able to speak any language H.add_language("Abductor Mindlink") //other than over the abductor's own mindlink var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR] - abductor_hud.add_hud_to(H) + abductor_hud.add_hud_to(H, "abductor") /datum/species/abductor/on_species_loss(mob/living/carbon/human/H) ..() var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR] - abductor_hud.remove_hud_from(H) + abductor_hud.remove_hud_from(H, "abductor") diff --git a/code/modules/mob/living/carbon/human/species/machine.dm b/code/modules/mob/living/carbon/human/species/machine.dm index 54e78c37dbc..825ea14709b 100644 --- a/code/modules/mob/living/carbon/human/species/machine.dm +++ b/code/modules/mob/living/carbon/human/species/machine.dm @@ -107,7 +107,7 @@ diag_hud.remove_from_hud(H) else if(istype(hud, /datum/atom_hud/data/human/medical)) var/datum/atom_hud/data/human/medical/med_hud = hud - med_hud.add_hud_to(H) + med_hud.add_to_hud(H) // i love snowflake code var/image/health_bar = H.hud_list[DIAG_HUD] diff --git a/code/modules/mob/living/silicon/robot/robot_mob.dm b/code/modules/mob/living/silicon/robot/robot_mob.dm index 4ba792bdc41..8000834aaaf 100644 --- a/code/modules/mob/living/silicon/robot/robot_mob.dm +++ b/code/modules/mob/living/silicon/robot/robot_mob.dm @@ -1257,7 +1257,8 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( clear_supplied_laws() laws = new /datum/ai_laws/crewsimov var/datum/atom_hud/data/human/malf_ai/A = GLOB.huds[DATA_HUD_MALF_AI] - A.remove_hud_from(user) + + A.remove_hud_from(user, "emag") /mob/living/silicon/robot/emag_act(mob/user) if(!ishuman(user) && !issilicon(user)) @@ -1646,7 +1647,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( update_icons() emagged = TRUE var/datum/atom_hud/data/human/malf_ai/A = GLOB.huds[DATA_HUD_MALF_AI] - A.add_hud_to(src) + A.add_hud_to(src, "emag") SetLockdown(FALSE) /mob/living/silicon/robot/proc/make_mindflayer_robot(mob/living/flayer) diff --git a/code/modules/mob/living/silicon/silicon_mob.dm b/code/modules/mob/living/silicon/silicon_mob.dm index 5cea2ec0f47..0b4c915014b 100644 --- a/code/modules/mob/living/silicon/silicon_mob.dm +++ b/code/modules/mob/living/silicon/silicon_mob.dm @@ -409,27 +409,27 @@ var/datum/atom_hud/medsensor = GLOB.huds[med_hud] var/datum/atom_hud/diagsensor = GLOB.huds[d_hud] var/datum/atom_hud/janisensor = GLOB.huds[jani_hud] - secsensor.remove_hud_from(src) - medsensor.remove_hud_from(src) - diagsensor.remove_hud_from(src) - janisensor.remove_hud_from(src) + secsensor.remove_hud_from(src, "silicon") + medsensor.remove_hud_from(src, "silicon") + diagsensor.remove_hud_from(src, "silicon") + janisensor.remove_hud_from(src, "silicon") /mob/living/silicon/proc/add_sec_hud() var/datum/atom_hud/secsensor = GLOB.huds[sec_hud] - secsensor.add_hud_to(src) + secsensor.add_hud_to(src, "silicon") /mob/living/silicon/proc/add_med_hud() var/datum/atom_hud/medsensor = GLOB.huds[med_hud] - medsensor.add_hud_to(src) + medsensor.add_hud_to(src, "silicon") /mob/living/silicon/proc/add_diag_hud() var/datum/atom_hud/diagsensor = GLOB.huds[d_hud] - diagsensor.add_hud_to(src) + diagsensor.add_hud_to(src, "silicon") /mob/living/silicon/proc/add_jani_hud() var/datum/atom_hud/janisensor = GLOB.huds[jani_hud] - janisensor.add_hud_to(src) + janisensor.add_hud_to(src, "silicon") /mob/living/silicon/proc/toggle_sensor_mode() to_chat(src, SPAN_NOTICE("Please select sensor type.")) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 407860d43aa..4fad21f3bca 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -182,7 +182,7 @@ var/datum/atom_hud/data_hud = GLOB.huds[data_hud_type] if(data_hud) - data_hud.remove_hud_from(src) + data_hud.remove_hud_from(src, "bot") GLOB.bots_list -= src QDEL_NULL(path) @@ -1077,7 +1077,7 @@ Pass a positive integer as an argument to override a bot's default speed. var/datum/atom_hud/data_hud = GLOB.huds[data_hud_type] if(data_hud) - data_hud.add_hud_to(src) + data_hud.add_hud_to(src, "bot") diag_hud_set_botmode() show_laws() diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm index 2f04fa758cb..b86a52aa5d0 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm @@ -289,7 +289,7 @@ GLOBAL_LIST_EMPTY(ts_infected_list) addtimer(CALLBACK(src, PROC_REF(CheckFaction)), 20) addtimer(CALLBACK(src, PROC_REF(announcetoghosts)), 30) var/datum/atom_hud/U = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - U.add_hud_to(src) + U.add_hud_to(src, "spider") spider_creation_time = world.time AddComponent(/datum/component/event_tracker, EVENT_TERROR_SPIDERS) @@ -305,7 +305,7 @@ GLOBAL_LIST_EMPTY(ts_infected_list) /mob/living/simple_animal/hostile/poison/terror_spider/Destroy() GLOB.ts_spiderlist -= src var/datum/atom_hud/U = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - U.remove_hud_from(src) + U.remove_hud_from(src, "spider") handle_dying() spider_mymother = null diff --git a/code/modules/mod/modules/modules_visor.dm b/code/modules/mod/modules/modules_visor.dm index 249059032ad..4ce1af08fd6 100644 --- a/code/modules/mod/modules/modules_visor.dm +++ b/code/modules/mod/modules/modules_visor.dm @@ -21,7 +21,7 @@ return if(hud_type) var/datum/atom_hud/hud = GLOB.huds[hud_type] - hud.add_hud_to(mod.wearer) + hud.add_hud_to(mod.wearer, src) if(length(visor_trait)) ADD_TRAIT(mod.wearer, visor_trait, MODSUIT_TRAIT) mod.wearer.update_sight() @@ -32,7 +32,7 @@ return if(hud_type) var/datum/atom_hud/hud = GLOB.huds[hud_type] - hud.remove_hud_from(mod.wearer) + hud.remove_hud_from(mod.wearer, src) if(length(visor_trait)) REMOVE_TRAIT(mod.wearer, visor_trait, MODSUIT_TRAIT) mod.wearer.update_sight() diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm index 90d3c71a669..f13eb1192ea 100644 --- a/code/modules/surgery/organs/augments_eyes.dm +++ b/code/modules/surgery/organs/augments_eyes.dm @@ -25,7 +25,7 @@ ..() if(HUD_type) var/datum/atom_hud/H = GLOB.huds[HUD_type] - H.add_hud_to(M) + H.add_hud_to(M, src) M.permanent_huds |= H /obj/item/organ/internal/cyberimp/eyes/hud/remove(mob/living/carbon/M, special = 0) @@ -33,7 +33,7 @@ if(HUD_type) var/datum/atom_hud/H = GLOB.huds[HUD_type] M.permanent_huds ^= H - H.remove_hud_from(M) + H.remove_hud_from(M, src) /obj/item/organ/internal/cyberimp/eyes/hud/medical name = "Medical HUD implant" diff --git a/code/modules/tgui/modules/ghost_hud_panel.dm b/code/modules/tgui/modules/ghost_hud_panel.dm index 5e921ab25bd..7327ddf057f 100644 --- a/code/modules/tgui/modules/ghost_hud_panel.dm +++ b/code/modules/tgui/modules/ghost_hud_panel.dm @@ -88,9 +88,9 @@ GLOBAL_DATUM_INIT(ghost_hud_panel, /datum/ui_module/ghost_hud_panel, new) var/datum/atom_hud/antag/chosen_hud = hud if(!istype(chosen_hud)) continue - chosen_hud.add_hud_to(ghost) + chosen_hud.add_hud_to(ghost, "observer") var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.add_hud_to(ghost) + H.add_hud_to(ghost, "observer") if("ahud_off") ghost.antagHUD = FALSE @@ -98,6 +98,6 @@ GLOBAL_DATUM_INIT(ghost_hud_panel, /datum/ui_module/ghost_hud_panel, new) var/datum/atom_hud/antag/chosen_hud = hud if(!istype(chosen_hud)) continue - chosen_hud.remove_hud_from(ghost) + chosen_hud.remove_hud_from(ghost, "observer") var/datum/atom_hud/data/human/malf_ai/H = GLOB.huds[DATA_HUD_MALF_AI] - H.remove_hud_from(ghost) + H.remove_hud_from(ghost, "observer")