Do not spawn the item in nullspace in InventoryHelpers

This commit is contained in:
Víctor Aguilera Puerto
2020-08-21 20:29:29 +02:00
parent 7887f78f0d
commit 1086474cd0

View File

@@ -15,9 +15,10 @@ namespace Content.Server.Utility
{
var entityManager = inventory.Owner.EntityManager;
var protoManager = IoCManager.Resolve<IPrototypeManager>();
var user = inventory.Owner;
// Let's do nothing if the owner of the inventory has been deleted.
if (inventory.Owner.Deleted)
if (user.Deleted)
return false;
// If we don't have that slot or there's already an item there, we do nothing.
@@ -28,8 +29,8 @@ namespace Content.Server.Utility
if (!protoManager.HasIndex<EntityPrototype>(prototype))
return false;
// Let's spawn this in nullspace first...
var item = entityManager.SpawnEntity(prototype, MapCoordinates.Nullspace);
// Let's spawn this first...
var item = entityManager.SpawnEntity(prototype, user.Transform.MapPosition);
// Helper method that deletes the item and returns false.
bool DeleteItem()