]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Resolve `'EntitySystem.Get<T>()' is obsolete` in content (#27936)
authorKara <lunarautomaton6@gmail.com>
Mon, 13 May 2024 00:34:52 +0000 (17:34 -0700)
committerGitHub <noreply@github.com>
Mon, 13 May 2024 00:34:52 +0000 (20:34 -0400)
* PROJECT 0 WARNINGS: Resolve `'EntitySystem.Get<T>()' is obsolete` in content

* pass entman

* dog ass test

* webeditor

65 files changed:
Content.Client/Decals/ToggleDecalCommand.cs
Content.Client/Decals/UI/DecalPlacerWindow.xaml.cs
Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs
Content.Client/NodeContainer/NodeVisCommand.cs
Content.IntegrationTests/Tests/Commands/RestartRoundTest.cs
Content.Server/Administration/Commands/DSay.cs
Content.Server/Administration/Commands/ReadyAll.cs
Content.Server/Administration/Commands/ShuttleCommands.cs
Content.Server/Administration/Commands/ThrowScoreboardCommand.cs
Content.Server/Administration/Logs/AdminLogsEui.cs
Content.Server/Administration/UI/SpawnExplosionEui.cs
Content.Server/Alert/Commands/ClearAlert.cs
Content.Server/Alert/Commands/ShowAlert.cs
Content.Server/Atmos/Commands/ListGasesCommand.cs
Content.Server/Atmos/Commands/ShowAtmosCommand.cs
Content.Server/Atmos/Components/AtmosPlaqueComponent.cs
Content.Server/Atmos/Monitor/Systems/AirAlarmModes.cs
Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs
Content.Server/Chat/Commands/LOOCCommand.cs
Content.Server/Chat/Commands/SuicideCommand.cs
Content.Server/Chemistry/EntitySystems/VaporSystem.cs
Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs
Content.Server/Chemistry/ReagentEffectConditions/HasTagCondition.cs
Content.Server/Chemistry/ReagentEffects/ChemCleanBloodstream.cs
Content.Server/Chemistry/ReagentEffects/ExtinguishReaction.cs
Content.Server/Chemistry/ReagentEffects/Ignite.cs
Content.Server/Chemistry/ReagentEffects/ModifyBleedAmount.cs
Content.Server/Chemistry/ReagentEffects/ModifyBloodLevel.cs
Content.Server/Chemistry/ReagentEffects/MovespeedModifier.cs
Content.Server/Chemistry/ReagentEffects/Oxygenate.cs
Content.Server/Chemistry/ReagentEffects/Paralyze.cs
Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs
Content.Server/Chemistry/ReagentEffects/WashCreamPieReaction.cs
Content.Server/Chemistry/TileReactions/CleanDecalsReaction.cs
Content.Server/Chemistry/TileReactions/CleanTileReaction.cs
Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs
Content.Server/Chemistry/TileReactions/ExtinguishTileReaction.cs
Content.Server/Chemistry/TileReactions/FlammableTileReaction.cs
Content.Server/Chemistry/TileReactions/PryTileReaction.cs
Content.Server/Chemistry/TileReactions/SpillIfPuddlePresentTileReaction.cs
Content.Server/Chemistry/TileReactions/SpillTileReaction.cs
Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs
Content.Server/Destructible/Thresholds/Behaviors/OpenBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs
Content.Server/Fluids/EntitySystems/PuddleSystem.cs
Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Content.Server/GameTicking/Commands/DelayStartCommand.cs
Content.Server/GameTicking/Commands/EndRoundCommand.cs
Content.Server/GameTicking/Commands/ForcePresetCommand.cs
Content.Server/GameTicking/Commands/GoLobbyCommand.cs
Content.Server/GameTicking/Commands/ObserveCommand.cs
Content.Server/GameTicking/Commands/RestartRoundCommand.cs
Content.Server/GameTicking/Commands/StartRoundCommand.cs
Content.Server/GameTicking/Commands/ToggleReadyCommand.cs
Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
Content.Server/Ghost/Roles/GhostRoleSystem.cs
Content.Server/Ghost/Roles/UI/GhostRolesEui.cs
Content.Server/Maps/Conditions/HolidayMapCondition.cs
Content.Server/NodeContainer/Nodes/PipeNode.cs
Content.Server/Power/Commands/PowerStatCommand.cs
Content.Server/Power/PowerWireAction.cs
Content.Server/Sandbox/Commands/ColorNetworkCommand.cs
Content.Shared/Chemistry/Reaction/ITileReaction.cs
Content.Shared/Chemistry/Reagent/ReagentPrototype.cs
Content.Tests/Shared/Alert/ServerAlertsComponentTests.cs

index 9f0851f08060dbfd387c22913e7cbe8343437b48..025ed1299d1f05645dfcb7e8cbff3b364fa1ae64 100644 (file)
@@ -5,11 +5,13 @@ namespace Content.Client.Decals;
 
 public sealed class ToggleDecalCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _e = default!;
+
     public string Command => "toggledecals";
     public string Description => "Toggles decaloverlay";
     public string Help => $"{Command}";
     public void Execute(IConsoleShell shell, string argStr, string[] args)
     {
-        EntitySystem.Get<DecalSystem>().ToggleOverlay();
+        _e.System<DecalSystem>().ToggleOverlay();
     }
 }
index 1be175108079bd230969236d905241b2dccbc03f..21b816515a481b83ea853fd78188757386196290 100644 (file)
@@ -16,6 +16,7 @@ namespace Content.Client.Decals.UI;
 public sealed partial class DecalPlacerWindow : DefaultWindow
 {
     [Dependency] private readonly IPrototypeManager _prototype = default!;
+    [Dependency] private readonly IEntityManager _e = default!;
 
     private readonly DecalPlacementSystem _decalPlacementSystem;
 
@@ -39,7 +40,7 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
         RobustXamlLoader.Load(this);
         IoCManager.InjectDependencies(this);
 
-        _decalPlacementSystem = EntitySystem.Get<DecalPlacementSystem>();
+        _decalPlacementSystem = _e.System<DecalPlacementSystem>();
 
         // This needs to be done in C# so we can have custom stuff passed in the constructor
         // and thus have a proper step size
index 2fd4f296556de791512611e9ed80c528adeaa438..2d561ba5f21c9679cd80af0cd23fc4207ddc4fec 100644 (file)
@@ -139,11 +139,13 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
 
 public sealed class ClearAllNetworkLinkOverlays : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _e = default!;
+
     public string Command => "clearnetworklinkoverlays";
     public string Description => "Clear all network link overlays.";
     public string Help => Command;
     public void Execute(IConsoleShell shell, string argStr, string[] args)
     {
-        IoCManager.Resolve<IEntityManager>().System<NetworkConfiguratorSystem>().ClearAllOverlays();
+        _e.System<NetworkConfiguratorSystem>().ClearAllOverlays();
     }
 }
index c6a95fce5b58f468a0437b70c21fdc06c06f152e..249c0d942721a7a9605dcc8bcbb4f6deefef9d89 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Client.NodeContainer
 {
     public sealed class NodeVisCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "nodevis";
         public string Description => "Toggles node group visualization";
         public string Help => "";
@@ -21,20 +23,22 @@ namespace Content.Client.NodeContainer
                 return;
             }
 
-            var sys = EntitySystem.Get<NodeGroupSystem>();
+            var sys = _e.System<NodeGroupSystem>();
             sys.SetVisEnabled(!sys.VisEnabled);
         }
     }
 
     public sealed class NodeVisFilterCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "nodevisfilter";
         public string Description => "Toggles showing a specific group on nodevis";
         public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var sys = EntitySystem.Get<NodeGroupSystem>();
+            var sys = _e.System<NodeGroupSystem>();
 
             if (args.Length == 0)
             {
index 74d014b7724284fc75bdf1e65ff6a066a1106135..ff24ec09686130521ac85c075c59d5492d2ecea2 100644 (file)
@@ -3,6 +3,7 @@ using Content.Server.GameTicking.Commands;
 using Content.Shared.CCVar;
 using Robust.Shared.Configuration;
 using Robust.Shared.GameObjects;
+using Robust.Shared.IoC;
 using Robust.Shared.Timing;
 
 namespace Content.IntegrationTests.Tests.Commands
@@ -40,8 +41,7 @@ namespace Content.IntegrationTests.Tests.Commands
 
                 tickBeforeRestart = entityManager.CurrentTick;
 
-                var command = new RestartRoundNowCommand();
-                command.Execute(null, string.Empty, Array.Empty<string>());
+                gameTicker.RestartRound();
 
                 if (lobbyEnabled)
                 {
index 61b47d785674de2c31e4a8eab00239ec18a077a3..8682614b5fcfab070cfa52323e004f0f4f4fda79 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     sealed class DSay : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "dsay";
 
         public string Description => Loc.GetString("dsay-command-description");
@@ -32,7 +34,7 @@ namespace Content.Server.Administration.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            var chat = EntitySystem.Get<ChatSystem>();
+            var chat = _e.System<ChatSystem>();
             chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
         }
     }
index d55ef09660c1d2bba1a1c026a20646fe3e9082c1..530ba0e89c42b8b6ec12b9b8b585912d2895109a 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Round)]
     public sealed class ReadyAll : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "readyall";
         public string Description => "Readies up all players in the lobby, except for observers.";
         public string Help => $"{Command} | ̣{Command} <ready>";
@@ -20,7 +22,7 @@ namespace Content.Server.Administration.Commands
                 ready = bool.Parse(args[0]);
             }
 
-            var gameTicker = EntitySystem.Get<GameTicker>();
+            var gameTicker = _e.System<GameTicker>();
 
 
             if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
index 5b0d39fd154a3eaafec3032d528763acb5a8e4b3..ea0f891360ae856d98a28011e5d6cd6050e8f2eb 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Round)]
     public sealed class CallShuttleCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "callshuttle";
         public string Description => Loc.GetString("call-shuttle-command-description");
         public string Help => Loc.GetString("call-shuttle-command-help-text", ("command",Command));
@@ -19,7 +21,7 @@ namespace Content.Server.Administration.Commands
             // ReSharper disable once ConvertIfStatementToSwitchStatement
             if (args.Length == 1 && TimeSpan.TryParseExact(args[0], ContentLocalizationManager.TimeSpanMinutesFormats, loc.DefaultCulture, out var timeSpan))
             {
-                EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
+                _e.System<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
             }
             else if (args.Length == 1)
             {
@@ -27,7 +29,7 @@ namespace Content.Server.Administration.Commands
             }
             else
             {
-                EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(shell.Player?.AttachedEntity, false);
+                _e.System<RoundEndSystem>().RequestRoundEnd(shell.Player?.AttachedEntity, false);
             }
         }
     }
@@ -35,13 +37,15 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Round)]
     public sealed class RecallShuttleCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "recallshuttle";
         public string Description => Loc.GetString("recall-shuttle-command-description");
         public string Help => Loc.GetString("recall-shuttle-command-help-text", ("command",Command));
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            EntitySystem.Get<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
+            _e.System<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
         }
     }
 }
index ed4ec5a5154d2ca16d71fa360272367cd174ea1e..e66efe809aa02c6218844fa93feba6674e387a36 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.VarEdit)]
 public sealed class ThrowScoreboardCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _e = default!;
+
     public string Command => "throwscoreboard";
 
     public string Description => Loc.GetString("throw-scoreboard-command-description");
@@ -20,6 +22,6 @@ public sealed class ThrowScoreboardCommand : IConsoleCommand
             shell.WriteLine(Help);
             return;
         }
-        EntitySystem.Get<GameTicker>().ShowRoundEndScoreboard();
+        _e.System<GameTicker>().ShowRoundEndScoreboard();
     }
 }
index 8bd870b2c77b524031f1f1e91f57f28c8fac9a60..e98a3b0ff29895766c3cf4be9c1540498bd8ce45 100644 (file)
@@ -23,6 +23,7 @@ public sealed class AdminLogsEui : BaseEui
     [Dependency] private readonly IAdminManager _adminManager = default!;
     [Dependency] private readonly ILogManager _logManager = default!;
     [Dependency] private readonly IConfigurationManager _configuration = default!;
+    [Dependency] private readonly IEntityManager _e = default!;
 
     private readonly ISawmill _sawmill;
 
@@ -51,7 +52,7 @@ public sealed class AdminLogsEui : BaseEui
         };
     }
 
-    private int CurrentRoundId => EntitySystem.Get<GameTicker>().RoundId;
+    private int CurrentRoundId => _e.System<GameTicker>().RoundId;
 
     public override async void Opened()
     {
index a3729b145439ae7ba74312f49ebe1458eeb6c3b8..001ce1efeec23734ad942a85d381f276bfb48714 100644 (file)
@@ -31,7 +31,7 @@ public sealed class SpawnExplosionEui : BaseEui
         if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0)
             return;
 
-        var explosion = EntitySystem.Get<ExplosionSystem>().GenerateExplosionPreview(request);
+        var explosion = _explosionSystem.GenerateExplosionPreview(request);
 
         if (explosion == null)
         {
index 1759612702f789d69f4e8c2ce9ebea36c977d33b..73a6ca52c70f4d250aadbf04409917af220fe944 100644 (file)
@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class ClearAlert : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "clearalert";
         public string Description => "Clears an alert for a player, defaulting to current player";
         public string Help => "clearalert <alertType> <name or userID, omit for current player>";
@@ -30,14 +32,14 @@ namespace Content.Server.Alert.Commands
                 if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
+            if (!_e.TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
             {
                 shell.WriteLine("user has no alerts component");
                 return;
             }
 
             var alertType = args[0];
-            var alertsSystem = EntitySystem.Get<AlertsSystem>();
+            var alertsSystem = _e.System<AlertsSystem>();
             if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
             {
                 shell.WriteLine("unrecognized alertType " + alertType);
index 11901e9af0021f5ff81a82c48ab2bfe23077d4f4..f37ab23f2fa3cb6a74513961fb59e1c7aaec886d 100644 (file)
@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class ShowAlert : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "showalert";
         public string Description => "Shows an alert for a player, defaulting to current player";
         public string Help => "showalert <alertType> <severity, -1 if no severity> <name or userID, omit for current player>";
@@ -30,7 +32,7 @@ namespace Content.Server.Alert.Commands
                 if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
+            if (!_e.TryGetComponent(attachedEntity, out AlertsComponent? alertsComponent))
             {
                 shell.WriteLine("user has no alerts component");
                 return;
@@ -38,7 +40,7 @@ namespace Content.Server.Alert.Commands
 
             var alertType = args[0];
             var severity = args[1];
-            var alertsSystem = EntitySystem.Get<AlertsSystem>();
+            var alertsSystem = _e.System<AlertsSystem>();
             if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
             {
                 shell.WriteLine("unrecognized alertType " + alertType);
index ab792fcf81f4d6abee9a5846598b3f8fb7324887..81acc2b3b5d7d8b9fd901b3ec42ade6ca06e14b0 100644 (file)
@@ -8,13 +8,15 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class ListGasesCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "listgases";
         public string Description => "Prints a list of gases and their indices.";
         public string Help => "listgases";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosSystem = _e.System<AtmosphereSystem>();
 
             foreach (var gasPrototype in atmosSystem.Gases)
             {
index 263ef947d0a08f491722e76cfbe6d5ef2b472a54..89b9c846ece5f6871ba7d28cff6a68d7915d5d00 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class ShowAtmos : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "showatmos";
         public string Description => "Toggles seeing atmos debug overlay.";
         public string Help => $"Usage: {Command}";
@@ -21,7 +23,7 @@ namespace Content.Server.Atmos.Commands
                 return;
             }
 
-            var atmosDebug = EntitySystem.Get<AtmosDebugOverlaySystem>();
+            var atmosDebug = _e.System<AtmosDebugOverlaySystem>();
             var enabled = atmosDebug.ToggleObserver(player);
 
             shell.WriteLine(enabled
index d86cbe1d2fb3ce6c7faac85a31ca5f9937a1f31b..3332d227e45d4f326b5671e50d2788b93dabf7ad 100644 (file)
@@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components
             set
             {
                 Type = value;
-                EntitySystem.Get<AtmosPlaqueSystem>().UpdateSign(Owner, this);
+                IoCManager.Resolve<IEntityManager>().System<AtmosPlaqueSystem>().UpdateSign(Owner, this);
             }
         }
     }
index d794be0d560ed13648775ba7d82126b1f306106a..f979f4b86077bd835b6348c2dc85ae60ca8d8a28 100644 (file)
@@ -90,8 +90,8 @@ public abstract class AirAlarmModeExecutor : IAirAlarmMode
     {
         IoCManager.InjectDependencies(this);
 
-        DeviceNetworkSystem = EntitySystem.Get<DeviceNetworkSystem>();
-        AirAlarmSystem = EntitySystem.Get<AirAlarmSystem>();
+        DeviceNetworkSystem = EntityManager.System<DeviceNetworkSystem>();
+        AirAlarmSystem = EntityManager.System<AirAlarmSystem>();
     }
 }
 
index 455d125e44be1f206779a50f2c303112cbb38555..5b05668ad57e30dd78a766303a3f9e04f709105f 100644 (file)
@@ -13,7 +13,7 @@ namespace Content.Server.Atmos.Piping.Components
         public Color ColorVV
         {
             get => Color;
-            set => EntitySystem.Get<AtmosPipeColorSystem>().SetColor(Owner, this, value);
+            set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
         }
     }
 }
index 9e16193fc38a4ee9f14354b3b770a16f7e5a960d..059d25df27c3feb9b9e1ea0e68b277c97c8d2d80 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Chat.Commands
     [AnyCommand]
     internal sealed class LOOCCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "looc";
         public string Description => "Send Local Out Of Character chat messages.";
         public string Help => "looc <text>";
@@ -33,7 +35,7 @@ namespace Content.Server.Chat.Commands
             if (string.IsNullOrEmpty(message))
                 return;
 
-            EntitySystem.Get<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player);
+            _e.System<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player);
         }
     }
 }
index 0c541b48b7ad7cef9ac862ee91ba8648e8df357f..0db03fec79b116346c061cfbb75d12e9817cbfd5 100644 (file)
@@ -10,6 +10,8 @@ namespace Content.Server.Chat.Commands
     [AnyCommand]
     internal sealed class SuicideCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "suicide";
 
         public string Description => Loc.GetString("suicide-command-description");
@@ -27,8 +29,8 @@ namespace Content.Server.Chat.Commands
             if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
                 return;
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var minds = entityManager.System<SharedMindSystem>();
+            var minds = _e.System<SharedMindSystem>();
+
             // This check also proves mind not-null for at the end when the mob is ghosted.
             if (!minds.TryGetMind(player, out var mindId, out var mind) ||
                 mind.OwnedEntity is not { Valid: true } victim)
@@ -37,17 +39,19 @@ namespace Content.Server.Chat.Commands
                 return;
             }
 
-            if (entityManager.HasComponent<AdminFrozenComponent>(victim))
+
+            var gameTicker = _e.System<GameTicker>();
+            var suicideSystem = _e.System<SuicideSystem>();
+
+            if (_e.HasComponent<AdminFrozenComponent>(victim))
             {
                 var deniedMessage = Loc.GetString("suicide-command-denied");
                 shell.WriteLine(deniedMessage);
-                entityManager.System<PopupSystem>()
+                _e.System<PopupSystem>()
                     .PopupEntity(deniedMessage, victim, victim);
                 return;
             }
 
-            var gameTicker = entityManager.System<GameTicker>();
-            var suicideSystem = entityManager.System<SuicideSystem>();
             if (suicideSystem.Suicide(victim))
             {
                 // Prevent the player from returning to the body.
index 1415b6cad3c1e5815a661da5c9e453a75e60db7c..8e12670ca62b92dc04b11f289ea6d59ec6a42bfa 100644 (file)
@@ -122,7 +122,7 @@ namespace Content.Server.Chemistry.EntitySystems
                     var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
 
                     var reaction =
-                        reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f);
+                        reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f, EntityManager);
 
                     if (reaction > reagentQuantity.Quantity)
                     {
index 8a558a3ffdc787385a5bdbbd567653ed3fb01c85..2771f79c3a3926c7b326a2408a27fcb6c75f18f7 100644 (file)
@@ -61,7 +61,8 @@ namespace Content.Server.Chemistry.ReactionEffects
         {
             var intensity = MathF.Min((float) args.Quantity * IntensityPerUnit, MaxTotalIntensity);
 
-            EntitySystem.Get<ExplosionSystem>().QueueExplosion(
+            args.EntityManager.System<ExplosionSystem>()
+                .QueueExplosion(
                 args.SolutionEntity,
                 ExplosionType,
                 intensity,
index 52d4d00eb3f9bb59624f3d6311631ad636709725..d185c7e0a764b62fd1c3da81aeeadc357d8868c7 100644 (file)
@@ -18,7 +18,7 @@ public sealed partial class HasTag : ReagentEffectCondition
     public override bool Condition(ReagentEffectArgs args)
     {
         if (args.EntityManager.TryGetComponent<TagComponent>(args.SolutionEntity, out var tag))
-            return EntitySystem.Get<TagSystem>().HasTag(tag, Tag) ^ Invert;
+            return args.EntityManager.System<TagSystem>().HasTag(tag, Tag) ^ Invert;
 
         return false;
     }
index 402b30a069b0acced8004a4e2cbdc2d9f5f1e314..ace73c84f3ae4887dd739e3262538d2013e684fd 100644 (file)
@@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.ReactionEffects
 
             cleanseRate *= args.Scale;
 
-            var bloodstreamSys = EntitySystem.Get<BloodstreamSystem>();
+            var bloodstreamSys = args.EntityManager.System<BloodstreamSystem>();
             bloodstreamSys.FlushChemicals(args.SolutionEntity, args.Reagent.ID, cleanseRate);
         }
     }
index e90290899884e3906ad8a13c1947af609ce11407..69aaf5cdcd72cfe253ac6bd7400db7959ba222cf 100644 (file)
@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
         {
             if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return;
 
-            var flammableSystem = EntitySystem.Get<FlammableSystem>();
+            var flammableSystem = args.EntityManager.System<FlammableSystem>();
             flammableSystem.Extinguish(args.SolutionEntity, flammable);
             flammableSystem.AdjustFireStacks(args.SolutionEntity, -1.5f * (float) args.Quantity, flammable);
         }
index 1fc90f63e310b5a79f0b16366c619dcacd3fa741..6c5d47711f35e5863778dcf3461bbb0b8a98d775 100644 (file)
@@ -19,7 +19,7 @@ public sealed partial class Ignite : ReagentEffect
 
     public override void Effect(ReagentEffectArgs args)
     {
-        var flamSys = EntitySystem.Get<FlammableSystem>();
+        var flamSys = args.EntityManager.System<FlammableSystem>();
         flamSys.Ignite(args.SolutionEntity, args.OrganEntity ?? args.SolutionEntity);
     }
 }
index 7b966ea4788a79e648969ad65e95bdd966452aff..ecd9c86255fcec1c40defe61ff78fa215077abd4 100644 (file)
@@ -21,7 +21,7 @@ public sealed partial class ModifyBleedAmount : ReagentEffect
     {
         if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood))
         {
-            var sys = EntitySystem.Get<BloodstreamSystem>();
+            var sys = args.EntityManager.System<BloodstreamSystem>();
             var amt = Scaled ? Amount * args.Quantity.Float() : Amount;
             amt *= args.Scale;
 
index 748aa71083ebb12af105fa60ddf0087860583d34..b136ff9bb8c1566525e374bfe117d287fb2f16ee 100644 (file)
@@ -22,7 +22,7 @@ public sealed partial class ModifyBloodLevel : ReagentEffect
     {
         if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood))
         {
-            var sys = EntitySystem.Get<BloodstreamSystem>();
+            var sys = args.EntityManager.System<BloodstreamSystem>();
             var amt = Scaled ? Amount * args.Quantity : Amount;
             amt *= args.Scale;
 
index 0301742c5afb3d5749399d09df5eaccd3137aea2..e538a011f6047b9f02bee4977183a1621b9a8f1d 100644 (file)
@@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.ReagentEffects
             IncreaseTimer(status, statusLifetime);
 
             if (modified)
-                EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity);
+                args.EntityManager.System<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity);
 
         }
         public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time)
index 34a2454139eec9d2091122d60cf4567f15d6509b..6c5ab155e44011871f8abdbf3d2e9b74279a91b6 100644 (file)
@@ -18,7 +18,7 @@ public sealed partial class Oxygenate : ReagentEffect
     {
         if (args.EntityManager.TryGetComponent<RespiratorComponent>(args.SolutionEntity, out var resp))
         {
-            var respSys = EntitySystem.Get<RespiratorSystem>();
+            var respSys = args.EntityManager.System<RespiratorSystem>();
             respSys.UpdateSaturation(args.SolutionEntity, args.Quantity.Float() * Factor, resp);
         }
     }
index 077d1abf2c2e72bd4c7ee7a4fcbdb539fe69de8f..d5d913f37d2c36a7c98d2eb27b54db3780239c63 100644 (file)
@@ -23,7 +23,7 @@ public sealed partial class Paralyze : ReagentEffect
         var paralyzeTime = ParalyzeTime;
         paralyzeTime *= args.Scale;
 
-        EntitySystem.Get<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh);
+        args.EntityManager.System<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh);
     }
 }
 
index 1208e74367b0e47c14e7f04fa306dd270abc831f..8813813c240282a059f08b6227a81d803ba32d43 100644 (file)
@@ -23,7 +23,7 @@ namespace Content.Server.Chemistry.ReagentEffects
         {
             var uid = args.SolutionEntity;
             if (args.EntityManager.TryGetComponent(uid, out ThirstComponent? thirst))
-                EntitySystem.Get<ThirstSystem>().ModifyThirst(uid, thirst, HydrationFactor);
+                args.EntityManager.System<ThirstSystem>().ModifyThirst(uid, thirst, HydrationFactor);
         }
 
         protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
index 9bf6792eca2a5e4b7c2e87ac4677fd4fefce618d..a71a42c25ffa8155d6bebe2989b31d81c0b7edfc 100644 (file)
@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
         {
             if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out CreamPiedComponent? creamPied)) return;
 
-            EntitySystem.Get<CreamPieSystem>().SetCreamPied(args.SolutionEntity, creamPied, false);
+            args.EntityManager.System<CreamPieSystem>().SetCreamPied(args.SolutionEntity, creamPied, false);
         }
     }
 }
index a20f54728ee49ce21005156052ed4d2dd7725eaf..6958dabb81b15690f28e709afbc19e03362576d8 100644 (file)
@@ -21,19 +21,20 @@ public sealed partial class CleanDecalsReaction : ITileReaction
     [DataField]
     public FixedPoint2 CleanCost { get; private set; } = FixedPoint2.New(0.25f);
 
-    public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+    public FixedPoint2 TileReact(TileRef tile,
+        ReagentPrototype reagent,
+        FixedPoint2 reactVolume,
+        IEntityManager entityManager)
     {
-        var entMan = IoCManager.Resolve<IEntityManager>();
-
         if (reactVolume <= CleanCost ||
-            !entMan.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) ||
-            !entMan.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid))
+            !entityManager.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) ||
+            !entityManager.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid))
         {
             return FixedPoint2.Zero;
         }
 
-        var lookupSystem = entMan.System<EntityLookupSystem>();
-        var decalSystem = entMan.System<DecalSystem>();
+        var lookupSystem = entityManager.System<EntityLookupSystem>();
+        var decalSystem = entityManager.System<DecalSystem>();
         // Very generous hitbox.
         var decals = decalSystem
             .GetDecalsIntersecting(tile.GridUid, lookupSystem.GetLocalBounds(tile, grid.TileSize).Enlarged(0.5f).Translated(new Vector2(-0.5f, -0.5f)));
index 3f5ae63c365dc56eccfcfada9a9fffcaf91119bc..08f77de72dd3bb7c0448f1a9308649252e2d2582 100644 (file)
@@ -31,12 +31,14 @@ public sealed partial class CleanTileReaction : ITileReaction
     [DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
     public string ReplacementReagent = "Water";
 
-    FixedPoint2 ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+    FixedPoint2 ITileReaction.TileReact(TileRef tile,
+        ReagentPrototype reagent,
+        FixedPoint2 reactVolume,
+        IEntityManager entityManager)
     {
-        var entMan = IoCManager.Resolve<IEntityManager>();
-        var entities = entMan.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray();
-        var puddleQuery = entMan.GetEntityQuery<PuddleComponent>();
-        var solutionContainerSystem = entMan.System<SolutionContainerSystem>();
+        var entities = entityManager.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray();
+        var puddleQuery = entityManager.GetEntityQuery<PuddleComponent>();
+        var solutionContainerSystem = entityManager.System<SolutionContainerSystem>();
         // Multiply as the amount we can actually purge is higher than the react amount.
         var purgeAmount = reactVolume / CleanAmountMultiplier;
 
index 9cb1ba201d5b9cefbb3da1943f9baf01a45cc563..29f9275bdf47f2be3491054af6eaa99b1d5166f6 100644 (file)
@@ -35,13 +35,13 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
     [DataField]
     public float RandomOffsetMax = 0.0f;
 
-    public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+    public FixedPoint2 TileReact(TileRef tile,
+        ReagentPrototype reagent,
+        FixedPoint2 reactVolume,
+        IEntityManager entityManager)
     {
         if (reactVolume >= Usage)
         {
-            // TODO probably pass this in args like reagenteffects do.
-            var entMan = IoCManager.Resolve<IEntityManager>();
-
             if (Whitelist != null)
             {
                 int acc = 0;
@@ -59,9 +59,9 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
             var xoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
             var yoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
 
-            var center = entMan.System<TurfSystem>().GetTileCenter(tile);
+            var center = entityManager.System<TurfSystem>().GetTileCenter(tile);
             var pos = center.Offset(new Vector2(xoffs, yoffs));
-            entMan.SpawnEntity(Entity, pos);
+            entityManager.SpawnEntity(Entity, pos);
 
             return Usage;
         }
index 312b88bd3418dee2922c0b07c9ae4a8325357a8b..198f650ac1a01182bb6f6a5c9ce566e43ba009fa 100644 (file)
@@ -14,12 +14,15 @@ namespace Content.Server.Chemistry.TileReactions
     {
         [DataField("coolingTemperature")] private float _coolingTemperature = 2f;
 
-        public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+        public FixedPoint2 TileReact(TileRef tile,
+            ReagentPrototype reagent,
+            FixedPoint2 reactVolume,
+            IEntityManager entityManager)
         {
             if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
                 return FixedPoint2.Zero;
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = entityManager.System<AtmosphereSystem>();
 
             var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);
 
index a694bf6019042c7db17b1816116870e3ca3e9f79..b13b70d3d5c27f38aae53adb74582168d5740484 100644 (file)
@@ -13,12 +13,15 @@ namespace Content.Server.Chemistry.TileReactions
     {
         [DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f;
 
-        public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+        public FixedPoint2 TileReact(TileRef tile,
+            ReagentPrototype reagent,
+            FixedPoint2 reactVolume,
+            IEntityManager entityManager)
         {
             if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
                 return FixedPoint2.Zero;
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = entityManager.System<AtmosphereSystem>();
 
             var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);
             if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices))
index 39e95df5f7cb45134a046c166922778692beadef..c10b031720fefc864111aa3a0f055a73dc32e979 100644 (file)
@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions;
 [DataDefinition]
 public sealed partial class PryTileReaction : ITileReaction
 {
-    public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+    public FixedPoint2 TileReact(TileRef tile,
+        ReagentPrototype reagent,
+        FixedPoint2 reactVolume,
+        IEntityManager entityManager)
     {
-        var sys = IoCManager.Resolve<IEntityManager>().System<TileSystem>();
+        var sys = entityManager.System<TileSystem>();
         sys.PryTile(tile);
         return reactVolume;
     }
index 82ede720cd0e0b071794406bd4107d8dfebad4f4..6b46b8949594c436c2bd96086ef7d9ab852778c6 100644 (file)
@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions
     [DataDefinition]
     public sealed partial class SpillIfPuddlePresentTileReaction : ITileReaction
     {
-        public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+        public FixedPoint2 TileReact(TileRef tile,
+            ReagentPrototype reagent,
+            FixedPoint2 reactVolume,
+            IEntityManager entityManager)
         {
-            var spillSystem = EntitySystem.Get<PuddleSystem>();
+            var spillSystem = entityManager.System<PuddleSystem>();
             if (reactVolume < 5 || !spillSystem.TryGetPuddle(tile, out _))
                 return FixedPoint2.Zero;
 
index 8f8b0626a28a22afab69274e75281a227b3979bc..fadc7147c9c66c577805e1567180f600ac95e2d9 100644 (file)
@@ -26,13 +26,14 @@ namespace Content.Server.Chemistry.TileReactions
         /// </summary>
         [DataField("superSlippery")] private bool _superSlippery;
 
-        public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
+        public FixedPoint2 TileReact(TileRef tile,
+            ReagentPrototype reagent,
+            FixedPoint2 reactVolume,
+            IEntityManager entityManager)
         {
             if (reactVolume < 5)
                 return FixedPoint2.Zero;
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
             if (entityManager.EntitySysManager.GetEntitySystem<PuddleSystem>()
                 .TrySpillAt(tile, new Solution(reagent.ID, reactVolume), out var puddleUid, false, false))
             {
index 2ffd9a8f9f5eb2532a9ec281ca53c896f534de82..a5212dfe85c046173f261aa83f2005c2ab355263 100644 (file)
@@ -29,7 +29,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
                 !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))
                 return;
 
-            var vendingMachineSystem = EntitySystem.Get<VendingMachineSystem>();
+            var vendingMachineSystem = system.EntityManager.System<VendingMachineSystem>();
             var inventory = vendingMachineSystem.GetAvailableInventory(owner, vendingcomp);
             if (inventory.Count <= 0)
                 return;
index 7ab1fe11b01f31605cabc5e9c1865a47b07cec1f..dffcac6d96e0be4f50f6b7e17e10e98b586266da 100644 (file)
@@ -11,7 +11,7 @@ public sealed partial class OpenBehavior : IThresholdBehavior
 {
     public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null)
     {
-        var openable = EntitySystem.Get<OpenableSystem>();
+        var openable = system.EntityManager.System<OpenableSystem>();
         openable.TryOpen(uid);
     }
 }
index 38564380c042e70842dc1a7bd00225798334ce7e..5826a3871dbc5f05b260e1022e849af36ea8db65 100644 (file)
@@ -22,8 +22,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         /// <param name="cause"></param>
         public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
-            var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
-            var spillableSystem = EntitySystem.Get<PuddleSystem>();
+            var solutionContainerSystem = system.EntityManager.System<SolutionContainerSystem>();
+            var spillableSystem = system.EntityManager.System<PuddleSystem>();
 
             var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
 
index 923210cc73c2c4d67e5fbcb5a1258ec2569508b6..a232ed8c0eb433291ed534c15277376996ae38a1 100644 (file)
@@ -712,7 +712,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
         {
             var (reagent, quantity) = solution.Contents[i];
             var proto = _prototypeManager.Index<ReagentPrototype>(reagent.Prototype);
-            var removed = proto.ReactionTile(tileRef, quantity);
+            var removed = proto.ReactionTile(tileRef, quantity, EntityManager);
             if (removed <= FixedPoint2.Zero)
                 continue;
 
index ae170842a0c45a8f349f94ef7de5e86923d99a3f..9638dabf28ea694fb50bbcdf1c041ce06f463549 100644 (file)
@@ -315,7 +315,7 @@ public sealed class SmokeSystem : EntitySystem
                 continue;
 
             var reagent = _prototype.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
-            reagent.ReactionTile(tile, reagentQuantity.Quantity);
+            reagent.ReactionTile(tile, reagentQuantity.Quantity, EntityManager);
         }
     }
 
index 6f57f561d852feabbab86302739a8da3988b9b9e..6e101d93a320f57edaebbd3ad1670dcdb8af713f 100644 (file)
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     sealed class DelayStartCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "delaystart";
         public string Description => "Delays the round start.";
         public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided.";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
             if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
             {
                 shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
index 972fa9561a3691c93d3baf67a501ad4171ed2f96..c6a8ddbf5370f6b912f318bc95e9033f893b24b7 100644 (file)
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     sealed class EndRoundCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "endround";
         public string Description => "Ends the round and moves the server to PostRound.";
         public string Help => String.Empty;
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
 
             if (ticker.RunLevel != GameRunLevel.InRound)
             {
index 1041fed6ec1c998c596f9e3cd3dd751f973c2ac5..5ef72f59b370aec372bc3e3130c053d3ae22b54c 100644 (file)
@@ -10,13 +10,15 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     sealed class ForcePresetCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "forcepreset";
         public string Description => "Forces a specific game preset to start for the current lobby.";
         public string Help => $"Usage: {Command} <preset>";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
             if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
             {
                 shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");
index 4932dbe0bffeacb9735e0dffbb7c6210c9e26afc..b5984d260d3c4a035d50b0f1a876336eceb4da94 100644 (file)
@@ -10,6 +10,8 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     public sealed class GoLobbyCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "golobby";
         public string Description => "Enables the lobby and restarts the round.";
         public string Help => $"Usage: {Command} / {Command} <preset>";
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
             GamePresetPrototype? preset = null;
             var presetName = string.Join(" ", args);
 
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
 
             if (args.Length > 0)
             {
index 747e54e28becacbe38b75baa123161c90f58b52a..16c2c3261dea3ee11b66398ab6a6d74cd8e2bc31 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.GameTicking.Commands
     [AnyCommand]
     sealed class ObserveCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "observe";
         public string Description => "";
         public string Help => "";
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
                 return;
             }
 
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
 
             if (ticker.RunLevel == GameRunLevel.PreRoundLobby)
             {
index 36c0ba981c754ce94b9c033d158c9a4ec73be8f8..e4ea3fa53c36ccc963431a386a3fa2c62367e11b 100644 (file)
@@ -8,13 +8,15 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     public sealed class RestartRoundCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "restartround";
         public string Description => "Ends the current round and starts the countdown for the next lobby.";
         public string Help => string.Empty;
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
 
             if (ticker.RunLevel != GameRunLevel.InRound)
             {
@@ -22,20 +24,22 @@ namespace Content.Server.GameTicking.Commands
                 return;
             }
 
-            EntitySystem.Get<RoundEndSystem>().EndRound();
+            _e.System<RoundEndSystem>().EndRound();
         }
     }
 
     [AdminCommand(AdminFlags.Round)]
     public sealed class RestartRoundNowCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "restartroundnow";
         public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
         public string Help => String.Empty;
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            EntitySystem.Get<GameTicker>().RestartRound();
+            _e.System<GameTicker>().RestartRound();
         }
     }
 }
index 1652a14120383ba755e8ef487f6c825f90b30b71..432cdd23e35f5e137d0e311903476a84822d5d37 100644 (file)
@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
     [AdminCommand(AdminFlags.Round)]
     sealed class StartRoundCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "startround";
         public string Description => "Ends PreRoundLobby state and starts the round.";
         public string Help => String.Empty;
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
 
             if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
             {
index df418c27ee1af1d640168f9593c6b08d28dd5e69..34b504acbc9d143e8813e22c642a0dc83094ae8f 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Server.GameTicking.Commands
     [AnyCommand]
     sealed class ToggleReadyCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "toggleready";
         public string Description => "";
         public string Help => "";
@@ -23,7 +25,7 @@ namespace Content.Server.GameTicking.Commands
                 return;
             }
 
-            var ticker = EntitySystem.Get<GameTicker>();
+            var ticker = _e.System<GameTicker>();
             ticker.ToggleReady(player, bool.Parse(args[0]));
         }
     }
index ccd460a9cfc60d81f5fbf860348af000b5f5c77f..86026b230baf54436992083aba531976d8dd51a3 100644 (file)
@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.Components
             set
             {
                 _roleName = value;
-                EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
+                IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
             }
         }
 
@@ -52,7 +52,7 @@ namespace Content.Server.Ghost.Roles.Components
             set
             {
                 _roleDescription = value;
-                EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
+                IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
             }
         }
 
@@ -64,7 +64,7 @@ namespace Content.Server.Ghost.Roles.Components
             set
             {
                 _roleRules = value;
-                EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
+                IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
             }
         }
 
index c198b54b1b953688f1fa3c8de57a9fed8481647d..b6627f11540fecbe3181de13bb4f4776d906c6d1 100644 (file)
@@ -791,13 +791,15 @@ namespace Content.Server.Ghost.Roles
     [AnyCommand]
     public sealed class GhostRoles : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "ghostroles";
         public string Description => "Opens the ghost role request window.";
         public string Help => $"{Command}";
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (shell.Player != null)
-                EntitySystem.Get<GhostRoleSystem>().OpenEui(shell.Player);
+                _e.System<GhostRoleSystem>().OpenEui(shell.Player);
             else
                 shell.WriteLine("You can only open the ghost roles UI on a client.");
         }
index c1e39919a2f7d340b083efea68acbd39ddd9780f..825691fe9502d28025c64cd832a03e46e293c13d 100644 (file)
@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.UI
         {
             base.Closed();
 
-            EntitySystem.Get<GhostRoleSystem>().CloseEui(Player);
+            _ghostRoleSystem.CloseEui(Player);
         }
     }
 }
index 81ecfb356e8db9b969500be64fab626d19019185..da971c78f321f50962bc3ab103db211824349b5d 100644 (file)
@@ -10,7 +10,7 @@ public sealed partial class HolidayMapCondition : GameMapCondition
 
     public override bool Check(GameMapPrototype map)
     {
-        var holidaySystem = EntitySystem.Get<HolidaySystem>();
+        var holidaySystem = IoCManager.Resolve<IEntityManager>().System<HolidaySystem>();
 
         return Holidays.Any(holiday => holidaySystem.IsCurrentlyHoliday(holiday)) ^ Inverted;
     }
index 14afa2f1083eca7b2edd2745f8ad519ebfae2311..861f3eea98d215a2c1507d30ae2839a5a76a5d9d 100644 (file)
@@ -37,7 +37,7 @@ namespace Content.Server.NodeContainer.Nodes
             _alwaysReachable.Add(pipeNode);
 
             if (NodeGroup != null)
-                EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
+                IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
         }
 
         public void RemoveAlwaysReachable(PipeNode pipeNode)
@@ -47,7 +47,7 @@ namespace Content.Server.NodeContainer.Nodes
             _alwaysReachable.Remove(pipeNode);
 
             if (NodeGroup != null)
-                EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
+                IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
         }
 
         /// <summary>
@@ -62,7 +62,7 @@ namespace Content.Server.NodeContainer.Nodes
                 _connectionsEnabled = value;
 
                 if (NodeGroup != null)
-                    EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
+                    IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
             }
         }
 
index 440e40437b289d560179e454b6b8d72d2d416b39..127050393aa170dd0e079dd91f4af8fc9f2f544b 100644 (file)
@@ -8,13 +8,15 @@ namespace Content.Server.Power.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class PowerStatCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _e = default!;
+
         public string Command => "powerstat";
         public string Description => "Shows statistics for pow3r";
         public string Help => "Usage: powerstat";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var stats = EntitySystem.Get<PowerNetSystem>().GetStatistics();
+            var stats = _e.System<PowerNetSystem>().GetStatistics();
 
             shell.WriteLine($"networks: {stats.CountNetworks}");
             shell.WriteLine($"loads: {stats.CountLoads}");
index 785eac91dba8c8fae547b038566c2567c7992754..ac34966036cc979d0b134b7805670782f5be3892 100644 (file)
@@ -159,7 +159,7 @@ public sealed partial class PowerWireAction : BaseWireAction
     {
         base.Initialize();
 
-        _electrocutionSystem = EntitySystem.Get<ElectrocutionSystem>();
+        _electrocutionSystem = EntityManager.System<ElectrocutionSystem>();
     }
 
     // This should add a wire into the entity's state, whether it be
index 6ce8edd1d840a9faf5c98d82d45dbdf149c053bc..d5dca64eaaca9c2eba92a17a6d09023fb54cc27c 100644 (file)
@@ -19,7 +19,7 @@ namespace Content.Server.Sandbox.Commands
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            var sandboxManager = EntitySystem.Get<SandboxSystem>();
+            var sandboxManager = _entManager.System<SandboxSystem>();
             var adminManager = IoCManager.Resolve<IAdminManager>();
             if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
             {
index 1f6a6bf30735d4b3f183ddb62d5752c03d7313ba..af6cc34f48a2b452e1d7ea3b977035f9b333091d 100644 (file)
@@ -6,6 +6,9 @@ namespace Content.Shared.Chemistry.Reaction
 {
     public interface ITileReaction
     {
-        FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume);
+        FixedPoint2 TileReact(TileRef tile,
+            ReagentPrototype reagent,
+            FixedPoint2 reactVolume,
+            IEntityManager entityManager);
     }
 }
index df1b1aa20b49bf26521361dd1c1259c6e1da3a3a..6095676b9e0a061783072d92135ad2096255d8b4 100644 (file)
@@ -142,7 +142,7 @@ namespace Content.Shared.Chemistry.Reagent
         [DataField]
         public SoundSpecifier FootstepSound = new SoundCollectionSpecifier("FootstepWater", AudioParams.Default.WithVolume(6));
 
-        public FixedPoint2 ReactionTile(TileRef tile, FixedPoint2 reactVolume)
+        public FixedPoint2 ReactionTile(TileRef tile, FixedPoint2 reactVolume, IEntityManager entityManager)
         {
             var removed = FixedPoint2.Zero;
 
@@ -151,7 +151,7 @@ namespace Content.Shared.Chemistry.Reagent
 
             foreach (var reaction in TileReactions)
             {
-                removed += reaction.TileReact(tile, this, reactVolume - removed);
+                removed += reaction.TileReact(tile, this, reactVolume - removed, entityManager);
 
                 if (removed > reactVolume)
                     throw new Exception("Removed more than we have!");
index 405c0ec89eda448ea854965ac83493320a4b9a7e..47ae3ef74a68993ac91b6326438e7a92f68597c4 100644 (file)
@@ -49,10 +49,10 @@ namespace Content.Tests.Shared.Alert
             var alertsComponent = new AlertsComponent();
             alertsComponent = IoCManager.InjectDependencies(alertsComponent);
 
-            Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.LowPressure, out var lowpressure));
-            Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.HighPressure, out var highpressure));
+            Assert.That(entManager.System<AlertsSystem>().TryGet(AlertType.LowPressure, out var lowpressure));
+            Assert.That(entManager.System<AlertsSystem>().TryGet(AlertType.HighPressure, out var highpressure));
 
-            EntitySystem.Get<AlertsSystem>().ShowAlert(alertsComponent.Owner, AlertType.LowPressure, null, null);
+            entManager.System<AlertsSystem>().ShowAlert(alertsComponent.Owner, AlertType.LowPressure, null, null);
 
             var getty = new ComponentGetState();
             entManager.EventBus.RaiseComponentEvent(alertsComponent, getty);
@@ -62,7 +62,7 @@ namespace Content.Tests.Shared.Alert
             Assert.That(alertState.Alerts.Count, Is.EqualTo(1));
             Assert.That(alertState.Alerts.ContainsKey(lowpressure.AlertKey));
 
-            EntitySystem.Get<AlertsSystem>().ShowAlert(alertsComponent.Owner, AlertType.HighPressure, null, null);
+            entManager.System<AlertsSystem>().ShowAlert(alertsComponent.Owner, AlertType.HighPressure, null, null);
 
             // Lazy
             entManager.EventBus.RaiseComponentEvent(alertsComponent, getty);
@@ -70,7 +70,7 @@ namespace Content.Tests.Shared.Alert
             Assert.That(alertState.Alerts.Count, Is.EqualTo(1));
             Assert.That(alertState.Alerts.ContainsKey(highpressure.AlertKey));
 
-            EntitySystem.Get<AlertsSystem>().ClearAlertCategory(alertsComponent.Owner, AlertCategory.Pressure);
+            entManager.System<AlertsSystem>().ClearAlertCategory(alertsComponent.Owner, AlertCategory.Pressure);
 
             entManager.EventBus.RaiseComponentEvent(alertsComponent, getty);
             alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!;