Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Dangerous Mindbreaking #1249

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand All @@ -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<WeightedRandomPrototype> _pool = "RandomPsionicPowerPool";
private const string GenericInitializationMessage = "generic-power-initialization-feedback";
Expand Down Expand Up @@ -178,7 +188,39 @@ public void RefreshPsionicModifiers(EntityUid uid)
/// </summary>
public void MindBreak(EntityUid uid)
{
if (!HasComp<PsionicComponent>(uid))
return;

RemoveAllPsionicPowers(uid, true);
if (_config.GetCVar(CCVars.ScarierMindbreaking))
ScarierMindbreak(uid);
}

/// <summary>
/// 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.
/// </summary>
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<HTNComponent>(uid);
htn.RootTask = new HTNCompoundTask() { Task = "IdleCompound" };
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void Effect(ReagentEffectArgs args)

var psySys = args.EntityManager.EntitySysManager.GetEntitySystem<PsionicAbilitiesSystem>();

psySys.RemoveAllPsionicPowers(args.SolutionEntity, true);
psySys.MindBreak(args.SolutionEntity);
}
}
}
11 changes: 11 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,17 @@ public static readonly CVarDef<float>
public static readonly CVarDef<bool> PresetAutoVoteEnabled =
CVarDef.Create("vote.preset_autovote_enabled", true, CVar.SERVERONLY);

#region Psionics

/// <summary>
/// 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.
/// </summary>
public static readonly CVarDef<bool> ScarierMindbreaking =
CVarDef.Create("psionics.scarier_mindbreaking", false, CVar.SERVERONLY);
#endregion

/// <summary>
/// Set to true to enable the dynamic hostname system.
/// Automatically updates the hostname to include current map and preset.
Expand Down
Loading