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

@@ -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);
}
}

View 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)

View 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);
}
}
}

View 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();
}
}

View 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()
{

View 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)
{