Stop terminating entities from being removed from containers (#22232)

This commit is contained in:
Leon Friedrich
2023-12-09 20:00:53 -05:00
committed by GitHub
parent 8bc4d2ab7a
commit 5da332f75e
2 changed files with 8 additions and 1 deletions

View File

@@ -331,6 +331,10 @@ public abstract partial class InventorySystem
bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
{
removedItem = null;
if (TerminatingOrDeleted(target))
return false;
if (!Resolve(target, ref inventory, false))
{
if(!silent && _gameTiming.IsFirstTimePredicted)
@@ -347,7 +351,7 @@ public abstract partial class InventorySystem
removedItem = slotContainer.ContainedEntity;
if (!removedItem.HasValue)
if (!removedItem.HasValue || TerminatingOrDeleted(removedItem.Value))
return false;
if (!force && !CanUnequip(actor, target, slot, out var reason, slotContainer, slotDefinition, inventory))