Document weather state persistence
This commit is contained in:
@@ -758,7 +758,10 @@ Target deliverable: A small group can join a server, spawn into one biome, gathe
|
|||||||
- [x] Save world time. World saves persist `UAgrarianSaveGame::WorldHours`
|
- [x] Save world time. World saves persist `UAgrarianSaveGame::WorldHours`
|
||||||
from `AAgrarianGameState::WorldHours` and restore it on server authority
|
from `AAgrarianGameState::WorldHours` and restore it on server authority
|
||||||
during world load.
|
during world load.
|
||||||
- [ ] Save weather seed/state.
|
- [x] Save weather seed/state. World saves persist fallback
|
||||||
|
`UAgrarianSaveGame::Weather`, provider `WeatherInputs`, and `WeatherDebug`,
|
||||||
|
then restore mapped provider inputs when present or the saved enum weather
|
||||||
|
otherwise.
|
||||||
- [ ] Save containers.
|
- [ ] Save containers.
|
||||||
- [ ] Add server-side save interval.
|
- [ ] Add server-side save interval.
|
||||||
- [x] Add manual admin save command.
|
- [x] Add manual admin save command.
|
||||||
|
|||||||
@@ -433,6 +433,12 @@ World time is stored in `UAgrarianSaveGame::WorldHours`. The persistence
|
|||||||
subsystem captures it from `AAgrarianGameState::WorldHours` during world save
|
subsystem captures it from `AAgrarianGameState::WorldHours` during world save
|
||||||
and restores it only on authority during world load.
|
and restores it only on authority during world load.
|
||||||
|
|
||||||
|
Weather state is stored as the fallback `UAgrarianSaveGame::Weather` enum plus
|
||||||
|
`WeatherInputs` and `WeatherDebug` snapshots. When provider data exists, load
|
||||||
|
reapplies the mapped weather inputs; otherwise it restores the saved enum
|
||||||
|
weather state. This gives the MVP a deterministic fallback while preserving the
|
||||||
|
latest real/provider-mapped tile weather payload when one was available.
|
||||||
|
|
||||||
## Testing Gates
|
## Testing Gates
|
||||||
|
|
||||||
Minimum persistence smoke test:
|
Minimum persistence smoke test:
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
|
||||||
|
EXPECTED = {
|
||||||
|
ROOT / "Source" / "AgrarianGame" / "AgrarianSaveGame.h": [
|
||||||
|
"EAgrarianWeatherType Weather = EAgrarianWeatherType::Clear;",
|
||||||
|
"FAgrarianMappedWeatherInputs WeatherInputs;",
|
||||||
|
"FAgrarianWeatherDebugSnapshot WeatherDebug;",
|
||||||
|
],
|
||||||
|
ROOT / "Source" / "AgrarianGame" / "AgrarianPersistenceSubsystem.cpp": [
|
||||||
|
"SaveGame->Weather = GameState->Weather;",
|
||||||
|
"SaveGame->WeatherInputs = GameState->ActiveWeatherInputs;",
|
||||||
|
"SaveGame->WeatherDebug = GameState->GetWeatherDebugSnapshot();",
|
||||||
|
"if (SaveGame->WeatherInputs.bHasProviderData)",
|
||||||
|
"GameState->ApplyMappedWeatherInputs(SaveGame->WeatherInputs);",
|
||||||
|
"GameState->SetWeather(SaveGame->Weather);",
|
||||||
|
],
|
||||||
|
ROOT / "Docs" / "PersistenceDesignDocument.md": [
|
||||||
|
"`UAgrarianSaveGame::Weather`",
|
||||||
|
"`WeatherInputs` and `WeatherDebug` snapshots",
|
||||||
|
"reapplies the mapped weather inputs",
|
||||||
|
],
|
||||||
|
ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
|
||||||
|
"[x] Save weather seed/state.",
|
||||||
|
"`UAgrarianSaveGame::Weather`",
|
||||||
|
"provider `WeatherInputs`, and `WeatherDebug`",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
missing = []
|
||||||
|
for path, snippets in EXPECTED.items():
|
||||||
|
text = path.read_text(encoding="utf-8")
|
||||||
|
for snippet in snippets:
|
||||||
|
if snippet not in text:
|
||||||
|
missing.append(f"{path.relative_to(ROOT)}: {snippet}")
|
||||||
|
|
||||||
|
if missing:
|
||||||
|
raise RuntimeError("Weather state persistence verification failed: " + "; ".join(missing))
|
||||||
|
|
||||||
|
print("PASS: weather state persists with provider inputs and enum fallback.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user