Refine context actions and preserve fleet landings

This commit is contained in:
Loïc Wisniewski 2026-08-14 23:15:12 +02:00
commit 663648d949
20 changed files with 197 additions and 103 deletions

View file

@ -34,7 +34,8 @@ func _ready() -> void:
enter_button.pressed.connect(_on_enter_pressed)
if GameState.has_return_position:
fleet.spawn_ships(GameState.surviving_ship_count, GameState.return_world_position)
fleet.spawn_ships(GameState.surviving_ship_count, GameState.return_world_position,
GameState.surviving_vessel_types)
camera.position = GameState.return_world_position
camera.zoom = Vector2(GameState.return_camera_zoom, GameState.return_camera_zoom)
GameState.has_return_position = false
@ -57,16 +58,12 @@ func _process(delta: float) -> void:
return
if world_map.visible or build_controller.is_showing_building_prompt():
# EnterAtmosphereButton shares one "action" slot with the map's
# RecenterButton and with BuildController's building prompt - it doesn't make sense to enter
# a planet's atmosphere while looking at the star map anyway, so
# suppress the prompt entirely rather than let it sit hidden
# behind the map's backdrop only to pop back in the instant the
# map closes.
# Context actions belong to BuildController. This controller owns the
# debounced planet selection and label, and suppresses both while a modal
# screen is open.
current_planet = null
pending_planet = null
planet_name_label.visible = false
enter_button.visible = false
return
# Debounced: only commit a visible/hidden change once the raw
@ -90,10 +87,8 @@ func _process(delta: float) -> void:
if current_planet != null:
planet_name_label.text = current_planet.planet_name
planet_name_label.visible = true
enter_button.visible = true
else:
planet_name_label.visible = false
enter_button.visible = false
func _on_enter_pressed() -> void:
@ -105,6 +100,7 @@ func _on_enter_pressed() -> void:
GameState.has_return_position = true
GameState.surviving_ship_count = fleet.ships.size()
GameState.surviving_vessel_types = fleet.vessel_types()
# The planet's own position, not fleet.get_centroid() - the fleet only
# needs to be somewhere within the planet's landing radius (not
# centered exactly on it) for the prompt to show, so the centroid can