Revert "Remove IContainer and move functions to the container system.… (#19975)

This commit is contained in:
metalgearsloth
2023-09-10 21:46:36 +10:00
committed by GitHub
parent 24810d916b
commit 4d1c3ae66a
19 changed files with 48 additions and 54 deletions

View File

@@ -360,7 +360,7 @@ public abstract partial class InventorySystem
}
//we need to do this to make sure we are 100% removing this entity, since we are now dropping dependant slots
if (!force && !_containerSystem.CanRemove(removedItem.Value, slotContainer))
if (!force && !slotContainer.CanRemove(removedItem.Value))
return false;
foreach (var slotDef in GetSlots(target, inventory))
@@ -426,12 +426,14 @@ public abstract partial class InventorySystem
if ((containerSlot == null || slotDefinition == null) && !TryGetSlotContainer(target, slot, out containerSlot, out slotDefinition, inventory))
return false;
if (containerSlot.ContainedEntity is not {} itemUid)
if (containerSlot.ContainedEntity == null)
return false;
if (!_containerSystem.CanRemove(itemUid, containerSlot))
if (!containerSlot.ContainedEntity.HasValue || !containerSlot.CanRemove(containerSlot.ContainedEntity.Value))
return false;
var itemUid = containerSlot.ContainedEntity.Value;
// make sure the user can actually reach the target
if (!CanAccess(actor, target, itemUid))
{