Add server autosave interval

This commit is contained in:
2026-05-18 19:29:35 -07:00
parent 06666b1dc3
commit a7ca8d10f8
5 changed files with 100 additions and 1 deletions
+47
View File
@@ -0,0 +1,47 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
EXPECTED = {
ROOT / "Source" / "AgrarianGame" / "AgrarianGameGameMode.h": [
"virtual void BeginPlay() override;",
"float ServerAutoSaveIntervalSeconds = 300.0f;",
"void RunServerAutoSave();",
"FTimerHandle ServerAutoSaveTimerHandle;",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianGameGameMode.cpp": [
"GetWorldTimerManager().SetTimer",
"&AAgrarianGameGameMode::RunServerAutoSave",
"ServerAutoSaveIntervalSeconds > 0.0f",
"Persistence->SaveCurrentWorld()",
],
ROOT / "Docs" / "PersistenceDesignDocument.md": [
"`ServerAutoSaveIntervalSeconds`",
"`UAgrarianPersistenceSubsystem::SaveCurrentWorld`",
"disables the MVP autosave timer",
],
ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add server-side save interval.",
"`AAgrarianGameGameMode`",
"`SaveCurrentWorld`",
],
}
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("Server save interval verification failed: " + "; ".join(missing))
print("PASS: authoritative server autosave interval is wired to world persistence.")
if __name__ == "__main__":
main()