This repository has been archived on 2026-05-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AgrarianGameArchive/Scripts/verify_fire_persistence.py
T
2026-05-17 19:09:55 -07:00

59 lines
2.4 KiB
Python

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()