Resolve 'EntitySystem.Get<T>()' is obsolete in content (#27936)

* PROJECT 0 WARNINGS: Resolve `'EntitySystem.Get<T>()' is obsolete` in content

* pass entman

* dog ass test

* webeditor
This commit is contained in:
Kara
2024-05-12 17:34:52 -07:00
committed by GitHub
parent efc430f651
commit 993eef1e7c
65 changed files with 186 additions and 110 deletions

View File

@@ -5,11 +5,13 @@ namespace Content.Client.Decals;
public sealed class ToggleDecalCommand : IConsoleCommand public sealed class ToggleDecalCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "toggledecals"; public string Command => "toggledecals";
public string Description => "Toggles decaloverlay"; public string Description => "Toggles decaloverlay";
public string Help => $"{Command}"; public string Help => $"{Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
EntitySystem.Get<DecalSystem>().ToggleOverlay(); _e.System<DecalSystem>().ToggleOverlay();
} }
} }

View File

@@ -16,6 +16,7 @@ namespace Content.Client.Decals.UI;
public sealed partial class DecalPlacerWindow : DefaultWindow public sealed partial class DecalPlacerWindow : DefaultWindow
{ {
[Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IEntityManager _e = default!;
private readonly DecalPlacementSystem _decalPlacementSystem; private readonly DecalPlacementSystem _decalPlacementSystem;
@@ -39,7 +40,7 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(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 // This needs to be done in C# so we can have custom stuff passed in the constructor
// and thus have a proper step size // and thus have a proper step size

View File

@@ -139,11 +139,13 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
public sealed class ClearAllNetworkLinkOverlays : IConsoleCommand public sealed class ClearAllNetworkLinkOverlays : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "clearnetworklinkoverlays"; public string Command => "clearnetworklinkoverlays";
public string Description => "Clear all network link overlays."; public string Description => "Clear all network link overlays.";
public string Help => Command; public string Help => Command;
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
IoCManager.Resolve<IEntityManager>().System<NetworkConfiguratorSystem>().ClearAllOverlays(); _e.System<NetworkConfiguratorSystem>().ClearAllOverlays();
} }
} }

View File

@@ -8,6 +8,8 @@ namespace Content.Client.NodeContainer
{ {
public sealed class NodeVisCommand : IConsoleCommand public sealed class NodeVisCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "nodevis"; public string Command => "nodevis";
public string Description => "Toggles node group visualization"; public string Description => "Toggles node group visualization";
public string Help => ""; public string Help => "";
@@ -21,20 +23,22 @@ namespace Content.Client.NodeContainer
return; return;
} }
var sys = EntitySystem.Get<NodeGroupSystem>(); var sys = _e.System<NodeGroupSystem>();
sys.SetVisEnabled(!sys.VisEnabled); sys.SetVisEnabled(!sys.VisEnabled);
} }
} }
public sealed class NodeVisFilterCommand : IConsoleCommand public sealed class NodeVisFilterCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "nodevisfilter"; public string Command => "nodevisfilter";
public string Description => "Toggles showing a specific group on nodevis"; public string Description => "Toggles showing a specific group on nodevis";
public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off"; public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var sys = EntitySystem.Get<NodeGroupSystem>(); var sys = _e.System<NodeGroupSystem>();
if (args.Length == 0) if (args.Length == 0)
{ {

View File

@@ -3,6 +3,7 @@ using Content.Server.GameTicking.Commands;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Timing; using Robust.Shared.Timing;
namespace Content.IntegrationTests.Tests.Commands namespace Content.IntegrationTests.Tests.Commands
@@ -40,8 +41,7 @@ namespace Content.IntegrationTests.Tests.Commands
tickBeforeRestart = entityManager.CurrentTick; tickBeforeRestart = entityManager.CurrentTick;
var command = new RestartRoundNowCommand(); gameTicker.RestartRound();
command.Execute(null, string.Empty, Array.Empty<string>());
if (lobbyEnabled) if (lobbyEnabled)
{ {

View File

@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Admin)] [AdminCommand(AdminFlags.Admin)]
sealed class DSay : IConsoleCommand sealed class DSay : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "dsay"; public string Command => "dsay";
public string Description => Loc.GetString("dsay-command-description"); public string Description => Loc.GetString("dsay-command-description");
@@ -32,7 +34,7 @@ namespace Content.Server.Administration.Commands
if (string.IsNullOrEmpty(message)) if (string.IsNullOrEmpty(message))
return; return;
var chat = EntitySystem.Get<ChatSystem>(); var chat = _e.System<ChatSystem>();
chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player); chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
} }
} }

View File

@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
public sealed class ReadyAll : IConsoleCommand public sealed class ReadyAll : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "readyall"; public string Command => "readyall";
public string Description => "Readies up all players in the lobby, except for observers."; public string Description => "Readies up all players in the lobby, except for observers.";
public string Help => $"{Command} | ̣{Command} <ready>"; public string Help => $"{Command} | ̣{Command} <ready>";
@@ -20,7 +22,7 @@ namespace Content.Server.Administration.Commands
ready = bool.Parse(args[0]); ready = bool.Parse(args[0]);
} }
var gameTicker = EntitySystem.Get<GameTicker>(); var gameTicker = _e.System<GameTicker>();
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby) if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)

View File

@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
public sealed class CallShuttleCommand : IConsoleCommand public sealed class CallShuttleCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "callshuttle"; public string Command => "callshuttle";
public string Description => Loc.GetString("call-shuttle-command-description"); public string Description => Loc.GetString("call-shuttle-command-description");
public string Help => Loc.GetString("call-shuttle-command-help-text", ("command",Command)); 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 // ReSharper disable once ConvertIfStatementToSwitchStatement
if (args.Length == 1 && TimeSpan.TryParseExact(args[0], ContentLocalizationManager.TimeSpanMinutesFormats, loc.DefaultCulture, out var timeSpan)) 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) else if (args.Length == 1)
{ {
@@ -27,7 +29,7 @@ namespace Content.Server.Administration.Commands
} }
else 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)] [AdminCommand(AdminFlags.Round)]
public sealed class RecallShuttleCommand : IConsoleCommand public sealed class RecallShuttleCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "recallshuttle"; public string Command => "recallshuttle";
public string Description => Loc.GetString("recall-shuttle-command-description"); public string Description => Loc.GetString("recall-shuttle-command-description");
public string Help => Loc.GetString("recall-shuttle-command-help-text", ("command",Command)); public string Help => Loc.GetString("recall-shuttle-command-help-text", ("command",Command));
public void Execute(IConsoleShell shell, string argStr, string[] args) 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);
} }
} }
} }

View File

@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.VarEdit)] [AdminCommand(AdminFlags.VarEdit)]
public sealed class ThrowScoreboardCommand : IConsoleCommand public sealed class ThrowScoreboardCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "throwscoreboard"; public string Command => "throwscoreboard";
public string Description => Loc.GetString("throw-scoreboard-command-description"); public string Description => Loc.GetString("throw-scoreboard-command-description");
@@ -20,6 +22,6 @@ public sealed class ThrowScoreboardCommand : IConsoleCommand
shell.WriteLine(Help); shell.WriteLine(Help);
return; return;
} }
EntitySystem.Get<GameTicker>().ShowRoundEndScoreboard(); _e.System<GameTicker>().ShowRoundEndScoreboard();
} }
} }

View File

@@ -23,6 +23,7 @@ public sealed class AdminLogsEui : BaseEui
[Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IConfigurationManager _configuration = default!; [Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly IEntityManager _e = default!;
private readonly ISawmill _sawmill; 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() public override async void Opened()
{ {

View File

@@ -31,7 +31,7 @@ public sealed class SpawnExplosionEui : BaseEui
if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0) if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0)
return; return;
var explosion = EntitySystem.Get<ExplosionSystem>().GenerateExplosionPreview(request); var explosion = _explosionSystem.GenerateExplosionPreview(request);
if (explosion == null) if (explosion == null)
{ {

View File

@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public sealed class ClearAlert : IConsoleCommand public sealed class ClearAlert : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "clearalert"; public string Command => "clearalert";
public string Description => "Clears an alert for a player, defaulting to current player"; 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>"; 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 (!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"); shell.WriteLine("user has no alerts component");
return; return;
} }
var alertType = args[0]; var alertType = args[0];
var alertsSystem = EntitySystem.Get<AlertsSystem>(); var alertsSystem = _e.System<AlertsSystem>();
if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert)) if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
{ {
shell.WriteLine("unrecognized alertType " + alertType); shell.WriteLine("unrecognized alertType " + alertType);

View File

@@ -9,6 +9,8 @@ namespace Content.Server.Alert.Commands
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public sealed class ShowAlert : IConsoleCommand public sealed class ShowAlert : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "showalert"; public string Command => "showalert";
public string Description => "Shows an alert for a player, defaulting to current player"; 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>"; 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 (!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"); shell.WriteLine("user has no alerts component");
return; return;
@@ -38,7 +40,7 @@ namespace Content.Server.Alert.Commands
var alertType = args[0]; var alertType = args[0];
var severity = args[1]; var severity = args[1];
var alertsSystem = EntitySystem.Get<AlertsSystem>(); var alertsSystem = _e.System<AlertsSystem>();
if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert)) if (!alertsSystem.TryGet(Enum.Parse<AlertType>(alertType), out var alert))
{ {
shell.WriteLine("unrecognized alertType " + alertType); shell.WriteLine("unrecognized alertType " + alertType);

View File

@@ -8,13 +8,15 @@ namespace Content.Server.Atmos.Commands
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public sealed class ListGasesCommand : IConsoleCommand public sealed class ListGasesCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "listgases"; public string Command => "listgases";
public string Description => "Prints a list of gases and their indices."; public string Description => "Prints a list of gases and their indices.";
public string Help => "listgases"; public string Help => "listgases";
public void Execute(IConsoleShell shell, string argStr, string[] args) 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) foreach (var gasPrototype in atmosSystem.Gases)
{ {

View File

@@ -8,6 +8,8 @@ namespace Content.Server.Atmos.Commands
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public sealed class ShowAtmos : IConsoleCommand public sealed class ShowAtmos : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "showatmos"; public string Command => "showatmos";
public string Description => "Toggles seeing atmos debug overlay."; public string Description => "Toggles seeing atmos debug overlay.";
public string Help => $"Usage: {Command}"; public string Help => $"Usage: {Command}";
@@ -21,7 +23,7 @@ namespace Content.Server.Atmos.Commands
return; return;
} }
var atmosDebug = EntitySystem.Get<AtmosDebugOverlaySystem>(); var atmosDebug = _e.System<AtmosDebugOverlaySystem>();
var enabled = atmosDebug.ToggleObserver(player); var enabled = atmosDebug.ToggleObserver(player);
shell.WriteLine(enabled shell.WriteLine(enabled

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components
set set
{ {
Type = value; Type = value;
EntitySystem.Get<AtmosPlaqueSystem>().UpdateSign(Owner, this); IoCManager.Resolve<IEntityManager>().System<AtmosPlaqueSystem>().UpdateSign(Owner, this);
} }
} }
} }

View File

@@ -90,8 +90,8 @@ public abstract class AirAlarmModeExecutor : IAirAlarmMode
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
DeviceNetworkSystem = EntitySystem.Get<DeviceNetworkSystem>(); DeviceNetworkSystem = EntityManager.System<DeviceNetworkSystem>();
AirAlarmSystem = EntitySystem.Get<AirAlarmSystem>(); AirAlarmSystem = EntityManager.System<AirAlarmSystem>();
} }
} }

View File

@@ -13,7 +13,7 @@ namespace Content.Server.Atmos.Piping.Components
public Color ColorVV public Color ColorVV
{ {
get => Color; get => Color;
set => EntitySystem.Get<AtmosPipeColorSystem>().SetColor(Owner, this, value); set => IoCManager.Resolve<IEntityManager>().System<AtmosPipeColorSystem>().SetColor(Owner, this, value);
} }
} }
} }

View File

@@ -8,6 +8,8 @@ namespace Content.Server.Chat.Commands
[AnyCommand] [AnyCommand]
internal sealed class LOOCCommand : IConsoleCommand internal sealed class LOOCCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "looc"; public string Command => "looc";
public string Description => "Send Local Out Of Character chat messages."; public string Description => "Send Local Out Of Character chat messages.";
public string Help => "looc <text>"; public string Help => "looc <text>";
@@ -33,7 +35,7 @@ namespace Content.Server.Chat.Commands
if (string.IsNullOrEmpty(message)) if (string.IsNullOrEmpty(message))
return; return;
EntitySystem.Get<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player); _e.System<ChatSystem>().TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Looc, false, shell, player);
} }
} }
} }

View File

@@ -10,6 +10,8 @@ namespace Content.Server.Chat.Commands
[AnyCommand] [AnyCommand]
internal sealed class SuicideCommand : IConsoleCommand internal sealed class SuicideCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "suicide"; public string Command => "suicide";
public string Description => Loc.GetString("suicide-command-description"); 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) if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
return; return;
var entityManager = IoCManager.Resolve<IEntityManager>(); var minds = _e.System<SharedMindSystem>();
var minds = entityManager.System<SharedMindSystem>();
// This check also proves mind not-null for at the end when the mob is ghosted. // 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) || if (!minds.TryGetMind(player, out var mindId, out var mind) ||
mind.OwnedEntity is not { Valid: true } victim) mind.OwnedEntity is not { Valid: true } victim)
@@ -37,17 +39,19 @@ namespace Content.Server.Chat.Commands
return; 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"); var deniedMessage = Loc.GetString("suicide-command-denied");
shell.WriteLine(deniedMessage); shell.WriteLine(deniedMessage);
entityManager.System<PopupSystem>() _e.System<PopupSystem>()
.PopupEntity(deniedMessage, victim, victim); .PopupEntity(deniedMessage, victim, victim);
return; return;
} }
var gameTicker = entityManager.System<GameTicker>();
var suicideSystem = entityManager.System<SuicideSystem>();
if (suicideSystem.Suicide(victim)) if (suicideSystem.Suicide(victim))
{ {
// Prevent the player from returning to the body. // Prevent the player from returning to the body.

View File

@@ -122,7 +122,7 @@ namespace Content.Server.Chemistry.EntitySystems
var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype); var reagent = _protoManager.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
var reaction = 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) if (reaction > reagentQuantity.Quantity)
{ {

View File

@@ -61,7 +61,8 @@ namespace Content.Server.Chemistry.ReactionEffects
{ {
var intensity = MathF.Min((float) args.Quantity * IntensityPerUnit, MaxTotalIntensity); var intensity = MathF.Min((float) args.Quantity * IntensityPerUnit, MaxTotalIntensity);
EntitySystem.Get<ExplosionSystem>().QueueExplosion( args.EntityManager.System<ExplosionSystem>()
.QueueExplosion(
args.SolutionEntity, args.SolutionEntity,
ExplosionType, ExplosionType,
intensity, intensity,

View File

@@ -18,7 +18,7 @@ public sealed partial class HasTag : ReagentEffectCondition
public override bool Condition(ReagentEffectArgs args) public override bool Condition(ReagentEffectArgs args)
{ {
if (args.EntityManager.TryGetComponent<TagComponent>(args.SolutionEntity, out var tag)) 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; return false;
} }

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.ReactionEffects
cleanseRate *= args.Scale; cleanseRate *= args.Scale;
var bloodstreamSys = EntitySystem.Get<BloodstreamSystem>(); var bloodstreamSys = args.EntityManager.System<BloodstreamSystem>();
bloodstreamSys.FlushChemicals(args.SolutionEntity, args.Reagent.ID, cleanseRate); bloodstreamSys.FlushChemicals(args.SolutionEntity, args.Reagent.ID, cleanseRate);
} }
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
{ {
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return; 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.Extinguish(args.SolutionEntity, flammable);
flammableSystem.AdjustFireStacks(args.SolutionEntity, -1.5f * (float) args.Quantity, flammable); flammableSystem.AdjustFireStacks(args.SolutionEntity, -1.5f * (float) args.Quantity, flammable);
} }

View File

@@ -19,7 +19,7 @@ public sealed partial class Ignite : ReagentEffect
public override void Effect(ReagentEffectArgs args) 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); flamSys.Ignite(args.SolutionEntity, args.OrganEntity ?? args.SolutionEntity);
} }
} }

View File

@@ -21,7 +21,7 @@ public sealed partial class ModifyBleedAmount : ReagentEffect
{ {
if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood)) 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; var amt = Scaled ? Amount * args.Quantity.Float() : Amount;
amt *= args.Scale; amt *= args.Scale;

View File

@@ -22,7 +22,7 @@ public sealed partial class ModifyBloodLevel : ReagentEffect
{ {
if (args.EntityManager.TryGetComponent<BloodstreamComponent>(args.SolutionEntity, out var blood)) 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; var amt = Scaled ? Amount * args.Quantity : Amount;
amt *= args.Scale; amt *= args.Scale;

View File

@@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.ReagentEffects
IncreaseTimer(status, statusLifetime); IncreaseTimer(status, statusLifetime);
if (modified) if (modified)
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity); args.EntityManager.System<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(args.SolutionEntity);
} }
public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time) public void IncreaseTimer(MovespeedModifierMetabolismComponent status, float time)

View File

@@ -18,7 +18,7 @@ public sealed partial class Oxygenate : ReagentEffect
{ {
if (args.EntityManager.TryGetComponent<RespiratorComponent>(args.SolutionEntity, out var resp)) 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); respSys.UpdateSaturation(args.SolutionEntity, args.Quantity.Float() * Factor, resp);
} }
} }

View File

@@ -23,7 +23,7 @@ public sealed partial class Paralyze : ReagentEffect
var paralyzeTime = ParalyzeTime; var paralyzeTime = ParalyzeTime;
paralyzeTime *= args.Scale; paralyzeTime *= args.Scale;
EntitySystem.Get<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh); args.EntityManager.System<StunSystem>().TryParalyze(args.SolutionEntity, TimeSpan.FromSeconds(paralyzeTime), Refresh);
} }
} }

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Chemistry.ReagentEffects
{ {
var uid = args.SolutionEntity; var uid = args.SolutionEntity;
if (args.EntityManager.TryGetComponent(uid, out ThirstComponent? thirst)) 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) protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffects
{ {
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out CreamPiedComponent? creamPied)) return; 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);
} }
} }
} }

View File

@@ -21,19 +21,20 @@ public sealed partial class CleanDecalsReaction : ITileReaction
[DataField] [DataField]
public FixedPoint2 CleanCost { get; private set; } = FixedPoint2.New(0.25f); 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 || if (reactVolume <= CleanCost ||
!entMan.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) || !entityManager.TryGetComponent<MapGridComponent>(tile.GridUid, out var grid) ||
!entMan.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid)) !entityManager.TryGetComponent<DecalGridComponent>(tile.GridUid, out var decalGrid))
{ {
return FixedPoint2.Zero; return FixedPoint2.Zero;
} }
var lookupSystem = entMan.System<EntityLookupSystem>(); var lookupSystem = entityManager.System<EntityLookupSystem>();
var decalSystem = entMan.System<DecalSystem>(); var decalSystem = entityManager.System<DecalSystem>();
// Very generous hitbox. // Very generous hitbox.
var decals = decalSystem var decals = decalSystem
.GetDecalsIntersecting(tile.GridUid, lookupSystem.GetLocalBounds(tile, grid.TileSize).Enlarged(0.5f).Translated(new Vector2(-0.5f, -0.5f))); .GetDecalsIntersecting(tile.GridUid, lookupSystem.GetLocalBounds(tile, grid.TileSize).Enlarged(0.5f).Translated(new Vector2(-0.5f, -0.5f)));

View File

@@ -31,12 +31,14 @@ public sealed partial class CleanTileReaction : ITileReaction
[DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))] [DataField("reagent", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>))]
public string ReplacementReagent = "Water"; 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 = entityManager.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray();
var entities = entMan.System<EntityLookupSystem>().GetLocalEntitiesIntersecting(tile, 0f).ToArray(); var puddleQuery = entityManager.GetEntityQuery<PuddleComponent>();
var puddleQuery = entMan.GetEntityQuery<PuddleComponent>(); var solutionContainerSystem = entityManager.System<SolutionContainerSystem>();
var solutionContainerSystem = entMan.System<SolutionContainerSystem>();
// Multiply as the amount we can actually purge is higher than the react amount. // Multiply as the amount we can actually purge is higher than the react amount.
var purgeAmount = reactVolume / CleanAmountMultiplier; var purgeAmount = reactVolume / CleanAmountMultiplier;

View File

@@ -35,13 +35,13 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
[DataField] [DataField]
public float RandomOffsetMax = 0.0f; 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) if (reactVolume >= Usage)
{ {
// TODO probably pass this in args like reagenteffects do.
var entMan = IoCManager.Resolve<IEntityManager>();
if (Whitelist != null) if (Whitelist != null)
{ {
int acc = 0; int acc = 0;
@@ -59,9 +59,9 @@ public sealed partial class CreateEntityTileReaction : ITileReaction
var xoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax); var xoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
var yoffs = 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)); var pos = center.Offset(new Vector2(xoffs, yoffs));
entMan.SpawnEntity(Entity, pos); entityManager.SpawnEntity(Entity, pos);
return Usage; return Usage;
} }

View File

@@ -14,12 +14,15 @@ namespace Content.Server.Chemistry.TileReactions
{ {
[DataField("coolingTemperature")] private float _coolingTemperature = 2f; [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) if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
return FixedPoint2.Zero; return FixedPoint2.Zero;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>(); var atmosphereSystem = entityManager.System<AtmosphereSystem>();
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true); var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);

View File

@@ -13,12 +13,15 @@ namespace Content.Server.Chemistry.TileReactions
{ {
[DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f; [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) if (reactVolume <= FixedPoint2.Zero || tile.Tile.IsEmpty)
return FixedPoint2.Zero; return FixedPoint2.Zero;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>(); var atmosphereSystem = entityManager.System<AtmosphereSystem>();
var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true); var environment = atmosphereSystem.GetTileMixture(tile.GridUid, null, tile.GridIndices, true);
if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices)) if (environment == null || !atmosphereSystem.IsHotspotActive(tile.GridUid, tile.GridIndices))

View File

@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions;
[DataDefinition] [DataDefinition]
public sealed partial class PryTileReaction : ITileReaction 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); sys.PryTile(tile);
return reactVolume; return reactVolume;
} }

View File

@@ -12,9 +12,12 @@ namespace Content.Server.Chemistry.TileReactions
[DataDefinition] [DataDefinition]
public sealed partial class SpillIfPuddlePresentTileReaction : ITileReaction 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 _)) if (reactVolume < 5 || !spillSystem.TryGetPuddle(tile, out _))
return FixedPoint2.Zero; return FixedPoint2.Zero;

View File

@@ -26,13 +26,14 @@ namespace Content.Server.Chemistry.TileReactions
/// </summary> /// </summary>
[DataField("superSlippery")] private bool _superSlippery; [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) if (reactVolume < 5)
return FixedPoint2.Zero; return FixedPoint2.Zero;
var entityManager = IoCManager.Resolve<IEntityManager>();
if (entityManager.EntitySysManager.GetEntitySystem<PuddleSystem>() if (entityManager.EntitySysManager.GetEntitySystem<PuddleSystem>()
.TrySpillAt(tile, new Solution(reagent.ID, reactVolume), out var puddleUid, false, false)) .TrySpillAt(tile, new Solution(reagent.ID, reactVolume), out var puddleUid, false, false))
{ {

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
!system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform)) !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))
return; return;
var vendingMachineSystem = EntitySystem.Get<VendingMachineSystem>(); var vendingMachineSystem = system.EntityManager.System<VendingMachineSystem>();
var inventory = vendingMachineSystem.GetAvailableInventory(owner, vendingcomp); var inventory = vendingMachineSystem.GetAvailableInventory(owner, vendingcomp);
if (inventory.Count <= 0) if (inventory.Count <= 0)
return; return;

View File

@@ -11,7 +11,7 @@ public sealed partial class OpenBehavior : IThresholdBehavior
{ {
public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null) public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null)
{ {
var openable = EntitySystem.Get<OpenableSystem>(); var openable = system.EntityManager.System<OpenableSystem>();
openable.TryOpen(uid); openable.TryOpen(uid);
} }
} }

View File

@@ -22,8 +22,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// <param name="cause"></param> /// <param name="cause"></param>
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{ {
var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>(); var solutionContainerSystem = system.EntityManager.System<SolutionContainerSystem>();
var spillableSystem = EntitySystem.Get<PuddleSystem>(); var spillableSystem = system.EntityManager.System<PuddleSystem>();
var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates; var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;

View File

@@ -712,7 +712,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
{ {
var (reagent, quantity) = solution.Contents[i]; var (reagent, quantity) = solution.Contents[i];
var proto = _prototypeManager.Index<ReagentPrototype>(reagent.Prototype); var proto = _prototypeManager.Index<ReagentPrototype>(reagent.Prototype);
var removed = proto.ReactionTile(tileRef, quantity); var removed = proto.ReactionTile(tileRef, quantity, EntityManager);
if (removed <= FixedPoint2.Zero) if (removed <= FixedPoint2.Zero)
continue; continue;

View File

@@ -315,7 +315,7 @@ public sealed class SmokeSystem : EntitySystem
continue; continue;
var reagent = _prototype.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype); var reagent = _prototype.Index<ReagentPrototype>(reagentQuantity.Reagent.Prototype);
reagent.ReactionTile(tile, reagentQuantity.Quantity); reagent.ReactionTile(tile, reagentQuantity.Quantity, EntityManager);
} }
} }

View File

@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
sealed class DelayStartCommand : IConsoleCommand sealed class DelayStartCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "delaystart"; public string Command => "delaystart";
public string Description => "Delays the round start."; public string Description => "Delays the round start.";
public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided."; public string Help => $"Usage: {Command} <seconds>\nPauses/Resumes the countdown if no argument is provided.";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby) if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{ {
shell.WriteLine("This can only be executed while the game is in the pre-round lobby."); shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");

View File

@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
sealed class EndRoundCommand : IConsoleCommand sealed class EndRoundCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "endround"; public string Command => "endround";
public string Description => "Ends the round and moves the server to PostRound."; public string Description => "Ends the round and moves the server to PostRound.";
public string Help => String.Empty; public string Help => String.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.InRound) if (ticker.RunLevel != GameRunLevel.InRound)
{ {

View File

@@ -10,13 +10,15 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
sealed class ForcePresetCommand : IConsoleCommand sealed class ForcePresetCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "forcepreset"; public string Command => "forcepreset";
public string Description => "Forces a specific game preset to start for the current lobby."; public string Description => "Forces a specific game preset to start for the current lobby.";
public string Help => $"Usage: {Command} <preset>"; public string Help => $"Usage: {Command} <preset>";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby) if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{ {
shell.WriteLine("This can only be executed while the game is in the pre-round lobby."); shell.WriteLine("This can only be executed while the game is in the pre-round lobby.");

View File

@@ -10,6 +10,8 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
public sealed class GoLobbyCommand : IConsoleCommand public sealed class GoLobbyCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "golobby"; public string Command => "golobby";
public string Description => "Enables the lobby and restarts the round."; public string Description => "Enables the lobby and restarts the round.";
public string Help => $"Usage: {Command} / {Command} <preset>"; public string Help => $"Usage: {Command} / {Command} <preset>";
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
GamePresetPrototype? preset = null; GamePresetPrototype? preset = null;
var presetName = string.Join(" ", args); var presetName = string.Join(" ", args);
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (args.Length > 0) if (args.Length > 0)
{ {

View File

@@ -7,6 +7,8 @@ namespace Content.Server.GameTicking.Commands
[AnyCommand] [AnyCommand]
sealed class ObserveCommand : IConsoleCommand sealed class ObserveCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "observe"; public string Command => "observe";
public string Description => ""; public string Description => "";
public string Help => ""; public string Help => "";
@@ -18,7 +20,7 @@ namespace Content.Server.GameTicking.Commands
return; return;
} }
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel == GameRunLevel.PreRoundLobby) if (ticker.RunLevel == GameRunLevel.PreRoundLobby)
{ {

View File

@@ -8,13 +8,15 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundCommand : IConsoleCommand public sealed class RestartRoundCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "restartround"; public string Command => "restartround";
public string Description => "Ends the current round and starts the countdown for the next lobby."; public string Description => "Ends the current round and starts the countdown for the next lobby.";
public string Help => string.Empty; public string Help => string.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.InRound) if (ticker.RunLevel != GameRunLevel.InRound)
{ {
@@ -22,20 +24,22 @@ namespace Content.Server.GameTicking.Commands
return; return;
} }
EntitySystem.Get<RoundEndSystem>().EndRound(); _e.System<RoundEndSystem>().EndRound();
} }
} }
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundNowCommand : IConsoleCommand public sealed class RestartRoundNowCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "restartroundnow"; public string Command => "restartroundnow";
public string Description => "Moves the server from PostRound to a new PreRoundLobby."; public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
public string Help => String.Empty; public string Help => String.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
EntitySystem.Get<GameTicker>().RestartRound(); _e.System<GameTicker>().RestartRound();
} }
} }
} }

View File

@@ -7,13 +7,15 @@ namespace Content.Server.GameTicking.Commands
[AdminCommand(AdminFlags.Round)] [AdminCommand(AdminFlags.Round)]
sealed class StartRoundCommand : IConsoleCommand sealed class StartRoundCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "startround"; public string Command => "startround";
public string Description => "Ends PreRoundLobby state and starts the round."; public string Description => "Ends PreRoundLobby state and starts the round.";
public string Help => String.Empty; public string Help => String.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.PreRoundLobby) if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
{ {

View File

@@ -6,6 +6,8 @@ namespace Content.Server.GameTicking.Commands
[AnyCommand] [AnyCommand]
sealed class ToggleReadyCommand : IConsoleCommand sealed class ToggleReadyCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "toggleready"; public string Command => "toggleready";
public string Description => ""; public string Description => "";
public string Help => ""; public string Help => "";
@@ -23,7 +25,7 @@ namespace Content.Server.GameTicking.Commands
return; return;
} }
var ticker = EntitySystem.Get<GameTicker>(); var ticker = _e.System<GameTicker>();
ticker.ToggleReady(player, bool.Parse(args[0])); ticker.ToggleReady(player, bool.Parse(args[0]));
} }
} }

View File

@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.Components
set set
{ {
_roleName = value; _roleName = value;
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui(); IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
} }
} }
@@ -52,7 +52,7 @@ namespace Content.Server.Ghost.Roles.Components
set set
{ {
_roleDescription = value; _roleDescription = value;
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui(); IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
} }
} }
@@ -64,7 +64,7 @@ namespace Content.Server.Ghost.Roles.Components
set set
{ {
_roleRules = value; _roleRules = value;
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui(); IoCManager.Resolve<IEntityManager>().System<GhostRoleSystem>().UpdateAllEui();
} }
} }

View File

@@ -791,13 +791,15 @@ namespace Content.Server.Ghost.Roles
[AnyCommand] [AnyCommand]
public sealed class GhostRoles : IConsoleCommand public sealed class GhostRoles : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "ghostroles"; public string Command => "ghostroles";
public string Description => "Opens the ghost role request window."; public string Description => "Opens the ghost role request window.";
public string Help => $"{Command}"; public string Help => $"{Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
if (shell.Player != null) if (shell.Player != null)
EntitySystem.Get<GhostRoleSystem>().OpenEui(shell.Player); _e.System<GhostRoleSystem>().OpenEui(shell.Player);
else else
shell.WriteLine("You can only open the ghost roles UI on a client."); shell.WriteLine("You can only open the ghost roles UI on a client.");
} }

View File

@@ -40,7 +40,7 @@ namespace Content.Server.Ghost.Roles.UI
{ {
base.Closed(); base.Closed();
EntitySystem.Get<GhostRoleSystem>().CloseEui(Player); _ghostRoleSystem.CloseEui(Player);
} }
} }
} }

View File

@@ -10,7 +10,7 @@ public sealed partial class HolidayMapCondition : GameMapCondition
public override bool Check(GameMapPrototype map) 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; return Holidays.Any(holiday => holidaySystem.IsCurrentlyHoliday(holiday)) ^ Inverted;
} }

View File

@@ -37,7 +37,7 @@ namespace Content.Server.NodeContainer.Nodes
_alwaysReachable.Add(pipeNode); _alwaysReachable.Add(pipeNode);
if (NodeGroup != null) if (NodeGroup != null)
EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup); IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
} }
public void RemoveAlwaysReachable(PipeNode pipeNode) public void RemoveAlwaysReachable(PipeNode pipeNode)
@@ -47,7 +47,7 @@ namespace Content.Server.NodeContainer.Nodes
_alwaysReachable.Remove(pipeNode); _alwaysReachable.Remove(pipeNode);
if (NodeGroup != null) if (NodeGroup != null)
EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup); IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
} }
/// <summary> /// <summary>
@@ -62,7 +62,7 @@ namespace Content.Server.NodeContainer.Nodes
_connectionsEnabled = value; _connectionsEnabled = value;
if (NodeGroup != null) if (NodeGroup != null)
EntitySystem.Get<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup); IoCManager.Resolve<IEntityManager>().System<NodeGroupSystem>().QueueRemakeGroup((BaseNodeGroup) NodeGroup);
} }
} }

View File

@@ -8,13 +8,15 @@ namespace Content.Server.Power.Commands
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public sealed class PowerStatCommand : IConsoleCommand public sealed class PowerStatCommand : IConsoleCommand
{ {
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "powerstat"; public string Command => "powerstat";
public string Description => "Shows statistics for pow3r"; public string Description => "Shows statistics for pow3r";
public string Help => "Usage: powerstat"; public string Help => "Usage: powerstat";
public void Execute(IConsoleShell shell, string argStr, string[] args) 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($"networks: {stats.CountNetworks}");
shell.WriteLine($"loads: {stats.CountLoads}"); shell.WriteLine($"loads: {stats.CountLoads}");

View File

@@ -159,7 +159,7 @@ public sealed partial class PowerWireAction : BaseWireAction
{ {
base.Initialize(); base.Initialize();
_electrocutionSystem = EntitySystem.Get<ElectrocutionSystem>(); _electrocutionSystem = EntityManager.System<ElectrocutionSystem>();
} }
// This should add a wire into the entity's state, whether it be // This should add a wire into the entity's state, whether it be

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Sandbox.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var sandboxManager = EntitySystem.Get<SandboxSystem>(); var sandboxManager = _entManager.System<SandboxSystem>();
var adminManager = IoCManager.Resolve<IAdminManager>(); var adminManager = IoCManager.Resolve<IAdminManager>();
if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping))) if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
{ {

View File

@@ -6,6 +6,9 @@ namespace Content.Shared.Chemistry.Reaction
{ {
public interface ITileReaction public interface ITileReaction
{ {
FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume); FixedPoint2 TileReact(TileRef tile,
ReagentPrototype reagent,
FixedPoint2 reactVolume,
IEntityManager entityManager);
} }
} }

View File

@@ -142,7 +142,7 @@ namespace Content.Shared.Chemistry.Reagent
[DataField] [DataField]
public SoundSpecifier FootstepSound = new SoundCollectionSpecifier("FootstepWater", AudioParams.Default.WithVolume(6)); 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; var removed = FixedPoint2.Zero;
@@ -151,7 +151,7 @@ namespace Content.Shared.Chemistry.Reagent
foreach (var reaction in TileReactions) foreach (var reaction in TileReactions)
{ {
removed += reaction.TileReact(tile, this, reactVolume - removed); removed += reaction.TileReact(tile, this, reactVolume - removed, entityManager);
if (removed > reactVolume) if (removed > reactVolume)
throw new Exception("Removed more than we have!"); throw new Exception("Removed more than we have!");

View File

@@ -49,10 +49,10 @@ namespace Content.Tests.Shared.Alert
var alertsComponent = new AlertsComponent(); var alertsComponent = new AlertsComponent();
alertsComponent = IoCManager.InjectDependencies(alertsComponent); alertsComponent = IoCManager.InjectDependencies(alertsComponent);
Assert.That(EntitySystem.Get<AlertsSystem>().TryGet(AlertType.LowPressure, out var lowpressure)); Assert.That(entManager.System<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.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(); var getty = new ComponentGetState();
entManager.EventBus.RaiseComponentEvent(alertsComponent, getty); 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.Count, Is.EqualTo(1));
Assert.That(alertState.Alerts.ContainsKey(lowpressure.AlertKey)); 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 // Lazy
entManager.EventBus.RaiseComponentEvent(alertsComponent, getty); 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.Count, Is.EqualTo(1));
Assert.That(alertState.Alerts.ContainsKey(highpressure.AlertKey)); 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); entManager.EventBus.RaiseComponentEvent(alertsComponent, getty);
alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!; alertState = (AlertsComponent.AlertsComponent_AutoState) getty.State!;