feat(@projects/@magic-civilization): add bunker test improvements

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-10 03:54:56 -07:00
parent c88e136469
commit 242e717fb6
2 changed files with 20 additions and 8 deletions

View file

@ -562,6 +562,7 @@
],
"improvements": [
"beacon_tower",
"bunker",
"deforestation",
"drainage",
"farm",

View file

@ -66,20 +66,25 @@ func _run_bunker_cycle() -> void:
return
_state = ClassDB.instantiate("GdGameState") as RefCounted
_state.call("create_grid", GRID_W, GRID_H)
# Tile authoring lives on GdGridState (get/set_tile_dict); GdGameState
# adopts the finished grid via set_grid_from_gridstate.
var grid_seed: RefCounted = ClassDB.instantiate("GdGridState") as RefCounted
var grid: RefCounted = grid_seed.call("create", GRID_W, GRID_H) as RefCounted
# Set the bunker tile to hills with a tier-7 deposit (quality = tier source),
# and a separate river-course tile to exercise the build guard.
var bunker_tile: Dictionary = _state.call("get_tile_dict", BUNKER_COL, BUNKER_ROW) as Dictionary
var bunker_tile: Dictionary = grid.call("get_tile_dict", BUNKER_COL, BUNKER_ROW) as Dictionary
bunker_tile["biome_id"] = "hills"
bunker_tile["quality"] = DEPOSIT_TIER
_state.call("set_tile_dict", BUNKER_COL, BUNKER_ROW, bunker_tile)
grid.call("set_tile_dict", BUNKER_COL, BUNKER_ROW, bunker_tile)
var river_tile: Dictionary = _state.call("get_tile_dict", RIVER_COL, RIVER_ROW) as Dictionary
var river_tile: Dictionary = grid.call("get_tile_dict", RIVER_COL, RIVER_ROW) as Dictionary
river_tile["biome_id"] = "hills"
# river_edges isn't in set_tile_dict; mark via a river course directly.
river_tile["river_edges"] = [0, 3]
_state.call("set_tile_dict", RIVER_COL, RIVER_ROW, river_tile)
grid.call("set_tile_dict", RIVER_COL, RIVER_ROW, river_tile)
_state.call("set_grid_from_gridstate", grid)
# Build guard: river-course tile blocked, dry hills tile allowed.
_river_gap_blocked = bool(_state.call("bunker_river_gap_blocked", RIVER_COL, RIVER_ROW))
@ -171,8 +176,14 @@ func _check(font: Font, x: float, y: float, label: String, value: String, ok: bo
var mark: String = "[PASS]" if ok else "[FAIL]"
var mark_color: Color = Color(0.3, 0.95, 0.4) if ok else Color(1.0, 0.4, 0.4)
draw_string(font, Vector2(x, y), mark, HORIZONTAL_ALIGNMENT_LEFT, -1, 15, mark_color)
draw_string(font, Vector2(x + 70, y), label, HORIZONTAL_ALIGNMENT_LEFT, -1, 15, Color(0.85, 0.85, 0.85))
draw_string(font, Vector2(x + 540, y), value, HORIZONTAL_ALIGNMENT_LEFT, -1, 15, Color(0.75, 0.82, 0.55))
draw_string(
font, Vector2(x + 70, y), label,
HORIZONTAL_ALIGNMENT_LEFT, -1, 15, Color(0.85, 0.85, 0.85)
)
draw_string(
font, Vector2(x + 540, y), value,
HORIZONTAL_ALIGNMENT_LEFT, -1, 15, Color(0.75, 0.82, 0.55)
)
func _capture_and_quit() -> void: