Fixed Tomato farming (again)
This commit is contained in:
@@ -17,6 +17,9 @@ public partial class InventoryInstance : Node
|
||||
[Signal]
|
||||
public delegate void InventoryContentsChangedEventHandler();
|
||||
|
||||
/// <summary>
|
||||
/// The total amount of Inventoryslots in the inventory (empty and occupied).
|
||||
/// </summary>
|
||||
[Export]
|
||||
public int SlotAmount
|
||||
{
|
||||
@@ -49,7 +52,7 @@ public partial class InventoryInstance : Node
|
||||
private InventoryActionResult AddItemAndStackRecursive(ItemInstance newItem, int slotSearch)
|
||||
{
|
||||
if (newItem.blueprint == null || newItem.amount == 0)
|
||||
return InventoryActionResult.SourceDoesNotExists;
|
||||
return InventoryActionResult.SourceDoesNotExist;
|
||||
|
||||
var slotIndex = -1;
|
||||
// find stackable slot
|
||||
@@ -97,7 +100,7 @@ public partial class InventoryInstance : Node
|
||||
if (inventorySlot < 0 || inventorySlot >= _slots.Count)
|
||||
{
|
||||
itemInstance = null;
|
||||
return InventoryActionResult.SourceDoesNotExists;
|
||||
return InventoryActionResult.SourceDoesNotExist;
|
||||
}
|
||||
|
||||
if (_slots[inventorySlot].IsEmpty())
|
||||
@@ -107,6 +110,10 @@ public partial class InventoryInstance : Node
|
||||
}
|
||||
|
||||
itemInstance = _slots[inventorySlot].itemInstance;
|
||||
if (itemInstance == null)
|
||||
return InventoryActionResult.SourceDoesNotExist;
|
||||
|
||||
itemInstance.amount -= 1;
|
||||
_slots[inventorySlot].itemInstance = null;
|
||||
EmitSignal(SignalName.InventoryContentsChanged);
|
||||
return InventoryActionResult.Success;
|
||||
@@ -120,7 +127,7 @@ public partial class InventoryInstance : Node
|
||||
public InventoryActionResult AddItemToSlot(ItemInstance itemInstance, int destinationSlot)
|
||||
{
|
||||
if (destinationSlot < 0 || destinationSlot >= _slots.Count)
|
||||
return InventoryActionResult.DestinationDoesNotExists;
|
||||
return InventoryActionResult.DestinationDoesNotExist;
|
||||
|
||||
if (!_slots[destinationSlot].IsEmpty())
|
||||
return InventoryActionResult.DestinationFull;
|
||||
|
||||
Reference in New Issue
Block a user