From dc570dcdb5c2a0c3c2ef0fbc167a47175115ac9e Mon Sep 17 00:00:00 2001 From: BIGZi0348 Date: Wed, 25 Dec 2024 11:44:25 +0300 Subject: [PATCH 1/2] temp --- .../_White/AuthPanel/AuthPanelSystem.cs | 45 +++++++++++++++---- .../ERTRecruitment/ERTRecruitmentRule.cs | 11 +---- .../ERTRecruitmentRuleComponent.cs | 4 +- .../Prototypes/_White/event_prototypes.yml | 3 +- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Content.Server/_White/AuthPanel/AuthPanelSystem.cs b/Content.Server/_White/AuthPanel/AuthPanelSystem.cs index 73822ad222..6d53b6b181 100644 --- a/Content.Server/_White/AuthPanel/AuthPanelSystem.cs +++ b/Content.Server/_White/AuthPanel/AuthPanelSystem.cs @@ -2,15 +2,19 @@ using Content.Server.GameTicking; using Content.Server.Popups; using Content.Server.Station.Systems; using Content.Server._White.ERTRecruitment; +using Content.Server._White.JoinQueue; using Content.Shared.Access.Systems; using Content.Shared.Administration.Logs; using Content.Shared.Database; using Content.Shared.GameTicking; using Content.Shared._White.AuthPanel; using Content.Shared._White.GhostRecruitment; +using Content.Shared.Ghost; using Robust.Server.GameObjects; +using Robust.Server.Player; using Robust.Shared.Random; using Robust.Shared.Timing; +using Robust.Shared.Player; namespace Content.Server._White.AuthPanel; @@ -26,17 +30,16 @@ public sealed class AuthPanelSystem : EntitySystem [Dependency] private readonly ERTRecruitmentRule _ert = default!; [Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly StationSystem _station = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + [Dependency] private readonly GameTicker _ticker = default!; public Dictionary> Counter = new(); public Dictionary> CardIndexes = new(); public string Reason = ""; - - public static int MaxCount = 2; - - public static int RandomAcceptRate = 8; - + public static int MaxCount = 1; + public static int DelayNextAction = 10; + public static int EarliestStart = 45; private TimeSpan? _delay; - public override void Initialize() { SubscribeLocalEvent(OnButtonPressed); @@ -52,6 +55,11 @@ public sealed class AuthPanelSystem : EntitySystem } private void OnRestart(RoundRestartCleanupEvent ev) + { + ClearPanel(); + } + + private void ClearPanel() { Counter.Clear(); CardIndexes.Clear(); @@ -63,7 +71,26 @@ public sealed class AuthPanelSystem : EntitySystem { if (args.Action is AuthPanelAction.ERTRecruit) { - if (_random.Next(10) < RandomAcceptRate) + var query = EntityQueryEnumerator(); + var ghostList = new List(); + while (query.MoveNext(out var ghost, out _, out _)) + { + ghostList.Add(ghost); + } + + // if (_ticker.RoundDuration() < TimeSpan.FromMinutes(EarliestStart)) + // { + // var station = _station.GetStationInMap(Transform(uid).MapID); + + // if (station != null) + // _ert.DeclineERT(station.Value); + // _adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough time passed"); + // return; + // } + + var playerCount = _playerManager.PlayerCount; + //if (playerCount - ghostList.Count > playerCount / 2 && ghostList.Count > 3) + if (true) { _gameTicker.AddGameRule(ERTRecruitmentRuleComponent.EventName); } @@ -73,7 +100,7 @@ public sealed class AuthPanelSystem : EntitySystem if (station != null) _ert.DeclineERT(station.Value); - _adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - due to random"); + _adminLogger.Add(LogType.EventStarted, LogImpact.High, $"ERT Declined - Not enough ghosts"); } foreach (var entities in Counter.Values) @@ -85,6 +112,8 @@ public sealed class AuthPanelSystem : EntitySystem } } } + + Timer.Spawn(TimeSpan.FromSeconds(DelayNextAction), () => ClearPanel()); } private void OnButtonPressed(EntityUid uid, AuthPanelComponent component, AuthPanelButtonPressedMessage args) diff --git a/Content.Server/_White/ERTRecruitment/ERTRecruitmentRule.cs b/Content.Server/_White/ERTRecruitment/ERTRecruitmentRule.cs index f493c36b1c..8705bdd11e 100644 --- a/Content.Server/_White/ERTRecruitment/ERTRecruitmentRule.cs +++ b/Content.Server/_White/ERTRecruitment/ERTRecruitmentRule.cs @@ -29,7 +29,6 @@ public sealed class ERTRecruitmentRule : StationEventSystem Date: Thu, 26 Dec 2024 00:10:19 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9E=D0=91=D0=A0=20=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthPanel/AuthPanelBoundUserInterface.cs | 25 +++--- .../_White/AuthPanel/AuthPanelMenu.xaml | 12 +-- .../_White/AuthPanel/AuthPanelMenu.xaml.cs | 58 ++++++------ .../_White/AuthPanel/AuthPanelSystem.cs | 90 +++++++++++++------ .../ERTRecruitment/ERTRecruitmentRule.cs | 8 +- .../ERTRecruitmentRuleComponent.cs | 5 +- Resources/Locale/ru-RU/_white/auth-panel.ftl | 10 ++- Resources/Locale/ru-RU/guidebook/guides.ftl | 1 + Resources/Prototypes/Guidebook/security.yml | 6 ++ .../Entities/Structures/Wallmounts/auth.yml | 3 + .../Prototypes/_White/event_prototypes.yml | 1 - .../Guidebook/Security/AuthPanel.xml | 31 +++++++ 12 files changed, 164 insertions(+), 86 deletions(-) create mode 100644 Resources/ServerInfo/Guidebook/Security/AuthPanel.xml diff --git a/Content.Client/_White/AuthPanel/AuthPanelBoundUserInterface.cs b/Content.Client/_White/AuthPanel/AuthPanelBoundUserInterface.cs index 29dbb73a86..014f54574c 100644 --- a/Content.Client/_White/AuthPanel/AuthPanelBoundUserInterface.cs +++ b/Content.Client/_White/AuthPanel/AuthPanelBoundUserInterface.cs @@ -17,9 +17,9 @@ public sealed class AuthPanelBoundUserInterface : BoundUserInterface _menu = new AuthPanelMenu(); - _menu.OnRedButtonPressed(_=>SendButtonPressed(AuthPanelAction.ERTRecruit)); - _menu.OnAccessButtonPressed(_=>SendButtonPressed(AuthPanelAction.AddAccess)); - _menu.OnBluespaceWeaponButtonPressed(_=>SendButtonPressed(AuthPanelAction.BluespaceWeapon)); + _menu.OnRedButtonPressed(_ => SendButtonPressed(AuthPanelAction.ERTRecruit)); + // _menu.OnAccessButtonPressed(_ => SendButtonPressed(AuthPanelAction.AddAccess)); + // _menu.OnBluespaceWeaponButtonPressed(_ => SendButtonPressed(AuthPanelAction.BluespaceWeapon)); _menu.OnClose += Close; _menu.OpenCentered(); @@ -27,26 +27,27 @@ public sealed class AuthPanelBoundUserInterface : BoundUserInterface public void SendButtonPressed(AuthPanelAction button) { - SendMessage(new AuthPanelButtonPressedMessage(button,_menu?.GetReason())); + SendMessage(new AuthPanelButtonPressedMessage(button, _menu?.GetReason())); } protected override void UpdateState(BoundUserInterfaceState state) { - if(state is not AuthPanelConfirmationActionState confirmationActionState) + if (state is not AuthPanelConfirmationActionState confirmationActionState) return; var action = confirmationActionState.Action; - if(action.Action is AuthPanelAction.AddAccess) - _menu?.SetAccessCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount); - if(action.Action is AuthPanelAction.ERTRecruit) - _menu?.SetRedCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount); - if(action.Action is AuthPanelAction.BluespaceWeapon) - _menu?.SetWeaponCount(action.ConfirmedPeopleCount,action.MaxConfirmedPeopleCount); + // if (action.Action is AuthPanelAction.AddAccess) + // _menu?.SetAccessCount(action.ConfirmedPeopleCount, action.MaxConfirmedPeopleCount); + if (action.Action is AuthPanelAction.ERTRecruit) + _menu?.SetRedCount(action.ConfirmedPeopleCount, action.MaxConfirmedPeopleCount); + // if (action.Action is AuthPanelAction.BluespaceWeapon) + // _menu?.SetWeaponCount(action.ConfirmedPeopleCount, action.MaxConfirmedPeopleCount); _menu?.SetReason(action.Reason); - + if (action.ConfirmedPeopleCount == 0) + _menu?.UnlockReason(); } protected override void Dispose(bool disposing) diff --git a/Content.Client/_White/AuthPanel/AuthPanelMenu.xaml b/Content.Client/_White/AuthPanel/AuthPanelMenu.xaml index eb2b67705d..28b10fd96e 100644 --- a/Content.Client/_White/AuthPanel/AuthPanelMenu.xaml +++ b/Content.Client/_White/AuthPanel/AuthPanelMenu.xaml @@ -1,9 +1,9 @@ + Title="{Loc 'auth-panel-name'}" + MinSize="500 300" + SetSize="500 300">