Skip to content

feat: add RPG inventory and persistent loot sources - #16

Merged
pes7 merged 61 commits into
masterfrom
refactor/inventory-items-construction
Jul 27, 2026
Merged

pes7 merged 61 commits into
masterfrom
refactor/inventory-items-construction

Conversation

@pes7

@pes7 pes7 commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This stacked PR adds the RPG inventory and persistent loot foundation needed by the player, raid NPCs, POI NPCs, world items, searchable containers and corpses.

The previous construction-oriented scope was removed. This PR no longer contains construction definitions, construction progress or worker/production gameplay.

Completed scope

  • adds ZoneUA.Inventory runtime assembly
  • adds ItemDefinition and ItemCatalog
  • adds item category, base loot value and weight metadata for future NPC evaluation
  • adds deterministic InventoryState
  • supports capacity, add/remove, atomic consumption and atomic inventory-to-inventory transfer
  • adds InventoryComponent
  • adds InventorySaveParticipant
  • adds persistent WorldItemPickup
  • exposes world items through the shared ILootSource contract
  • creates tombstones only after successful pickup
  • adds InventoryDropper
  • assigns new logical IDs to dropped item instances
  • persists dropped stack amounts through participant key world-item
  • adds LootSourceKind, LootSearchState, ILootSource and pure LootContainerState
  • adds persistent searchable LootContainer
  • persists container contents and searched/empty state independently
  • adds CorpseLootContainer to snapshot a dead actor's complete inventory
  • clears the source actor inventory by default to prevent duplicated corpse loot
  • adds LootReservationRegistry with owner IDs and expiry times for raid-NPC coordination
  • adds inventory/loot content validation and build preprocessing
  • adds EditMode coverage for capacity, atomic transfer, search gating, empty-state transitions and reservation expiry
  • adds Docs/RPG_INVENTORY_LOOT.md

Removed as out of scope

  • construction definitions
  • construction resource costs
  • construction progress/state
  • construction scene components and validators

Stacking

Base branch: refactor/stable-ids-save-participants

Merge after PR #15, or retarget after earlier stacked PRs are merged.

The branch name remains refactor/inventory-items-construction for Git history continuity, but the PR diff and scope are now inventory/loot only.

Unity workflow

  1. Create item definitions and an item catalog.
  2. Add InventoryComponent and InventorySaveParticipant to the persistent player and loot-capable NPC prefabs.
  3. Configure pickup prefabs with PersistentIdentity, TransformSaveParticipant, WorldItemPickup and a collider.
  4. Register dropped-item prefabs in PersistentPrefabCatalog.
  5. Configure crates/stashes with PersistentIdentity, InventoryComponent, InventorySaveParticipant and LootContainer.
  6. Configure corpse prefabs with the normal loot-container composition plus CorpseLootContainer.
  7. On actor death, call CorpseLootContainer.InitialiseFrom(deadActorInventory).
  8. Run Zone UA -> Validation -> Validate Inventory and Loot.

Validation required in Unity 6000.5.5f1

  • project compiles with zero Console errors
  • all InventoryLootTests pass
  • inventory save/load round-trip restores exact contents
  • full inventory rejects pickup without tombstoning the item
  • successful pickup creates a tombstone
  • dropping removes the exact amount and assigns a new stable object ID
  • dropped stacks restore exactly once after save/load
  • crates persist contents and Unsearched/Searched/Empty state
  • failed transfers cannot delete source loot
  • corpse initialization snapshots spawn equipment and acquired loot
  • source actor inventory is not duplicated after corpse creation
  • corpse contents restore after save/load
  • two NPCs cannot reserve the same loot source simultaneously
  • expired/released reservations allow another NPC to claim the source
  • duplicate item IDs block builds

This PR remains draft because Unity compilation, prefab references, interaction timing, death integration and Play Mode save/load must be validated locally.

@pes7 pes7 changed the title feat: add inventory items and construction persistence feat: add RPG inventory and persistent loot sources Jul 27, 2026
@pes7
pes7 force-pushed the refactor/stable-ids-save-participants branch from f4f23d8 to ec7e96f Compare July 27, 2026 21:16
@pes7
pes7 force-pushed the refactor/inventory-items-construction branch from 59459dc to 51630a8 Compare July 27, 2026 21:18
@pes7
pes7 changed the base branch from refactor/stable-ids-save-participants to master July 27, 2026 21:18
@pes7
pes7 marked this pull request as ready for review July 27, 2026 21:18
@pes7
pes7 merged commit 6ad145d into master Jul 27, 2026
2 checks passed
@pes7
pes7 deleted the refactor/inventory-items-construction branch July 28, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant