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_server_travel_flow.py
2026-05-18 15:12:20 -07:00

76 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Validate MVP server travel flow wiring."""
from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
def read(relative_path: str) -> str:
path = ROOT / relative_path
if not path.exists():
raise AssertionError(f"Missing required file: {relative_path}")
return path.read_text(encoding="utf-8")
def require(content: str, needle: str, context: str) -> None:
if needle not in content:
raise AssertionError(f"Missing {needle!r} in {context}")
def main() -> int:
errors: list[str] = []
checks = {
"Source/AgrarianGame/AgrarianGamePlayerController.h": [
"void AgrarianServerTravel(FName MapName);",
"void ServerAgrarianServerTravel(FName MapName);",
],
"Source/AgrarianGame/AgrarianGamePlayerController.cpp": [
"GroundZeroServerTravelMapPath",
"ResolveAgrarianServerTravelMap",
"AgrarianServerTravel(FName MapName)",
"ServerAgrarianServerTravel_Implementation",
"HasAuthority()",
"AgrarianServerTravel GroundZero",
"World->ServerTravel(TravelURL, false, false)",
"/Game/Agrarian/Maps/L_GroundZeroTerrain_Test",
"?listen",
],
"Docs/MultiplayerNetworkingDesign.md": [
"Server Travel Flow",
"AgrarianServerTravel GroundZero",
"/Game/Agrarian/Maps/L_GroundZeroTerrain_Test?listen",
"without exposing arbitrary map URLs",
],
"Docs/Ops/DedicatedServerBuildRunbook.md": [
"AgrarianServerTravel GroundZero",
"allowlisted to the Ground Zero MVP map",
],
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add server travel flow.",
"AgrarianServerTravel",
"/Game/Agrarian/Maps/L_GroundZeroTerrain_Test?listen",
],
}
for relative_path, needles in checks.items():
try:
content = read(relative_path)
for needle in needles:
require(content, needle, relative_path)
except AssertionError as exc:
errors.append(str(exc))
if errors:
for error in errors:
print(f"ERROR: {error}", file=sys.stderr)
return 1
print("PASS: MVP server travel flow is wired and documented.")
return 0
if __name__ == "__main__":
raise SystemExit(main())