Bunch more resolves removed.
This commit is contained in:
@@ -15,14 +15,16 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalEntryComponent : DisposalTubeComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private const string HolderPrototypeId = "DisposalHolder";
|
||||
|
||||
public override string Name => "DisposalEntry";
|
||||
|
||||
public bool TryInsert(DisposalUnitComponent from)
|
||||
{
|
||||
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
var holderComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DisposalHolderComponent>(holder);
|
||||
var holder = _entMan.SpawnEntity(HolderPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
var holderComponent = _entMan.GetComponent<DisposalHolderComponent>(holder);
|
||||
|
||||
foreach (var entity in from.ContainedEntities.ToArray())
|
||||
{
|
||||
@@ -37,7 +39,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
protected override Direction[] ConnectableDirections()
|
||||
{
|
||||
return new[] {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
||||
return new[] {_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalJunctionComponent : DisposalTubeComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,14 +28,14 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
protected override Direction[] ConnectableDirections()
|
||||
{
|
||||
var direction = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation;
|
||||
var direction = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation;
|
||||
|
||||
return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray();
|
||||
}
|
||||
|
||||
public override Direction NextDirection(DisposalHolderComponent holder)
|
||||
{
|
||||
var next = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
var next = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
var directions = ConnectableDirections().Skip(1).ToArray();
|
||||
|
||||
if (holder.PreviousDirectionFrom == Direction.Invalid ||
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalRouterComponent : DisposalJunctionComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DisposalRouter";
|
||||
|
||||
[ViewVariables]
|
||||
@@ -36,7 +38,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||
@@ -52,7 +54,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
return directions[1];
|
||||
}
|
||||
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
return _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
@@ -160,12 +162,12 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||
void IActivate.Activate(ActivateEventArgs args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||
{
|
||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalTaggerComponent : DisposalTransitComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DisposalTagger";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -33,7 +35,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||
@@ -126,12 +128,12 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||
void IActivate.Activate(ActivateEventArgs args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||
{
|
||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
||||
return;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
{
|
||||
public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent, IBreakAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public static readonly TimeSpan ClangDelay = TimeSpan.FromSeconds(0.5);
|
||||
public TimeSpan LastClang;
|
||||
|
||||
@@ -35,7 +37,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
private bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
/// <summary>
|
||||
@@ -88,7 +90,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
foreach (var entity in Contents.ContainedEntities.ToArray())
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out DisposalHolderComponent? holder))
|
||||
if (!_entMan.TryGetComponent(entity, out DisposalHolderComponent? holder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -106,7 +108,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
private void UpdateVisualState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +124,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
public void AnchoredChanged()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics))
|
||||
if (!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user