using Content.Server.Administration.Logs;
using Content.Server.Antag;
using Content.Server.Chat.Managers;
+using Content.Server.EUI;
using Content.Server.Flash;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Mind;
using Content.Server.NPC.Components;
using Content.Server.NPC.Systems;
using Content.Server.Popups;
+using Content.Server.Revolutionary;
using Content.Server.Revolutionary.Components;
using Content.Server.Roles;
using Content.Server.RoundEnd;
using Content.Shared.Humanoid;
using Content.Shared.IdentityManagement;
using Content.Shared.Mind;
+using Content.Shared.Mind.Components;
using Content.Shared.Mindshield.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly AntagSelectionSystem _antagSelection = default!;
+ [Dependency] private readonly EuiManager _euiMan = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
// If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen
if (_antagSelection.IsGroupDead(headRevList, false))
{
- var rev = AllEntityQuery<RevolutionaryComponent>();
- while (rev.MoveNext(out var uid, out _))
+ var rev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
+ while (rev.MoveNext(out var uid, out _, out var mc))
{
- if (!HasComp<HeadRevolutionaryComponent>(uid))
- {
- _npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction);
- _stun.TryParalyze(uid, stunTime, true);
- RemCompDeferred<RevolutionaryComponent>(uid);
- _popup.PopupEntity(Loc.GetString("rev-break-control", ("name", Identity.Entity(uid, EntityManager))), uid);
- _adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(uid)} was deconverted due to all Head Revolutionaries dying.");
- }
+ if (HasComp<HeadRevolutionaryComponent>(uid))
+ continue;
+
+ _npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction);
+ _stun.TryParalyze(uid, stunTime, true);
+ RemCompDeferred<RevolutionaryComponent>(uid);
+ _popup.PopupEntity(Loc.GetString("rev-break-control", ("name", Identity.Entity(uid, EntityManager))), uid);
+ _adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(uid)} was deconverted due to all Head Revolutionaries dying.");
+
+ if (!_mind.TryGetMind(uid, out var mindId, out var mind, mc))
+ continue;
+
+ // remove their antag role
+ _role.MindTryRemoveRole<RevolutionaryRoleComponent>(mindId);
+
+ // make it very obvious to the rev they've been deconverted since
+ // they may not see the popup due to antag and/or new player tunnel vision
+ if (_mind.TryGetSession(mindId, out var session))
+ _euiMan.OpenEui(new DeconvertedEui(), session);
}
return true;
}