Tools get deactivated from animation when switching to an empty slot in the inventory. Also fixed layering (AGAIN)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Threading.Tasks;
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Babushka.scripts.CSharp.Common.Services;
|
||||
using Godot;
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Inventory;
|
||||
|
||||
[GlobalClass]
|
||||
@@ -18,7 +19,7 @@ public partial class ItemResource : Resource
|
||||
|
||||
[Export]
|
||||
public PackedScene? itemPrefab;
|
||||
|
||||
|
||||
public ItemResource()
|
||||
{
|
||||
name = "";
|
||||
@@ -27,3 +28,4 @@ public partial class ItemResource : Resource
|
||||
itemPrefab = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user