Bunch more resolves removed.

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 17:17:12 +01:00
parent ba736f70df
commit 684cb76173
38 changed files with 267 additions and 208 deletions

View File

@@ -33,6 +33,8 @@ namespace Content.Server.Morgue.Components
public class MorgueEntityStorageComponent : EntityStorageComponent, IExamine
#pragma warning restore 618
{
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "MorgueEntityStorage";
[ViewVariables(VVAccess.ReadWrite)]
@@ -65,13 +67,13 @@ namespace Content.Server.Morgue.Components
public override Vector2 ContentsDumpPosition()
{
if (_tray != null)
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).WorldPosition;
return _entMan.GetComponent<TransformComponent>(_tray).WorldPosition;
return base.ContentsDumpPosition();
}
protected override bool AddToContents(EntityUid entity)
{
if (IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
if (_entMan.HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
return false;
return base.AddToContents(entity);
}
@@ -79,7 +81,7 @@ namespace Content.Server.Morgue.Components
public override bool CanOpen(EntityUid user, bool silent = false)
{
if (!Owner.InRangeUnobstructed(
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates.Offset(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
_entMan.GetComponent<TransformComponent>(Owner).Coordinates.Offset(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
))
{
@@ -100,7 +102,7 @@ namespace Content.Server.Morgue.Components
if (_tray == null)
{
_tray = IoCManager.Resolve<IEntityManager>().SpawnEntity(_trayPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
_tray = _entMan.SpawnEntity(_trayPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
trayComp.Morgue = Owner;
}
@@ -109,7 +111,7 @@ namespace Content.Server.Morgue.Components
TrayContainer?.Remove(_tray);
}
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
_entMan.GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
base.OpenStorage();
}
@@ -122,9 +124,9 @@ namespace Content.Server.Morgue.Components
foreach (var entity in Contents.ContainedEntities)
{
count++;
if (!hasMob && IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity))
if (!hasMob && _entMan.HasComponent<SharedBodyComponent>(entity))
hasMob = true;
if (!hasSoul && IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
if (!hasSoul && _entMan.TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
hasSoul = true;
}
Appearance?.SetData(MorgueVisuals.HasContents, count > 0);