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_resource_respawn_rules.py
2026-05-17 16:26:31 -07:00

76 lines
2.5 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
FILES = {
"AgrarianResourceNode.h": ROOT / "Source" / "AgrarianGame" / "AgrarianResourceNode.h",
"AgrarianResourceNode.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianResourceNode.cpp",
"setup_playable_blueprints.py": ROOT / "Scripts" / "setup_playable_blueprints.py",
"verify_playable_blueprints.py": ROOT / "Scripts" / "verify_playable_blueprints.py",
"TechnicalDesignDocument.md": ROOT / "Docs" / "TechnicalDesignDocument.md",
"Roadmap": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}
REQUIRED_SNIPPETS = {
"AgrarianResourceNode.h": [
"bool bRespawnsForMvp = false;",
"float RespawnDelaySeconds = 900.0f;",
"int32 MaxHarvests = 5;",
"void ScheduleRespawnIfNeeded();",
"void RespawnNode();",
"FTimerHandle RespawnTimerHandle;",
],
"AgrarianResourceNode.cpp": [
"ScheduleRespawnIfNeeded();",
"!bRespawnsForMvp || RemainingHarvests > 0",
"World->GetTimerManager().SetTimer",
"FMath::Max(1.0f, RespawnDelaySeconds)",
"RemainingHarvests = FMath::Max(1, MaxHarvests);",
"UpdateDepletedState();",
],
"setup_playable_blueprints.py": [
'"respawns_for_mvp": True',
'"respawns_for_mvp": False',
'"respawn_delay_seconds": 600.0',
'"respawn_delay_seconds": 900.0',
'"respawn_delay_seconds": 1200.0',
'"max_harvests": 16',
],
"verify_playable_blueprints.py": [
'"respawns_for_mvp": True',
'"respawns_for_mvp": False',
'"respawn_delay_seconds": 1800.0',
'"max_harvests": 12',
],
"TechnicalDesignDocument.md": [
"renewable MVP resource nodes respawn",
"Stone remains nonrespawning",
],
"Roadmap": [
"[x] Add respawn rules for MVP.",
"renewable surface resources respawn",
],
}
def main():
missing = []
for label, path in FILES.items():
text = path.read_text(encoding="utf-8")
for snippet in REQUIRED_SNIPPETS[label]:
if snippet not in text:
missing.append(f"{label}: missing {snippet!r}")
if missing:
raise SystemExit("Resource respawn rule verification failed:\n" + "\n".join(missing))
print(
"PASS: MVP resource respawn rules are configured for renewable nodes, "
"exclude nonrenewable stone, and are covered by Blueprint verification."
)
if __name__ == "__main__":
main()