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_tool_requirements.py
T
2026-05-17 16:49:52 -07:00

77 lines
2.6 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",
"GroundZeroResourcePass.md": ROOT / "Docs" / "Terrain" / "GroundZeroResourcePass.md",
"Roadmap": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}
REQUIRED_SNIPPETS = {
"AgrarianResourceNode.h": [
"FName RequiredToolItemId;",
"bool bAllowBareHandGathering = true;",
"int32 ToolQuantityBonus = 0;",
"bool HasRequiredTool",
"int32 GetHarvestQuantityFor",
],
"AgrarianResourceNode.cpp": [
"Gather by hand",
"RequiredToolItemId == NAME_None || bAllowBareHandGathering || HasRequiredTool(Interactor)",
"Inventory->HasItem(RequiredToolItemId, 1)",
"QuantityPerHarvest + ToolBonus",
"MakeYieldStack(Interactor)",
],
"setup_playable_blueprints.py": [
'"required_tool_item_id": "basic_tool"',
'"allow_bare_hand_gathering": True',
'"tool_quantity_bonus": 1',
'"tool_quantity_bonus": 0',
],
"verify_playable_blueprints.py": [
'"required_tool_item_id": "basic_tool"',
'"allow_bare_hand_gathering": True',
'"tool_quantity_bonus": 1',
'"required_tool_item_id": "None"',
],
"TechnicalDesignDocument.md": [
"Tool requirement rules remain inventory-based",
"`basic_tool` in inventory",
],
"GroundZeroResourcePass.md": [
"Wood, fiber, and stone nodes declare `basic_tool`",
"Edible plant nodes remain pure bare-hand gathering",
],
"Roadmap": [
"[x] Add tool requirement rules.",
"basic tool in\n inventory improves yields",
],
}
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 tool requirement verification failed:\n" + "\n".join(missing))
print(
"PASS: MVP resource tool requirement rules are inventory-based, "
"preserve bare-hand gathering, and add basic-tool yield bonuses."
)
if __name__ == "__main__":
main()