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_wildlife_navigation_support.py
T

87 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""Validate native wildlife navigation support wiring."""
from pathlib import Path
import sys
REPO_ROOT = Path(__file__).resolve().parents[1]
def read_text(relative_path: str) -> str:
path = REPO_ROOT / relative_path
if not path.exists():
raise AssertionError(f"Missing required file: {relative_path}")
return path.read_text(encoding="utf-8")
def require(needle: str, haystack: str, context: str) -> None:
if needle not in haystack:
raise AssertionError(f"Missing {needle!r} in {context}")
def main() -> int:
errors: list[str] = []
try:
build_cs = read_text("Source/AgrarianGame/AgrarianGame.Build.cs")
require('"AIModule"', build_cs, "AgrarianGame.Build.cs")
require('"NavigationSystem"', build_cs, "AgrarianGame.Build.cs")
except AssertionError as exc:
errors.append(str(exc))
try:
header = read_text("Source/AgrarianGame/AgrarianWildlifeBase.h")
for marker in [
"bUseNavigationMovement",
"NavigationAcceptanceRadius",
"NavigationRepathDistance",
"NavigationProjectionExtent",
"ChooseReachableWanderTarget",
"ProjectPointToNavigation",
"RequestNavigationMove",
"DirectMoveTowardLocation",
]:
require(marker, header, "AgrarianWildlifeBase.h")
except AssertionError as exc:
errors.append(str(exc))
try:
source = read_text("Source/AgrarianGame/AgrarianWildlifeBase.cpp")
for marker in [
'#include "AIController.h"',
'#include "NavigationSystem.h"',
"AutoPossessAI = EAutoPossessAI::PlacedInWorldOrSpawned",
"AIControllerClass = AAIController::StaticClass()",
"SpawnDefaultController()",
"GetRandomReachablePointInRadius",
"ProjectPointToNavigation",
"MoveToLocation",
"EPathFollowingRequestResult::Failed",
"StopMovement()",
"DirectMoveTowardLocation",
]:
require(marker, source, "AgrarianWildlifeBase.cpp")
except AssertionError as exc:
errors.append(str(exc))
try:
roadmap = read_text("AGRARIAN_DEVELOPMENT_ROADMAP.md")
require("[x] Add navigation support for wildlife.", roadmap, "AGRARIAN_DEVELOPMENT_ROADMAP.md")
docs = read_text("Docs/TechnicalDesignDocument.md")
require("Wildlife Navigation", docs, "Docs/TechnicalDesignDocument.md")
require("falls back to direct movement input", docs, "Docs/TechnicalDesignDocument.md")
except AssertionError as exc:
errors.append(str(exc))
if errors:
for error in errors:
print(f"ERROR: {error}", file=sys.stderr)
return 1
print("Wildlife navigation support is wired.")
return 0
if __name__ == "__main__":
raise SystemExit(main())