From aefa22166c0fd8e15cb8173f8e1d18e35591c4ba Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:00:01 -0500 Subject: [PATCH] Heretic Influences use alt appearances (so ghosts can now see them (semi-transparent)) (#85932) ## About The Pull Request Removes the rather overcomplicated system behind heretic influences and makes them use alt appearances Fixes a few bugs involving alt appearances that I noticed in making them I made this PR 7 months ago and forgot to Pr it ## Why It's Good For The Game Less complex codes and lets observers get a cut in on the action. Should fix #77530 ## Changelog :cl: Melbert refactor: Refactored heretic influences a tiny bit, now ghosts can see them! Report any oddities. /:cl: --- code/__DEFINES/dcs/signals/signals_mind.dm | 3 + .../elements/block_turf_fingerprints.dm | 56 ++++++++++ code/game/atom/alternate_appearance.dm | 69 +++++++++--- .../antagonists/_common/antag_datum.dm | 15 +-- code/modules/antagonists/_common/antag_hud.dm | 7 +- code/modules/antagonists/cult/blood_magic.dm | 2 +- code/modules/antagonists/cult/runes.dm | 4 +- .../antagonists/heretic/heretic_antag.dm | 16 +-- .../antagonists/heretic/heretic_knowledge.dm | 3 +- .../modules/antagonists/heretic/influences.dm | 104 +++--------------- .../heretic/knowledge/starting_lore.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 7 +- code/modules/mob/login.dm | 8 +- code/modules/mob/mob.dm | 8 +- tgstation.dme | 1 + 15 files changed, 155 insertions(+), 150 deletions(-) create mode 100644 code/datums/elements/block_turf_fingerprints.dm diff --git a/code/__DEFINES/dcs/signals/signals_mind.dm b/code/__DEFINES/dcs/signals/signals_mind.dm index 72f43f518eb..e9a62a26102 100644 --- a/code/__DEFINES/dcs/signals/signals_mind.dm +++ b/code/__DEFINES/dcs/signals/signals_mind.dm @@ -6,3 +6,6 @@ /// Called on the mind when an antagonist is being removed, after the antagonist list has updated (datum/antagonist/antagonist) #define COMSIG_ANTAGONIST_REMOVED "antagonist_removed" + +/// Called on the mob when losing an antagonist datum (datum/antagonist/antagonist) +#define COMSIG_MOB_ANTAGONIST_REMOVED "mob_antagonist_removed" diff --git a/code/datums/elements/block_turf_fingerprints.dm b/code/datums/elements/block_turf_fingerprints.dm new file mode 100644 index 00000000000..f3b7ab9cf19 --- /dev/null +++ b/code/datums/elements/block_turf_fingerprints.dm @@ -0,0 +1,56 @@ +/** + * ## block_turf_fingerprints + * + * Attach to a movable, prevents mobs from leaving fingerprints on the turf below it + */ +/datum/element/block_turf_fingerprints + element_flags = ELEMENT_DETACH_ON_HOST_DESTROY + +/datum/element/block_turf_fingerprints/Attach(datum/target) + . = ..() + if(!ismovable(target)) + return ELEMENT_INCOMPATIBLE + + var/atom/movable/target_movable = target + if(isturf(target_movable.loc)) + apply_to_turf(target_movable.loc) + + RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(move_turf)) + +/datum/element/block_turf_fingerprints/Detach(atom/movable/target) + . = ..() + if(isturf(target.loc)) + remove_from_turf(target.loc) + + UnregisterSignal(target, COMSIG_MOVABLE_MOVED) + +/datum/element/block_turf_fingerprints/proc/apply_to_turf(turf/the_turf) + // It's possible two things with this element could be on the same turf, so let's avoid double-applying + if(the_turf.interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND) + // But what if the turf has this flag by default? We still need to override register a signal. + // Otherwise we may run into a very niche bug: + // - A turf as this flag by default + // - A movable with this element is placed on the turf + // - It does not gain the flag nor register a signal + // - The turf changes, and the new turf does not gain the flag + if(initial(the_turf.interaction_flags_atom) & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND) + RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf), override = TRUE) + return + + the_turf.interaction_flags_atom |= INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND + RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf)) + +/datum/element/block_turf_fingerprints/proc/remove_from_turf(turf/the_turf) + the_turf.interaction_flags_atom &= ~INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND + UnregisterSignal(the_turf, COMSIG_TURF_CHANGE) + +/datum/element/block_turf_fingerprints/proc/move_turf(atom/movable/source, atom/old_loc) + SIGNAL_HANDLER + if(isturf(old_loc)) + remove_from_turf(old_loc) + if(isturf(source.loc)) + apply_to_turf(source.loc) + +/datum/element/block_turf_fingerprints/proc/replace_our_turf(datum/source, path, new_baseturfs, flags, post_change_callbacks) + SIGNAL_HANDLER + post_change_callbacks += CALLBACK(src, PROC_REF(apply_to_turf)) diff --git a/code/game/atom/alternate_appearance.dm b/code/game/atom/alternate_appearance.dm index 228462f7936..108b72b95d2 100644 --- a/code/game/atom/alternate_appearance.dm +++ b/code/game/atom/alternate_appearance.dm @@ -35,20 +35,51 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances) GLOB.active_alternate_appearances += src for(var/mob in GLOB.player_list) - if(mobShouldSee(mob)) - show_to(mob) + apply_to_new_mob(mob) /datum/atom_hud/alternate_appearance/Destroy() GLOB.active_alternate_appearances -= src return ..() -/datum/atom_hud/alternate_appearance/proc/onNewMob(mob/M) - if(mobShouldSee(M)) - show_to(M) +/// Wrapper for applying this alt hud to the passed mob (if they should see it) +/datum/atom_hud/alternate_appearance/proc/apply_to_new_mob(mob/applying_to) + if(mobShouldSee(applying_to)) + if(!hud_users_all_z_levels[applying_to]) + show_to(applying_to) + return TRUE + return FALSE +/// Checks if the passed mob should be seeing this hud /datum/atom_hud/alternate_appearance/proc/mobShouldSee(mob/M) return FALSE +/datum/atom_hud/alternate_appearance/show_to(mob/new_viewer) + . = ..() + if(!new_viewer) + return + track_mob(new_viewer) + +/// Registers some signals to track the mob's state to determine if they should be seeing the hud still +/datum/atom_hud/alternate_appearance/proc/track_mob(mob/new_viewer) + return + +/datum/atom_hud/alternate_appearance/hide_from(mob/former_viewer, absolute) + . = ..() + if(!former_viewer || hud_atoms_all_z_levels[former_viewer] >= 1) + return + untrack_mob(former_viewer) + +/// Unregisters the signals that were tracking the mob's state +/datum/atom_hud/alternate_appearance/proc/untrack_mob(mob/former_viewer) + return + +/datum/atom_hud/alternate_appearance/proc/check_hud(mob/source) + SIGNAL_HANDLER + // Attempt to re-apply the hud entirely + if(!apply_to_new_mob(source)) + // If that failed, probably shouldn't be seeing it at all, so nuke it + hide_from(source, absolute = TRUE) + /datum/atom_hud/alternate_appearance/add_atom_to_hud(atom/A, image/I) . = ..() if(.) @@ -99,6 +130,22 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances) if(ghost_appearance) QDEL_NULL(ghost_appearance) +/datum/atom_hud/alternate_appearance/basic/track_mob(mob/new_viewer) + RegisterSignals(new_viewer, list( + COMSIG_MOB_ANTAGONIST_REMOVED, + COMSIG_MOB_GHOSTIZED, + COMSIG_MOB_MIND_TRANSFERRED_INTO, + COMSIG_MOB_MIND_TRANSFERRED_OUT_OF, + ), PROC_REF(check_hud), override = TRUE) + +/datum/atom_hud/alternate_appearance/basic/untrack_mob(mob/former_viewer) + UnregisterSignal(former_viewer, list( + COMSIG_MOB_ANTAGONIST_REMOVED, + COMSIG_MOB_GHOSTIZED, + COMSIG_MOB_MIND_TRANSFERRED_INTO, + COMSIG_MOB_MIND_TRANSFERRED_OUT_OF, + )) + /datum/atom_hud/alternate_appearance/basic/add_atom_to_hud(atom/A) LAZYINITLIST(A.hud_list) A.hud_list[appearance_key] = image @@ -136,16 +183,10 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances) /datum/atom_hud/alternate_appearance/basic/noncult /datum/atom_hud/alternate_appearance/basic/noncult/mobShouldSee(mob/M) - if(!IS_CULTIST(M)) - return TRUE - return FALSE + return !IS_CULTIST(M) -/datum/atom_hud/alternate_appearance/basic/cult - -/datum/atom_hud/alternate_appearance/basic/cult/mobShouldSee(mob/M) - if(IS_CULTIST(M)) - return TRUE - return FALSE +/datum/atom_hud/alternate_appearance/basic/has_antagonist/cult + antag_datum_type = /datum/antagonist/cult /datum/atom_hud/alternate_appearance/basic/blessed_aware diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm index b5188c3821c..fc8bfa0de84 100644 --- a/code/modules/antagonists/_common/antag_datum.dm +++ b/code/modules/antagonists/_common/antag_datum.dm @@ -271,6 +271,9 @@ GLOBAL_LIST_EMPTY(antagonists) if(count_against_dynamic_roll_chance && owner.current.stat != DEAD && owner.current.client) owner.current.add_to_current_living_antags() + for (var/datum/atom_hud/alternate_appearance/basic/antag_hud as anything in GLOB.active_alternate_appearances) + antag_hud.apply_to_new_mob(owner.current) + SEND_SIGNAL(owner, COMSIG_ANTAGONIST_GAINED, src) /** @@ -328,13 +331,8 @@ GLOBAL_LIST_EMPTY(antagonists) if(team) team.remove_member(owner) SEND_SIGNAL(owner, COMSIG_ANTAGONIST_REMOVED, src) - - // Remove HUDs that they should no longer see - var/mob/living/current = owner.current - for (var/datum/atom_hud/alternate_appearance/basic/has_antagonist/antag_hud as anything in GLOB.has_antagonist_huds) - if (!antag_hud.mobShouldSee(current)) - antag_hud.hide_from(current) - + if(owner.current) + SEND_SIGNAL(owner.current, COMSIG_MOB_ANTAGONIST_REMOVED, src) qdel(src) /** @@ -530,8 +528,7 @@ GLOBAL_LIST_EMPTY(antagonists) // Add HUDs that they couldn't see before for (var/datum/atom_hud/alternate_appearance/basic/has_antagonist/antag_hud as anything in GLOB.has_antagonist_huds) - if (antag_hud.mobShouldSee(owner.current)) - antag_hud.show_to(owner.current) + antag_hud.apply_to_new_mob(owner.current) /// Takes a location, returns an image drawing "on" it that matches this antag datum's hud icon /datum/antagonist/proc/hud_image_on(mob/hud_loc) diff --git a/code/modules/antagonists/_common/antag_hud.dm b/code/modules/antagonists/_common/antag_hud.dm index 863d52ef5ff..9933569f9a9 100644 --- a/code/modules/antagonists/_common/antag_hud.dm +++ b/code/modules/antagonists/_common/antag_hud.dm @@ -8,8 +8,9 @@ GLOBAL_LIST_EMPTY_TYPED(has_antagonist_huds, /datum/atom_hud/alternate_appearanc var/datum/weakref/team_ref /datum/atom_hud/alternate_appearance/basic/has_antagonist/New(key, image/I, antag_datum_type, datum/weakref/team) - src.antag_datum_type = antag_datum_type - team_ref = team + if(antag_datum_type) + src.antag_datum_type = antag_datum_type + src.team_ref = team GLOB.has_antagonist_huds += src return ..(key, I, NONE) @@ -18,6 +19,8 @@ GLOBAL_LIST_EMPTY_TYPED(has_antagonist_huds, /datum/atom_hud/alternate_appearanc return ..() /datum/atom_hud/alternate_appearance/basic/has_antagonist/mobShouldSee(mob/M) + if(add_ghost_version && isobserver(M)) + return FALSE // use the ghost version instead var/datum/team/antag_team = team_ref?.resolve() if(!isnull(antag_team)) return !!(M.mind in antag_team.members) diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index cf03718649c..4cfa39f3fa6 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -263,7 +263,7 @@ SEND_SOUND(caller, sound('sound/effects/ghost.ogg', FALSE, TRUE, 50)) var/image/sparkle_image = image('icons/effects/cult.dmi', clicked_on, "bloodsparkles", ABOVE_MOB_LAYER) - clicked_on.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/cult, "cult_apoc", sparkle_image, NONE) + clicked_on.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/has_antagonist/cult, "cult_apoc", sparkle_image, NONE) addtimer(CALLBACK(clicked_on, TYPE_PROC_REF(/atom/, remove_alt_appearance), "cult_apoc", TRUE), 4 MINUTES, TIMER_OVERRIDE|TIMER_UNIQUE) to_chat(caller, span_cult_bold("[clicked_on] has been cursed with living nightmares!")) diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm index d8aaf89283d..985f5da9501 100644 --- a/code/modules/antagonists/cult/runes.dm +++ b/code/modules/antagonists/cult/runes.dm @@ -1167,8 +1167,8 @@ GLOBAL_VAR_INIT(narsie_summon_count, 0) images += B if(!IS_CULTIST(M)) if(M.client) - var/image/C = image('icons/effects/cult.dmi',M,"bloodsparkles", ABOVE_MOB_LAYER) - add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/cult, "cult_apoc", C, NONE) + var/image/C = image('icons/effects/cult.dmi', M, "bloodsparkles", ABOVE_MOB_LAYER) + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/has_antagonist/cult, "cult_apoc", C, NONE) addtimer(CALLBACK(M, TYPE_PROC_REF(/atom/, remove_alt_appearance),"cult_apoc",TRUE), duration) images += C else diff --git a/code/modules/antagonists/heretic/heretic_antag.dm b/code/modules/antagonists/heretic/heretic_antag.dm index f9b95ea0dab..82a0f8ca622 100644 --- a/code/modules/antagonists/heretic/heretic_antag.dm +++ b/code/modules/antagonists/heretic/heretic_antag.dm @@ -313,7 +313,6 @@ RegisterSignal(our_mob, COMSIG_LIVING_CULT_SACRIFICED, PROC_REF(on_cult_sacrificed)) RegisterSignals(our_mob, list(COMSIG_MOB_BEFORE_SPELL_CAST, COMSIG_MOB_SPELL_ACTIVATED), PROC_REF(on_spell_cast)) RegisterSignal(our_mob, COMSIG_USER_ITEM_INTERACTION, PROC_REF(on_item_use)) - RegisterSignal(our_mob, COMSIG_MOB_LOGIN, PROC_REF(fix_influence_network)) RegisterSignal(our_mob, COMSIG_LIVING_POST_FULLY_HEAL, PROC_REF(after_fully_healed)) /datum/antagonist/heretic/remove_innate_effects(mob/living/mob_override) @@ -329,7 +328,6 @@ COMSIG_MOB_BEFORE_SPELL_CAST, COMSIG_MOB_SPELL_ACTIVATED, COMSIG_USER_ITEM_INTERACTION, - COMSIG_MOB_LOGIN, COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_LIVING_CULT_SACRIFICED, )) @@ -457,18 +455,6 @@ var/obj/item/offhand = user.get_inactive_held_item() return !QDELETED(offhand) && istype(offhand, /obj/item/melee/touch_attack/mansus_fist) -/* - * Signal proc for [COMSIG_MOB_LOGIN]. - * - * Calls rework_network() on our reality smash tracker - * whenever a login / client change happens, to ensure - * influence client visibility is fixed. - */ -/datum/antagonist/heretic/proc/fix_influence_network(mob/source) - SIGNAL_HANDLER - - GLOB.reality_smash_track.rework_network() - /// Signal proc for [COMSIG_LIVING_POST_FULLY_HEAL], /// Gives the heretic aliving heart on aheal or organ refresh /datum/antagonist/heretic/proc/after_fully_healed(mob/living/source, heal_flags) @@ -656,7 +642,7 @@ /datum/antagonist/heretic/proc/passive_influence_gain() knowledge_points++ if(owner.current.stat <= SOFT_CRIT) - to_chat(owner.current, "[span_hear("You hear a whisper...")] [span_hypnophrase(pick(strings(HERETIC_INFLUENCE_FILE, "drain_message")))]") + to_chat(owner.current, "[span_hear("You hear a whisper...")] [span_hypnophrase(pick_list(HERETIC_INFLUENCE_FILE, "drain_message"))]") addtimer(CALLBACK(src, PROC_REF(passive_influence_gain)), passive_gain_timer) /datum/antagonist/heretic/roundend_report() diff --git a/code/modules/antagonists/heretic/heretic_knowledge.dm b/code/modules/antagonists/heretic/heretic_knowledge.dm index 06ea0d6c0bd..94ecc0f9d77 100644 --- a/code/modules/antagonists/heretic/heretic_knowledge.dm +++ b/code/modules/antagonists/heretic/heretic_knowledge.dm @@ -680,9 +680,8 @@ our_heretic.knowledge_points += KNOWLEDGE_RITUAL_POINTS was_completed = TRUE - var/drain_message = pick(strings(HERETIC_INFLUENCE_FILE, "drain_message")) to_chat(user, span_boldnotice("[name] completed!")) - to_chat(user, span_hypnophrase(span_big("[drain_message]"))) + to_chat(user, span_hypnophrase(span_big("[pick_list(HERETIC_INFLUENCE_FILE, "drain_message")]"))) desc += " (Completed!)" log_heretic_knowledge("[key_name(user)] completed a [name] at [worldtime2text()].") user.add_mob_memory(/datum/memory/heretic_knowledge_ritual) diff --git a/code/modules/antagonists/heretic/influences.dm b/code/modules/antagonists/heretic/influences.dm index 4fff7667f1e..abba2c3f100 100644 --- a/code/modules/antagonists/heretic/influences.dm +++ b/code/modules/antagonists/heretic/influences.dm @@ -29,36 +29,6 @@ tracked_heretics.Cut() return ..() -/** - * Automatically fixes the target and smash network - * - * Fixes any bugs that are caused by late Generate() or exchanging clients - */ -/datum/reality_smash_tracker/proc/rework_network() - SIGNAL_HANDLER - - for(var/mind in tracked_heretics) - if(isnull(mind)) - stack_trace("A null somehow landed in the [type] list of minds. How?") - tracked_heretics -= mind - continue - - add_to_smashes(mind) - -/** - * Allow [to_add] to see all tracked reality smashes. - */ -/datum/reality_smash_tracker/proc/add_to_smashes(datum/mind/to_add) - for(var/obj/effect/heretic_influence/reality_smash as anything in smashes) - reality_smash.add_mind(to_add) - -/** - * Stop [to_remove] from seeing any tracked reality smashes. - */ -/datum/reality_smash_tracker/proc/remove_from_smashes(datum/mind/to_remove) - for(var/obj/effect/heretic_influence/reality_smash as anything in smashes) - reality_smash.remove_mind(to_remove) - /** * Generates a set amount of reality smashes * based on the number of already existing smashes @@ -83,8 +53,6 @@ new /obj/effect/heretic_influence(chosen_location) - rework_network() - /** * Adds a mind to the list of people that can see the reality smashes * @@ -97,9 +65,6 @@ if(ishuman(heretic.current) && !is_centcom_level(heretic.current.z)) generate_new_influences() - add_to_smashes(heretic) - - /** * Removes a mind from the list of people that can see the reality smashes * @@ -108,8 +73,6 @@ /datum/reality_smash_tracker/proc/remove_tracked_mind(datum/mind/heretic) tracked_heretics -= heretic - remove_from_smashes(heretic) - /obj/effect/visible_heretic_influence name = "pierced reality" icon = 'icons/effects/eldritch.dmi' @@ -201,46 +164,23 @@ var/being_drained = FALSE /// The icon state applied to the image created for this influence. var/real_icon_state = "reality_smash" - /// A list of all minds that can see us. - var/list/datum/mind/minds = list() - /// The image shown to heretics - var/image/heretic_image - /// We hold the turf we're on so we can remove and add the 'no prints' flag. - var/turf/on_turf /obj/effect/heretic_influence/Initialize(mapload) . = ..() GLOB.reality_smash_track.smashes += src - heretic_image = image(icon, src, real_icon_state, OBJ_LAYER) generate_name() - on_turf = get_turf(src) - if(!istype(on_turf)) - return - on_turf.interaction_flags_atom |= INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND - RegisterSignal(on_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf)) + var/image/heretic_image = image(icon, src, real_icon_state, OBJ_LAYER) + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/has_antagonist/heretic, "reality_smash", heretic_image) + + AddElement(/datum/element/block_turf_fingerprints) AddComponent(/datum/component/redirect_attack_hand_from_turf, interact_check = CALLBACK(src, PROC_REF(verify_user_can_see))) /obj/effect/heretic_influence/proc/verify_user_can_see(mob/user) - return (user?.mind in minds) - -/obj/effect/heretic_influence/proc/replace_our_turf(datum/source, path, new_baseturfs, flags, post_change_callbacks) - SIGNAL_HANDLER - post_change_callbacks += CALLBACK(src, PROC_REF(replace_our_turf_two)) - on_turf = null //hard del ref? - -/obj/effect/heretic_influence/proc/replace_our_turf_two(turf/new_turf) - new_turf.interaction_flags_atom |= INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND - on_turf = new_turf + return (user.mind in GLOB.reality_smash_track.tracked_heretics) /obj/effect/heretic_influence/Destroy() GLOB.reality_smash_track.smashes -= src - for(var/datum/mind/heretic in minds) - remove_mind(heretic) - - heretic_image = null - on_turf?.interaction_flags_atom &= ~INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND - on_turf = null return ..() /obj/effect/heretic_influence/attack_hand_secondary(mob/user, list/modifiers) @@ -296,43 +236,29 @@ // Aaand now we delete it after_drain(user) -/* +/** * Handle the effects of the drain. */ /obj/effect/heretic_influence/proc/after_drain(mob/living/user) if(user) - to_chat(user, span_hypnophrase(pick(strings(HERETIC_INFLUENCE_FILE, "drain_message")))) + to_chat(user, span_hypnophrase(pick_list(HERETIC_INFLUENCE_FILE, "drain_message"))) to_chat(user, span_warning("[src] begins to fade into reality!")) var/obj/effect/visible_heretic_influence/illusion = new /obj/effect/visible_heretic_influence(drop_location()) - illusion.name = "\improper" + pick(strings(HERETIC_INFLUENCE_FILE, "drained")) + " " + format_text(name) + illusion.name = "\improper" + pick_list(HERETIC_INFLUENCE_FILE, "drained") + " " + format_text(name) GLOB.reality_smash_track.num_drained++ qdel(src) -/* - * Add a mind to the list of tracked minds, - * making another person able to see us. - */ -/obj/effect/heretic_influence/proc/add_mind(datum/mind/heretic) - minds |= heretic - heretic.current?.client?.images |= heretic_image - -/* - * Remove a mind present in our list - * from being able to see us. - */ -/obj/effect/heretic_influence/proc/remove_mind(datum/mind/heretic) - if(!(heretic in minds)) - CRASH("[type] - remove_mind called with a mind not present in the minds list!") - - minds -= heretic - heretic.current?.client?.images -= heretic_image - -/* +/** * Generates a random name for the influence. */ /obj/effect/heretic_influence/proc/generate_name() - name = "\improper" + pick(strings(HERETIC_INFLUENCE_FILE, "prefix")) + " " + pick(strings(HERETIC_INFLUENCE_FILE, "postfix")) + name = "\improper" + pick_list(HERETIC_INFLUENCE_FILE, "prefix") + " " + pick_list(HERETIC_INFLUENCE_FILE, "postfix") #undef NUM_INFLUENCES_PER_HERETIC + +/// Hud used for heretics to see influences +/datum/atom_hud/alternate_appearance/basic/has_antagonist/heretic + antag_datum_type = /datum/antagonist/heretic + add_ghost_version = TRUE diff --git a/code/modules/antagonists/heretic/knowledge/starting_lore.dm b/code/modules/antagonists/heretic/knowledge/starting_lore.dm index 54440b62a8c..be53bfbc3c4 100644 --- a/code/modules/antagonists/heretic/knowledge/starting_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/starting_lore.dm @@ -340,6 +340,6 @@ GLOBAL_LIST_INIT(heretic_start_knowledge, initialize_starting_knowledge()) return FALSE to_chat(user, span_danger(span_big("Your ambition is ravaged, but something powerful remains in its wake..."))) - var/drain_message = pick(strings(HERETIC_INFLUENCE_FILE, "drain_message")) + var/drain_message = pick_list(HERETIC_INFLUENCE_FILE, "drain_message") to_chat(user, span_hypnophrase(span_big("[drain_message]"))) return . diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index bf4411a0d48..80f7be5e318 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -141,11 +141,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) add_to_dead_mob_list() - for(var/v in GLOB.active_alternate_appearances) - if(!v) - continue - var/datum/atom_hud/alternate_appearance/AA = v - AA.onNewMob(src) + for(var/datum/atom_hud/alternate_appearance/alt_hud as anything in GLOB.active_alternate_appearances) + alt_hud.apply_to_new_mob(src) . = ..() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index d017a2acca1..17e929ba422 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -91,11 +91,9 @@ sync_mind() //Reload alternate appearances - for(var/v in GLOB.active_alternate_appearances) - if(!v) - continue - var/datum/atom_hud/alternate_appearance/AA = v - AA.onNewMob(src) + for(var/datum/atom_hud/alternate_appearance/alt_hud as anything in GLOB.active_alternate_appearances) + if(!alt_hud.apply_to_new_mob(src)) + alt_hud.hide_from(src, absolute = TRUE) update_client_colour() update_mouse_pointer() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index be770fb22ac..f321a8396a3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -86,11 +86,9 @@ update_incapacitated() set_focus(src) prepare_huds() - for(var/v in GLOB.active_alternate_appearances) - if(!v) - continue - var/datum/atom_hud/alternate_appearance/AA = v - AA.onNewMob(src) + for(var/datum/atom_hud/alternate_appearance/alt_hud as anything in GLOB.active_alternate_appearances) + alt_hud.apply_to_new_mob(src) + set_nutrition(rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX)) . = ..() setup_hud_traits() diff --git a/tgstation.dme b/tgstation.dme index 6e2024e5fa3..e05189ff13a 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1414,6 +1414,7 @@ #include "code\datums\elements\beauty.dm" #include "code\datums\elements\bed_tucking.dm" #include "code\datums\elements\befriend_petting.dm" +#include "code\datums\elements\block_turf_fingerprints.dm" #include "code\datums\elements\blocks_explosives.dm" #include "code\datums\elements\body_temp_sensitive.dm" #include "code\datums\elements\bombable_turf.dm"