599b9b4255
Data-driven ItemDatabase catalog + per-player replicated InventorySlot ([GhostField] OwnerSendType.All, a StatModifier twin). Harvest reroutes to the firing player's personal inventory (optional ComponentLookup<GhostOwner> in ResourceHarvestSystem; remainder/un-owned -> ledger); the G-key InventoryDepositRequest RPC moves the bag into the shared ledger the build economy spends. Catalog asset (Aether/Ore/Biomass + Stone Pickaxe) wired into the Gameplay subscene; read-only HUD inventory panel. ushort ItemId subsumes ResourceId; byte Category/Tier baked for gear-tier progression. Session-only (no SaveData bump). Play-validated host+client: catalog baked into both worlds, the re-baked player ghost carries InventorySlot with a clean handshake, a server write replicates to the client owner, the deposit RPC round-trips, and the HUD renders catalog names. See DR-026. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1.4 KiB
C#
32 lines
1.4 KiB
C#
using ProjectM.Simulation;
|
|
using UnityEngine;
|
|
|
|
namespace ProjectM.Authoring
|
|
{
|
|
/// <summary>
|
|
/// Designer-facing definition of one item (resource, tool, weapon, gear, consumable). Numeric/byte fields
|
|
/// are baked into the ItemDatabase blob (immutable, Burst-fast runtime config). Category and Tier are
|
|
/// BYTES, not enums, to dodge BOTH the MCP enum-drop hazard (manage_* silently drop enum fields when set
|
|
/// via tooling) AND the cross-assembly enum-in-Burst hazard. UI icon/description are deferred to a later
|
|
/// managed lookup keyed by id, exactly like AbilityDefinition.
|
|
/// </summary>
|
|
[CreateAssetMenu(menuName = "Project M/Item Definition", fileName = "Item_")]
|
|
public class ItemDefinition : ScriptableObject
|
|
{
|
|
[Tooltip("Stable item id (ushort range). Keep 1=Aether, 2=Ore, 3=Biomass; reserve >3 for new items; 0 = none.")]
|
|
public int ItemId = 4;
|
|
|
|
public string DisplayName = "Item";
|
|
|
|
[Tooltip("ItemCategory byte: 0=Resource, 1=Tool, 2=Weapon, 3=Gear, 4=Consumable.")]
|
|
public byte Category = ItemCategory.Resource;
|
|
|
|
[Tooltip("Progression tier (0 = base). Higher-tier tools harvest higher-tier nodes / hit harder.")]
|
|
public byte Tier = 0;
|
|
|
|
[Min(1)]
|
|
[Tooltip("Max units that stack in one inventory slot (1 for non-stacking equipment).")]
|
|
public int StackMax = 999;
|
|
}
|
|
}
|