better deconversion (#23315)
* add deconverted window * show deconverted window when deconverting + remove the role * webedit ops * antagonist -> revolutionary * evil * oh * eui ops --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
25
Content.Client/Revolutionary/UI/DeconvertedEui.cs
Normal file
25
Content.Client/Revolutionary/UI/DeconvertedEui.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Content.Client.Eui;
|
||||||
|
|
||||||
|
namespace Content.Client.Revolutionary.UI;
|
||||||
|
|
||||||
|
public sealed class DeconvertedEui : BaseEui
|
||||||
|
{
|
||||||
|
private readonly DeconvertedMenu _menu;
|
||||||
|
|
||||||
|
public DeconvertedEui()
|
||||||
|
{
|
||||||
|
_menu = new DeconvertedMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Opened()
|
||||||
|
{
|
||||||
|
_menu.OpenCentered();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Closed()
|
||||||
|
{
|
||||||
|
base.Closed();
|
||||||
|
|
||||||
|
_menu.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Content.Client/Revolutionary/UI/DeconvertedMenu.xaml
Normal file
10
Content.Client/Revolutionary/UI/DeconvertedMenu.xaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||||
|
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||||
|
Title="{Loc 'rev-deconverted-title'}">
|
||||||
|
<BoxContainer Orientation="Vertical" Margin="5">
|
||||||
|
<Label Text="{Loc 'rev-deconverted-text'}"/>
|
||||||
|
<BoxContainer Orientation="Horizontal" Align="Center">
|
||||||
|
<Button Name="ConfirmButton" Text="{Loc 'rev-deconverted-confirm'}"/>
|
||||||
|
</BoxContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
</controls:FancyWindow>
|
||||||
16
Content.Client/Revolutionary/UI/DeconvertedMenu.xaml.cs
Normal file
16
Content.Client/Revolutionary/UI/DeconvertedMenu.xaml.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Content.Client.UserInterface.Controls;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
|
||||||
|
namespace Content.Client.Revolutionary.UI;
|
||||||
|
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public sealed partial class DeconvertedMenu : FancyWindow
|
||||||
|
{
|
||||||
|
public DeconvertedMenu()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
|
ConfirmButton.OnPressed += _ => Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,14 @@ using System.Linq;
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Antag;
|
using Content.Server.Antag;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
|
using Content.Server.EUI;
|
||||||
using Content.Server.Flash;
|
using Content.Server.Flash;
|
||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
using Content.Server.Mind;
|
using Content.Server.Mind;
|
||||||
using Content.Server.NPC.Components;
|
using Content.Server.NPC.Components;
|
||||||
using Content.Server.NPC.Systems;
|
using Content.Server.NPC.Systems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Revolutionary;
|
||||||
using Content.Server.Revolutionary.Components;
|
using Content.Server.Revolutionary.Components;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Server.RoundEnd;
|
using Content.Server.RoundEnd;
|
||||||
@@ -16,6 +18,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Humanoid;
|
using Content.Shared.Humanoid;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Mindshield.Components;
|
using Content.Shared.Mindshield.Components;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
@@ -39,6 +42,7 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
|||||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly AntagSelectionSystem _antagSelection = default!;
|
[Dependency] private readonly AntagSelectionSystem _antagSelection = default!;
|
||||||
|
[Dependency] private readonly EuiManager _euiMan = default!;
|
||||||
[Dependency] private readonly MindSystem _mind = default!;
|
[Dependency] private readonly MindSystem _mind = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
||||||
@@ -305,17 +309,28 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
|||||||
// If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen
|
// If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen
|
||||||
if (_antagSelection.IsGroupDead(headRevList, false))
|
if (_antagSelection.IsGroupDead(headRevList, false))
|
||||||
{
|
{
|
||||||
var rev = AllEntityQuery<RevolutionaryComponent>();
|
var rev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
|
||||||
while (rev.MoveNext(out var uid, out _))
|
while (rev.MoveNext(out var uid, out _, out var mc))
|
||||||
{
|
{
|
||||||
if (!HasComp<HeadRevolutionaryComponent>(uid))
|
if (HasComp<HeadRevolutionaryComponent>(uid))
|
||||||
{
|
continue;
|
||||||
_npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction);
|
|
||||||
_stun.TryParalyze(uid, stunTime, true);
|
_npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction);
|
||||||
RemCompDeferred<RevolutionaryComponent>(uid);
|
_stun.TryParalyze(uid, stunTime, true);
|
||||||
_popup.PopupEntity(Loc.GetString("rev-break-control", ("name", Identity.Entity(uid, EntityManager))), uid);
|
RemCompDeferred<RevolutionaryComponent>(uid);
|
||||||
_adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(uid)} was deconverted due to all Head Revolutionaries dying.");
|
_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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
8
Content.Server/Revolutionary/DeconvertedEui.cs
Normal file
8
Content.Server/Revolutionary/DeconvertedEui.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Content.Server.EUI;
|
||||||
|
|
||||||
|
namespace Content.Server.Revolutionary;
|
||||||
|
|
||||||
|
public sealed class DeconvertedEui : BaseEui
|
||||||
|
{
|
||||||
|
// serverside it does nothing since its just to inform the player
|
||||||
|
}
|
||||||
@@ -64,3 +64,12 @@ rev-headrev-name = [color=#5e9cff]{$name}[/color] converted {$count} {$count ->
|
|||||||
[one] person
|
[one] person
|
||||||
*[other] people
|
*[other] people
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Deconverted window
|
||||||
|
|
||||||
|
rev-deconverted-title = Deconverted!
|
||||||
|
rev-deconverted-text =
|
||||||
|
As the last headrev has died, the revolution is over.
|
||||||
|
|
||||||
|
You are no longer a revolutionary, so be nice.
|
||||||
|
rev-deconverted-confirm = Confirm
|
||||||
|
|||||||
Reference in New Issue
Block a user