Fix not removing RevolutionaryRoleComponent from minds on mindshield application (#20832)
* Fix not removing RevolutionaryRoleComponent from minds on mindshield application * Simplify other part of the mindshield code * Fix being able to mindshield head revs * Other way around
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
using Content.Shared.Mindshield.Components;
|
|
||||||
using Content.Shared.Revolutionary.Components;
|
|
||||||
using Content.Server.Popups;
|
|
||||||
using Content.Shared.Database;
|
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Mind;
|
using Content.Server.Mind;
|
||||||
using Content.Shared.Implants;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Tag;
|
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Implants;
|
||||||
using Content.Shared.Implants.Components;
|
using Content.Shared.Implants.Components;
|
||||||
|
using Content.Shared.Mindshield.Components;
|
||||||
|
using Content.Shared.Revolutionary.Components;
|
||||||
|
using Content.Shared.Tag;
|
||||||
|
|
||||||
namespace Content.Server.Mindshield;
|
namespace Content.Server.Mindshield;
|
||||||
|
|
||||||
@@ -39,25 +39,26 @@ public sealed class MindShieldSystem : EntitySystem
|
|||||||
if (_tag.HasTag(ev.Implant, MindShieldTag) && ev.Implanted != null)
|
if (_tag.HasTag(ev.Implant, MindShieldTag) && ev.Implanted != null)
|
||||||
{
|
{
|
||||||
EnsureComp<MindShieldComponent>(ev.Implanted.Value);
|
EnsureComp<MindShieldComponent>(ev.Implanted.Value);
|
||||||
MindShieldRemovalCheck(ev.Implanted, ev.Implant);
|
MindShieldRemovalCheck(ev.Implanted.Value, ev.Implant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the implanted person was a Rev or Head Rev and remove role or destroy mindshield respectively.
|
/// Checks if the implanted person was a Rev or Head Rev and remove role or destroy mindshield respectively.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void MindShieldRemovalCheck(EntityUid? implanted, EntityUid implant)
|
public void MindShieldRemovalCheck(EntityUid implanted, EntityUid implant)
|
||||||
{
|
{
|
||||||
if (HasComp<RevolutionaryComponent>(implanted) && !HasComp<HeadRevolutionaryComponent>(implanted))
|
if (HasComp<HeadRevolutionaryComponent>(implanted))
|
||||||
{
|
{
|
||||||
_mindSystem.TryGetMind(implanted.Value, out var mindId, out _);
|
_popupSystem.PopupEntity(Loc.GetString("head-rev-break-mindshield"), implanted);
|
||||||
_adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(implanted.Value)} was deconverted due to being implanted with a Mindshield.");
|
|
||||||
_roleSystem.MindTryRemoveRole<RevolutionaryRoleComponent>(mindId);
|
|
||||||
}
|
|
||||||
else if (HasComp<RevolutionaryComponent>(implanted))
|
|
||||||
{
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("head-rev-break-mindshield"), implanted.Value);
|
|
||||||
QueueDel(implant);
|
QueueDel(implant);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mindSystem.TryGetMind(implanted, out var mindId, out _) &&
|
||||||
|
_roleSystem.MindTryRemoveRole<RevolutionaryRoleComponent>(mindId))
|
||||||
|
{
|
||||||
|
_adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(implanted)} was deconverted due to being implanted with a Mindshield.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Shared.Revolutionary.Components;
|
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Mindshield.Components;
|
using Content.Shared.Mindshield.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Content.Shared.Revolutionary.Components;
|
||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
|
|
||||||
namespace Content.Shared.Revolutionary;
|
namespace Content.Shared.Revolutionary;
|
||||||
@@ -22,7 +22,13 @@ public sealed class SharedRevolutionarySystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void MindShieldImplanted(EntityUid uid, MindShieldComponent comp, MapInitEvent init)
|
private void MindShieldImplanted(EntityUid uid, MindShieldComponent comp, MapInitEvent init)
|
||||||
{
|
{
|
||||||
if (HasComp<RevolutionaryComponent>(uid) && !HasComp<HeadRevolutionaryComponent>(uid))
|
if (HasComp<HeadRevolutionaryComponent>(uid))
|
||||||
|
{
|
||||||
|
RemCompDeferred<MindShieldComponent>(uid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HasComp<RevolutionaryComponent>(uid))
|
||||||
{
|
{
|
||||||
var stunTime = TimeSpan.FromSeconds(4);
|
var stunTime = TimeSpan.FromSeconds(4);
|
||||||
var name = Identity.Entity(uid, EntityManager);
|
var name = Identity.Entity(uid, EntityManager);
|
||||||
@@ -30,9 +36,5 @@ public sealed class SharedRevolutionarySystem : EntitySystem
|
|||||||
_sharedStun.TryParalyze(uid, stunTime, true);
|
_sharedStun.TryParalyze(uid, stunTime, true);
|
||||||
_popupSystem.PopupEntity(Loc.GetString("rev-break-control", ("name", name)), uid);
|
_popupSystem.PopupEntity(Loc.GetString("rev-break-control", ("name", name)), uid);
|
||||||
}
|
}
|
||||||
else if (HasComp<HeadRevolutionaryComponent>(uid))
|
|
||||||
{
|
|
||||||
RemCompDeferred<MindShieldComponent>(uid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user