Remove disposal tubes component references and ECS some of it (#15188)

This commit is contained in:
DrSmugleaf
2023-04-06 20:20:50 -07:00
committed by GitHub
parent 9ee1c61ca2
commit 97a8b64c1d
16 changed files with 261 additions and 233 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Server.Disposal.Tube;
using Content.Server.Disposal.Tube.Components;
using Content.Shared.Administration;
using Robust.Server.Player;
@@ -9,6 +10,8 @@ namespace Content.Server.Disposal
[AdminCommand(AdminFlags.Debug)]
public sealed class TubeConnectionsCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "tubeconnections";
public string Description => Loc.GetString("tube-connections-command-description");
public string Help => Loc.GetString("tube-connections-command-help-text", ("command", Command));
@@ -34,22 +37,21 @@ namespace Content.Server.Disposal
return;
}
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.EntityExists(id))
if (!_entities.EntityExists(id))
{
shell.WriteLine(Loc.GetString("shell-could-not-find-entity-with-uid",("uid", id)));
return;
}
if (!entityManager.TryGetComponent(id, out IDisposalTubeComponent? tube))
if (!_entities.TryGetComponent(id, out DisposalTubeComponent? tube))
{
shell.WriteLine(Loc.GetString("shell-entity-with-uid-lacks-component",
("uid", id),
("componentName", nameof(IDisposalTubeComponent))));
("componentName", nameof(DisposalTubeComponent))));
return;
}
tube.PopupDirections(player.AttachedEntity.Value);
_entities.System<DisposalTubeSystem>().PopupDirections(id, tube, player.AttachedEntity.Value);
}
}
}