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

@ -67,7 +67,7 @@ func _process(delta: float) -> bool:
return false
# --- first one: informed, then built -------------------------
controller._on_build_pressed()
controller._on_place_mothership()
controller._show_building_info(GameState.BUILDING_MOTHERSHIP)
var first_text: String = popup.get_node("Panel/MessageLabel").text.to_lower()
var first_warned: bool = "destroy" in first_text
print("first: popup=%s warned=%s built_before_confirm=%d" % [
@ -86,7 +86,7 @@ func _process(delta: float) -> bool:
# --- second: warns, builds nothing ---------------------------
_place_fleet(second_pos)
controller._on_build_pressed()
controller._on_place_mothership()
controller._show_building_info(GameState.BUILDING_MOTHERSHIP)
var warned: bool = popup.visible and "destroy" in popup.get_node("Panel/MessageLabel").text.to_lower()
print("second press: warned=%s motherships=%d" % [warned, _count_motherships()])
if not warned or _count_motherships() != 1:
@ -107,7 +107,7 @@ func _process(delta: float) -> bool:
# --- confirming replaces -------------------------------------
var rocks_before: int = game_state.rocks
controller._on_place_mothership()
controller._show_building_info(GameState.BUILDING_MOTHERSHIP)
controller._confirm_build()
var only_one: bool = _count_motherships() == 1
var moved: bool = game_state.get_mothership_position().distance_to(second_pos) < 60.0
@ -124,7 +124,7 @@ func _process(delta: float) -> bool:
game_state.rocks = GameState.MOTHERSHIP_COST - 1
_place_fleet(Vector2(2500.0, -800.0))
controller._on_build_pressed()
controller._on_place_mothership()
controller._show_building_info(GameState.BUILDING_MOTHERSHIP)
# With nothing affordable there is no confirm button to press;
# pressing it anyway must still do nothing.
var offered: bool = popup.get_node("Panel/BuildButton").visible