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

@@ -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.