80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Validate MVP wildlife spawn manager 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(haystack: str, needle: str, context: str) -> None:
|
|
if needle not in haystack:
|
|
raise AssertionError(f"Missing {needle!r} in {context}")
|
|
|
|
|
|
def main() -> int:
|
|
errors: list[str] = []
|
|
checks = {
|
|
"Source/AgrarianGame/AgrarianWildlifeSpawnManager.h": [
|
|
"class AAgrarianWildlifeSpawnManager",
|
|
"TSubclassOf<AAgrarianWildlifeBase> WildlifeClass",
|
|
"InitialSpawnCount",
|
|
"MaxActiveWildlife",
|
|
"SpawnRadius",
|
|
"SpawnIntervalSeconds",
|
|
"bProjectSpawnsToNavigation",
|
|
"SpawnWildlife()",
|
|
"GetActiveWildlifeCount()",
|
|
"TArray<TObjectPtr<AAgrarianWildlifeBase>> SpawnedWildlife",
|
|
],
|
|
"Source/AgrarianGame/AgrarianWildlifeSpawnManager.cpp": [
|
|
"bReplicates = true",
|
|
"DOREPLIFETIME(AAgrarianWildlifeSpawnManager, SpawnedWildlife)",
|
|
"HasAuthority()",
|
|
"SpawnInitialWildlife()",
|
|
"GetActiveWildlifeCount() >= MaxActiveWildlife",
|
|
"ProjectPointToNavigation",
|
|
"SpawnActor<AAgrarianWildlifeBase>",
|
|
"AdjustIfPossibleButAlwaysSpawn",
|
|
"RemoveInvalidSpawnedWildlife()",
|
|
],
|
|
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
|
|
"[x] Add spawn manager.",
|
|
"server-authoritative wildlife",
|
|
"max active population",
|
|
],
|
|
"Docs/TechnicalDesignDocument.md": [
|
|
"Wildlife Spawning",
|
|
"AAgrarianWildlifeSpawnManager",
|
|
"spawn radius",
|
|
"respawn interval",
|
|
],
|
|
}
|
|
|
|
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: wildlife spawn manager is wired and documented.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|