From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sun, 10 Dec 2023 01:00:53 +0000 (-0500) Subject: Stop terminating entities from being removed from containers (#22232) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=5da332f75ec6f0f762b5d8fc05598019fa6ed63c;p=space-station-14.git Stop terminating entities from being removed from containers (#22232) --- diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index 4290920132..15b07cb62f 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -177,6 +177,9 @@ public abstract partial class SharedHandsSystem var entity = hand.Container.ContainedEntity.Value; + if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(entity)) + return; + 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}."); diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index a6c818ca7e..456c8373df 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -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))