diff --git a/Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs b/Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs index bdf295615ea..a657af150f4 100644 --- a/Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs +++ b/Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Abilities.Psionics; using Content.Shared.Actions; using Content.Shared.Popups; +using Content.Shared.Chat; using Content.Shared.Psionics.Glimmer; using Content.Shared.Random; using Content.Shared.Random.Helpers; @@ -12,7 +13,12 @@ using System.Linq; using Robust.Server.Player; using Content.Server.Chat.Managers; - +using Robust.Shared.Configuration; +using Content.Shared.CCVar; +using Content.Server.NPC.Systems; +using Content.Server.NPC.HTN; +using Content.Server.Ghost; +using Content.Server.Mind; namespace Content.Server.Abilities.Psionics { public sealed class PsionicAbilitiesSystem : EntitySystem @@ -29,6 +35,10 @@ public sealed class PsionicAbilitiesSystem : EntitySystem [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly PsionicFamiliarSystem _psionicFamiliar = default!; + [Dependency] private readonly IConfigurationManager _config = default!; + [Dependency] private readonly NpcFactionSystem _npcFaction = default!; + [Dependency] private readonly GhostSystem _ghost = default!; + [Dependency] private readonly MindSystem _mind = default!; private ProtoId _pool = "RandomPsionicPowerPool"; private const string GenericInitializationMessage = "generic-power-initialization-feedback"; @@ -178,7 +188,39 @@ public void RefreshPsionicModifiers(EntityUid uid) /// public void MindBreak(EntityUid uid) { + if (!HasComp(uid)) + return; + RemoveAllPsionicPowers(uid, true); + if (_config.GetCVar(CCVars.ScarierMindbreaking)) + ScarierMindbreak(uid); + } + + /// + /// An even more advanced form of Mindbreaking. Turn the victim into an NPC. + /// For the people who somehow didn't intuit from the absolutely horrifying text that mindbreaking people is very fucking bad. + /// + public void ScarierMindbreak(EntityUid uid) + { + if (!_playerManager.TryGetSessionByEntity(uid, out var session) || session is null) + return; + + var feedbackMessage = $"[font size=24][color=#ff0000]{"Your characters personhood has been obliterated. If you wish to continue playing, consider respawning as a new character."}[/color][/font]"; + _chatManager.ChatMessageToOne( + ChatChannel.Emotes, + feedbackMessage, + feedbackMessage, + EntityUid.Invalid, + false, + session.Channel); + + if (!_mind.TryGetMind(session, out var mindId, out var mind)) + return; + + _ghost.SpawnGhost((mindId, mind), Transform(uid).Coordinates, false); + _npcFaction.AddFaction(uid, "SimpleNeutral"); + var htn = EnsureComp(uid); + htn.RootTask = new HTNCompoundTask() { Task = "IdleCompound" }; } /// diff --git a/Content.Server/Nyanotrasen/Chemistry/Effects/ChemRemovePsionic.cs b/Content.Server/Nyanotrasen/Chemistry/Effects/ChemRemovePsionic.cs index 859f22cd4a9..e500e246d5b 100644 --- a/Content.Server/Nyanotrasen/Chemistry/Effects/ChemRemovePsionic.cs +++ b/Content.Server/Nyanotrasen/Chemistry/Effects/ChemRemovePsionic.cs @@ -21,7 +21,7 @@ public override void Effect(ReagentEffectArgs args) var psySys = args.EntityManager.EntitySysManager.GetEntitySystem(); - psySys.RemoveAllPsionicPowers(args.SolutionEntity, true); + psySys.MindBreak(args.SolutionEntity); } } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index d597ca04f75..a8254797cbb 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -2791,6 +2791,17 @@ public static readonly CVarDef public static readonly CVarDef PresetAutoVoteEnabled = CVarDef.Create("vote.preset_autovote_enabled", true, CVar.SERVERONLY); + #region Psionics + + /// + /// When mindbroken, permanently eject the player from their own body, and turn their character into an NPC. + /// Congratulations, now they *actually* aren't a person anymore. + /// For people who complained that it wasn't obvious enough from the text that Mindbreaking is a form of Murder. + /// + public static readonly CVarDef ScarierMindbreaking = + CVarDef.Create("psionics.scarier_mindbreaking", false, CVar.SERVERONLY); + #endregion + /// /// Set to true to enable the dynamic hostname system. /// Automatically updates the hostname to include current map and preset.