entitystorage fixes (#5660)
This commit is contained in:
@@ -373,14 +373,7 @@ namespace Content.Server.Storage.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Contents.Insert(entity)) return false;
|
return Contents.Insert(entity);
|
||||||
|
|
||||||
entity.Transform.LocalPosition = Vector2.Zero;
|
|
||||||
if (entity.TryGetComponent(out IPhysBody? body))
|
|
||||||
{
|
|
||||||
body.CanCollide = false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Robust.Shared.GameObjects;
|
|||||||
|
|
||||||
namespace Content.Server.Storage.Components
|
namespace Content.Server.Storage.Components
|
||||||
{
|
{
|
||||||
public interface IStorageComponent
|
public interface IStorageComponent : IComponent
|
||||||
{
|
{
|
||||||
bool Remove(IEntity entity);
|
bool Remove(IEntity entity);
|
||||||
bool Insert(IEntity entity);
|
bool Insert(IEntity entity);
|
||||||
|
|||||||
@@ -50,8 +50,12 @@ namespace Content.Server.Storage.Components
|
|||||||
|
|
||||||
for (var i = 0; i < storageItem.Amount; i++)
|
for (var i = 0; i < storageItem.Amount; i++)
|
||||||
{
|
{
|
||||||
storage.Insert(
|
var ent = Owner.EntityManager.SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates);
|
||||||
Owner.EntityManager.SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates));
|
|
||||||
|
if (storage.Insert(ent)) continue;
|
||||||
|
|
||||||
|
Logger.ErrorS("storage", $"Tried to StorageFill {storageItem.PrototypeId} inside {Owner} but can't.");
|
||||||
|
Owner.EntityManager.DeleteEntity(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
|
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
|
||||||
|
|||||||
Reference in New Issue
Block a user