Stop terminating entities from being removed from containers (#22232)
This commit is contained in:
@@ -177,6 +177,9 @@ public abstract partial class SharedHandsSystem
|
|||||||
|
|
||||||
var entity = hand.Container.ContainedEntity.Value;
|
var entity = hand.Container.ContainedEntity.Value;
|
||||||
|
|
||||||
|
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(entity))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!hand.Container.Remove(entity, EntityManager))
|
if (!hand.Container.Remove(entity, EntityManager))
|
||||||
{
|
{
|
||||||
Log.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
|
Log.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
|
||||||
|
|||||||
@@ -331,6 +331,10 @@ public abstract partial class InventorySystem
|
|||||||
bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
|
bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
|
||||||
{
|
{
|
||||||
removedItem = null;
|
removedItem = null;
|
||||||
|
|
||||||
|
if (TerminatingOrDeleted(target))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!Resolve(target, ref inventory, false))
|
if (!Resolve(target, ref inventory, false))
|
||||||
{
|
{
|
||||||
if(!silent && _gameTiming.IsFirstTimePredicted)
|
if(!silent && _gameTiming.IsFirstTimePredicted)
|
||||||
@@ -347,7 +351,7 @@ public abstract partial class InventorySystem
|
|||||||
|
|
||||||
removedItem = slotContainer.ContainedEntity;
|
removedItem = slotContainer.ContainedEntity;
|
||||||
|
|
||||||
if (!removedItem.HasValue)
|
if (!removedItem.HasValue || TerminatingOrDeleted(removedItem.Value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!force && !CanUnequip(actor, target, slot, out var reason, slotContainer, slotDefinition, inventory))
|
if (!force && !CanUnequip(actor, target, slot, out var reason, slotContainer, slotDefinition, inventory))
|
||||||
|
|||||||
Reference in New Issue
Block a user