Add stackable items
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user