Tools get deactivated from animation when switching to an empty slot in the inventory. Also fixed layering (AGAIN)

This commit is contained in:
2025-08-20 00:26:58 +02:00
parent 378bf45c49
commit 871e1856f1
5 changed files with 13 additions and 10 deletions
@@ -46,23 +46,21 @@ public partial class VesnaBehaviour2D : Node
{
InventorySlot currentSlot = InventoryManager.Instance.GetCurrentSelectedSlot();
ItemInstance? currentItem = currentSlot.itemInstance;
if (currentItem == null)
return;
int toolId = -1;
if (currentItem.blueprint == _hoe)
if (currentItem != null && currentItem.blueprint == _hoe)
{
toolId = 0;
}
if (currentItem.blueprint == _wateringCan)
if (currentItem != null && currentItem.blueprint == _wateringCan)
{
toolId = 1;
}
ActivateTool(toolId);
_vesnaAnimations.ActivateTool(toolId >= 0, toolId);
EmitSignal(SignalName.InventorySelectionChanged, toolId);
}