Compose buildings from definitions and capabilities

This commit is contained in:
Loïc Wisniewski 2026-08-14 21:44:28 +02:00
commit 0504b24d8d
46 changed files with 1091 additions and 878 deletions

View file

@ -28,9 +28,9 @@ var elapsed: float = 0.0
# Extractor is excluded: it needs a planet underneath, which
# test_extractor_building covers in full.
const OPTIONS: Array = [
{"press": "_on_place_mothership", "type": "mothership", "title": "Mothership"},
{"press": "_on_place_crafter", "type": "ship_crafter", "title": "Ship Crafter"},
{"press": "_on_place_command_center", "type": "command_center", "title": "Command Center"},
{"type": "mothership", "title": "Mothership"},
{"type": "ship_crafter", "title": "Ship Crafter"},
{"type": "command_center", "title": "Command Center"},
]
@ -84,7 +84,7 @@ func _process(delta: float) -> bool:
var built_before: int = _count(type)
controller._on_build_pressed()
controller.call(option.press)
controller._show_building_info(type)
var informed: bool = popup.visible \
and title.text == option.title \
@ -111,7 +111,7 @@ func _process(delta: float) -> bool:
# --- reopening and confirming builds it ------------------
controller._on_build_pressed()
controller.call(option.press)
controller._show_building_info(type)
controller._confirm_build()
var built: bool = _count(type) == built_before + 1
var charged: bool = game_state.rocks == rocks_before - expected_cost