Inline EntityManager
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Content.Server.Storage.Components
|
||||
// No contents, we do nothing
|
||||
if (Contents.ContainedEntities.Count == 0) return;
|
||||
|
||||
var lockers = Owner.EntityManager.EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
||||
var lockers = IoCManager.Resolve<IEntityManager>().EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
||||
|
||||
if (lockers.Contains(Owner))
|
||||
lockers.Remove(Owner);
|
||||
|
||||
@@ -218,14 +218,14 @@ namespace Content.Server.Storage.Components
|
||||
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
||||
|
||||
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
||||
if (Owner.EntityManager.HasComponent<GhostComponent>(entity.Uid))
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity.Uid))
|
||||
continue;
|
||||
|
||||
// checks
|
||||
|
||||
var targetIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(entity.Uid);
|
||||
var targetIsMob = Owner.EntityManager.HasComponent<SharedBodyComponent>(entity.Uid);
|
||||
var storageIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(OwnerUid);
|
||||
var targetIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity.Uid);
|
||||
var targetIsMob = IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid);
|
||||
var storageIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(OwnerUid);
|
||||
|
||||
var allowedToEat = false;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Content.Server.Storage.Components
|
||||
private const string LoggerName = "Storage";
|
||||
|
||||
public Container? Storage;
|
||||
|
||||
|
||||
private readonly Dictionary<IEntity, int> _sizeCache = new();
|
||||
|
||||
[DataField("occludesLight")]
|
||||
@@ -462,13 +462,13 @@ namespace Content.Server.Storage.Components
|
||||
var ownerTransform = Owner.Transform;
|
||||
var playerTransform = player.Transform;
|
||||
|
||||
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
|
||||
if (!playerTransform.Coordinates.InRange(IoCManager.Resolve<IEntityManager>(), ownerTransform.Coordinates, 2) ||
|
||||
Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Owner.EntityManager.TryGetEntity(remove.EntityUid, out var entity) || Storage?.Contains(entity) == false)
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(remove.EntityUid, out var entity) || Storage?.Contains(entity) == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Content.Server.Storage.Components
|
||||
for (var i = 0; i < storageItem.Amount; i++)
|
||||
{
|
||||
storage.Insert(
|
||||
Owner.EntityManager.SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates));
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
|
||||
|
||||
Reference in New Issue
Block a user