diff --git a/code/datums/actions/mobs/personality_commune.dm b/code/datums/actions/mobs/personality_commune.dm new file mode 100644 index 00000000000..26cf4834492 --- /dev/null +++ b/code/datums/actions/mobs/personality_commune.dm @@ -0,0 +1,56 @@ +// This can probably be changed to use mind linker at some point +/datum/action/personality_commune + name = "Personality Commune" + desc = "Sends thoughts to your alternate consciousness." + background_icon_state = "bg_spell" + button_icon = 'icons/mob/actions/actions_spells.dmi' + button_icon_state = "telepathy" + overlay_icon_state = "bg_spell_border" + + /// Fluff text shown when a message is sent to the pair + var/fluff_text = span_boldnotice("You hear an echoing voice in the back of your head...") + +/datum/action/personality_commune/New(Target) + . = ..() + if(!istype(target, /datum/brain_trauma/severe/split_personality)) + stack_trace("[type] was created on a target that isn't a /datum/brain_trauma/severe/split_personality, this doesn't work.") + qdel(src) + +/datum/action/personality_commune/Grant(mob/grant_to) + if(!istype(grant_to, /mob/living/split_personality)) + return + + return ..() + +/datum/action/personality_commune/Trigger(trigger_flags) + . = ..() + if(!.) + return FALSE + + var/datum/brain_trauma/severe/split_personality/trauma = target + var/mob/living/split_personality/non_controller = usr + var/client/non_controller_client = non_controller.client + + var/to_send = tgui_input_text(non_controller, "What would you like to tell your other self?", "Commune") + if(QDELETED(src) || QDELETED(trauma) || !to_send) + return FALSE + + var/mob/living/carbon/human/personality_body = trauma.owner + if(personality_body.client == non_controller_client) // We took control + return FALSE + + var/user_message = span_boldnotice("You concentrate and send thoughts to your other self:") + var/user_message_body = span_notice("[to_send]") + + to_chat(non_controller, "[user_message] [user_message_body]") + + personality_body.balloon_alert(personality_body, "you hear a voice") + to_chat(personality_body, "[fluff_text] [user_message_body]") + + log_directed_talk(non_controller, personality_body, to_send, LOG_SAY, "[name]") + for(var/dead_mob in GLOB.dead_mob_list) + if(!isobserver(dead_mob)) + continue + to_chat(dead_mob, "[FOLLOW_LINK(dead_mob, non_controller)] [span_boldnotice("[non_controller] [name]:")] [span_notice("\"[to_send]\" to")] [span_name("[trauma]")]") + + return TRUE diff --git a/code/datums/brain_damage/split_personality.dm b/code/datums/brain_damage/split_personality.dm index 92992865e44..faa05a6bd28 100644 --- a/code/datums/brain_damage/split_personality.dm +++ b/code/datums/brain_damage/split_personality.dm @@ -25,11 +25,11 @@ /datum/brain_trauma/severe/split_personality/proc/make_backseats() stranger_backseat = new(owner, src) - var/datum/action/cooldown/spell/personality_commune/stranger_spell = new(src) + var/datum/action/personality_commune/stranger_spell = new(src) stranger_spell.Grant(stranger_backseat) owner_backseat = new(owner, src) - var/datum/action/cooldown/spell/personality_commune/owner_spell = new(src) + var/datum/action/personality_commune/owner_spell = new(src) owner_spell.Grant(owner_backseat) /// Attempts to get a ghost to play the personality diff --git a/code/modules/spells/spell_types/self/personality_commune.dm b/code/modules/spells/spell_types/self/personality_commune.dm deleted file mode 100644 index cd10c2b7736..00000000000 --- a/code/modules/spells/spell_types/self/personality_commune.dm +++ /dev/null @@ -1,56 +0,0 @@ -// This can probably be changed to use mind linker at some point -/datum/action/cooldown/spell/personality_commune - name = "Personality Commune" - desc = "Sends thoughts to your alternate consciousness." - button_icon_state = "telepathy" - cooldown_time = 0 SECONDS - spell_requirements = NONE - - /// Fluff text shown when a message is sent to the pair - var/fluff_text = span_boldnotice("You hear an echoing voice in the back of your head...") - /// The message to send to the corresponding person on cast - var/to_send - -/datum/action/cooldown/spell/personality_commune/New(Target) - . = ..() - if(!istype(target, /datum/brain_trauma/severe/split_personality)) - stack_trace("[type] was created on a target that isn't a /datum/brain_trauma/severe/split_personality, this doesn't work.") - qdel(src) - -/datum/action/cooldown/spell/personality_commune/is_valid_target(atom/cast_on) - return isliving(cast_on) - -/datum/action/cooldown/spell/personality_commune/before_cast(atom/cast_on) - . = ..() - if(. & SPELL_CANCEL_CAST) - return - - var/datum/brain_trauma/severe/split_personality/trauma = target - if(!istype(trauma)) // hypothetically impossible but you never know - return . | SPELL_CANCEL_CAST - - to_send = tgui_input_text(cast_on, "What would you like to tell your other self?", "Commune") - if(QDELETED(src) || QDELETED(trauma) || QDELETED(cast_on) || QDELETED(trauma.owner) || !can_cast_spell()) - return . | SPELL_CANCEL_CAST - if(!to_send) - reset_cooldown() - return . | SPELL_CANCEL_CAST - -// Pillaged and adapted from telepathy code -/datum/action/cooldown/spell/personality_commune/cast(mob/living/cast_on) - . = ..() - var/datum/brain_trauma/severe/split_personality/trauma = target - - var/user_message = span_boldnotice("You concentrate and send thoughts to your other self:") - var/user_message_body = span_notice("[to_send]") - - to_chat(cast_on, "[user_message] [user_message_body]") - - trauma.owner.balloon_alert(trauma.owner, "you hear a voice") - to_chat(trauma.owner, "[fluff_text] [user_message_body]") - - log_directed_talk(cast_on, trauma.owner, to_send, LOG_SAY, "[name]") - for(var/dead_mob in GLOB.dead_mob_list) - if(!isobserver(dead_mob)) - continue - to_chat(dead_mob, "[FOLLOW_LINK(dead_mob, cast_on)] [span_boldnotice("[cast_on] [name]:")] [span_notice("\"[to_send]\" to")] [span_name("[trauma]")]") diff --git a/tgstation.dme b/tgstation.dme index 310b9c85f44..c2a6332ab78 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -916,6 +916,7 @@ #include "code\datums\actions\mobs\meteors.dm" #include "code\datums\actions\mobs\mobcooldown.dm" #include "code\datums\actions\mobs\open_mob_commands.dm" +#include "code\datums\actions\mobs\personality_commune.dm" #include "code\datums\actions\mobs\projectileattack.dm" #include "code\datums\actions\mobs\sign_language.dm" #include "code\datums\actions\mobs\sneak.dm" @@ -5586,7 +5587,6 @@ #include "code\modules\spells\spell_types\self\lichdom.dm" #include "code\modules\spells\spell_types\self\mime_vow.dm" #include "code\modules\spells\spell_types\self\mutate.dm" -#include "code\modules\spells\spell_types\self\personality_commune.dm" #include "code\modules\spells\spell_types\self\rod_form.dm" #include "code\modules\spells\spell_types\self\sanguine_strike.dm" #include "code\modules\spells\spell_types\self\smoke.dm"