From 22de4d8b3ba02f6bb201e30e41cf0b5d596dd955 Mon Sep 17 00:00:00 2001 From: san7890 Date: Mon, 30 Oct 2023 15:16:59 -0700 Subject: [PATCH] Prevents Mindswapping on Bitrunners (#79323) ## About The Pull Request Fixes #79310 Adds a new trait to prevent mindswaps (which is just useful for any future cases when we don't wanna rely on the blacklist typecache) while also accounting for bitrunners (who you can't mindswap because their mind is elsewhere) and their avatars (because that's not a real mind now is it). this does mean that bitrunners while bitrunning are immune to all mindswaps but i don't have a good answer on how to fix it. i don't even much like the idea of VR but I think that having these traits are useful enough for future utilization. ## Why It's Good For The Game prevent big breakage. ## Changelog :cl: fix: Bitrunners can no longer get mass-mindswapped out of their avatar when the wizard does the event. Something about machinery and magic not going well together. /:cl: --- code/__DEFINES/traits.dm | 3 +++ .../modules/bitrunning/components/avatar_connection.dm | 1 + code/modules/events/wizard/shuffle.dm | 2 +- .../spells/spell_types/pointed/mind_transfer.dm | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 7b73165f46e..1871a0b5436 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -1345,3 +1345,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_WING_BUFFET_TIRED "wing_buffet_tired" /// Trait given to a dragon who fails to defend their rifts #define TRAIT_RIFT_FAILURE "fail_dragon_loser" + +/// Trait given to mobs that we do not want to mindswap +#define TRAIT_NO_MINDSWAP "no_mindswap" diff --git a/code/modules/bitrunning/components/avatar_connection.dm b/code/modules/bitrunning/components/avatar_connection.dm index dab9be07e92..39b01b5ac00 100644 --- a/code/modules/bitrunning/components/avatar_connection.dm +++ b/code/modules/bitrunning/components/avatar_connection.dm @@ -33,6 +33,7 @@ server.avatar_connection_refs.Add(WEAKREF(src)) avatar.key = old_body.key + ADD_TRAIT(avatar, TRAIT_NO_MINDSWAP, REF(src)) // do not remove this one ADD_TRAIT(old_body, TRAIT_MIND_TEMPORARILY_GONE, REF(src)) RegisterSignals(old_body, list(COMSIG_LIVING_DEATH, COMSIG_MOVABLE_MOVED, COMSIG_LIVING_STATUS_UNCONSCIOUS), PROC_REF(on_sever_connection)) diff --git a/code/modules/events/wizard/shuffle.dm b/code/modules/events/wizard/shuffle.dm index a41e7d7de32..460fe7b8a2f 100644 --- a/code/modules/events/wizard/shuffle.dm +++ b/code/modules/events/wizard/shuffle.dm @@ -87,7 +87,7 @@ var/list/mobs_to_swap = list() for(var/mob/living/carbon/human/alive_human in GLOB.alive_mob_list) - if(alive_human.stat != CONSCIOUS || !alive_human.mind || IS_WIZARD(alive_human)) + if(alive_human.stat != CONSCIOUS || isnull(alive_human.mind) || IS_WIZARD(alive_human) || HAS_TRAIT(alive_human, TRAIT_NO_MINDSWAP)) continue //the wizard(s) are spared on this one mobs_to_swap += alive_human diff --git a/code/modules/spells/spell_types/pointed/mind_transfer.dm b/code/modules/spells/spell_types/pointed/mind_transfer.dm index 08c638ffe07..72441362b65 100644 --- a/code/modules/spells/spell_types/pointed/mind_transfer.dm +++ b/code/modules/spells/spell_types/pointed/mind_transfer.dm @@ -55,9 +55,19 @@ if(!isliving(cast_on)) to_chat(owner, span_warning("You can only swap minds with living beings!")) return FALSE + + if(HAS_TRAIT(cast_on, TRAIT_MIND_TEMPORARILY_GONE)) + to_chat(owner, span_warning("This creature's mind is somewhere else entirely!")) + return FALSE + + if(HAS_TRAIT(cast_on, TRAIT_NO_MINDSWAP)) + to_chat(owner, span_warning("This type of magic can't operate on [cast_on.p_their()] mind!")) + return FALSE + if(is_type_in_typecache(cast_on, blacklisted_mobs)) to_chat(owner, span_warning("This creature is too [pick("powerful", "strange", "arcane", "obscene")] to control!")) return FALSE + if(isguardian(cast_on)) var/mob/living/simple_animal/hostile/guardian/stand = cast_on if(stand.summoner && stand.summoner == owner)