Add stackable items

This commit is contained in:
2025-03-11 16:00:46 -07:00
parent 192f2eb316
commit f060229b5e
17 changed files with 151 additions and 57 deletions

View File

@@ -2,12 +2,13 @@ using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("throwable_item")]
public partial class ThrowableItem : InventoryItem
public partial class ThrowableItem : InventoryItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
@@ -40,10 +41,14 @@ public partial class ThrowableItem : InventoryItem
public void SetDescription(string description) => Stats.Description = description;
public int Count { get; }
[Save("throwable_item_count")]
public int Count { get; private set; } = 1;
[Export]
[Save("throwable_item_stats")]
public ThrowableItemStats Stats { get; set; }
public override Texture2D GetTexture() => Stats.Texture;
public void SetCount(int count) => Count = count;
}