2024-06-10 15:08:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace ColdMint.scripts.item;
|
|
|
|
|
|
2024-06-12 19:07:55 +00:00
|
|
|
|
public readonly struct ItemType(string id, Func<IItem> newItemFunc, Texture2D? icon, int maxStackQuantity)
|
2024-06-10 15:08:48 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Item id of this type</para>
|
|
|
|
|
/// </summary>
|
2024-06-12 19:04:12 +00:00
|
|
|
|
public string Id { get; init; } = id;
|
2024-06-10 15:08:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>A function returns a new item instance of this type</para>
|
|
|
|
|
/// </summary>
|
2024-06-12 19:07:55 +00:00
|
|
|
|
public Func<IItem> NewItemFunc { get; init; } = newItemFunc;
|
2024-06-10 15:08:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Default icon of items of this type</para>
|
|
|
|
|
/// </summary>
|
2024-06-12 19:04:12 +00:00
|
|
|
|
public Texture2D? Icon { get; init; } = icon;
|
2024-06-10 15:08:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>Max number in item stack of this type</para>
|
|
|
|
|
/// </summary>
|
2024-06-12 19:04:12 +00:00
|
|
|
|
public int MaxStackQuantity { get; init; } = maxStackQuantity;
|
2024-06-10 15:08:48 +00:00
|
|
|
|
}
|