Document player inventory persistence

This commit is contained in:
2026-05-18 19:19:00 -07:00
parent 1d2ac1e584
commit 188ef7b509
3 changed files with 19 additions and 1 deletions
+4 -1
View File
@@ -746,7 +746,10 @@ Target deliverable: A small group can join a server, spawn into one biome, gathe
for nutrition, illness, injury, sleep, shelter, stress, workload, and
treatment quality placeholders, while aging/generational effects remain
deferred.
- [ ] Save player inventory.
- [x] Save player inventory. Player saves already persist
`FAgrarianSavedPlayer::Inventory` from `UAgrarianInventoryComponent::Items`
and restore through `RestoreSavedItems`, so inventory listeners and derived
carry weight refresh after load.
- [x] Save placed structures.
- [ ] Save resource depletion state if needed.
- [ ] Save world time.
+6
View File
@@ -423,6 +423,12 @@ treatment quality data for later generational and health systems. Version 0.1.M
only persists and restores those placeholders; it does not apply aging,
lifespan, inheritance, or generational outcome gameplay.
Player inventory is stored through `FAgrarianSavedPlayer::Inventory`, copied
from `UAgrarianInventoryComponent::Items`, and restored through
`UAgrarianInventoryComponent::RestoreSavedItems`. Restore recomputes derived
values and broadcasts inventory changes so HUD/debug listeners see loaded item
state.
## Testing Gates
Minimum persistence smoke test:
+9
View File
@@ -9,6 +9,7 @@ FILES = {
"AgrarianPersistenceSubsystem.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianPersistenceSubsystem.cpp",
"InventoryDataModel.md": ROOT / "Docs" / "InventoryDataModel.md",
"TechnicalDesignDocument.md": ROOT / "Docs" / "TechnicalDesignDocument.md",
"PersistenceDesignDocument.md": ROOT / "Docs" / "PersistenceDesignDocument.md",
"AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}
@@ -40,11 +41,19 @@ EXPECTED = {
"`UAgrarianInventoryComponent::RestoreSavedItems`",
"`OnInventoryChanged`",
],
"PersistenceDesignDocument.md": [
"`FAgrarianSavedPlayer::Inventory`",
"`UAgrarianInventoryComponent::Items`",
"`UAgrarianInventoryComponent::RestoreSavedItems`",
"broadcasts inventory changes",
],
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add persistence for inventory.",
"[x] Save player inventory.",
"`FAgrarianSavedPlayer::Inventory`",
"`RestoreSavedItems`",
"listeners are notified after load",
"carry weight refresh after load",
],
}