Add campfire persistence state

This commit is contained in:
2026-05-17 19:09:55 -07:00
parent c60b975294
commit 7291c4844b
8 changed files with 171 additions and 2 deletions
+58
View File
@@ -0,0 +1,58 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REQUIRED = {
ROOT / "Source" / "AgrarianGame" / "AgrarianPersistentStateProvider.h": [
"class IAgrarianPersistentStateProvider",
"void CapturePersistentState(UAgrarianPersistentActorComponent* PersistentComponent) const;",
"void ApplyPersistentState(UAgrarianPersistentActorComponent* PersistentComponent);",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianPersistentActorComponent.cpp": [
"IAgrarianPersistentStateProvider::Execute_CapturePersistentState",
"IAgrarianPersistentStateProvider::Execute_ApplyPersistentState",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.h": [
"public IAgrarianPersistentStateProvider",
"TObjectPtr<UAgrarianPersistentActorComponent> PersistentActorComponent;",
"CapturePersistentState_Implementation",
"ApplyPersistentState_Implementation",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.cpp": [
"PersistentActorComponent = CreateDefaultSubobject<UAgrarianPersistentActorComponent>(TEXT(\"PersistentActorComponent\"));",
"PersistentActorComponent->ActorTypeId = TEXT(\"campfire\");",
"NumberState.Add(TEXT(\"lit\")",
"NumberState.Add(TEXT(\"fuel_seconds\")",
"NumberState.Add(TEXT(\"cooking_progress_seconds\")",
"void AAgrarianCampfire::ApplyPersistentState_Implementation",
"SetLit(SavedLit && *SavedLit > 0.5f && FuelSeconds > 0.0f);",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp": [
"Persistence->RegisterWorldActorClass(TEXT(\"campfire\"), AAgrarianCampfire::StaticClass());",
],
ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"- [x] Add persistence.",
],
ROOT / "Docs" / "TechnicalDesignDocument.md": [
"Campfire persistence uses the shared `UAgrarianPersistentActorComponent` world",
],
}
def main():
missing = []
for path, snippets in REQUIRED.items():
text = path.read_text(encoding="utf-8")
for snippet in snippets:
if snippet not in text:
missing.append(f"{path.relative_to(ROOT)} missing {snippet!r}")
if missing:
raise SystemExit("Campfire persistence verification failed:\n" + "\n".join(missing))
print("PASS: campfire persistence is implemented and documented.")
if __name__ == "__main__":
main()