Add MVP resource respawn rules
This commit is contained in:
@@ -33,6 +33,9 @@ BLUEPRINTS = [
|
||||
"yield_item_definition": WOOD_ITEM_PATH,
|
||||
"remaining_harvests": 16,
|
||||
"quantity_per_harvest": 2,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 900.0,
|
||||
"max_harvests": 16,
|
||||
},
|
||||
"mesh": MESH_CUBE_PATH,
|
||||
"scale": unreal.Vector(1.0, 1.0, 1.5),
|
||||
@@ -45,6 +48,9 @@ BLUEPRINTS = [
|
||||
"yield_item_definition": FIBER_ITEM_PATH,
|
||||
"remaining_harvests": 10,
|
||||
"quantity_per_harvest": 3,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 600.0,
|
||||
"max_harvests": 10,
|
||||
},
|
||||
"mesh": MESH_CYLINDER_PATH,
|
||||
"scale": unreal.Vector(0.8, 0.8, 1.0),
|
||||
@@ -57,6 +63,9 @@ BLUEPRINTS = [
|
||||
"yield_item_definition": STONE_ITEM_PATH,
|
||||
"remaining_harvests": 12,
|
||||
"quantity_per_harvest": 2,
|
||||
"respawns_for_mvp": False,
|
||||
"respawn_delay_seconds": 1800.0,
|
||||
"max_harvests": 12,
|
||||
},
|
||||
"mesh": MESH_CUBE_PATH,
|
||||
"scale": unreal.Vector(0.9, 0.75, 0.45),
|
||||
@@ -69,6 +78,9 @@ BLUEPRINTS = [
|
||||
"yield_item_definition": FOOD_ITEM_PATH,
|
||||
"remaining_harvests": 8,
|
||||
"quantity_per_harvest": 1,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 1200.0,
|
||||
"max_harvests": 8,
|
||||
},
|
||||
"mesh": MESH_CYLINDER_PATH,
|
||||
"scale": unreal.Vector(0.65, 0.65, 0.85),
|
||||
|
||||
@@ -6,6 +6,9 @@ EXPECTED = {
|
||||
"properties": {
|
||||
"remaining_harvests": 16,
|
||||
"quantity_per_harvest": 2,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 900.0,
|
||||
"max_harvests": 16,
|
||||
},
|
||||
"yield_item_id": "wood",
|
||||
},
|
||||
@@ -13,6 +16,9 @@ EXPECTED = {
|
||||
"properties": {
|
||||
"remaining_harvests": 10,
|
||||
"quantity_per_harvest": 3,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 600.0,
|
||||
"max_harvests": 10,
|
||||
},
|
||||
"yield_item_id": "fiber",
|
||||
},
|
||||
@@ -20,6 +26,9 @@ EXPECTED = {
|
||||
"properties": {
|
||||
"remaining_harvests": 12,
|
||||
"quantity_per_harvest": 2,
|
||||
"respawns_for_mvp": False,
|
||||
"respawn_delay_seconds": 1800.0,
|
||||
"max_harvests": 12,
|
||||
},
|
||||
"yield_item_id": "stone",
|
||||
},
|
||||
@@ -27,6 +36,9 @@ EXPECTED = {
|
||||
"properties": {
|
||||
"remaining_harvests": 8,
|
||||
"quantity_per_harvest": 1,
|
||||
"respawns_for_mvp": True,
|
||||
"respawn_delay_seconds": 1200.0,
|
||||
"max_harvests": 8,
|
||||
},
|
||||
"yield_item_id": "food",
|
||||
},
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user