Files
Project-M/Assets/_Project/Scripts/Simulation/Items/InventoryDepositRequest.cs
T
kronic 599b9b4255 Inventory: per-player items backbone (DR-026 Phase 0)
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>
2026-06-08 09:43:31 -07:00

24 lines
1.2 KiB
C#

using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Client -&gt; server request to move items from the sender's PERSONAL inventory into the shared base
/// stockpile (the global <see cref="ResourceLedger"/> the build/upgrade/automation economy spends from).
/// A one-off action, so it is an RPC (not a per-tick predicted input), and the server applies it exactly
/// once in the plain SimulationSystemGroup (no rollback double-apply). Payload is plain blittable scalars
/// (no entity refs, no enum): the server resolves the sender's player from the RPC's SourceConnection. The
/// wire type is UNCONDITIONAL (never #if-gated) so the RpcCollection hash matches across release/dev peers;
/// only the send/receive SYSTEMS may be #if-gated.
/// </summary>
public struct InventoryDepositRequest : IRpcCommand
{
/// <summary>Item to deposit, or 0 to deposit EVERYTHING the player is carrying. The server branches on
/// 0 BEFORE any per-item withdraw and never writes a 0-id row.</summary>
public ushort ItemId;
/// <summary>Quantity to deposit; &lt;= 0 means "all of that item" (ignored when ItemId is 0).</summary>
public int Count;
}
}