Even more resolve removals.
This commit is contained in:
@@ -36,6 +36,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
[RegisterComponent]
|
||||
public class ParticleAcceleratorControlBoxComponent : ParticleAcceleratorPartComponent, IActivate, IWires
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public override string Name => "ParticleAcceleratorControlBox";
|
||||
@@ -221,12 +222,12 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<WiresComponent?>(Owner, out var wires) && wires.IsPanelOpen)
|
||||
if (_entMan.TryGetComponent<WiresComponent?>(Owner, out var wires) && wires.IsPanelOpen)
|
||||
{
|
||||
wires.OpenInterface(actor.PlayerSession);
|
||||
}
|
||||
@@ -333,7 +334,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdateWireStatus()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out WiresComponent? wires))
|
||||
if (!_entMan.TryGetComponent(Owner, out WiresComponent? wires))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -383,13 +384,13 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
_partEmitterRight = null;
|
||||
|
||||
// Find fuel chamber first by scanning cardinals.
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored)
|
||||
if (_entMan.GetComponent<TransformComponent>(Owner).Anchored)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
var grid = _mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||
if (_entMan.TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -405,7 +406,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
// Align ourselves to match fuel chamber orientation.
|
||||
// This means that if you mess up the orientation of the control box it's not a big deal,
|
||||
// because the sprite is far from obvious about the orientation.
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_partFuelChamber.Owner).LocalRotation;
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = _entMan.GetComponent<TransformComponent>(_partFuelChamber.Owner).LocalRotation;
|
||||
|
||||
var offsetEndCap = RotateOffset((1, 1));
|
||||
var offsetPowerBox = RotateOffset((1, -1));
|
||||
@@ -451,7 +452,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
Vector2i RotateOffset(in Vector2i vec)
|
||||
{
|
||||
var rot = new Angle(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation);
|
||||
var rot = new Angle(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation);
|
||||
return (Vector2i) rot.RotateVec(vec);
|
||||
}
|
||||
}
|
||||
@@ -459,11 +460,11 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
private bool ScanPart<T>(Vector2i offset, [NotNullWhen(true)] out T? part)
|
||||
where T : ParticleAcceleratorPartComponent
|
||||
{
|
||||
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
var grid = _mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
foreach (var ent in grid.GetOffset(coords, offset))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(ent, out part) && !part.Deleted)
|
||||
if (_entMan.TryGetComponent(ent, out part) && !part.Deleted)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -576,7 +577,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(ParticleAcceleratorVisuals.VisualState,
|
||||
_apcPowerReceiverComponent!.Powered
|
||||
@@ -682,7 +683,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdatePartVisualState(ParticleAcceleratorPartComponent? component)
|
||||
{
|
||||
if (component == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
||||
if (component == null || !_entMan.TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user