From 4e6c59cfe51211064d79a727cc2d37c2a2f55a2c Mon Sep 17 00:00:00 2001 From: Rainfey Date: Thu, 29 Feb 2024 06:25:10 +0000 Subject: [PATCH] Refactor antag rule code (#23445) * Initial Pass, Rev, Thief * Zombie initial pass * Rebase, Traitor * Nukeops, More overloads * Revert RevolutionaryRuleComponent * Use TryRoundStartAttempt, Rewrite nukie spawning * Comments, Add task scheduler to GameRuleSystem * Zombie initial testing done * Sort methods, rework GameRuleTask * Add CCVar, Initial testing continues * Might as well get rid of the obsolete logging * Oops, i dont know how to log apparently * Suggested formatting fixes * Suggested changes * Fix merge issues * Minor optimisation * Allowed thief to choose other antags * Review changes * Spawn items on floor first, then inserting * minor tweaks * Shift as much as possible to ProtoId<> * Remove unneeded * Add exclusive antag attribute * Fix merge issues * Minor formatting fix * Convert to struct * Cleanup * Review cleanup (need to test a lot) * Some fixes, (mostly) tested * oop * Pass tests (for real) --------- Co-authored-by: Rainfall Co-authored-by: AJCM --- .../WarDeclaratorBoundUserInterface.cs | 8 +- .../NukeOps/WarDeclaratorWindow.xaml | 19 +- .../NukeOps/WarDeclaratorWindow.xaml.cs | 95 +- .../Tests/PostMapInitTest.cs | 4 +- .../Systems/AdminVerbSystem.Antags.cs | 32 +- Content.Server/Antag/AntagSelectionSystem.cs | 516 +- .../Rules/Components/GameRuleComponent.cs | 2 +- .../NukeOperativeSpawnerComponent.cs | 7 +- .../Rules/Components/NukeopsRuleComponent.cs | 107 +- .../Components/RevolutionaryRuleComponent.cs | 10 - .../Rules/Components/ThiefRuleComponent.cs | 21 +- .../Rules/Components/TraitorRuleComponent.cs | 44 +- .../Rules/Components/ZombieRuleComponent.cs | 47 +- .../Rules/GameRuleSystem.Utility.cs | 2 +- .../GameTicking/Rules/GameRuleSystem.cs | 8 +- .../GameTicking/Rules/NukeopsRuleSystem.cs | 1058 +- .../GameTicking/Rules/PiratesRuleSystem.cs | 7 +- .../Rules/RevolutionaryRuleSystem.cs | 178 +- .../GameTicking/Rules/ThiefRuleSystem.cs | 165 +- .../GameTicking/Rules/TraitorRuleSystem.cs | 255 +- .../GameTicking/Rules/ZombieRuleSystem.cs | 240 +- .../NukeOps/WarDeclaratorComponent.cs | 37 +- Content.Server/NukeOps/WarDeclaratorSystem.cs | 112 +- Content.Server/Roles/DragonRoleComponent.cs | 2 +- .../Roles/InitialInfectedRoleComponent.cs | 4 +- Content.Server/Roles/NinjaRoleComponent.cs | 2 +- Content.Server/Roles/NukeopsRoleComponent.cs | 4 +- .../Roles/RevolutionaryRoleComponent.cs | 2 +- .../Roles/TerminatorRoleComponent.cs | 4 +- Content.Server/Roles/TraitorRoleComponent.cs | 4 +- Content.Server/Roles/ZombieRoleComponent.cs | 4 +- .../Shuttles/Components/GridFillComponent.cs | 10 +- .../Systems/ShuttleSystem.GridFill.cs | 11 + .../StationEvents/Events/LoneOpsSpawnRule.cs | 18 +- .../Events/StationEventSystem.cs | 21 +- .../Traitor/Systems/AutoTraitorSystem.cs | 19 +- Content.Shared/Antag/AntagAcceptability.cs | 22 + Content.Shared/CCVar/CCVars.cs | 7 + .../Inventory/InventorySystem.Helpers.cs | 55 + Content.Shared/NukeOps/WarDeclaratorEvents.cs | 24 +- .../Components/RevolutionaryComponent.cs | 9 +- .../Roles/AntagonistRoleComponent.cs | 13 +- Content.Shared/Roles/MindIsAntagonistEvent.cs | 5 +- Content.Shared/Roles/SharedRoleSystem.cs | 22 +- .../Locale/en-US/game-ticking/game-ticker.ftl | 3 + .../Locale/en-US/nukeops/war-declarator.ftl | 11 +- Resources/Locale/en-US/nukeops/war-ops.ftl | 2 +- .../Maps/{ => Nonstations}/nukieplanet.yml | 30222 ++++++++-------- Resources/Maps/{ => Shuttles}/infiltrator.yml | 11342 +++--- .../Syndicate_Gadgets/war_declarator.yml | 5 +- .../Entities/Stations/syndicate.yml | 16 + Resources/Prototypes/GameRules/roundstart.yml | 2 + Resources/Prototypes/Maps/syndicate.yml | 11 + 53 files changed, 22454 insertions(+), 22396 deletions(-) create mode 100644 Content.Shared/Antag/AntagAcceptability.cs rename Resources/Maps/{ => Nonstations}/nukieplanet.yml (86%) rename Resources/Maps/{ => Shuttles}/infiltrator.yml (95%) create mode 100644 Resources/Prototypes/Entities/Stations/syndicate.yml create mode 100644 Resources/Prototypes/Maps/syndicate.yml diff --git a/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs b/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs index 20103a9743..ec055b3240 100644 --- a/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs +++ b/Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs @@ -3,6 +3,7 @@ using Content.Shared.Chat; using Content.Shared.NukeOps; using JetBrains.Annotations; using Robust.Shared.Configuration; +using Robust.Shared.Timing; namespace Content.Client.NukeOps; @@ -10,6 +11,8 @@ namespace Content.Client.NukeOps; public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface { [Dependency] private readonly IConfigurationManager _cfg = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly ILocalizationManager _localizationManager = default!; [ViewVariables] private WarDeclaratorWindow? _window; @@ -20,7 +23,7 @@ public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface { base.Open(); - _window = new WarDeclaratorWindow(); + _window = new WarDeclaratorWindow(_gameTiming, _localizationManager); if (State != null) UpdateState(State); @@ -42,7 +45,8 @@ public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface protected override void Dispose(bool disposing) { base.Dispose(disposing); - if (disposing) _window?.Dispose(); + if (disposing) + _window?.Dispose(); } private void OnWarDeclaratorActivated(string message) diff --git a/Content.Client/NukeOps/WarDeclaratorWindow.xaml b/Content.Client/NukeOps/WarDeclaratorWindow.xaml index f90ed865a0..43381158a2 100644 --- a/Content.Client/NukeOps/WarDeclaratorWindow.xaml +++ b/Content.Client/NukeOps/WarDeclaratorWindow.xaml @@ -1,4 +1,5 @@ - @@ -7,12 +8,16 @@ MinHeight="200" Access="Public" />