private bool TryAddInternal(IEntityContainer holder, Entity item, int index, bool replace) { if (item == null || holder == null || holder.Contains(item)) { return(false); } var inventoryItem = item.Get <InventoryItem>(); if (inventoryItem == null) { return(false); } if (holder[index] != null) { if (!replace) { return(false); } holder.Remove(holder[index]); } if (inventoryItem.Inventory != null) { inventoryItem.Inventory.Remove(item); } holder.ContainerSystemSet(item, index); ProcessHolderChange(holder, item, inventoryItem, index); return(true); }
public bool TryAdd(IEntityContainer holder, Entity item) { if (item == null || holder == null || holder.IsFull || holder.Contains(item)) { return(false); } var inventoryItem = item.Get <InventoryItem>(); if (inventoryItem == null) { return(false); } if (inventoryItem.Inventory != null) { inventoryItem.Inventory.Remove(item); } ProcessHolderChange(holder, item, inventoryItem, holder.ContainerSystemAdd(item)); return(true); }