From f331ed29c83f764c8d88ddfcd518fbdd27210f72 Mon Sep 17 00:00:00 2001 From: EdgeLordExe <42111655+EdgeLordExe@users.noreply.github.com> Date: Fri, 20 Nov 2020 09:38:41 +0100 Subject: [PATCH] Fixes 2 last heretic bugs that are on issue tracker (#54967) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit About The Pull Request Fixes the cursed heart being unable to track targets in containers. Fixes the shitcode that was reality_smash_tracker, now it is only responsible for generating influences. closes #53583 closes #52554 Changelog 🆑 fix: fixes the cursed heart being unable to track people inside containers. fix: fixes influence vision getting broken by replacing someone's eyes. /🆑 --- code/game/alternate_appearance.dm | 13 +++ .../eldritch_cult/eldritch_antag.dm | 4 +- .../eldritch_cult/eldritch_effects.dm | 105 ++++-------------- .../eldritch_cult/eldritch_items.dm | 10 +- 4 files changed, 40 insertions(+), 92 deletions(-) diff --git a/code/game/alternate_appearance.dm b/code/game/alternate_appearance.dm index 207f13e0078..d907efcb8f5 100644 --- a/code/game/alternate_appearance.dm +++ b/code/game/alternate_appearance.dm @@ -186,3 +186,16 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances) ..(key, I, FALSE) seer = M add_hud_to(seer) + +/datum/atom_hud/alternate_appearance/basic/heretics + add_ghost_version = FALSE //just in case, to prevent infinite loops + +/datum/atom_hud/alternate_appearance/basic/heretics/New() + ..() + for(var/mob in GLOB.player_list) + if(mobShouldSee(mob)) + add_hud_to(mob) + +/datum/atom_hud/alternate_appearance/basic/heretics/mobShouldSee(mob/M) + return IS_HERETIC(M) || IS_HERETIC_MONSTER(M) + diff --git a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm index 0430e5b0269..811f92d4089 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm @@ -36,7 +36,7 @@ gain_knowledge(/datum/eldritch_knowledge/living_heart) gain_knowledge(/datum/eldritch_knowledge/codex_cicatrix) current.log_message("has been converted to the cult of the forgotten ones!", LOG_ATTACK, color="#960000") - GLOB.reality_smash_track.AddMind(owner) + GLOB.reality_smash_track.Generate() START_PROCESSING(SSprocessing,src) RegisterSignal(owner.current,COMSIG_LIVING_DEATH,.proc/on_death) if(give_equipment) @@ -52,7 +52,7 @@ if(!silent) to_chat(owner.current, "Your mind begins to flare as the otherwordly knowledge escapes your grasp!") owner.current.log_message("has renounced the cult of the old ones!", LOG_ATTACK, color="#960000") - GLOB.reality_smash_track.RemoveMind(owner) + GLOB.reality_smash_track.targets-- STOP_PROCESSING(SSprocessing,src) on_death() diff --git a/code/modules/antagonists/eldritch_cult/eldritch_effects.dm b/code/modules/antagonists/eldritch_cult/eldritch_effects.dm index 4511541721f..8e520092e5b 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_effects.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_effects.dm @@ -115,41 +115,23 @@ */ /datum/reality_smash_tracker ///list of tracked reality smashes - var/list/smashes = list() + var/smashes = 0 ///List of mobs with ability to see the smashes - var/list/targets = list() + var/targets = 0 /datum/reality_smash_tracker/Destroy(force, ...) if(GLOB.reality_smash_track == src) - stack_trace("/datum/reality_smash_tracker was deleted. Heretics may no longer access any influences. Fix it or call coder support") - QDEL_LIST(smashes) - targets.Cut() + stack_trace("/datum/reality_smash_tracker was deleted. New heretics will no longer generate new influences") 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/ReworkNetwork() - listclearnulls(smashes) - for(var/mind in targets) - if(isnull(mind)) - stack_trace("A null somehow landed in a list of minds") - continue - for(var/X in smashes) - var/obj/effect/reality_smash/reality_smash = X - reality_smash.AddMind(mind) - /** * Generates a set amount of reality smashes based on the N value * * Automatically creates more reality smashes */ -/datum/reality_smash_tracker/proc/_Generate() - var/targ_len = length(targets) - var/smash_len = length(smashes) - var/number = max(targ_len * (4-(targ_len-1)) - smash_len,1) +/datum/reality_smash_tracker/proc/Generate() + targets++ + var/number = max(targets * (4-(targets-1)) - smashes,1) for(var/i in 0 to number) @@ -159,35 +141,8 @@ var/obj/effect/broken_illusion/what_if_i_had_one_but_got_used = locate() in range(1, chosen_location) if(what_if_i_have_one || what_if_i_had_one_but_got_used) //we dont want to spawn continue - var/obj/effect/reality_smash/RS = new/obj/effect/reality_smash(chosen_location) - smashes += RS - ReworkNetwork() - - -/** - * Adds a mind to the list of people that can see the reality smashes - * - * Use this whenever you want to add someone to the list - */ -/datum/reality_smash_tracker/proc/AddMind(datum/mind/M) - RegisterSignal(M.current,COMSIG_MOB_LOGIN,.proc/ReworkNetwork) - targets |= M - _Generate() - for(var/X in smashes) - var/obj/effect/reality_smash/reality_smash = X - reality_smash.AddMind(M) - - -/** - * Removes a mind from the list of people that can see the reality smashes - * - * Use this whenever you want to remove someone from the list - */ -/datum/reality_smash_tracker/proc/RemoveMind(datum/mind/M) - UnregisterSignal(M.current,COMSIG_MOB_LOGIN) - targets -= M - for(var/obj/effect/reality_smash/RS in smashes) - RS.RemoveMind(M) + new /obj/effect/reality_smash(chosen_location) + smashes++ /obj/effect/broken_illusion name = "pierced reality" @@ -200,10 +155,16 @@ /obj/effect/broken_illusion/Initialize() . = ..() addtimer(CALLBACK(src,.proc/show_presence),15 SECONDS) - var/image/I = image(icon = 'icons/effects/eldritch.dmi', icon_state = null, loc = src) + + var/image/I = image('icons/effects/eldritch.dmi',src,null,OBJ_LAYER) I.override = TRUE add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/silicons, "pierced_reality", I) + I = image('icons/effects/eldritch.dmi',src, "pierced_illusion",OBJ_LAYER) + I.override = TRUE + I.alpha = 255 + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/heretics,"pierced_reality",I) + ///Makes this obj appear out of nothing /obj/effect/broken_illusion/proc/show_presence() animate(src,alpha = 255,time = 15 SECONDS) @@ -261,17 +222,12 @@ anchored = TRUE resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF invisibility = INVISIBILITY_OBSERVER - ///We cannot use icon_state since this is invisible, functions the same way but with custom behaviour. - var/image_state = "reality_smash" - ///Who can see us? - var/list/minds = list() - ///Tracked image - var/image/img /obj/effect/reality_smash/Initialize() . = ..() - img = image(icon, src, image_state, OBJ_LAYER) + var/img = image(icon, src, "reality_smash", OBJ_LAYER) generate_name() + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/heretics,"influence",img) /obj/effect/reality_smash/Destroy() on_destroy() @@ -279,30 +235,9 @@ ///Custom effect that happens on destruction /obj/effect/reality_smash/proc/on_destroy() - for(var/cm in minds) - var/datum/mind/cultie = cm - if(cultie.current?.client) - cultie.current.client.images -= img - //clear the list - minds -= cultie - GLOB.reality_smash_track.smashes -= src - img = null - new /obj/effect/broken_illusion(drop_location()) - -///Makes the mind able to see this effect -/obj/effect/reality_smash/proc/AddMind(datum/mind/cultie) - minds |= cultie - if(cultie.current.client) - cultie.current.client.images |= img - - - -///Makes the mind not able to see this effect -/obj/effect/reality_smash/proc/RemoveMind(datum/mind/cultie) - minds -= cultie - if(cultie.current.client) - cultie.current.client.images -= img - + GLOB.reality_smash_track.smashes-- + var/obj/effect/broken_illusion/illusion = new /obj/effect/broken_illusion(drop_location()) + illusion.name = pick("Researched","Siphoned","Analyzed","Emptied","Drained") + " " + name ///Generates random name diff --git a/code/modules/antagonists/eldritch_cult/eldritch_items.dm b/code/modules/antagonists/eldritch_cult/eldritch_items.dm index 361598386d1..81d2198191b 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_items.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_items.dm @@ -12,12 +12,12 @@ if(!IS_HERETIC(user)) return if(!target) - to_chat(user,"No target could be found. Put the living heart on the rune and use the rune to recieve a target.") + to_chat(user,"No target could be found. Put the living heart on a transmutation rune and activate the rune to recieve a target.") return - var/dist = get_dist(user.loc,target.loc) - var/dir = get_dir(user.loc,target.loc) + var/dist = get_dist(get_turf(user),get_turf(target)) + var/dir = get_dir(get_turf(user),get_turf(target)) if(user.z != target.z) - to_chat(user,"[target.real_name] is on another plane of existance!") + to_chat(user,"[target.real_name] is on another plane of existence!") else switch(dist) if(0 to 15) @@ -30,7 +30,7 @@ to_chat(user,"[target.real_name] is beyond our reach.") if(target.stat == DEAD) - to_chat(user,"[target.real_name] is dead. Bring them onto a transmutation rune!") + to_chat(user,"[target.real_name] is dead. Bring them to a transmutation rune!") /datum/action/innate/heretic_shatter name = "Shattering Offer"