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

66 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Validate MVP network relevancy rules."""
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/AgrarianItemPickup.cpp": ["NetCullDistanceSquared = FMath::Square(3000.0f);"],
"Source/AgrarianGame/AgrarianResourceNode.cpp": ["NetCullDistanceSquared = FMath::Square(4500.0f);"],
"Source/AgrarianGame/AgrarianCampfire.cpp": ["NetCullDistanceSquared = FMath::Square(6000.0f);"],
"Source/AgrarianGame/AgrarianShelterActor.cpp": ["NetCullDistanceSquared = FMath::Square(6000.0f);"],
"Source/AgrarianGame/AgrarianWildlifeBase.cpp": ["NetCullDistanceSquared = FMath::Square(6000.0f);"],
"Source/AgrarianGame/AgrarianWaterSource.cpp": ["NetCullDistanceSquared = FMath::Square(6500.0f);"],
"Source/AgrarianGame/AgrarianWeatherExposureZone.cpp": ["NetCullDistanceSquared = FMath::Square(6500.0f);"],
"Source/AgrarianGame/AgrarianWildlifeSpawnManager.cpp": ["NetCullDistanceSquared = FMath::Square(8000.0f);"],
"Docs/MultiplayerNetworkingDesign.md": [
"MVP actor cull distances",
"item pickups: 30 meters",
"resource nodes: 45 meters",
"campfires, shelters, and wildlife: 60 meters",
"water sources and weather exposure zones: 65 meters",
"wildlife spawn managers: 80 meters",
],
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
"[x] Add network relevancy rules.",
"explicit MVP net cull distances",
],
}
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 network relevancy rules are wired and documented.")
return 0
if __name__ == "__main__":
raise SystemExit(main())