Load world state on server start

This commit is contained in:
2026-05-18 19:32:25 -07:00
parent a7ca8d10f8
commit 9aa2f8bee3
5 changed files with 114 additions and 1 deletions
+48
View File
@@ -0,0 +1,48 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
EXPECTED = {
ROOT / "Source" / "AgrarianGame" / "AgrarianGameGameMode.h": [
"bool bLoadWorldOnServerStart = true;",
"void RegisterPersistentActorClasses(UAgrarianPersistenceSubsystem* Persistence) const;",
"void LoadWorldOnServerStart();",
],
ROOT / "Source" / "AgrarianGame" / "AgrarianGameGameMode.cpp": [
"LoadWorldOnServerStart();",
"Persistence->RegisterWorldActorClass(TEXT(\"primitive_shelter\"), AAgrarianShelterActor::StaticClass());",
"Persistence->RegisterWorldActorClass(TEXT(\"campfire\"), AAgrarianCampfire::StaticClass());",
"Persistence->DoesSaveExist()",
"Persistence->LoadCurrentWorld(RestoredPlayerCount, RestoredActorCount, bClearExistingActors);",
"constexpr bool bClearExistingActors = false;",
],
ROOT / "Docs" / "PersistenceDesignDocument.md": [
"`bLoadWorldOnServerStart`",
"`DoesSaveExist`",
"`LoadCurrentWorld` without clearing existing map",
],
ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add load-on-server-start.",
"`bLoadWorldOnServerStart`",
"authoritative `BeginPlay`",
],
}
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("Load-on-server-start verification failed: " + "; ".join(missing))
print("PASS: authoritative server startup load is wired to current world persistence.")
if __name__ == "__main__":
main()