#108: the prologue - the convoy, the ambush, and the breach
Landed as one piece across #122, #123 and #124: the frame is useless without a script, and the script has nowhere to run without the frame. The director drives the REAL scene rather than being a scene of its own. It wants the real fleet, the real enemies and the real asteroid field, and it makes "then the game starts" cost nothing - the director stops steering, clears the flag, and what is left running is the ordinary game. The script is a list of beats, each with a deadline as well as its own completion test, so a beat whose condition is never met - a player who refuses to fly at the ambush - runs out rather than wedging the prologue. skip() ends the whole thing at any point and lands in exactly the state playing it through does, so the game has one way to start rather than two that have to be kept in step. The test pins that equivalence. "No action button available, only movements" is enforced where the buttons are decided, not by the director reaching in: the ability controllers set their own visibility every frame and would have put them straight back, and the map button belongs to the map. The joystick, the pivot and the fader stay. The convoy is ten hulls where a new game's fleet is one, so it needs an explicit fleet-size override - a plain number rather than a fake doctrine, because nothing about the player's own progression should be bent to fit a cutscene. It is carriers rather than transporters: transporters belong to hubs and are not fleet-eligible, so a convoy of them would be silently filtered down to its escorts. The ambush is chasers and only chasers. "Easy enough" is the requirement, and a sniper against a convoy the player cannot yet fight properly is neither easy nor a good first impression. The breach takes the wheel through one check in GameController, covering the stick, the keyboard and the released-again path together - three separate gates would be three chances for one of them to keep steering. The shake is written to camera.offset, never to its position, because GameController owns where the camera is and would smooth a shake away. The vessel that survives is chosen as the interceptor rather than whichever happened to be first in the list, and the prologue ends on exactly a new game's opening position. Also: PlanetAtmosphereController no longer spawns the opening fleet while the prologue is arming, and the tests that are about what the GAME starts from now say so by turning the prologue off. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d8982fb800
commit
209169206b
14 changed files with 885 additions and 9 deletions
|
|
@ -33,7 +33,10 @@ func _ready() -> void:
|
|||
|
||||
func _process(delta: float) -> void:
|
||||
var had_visuals: bool = aiming or _has_effect_visuals()
|
||||
button.visible = fleet.has_capability(_component_id())
|
||||
# #122: "there's no action button available, only movements". Checked
|
||||
# here rather than by the director reaching in, because this line runs
|
||||
# every frame and would put the button straight back.
|
||||
button.visible = fleet.has_capability(_component_id()) and not GameState.intro_active
|
||||
button.enabled = _next_ready_ship() != null and _can_afford_shot()
|
||||
if not button.visible and aiming:
|
||||
_cancel_aim()
|
||||
|
|
|
|||
|
|
@ -397,6 +397,19 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
func _process(delta: float) -> void:
|
||||
_check_fleet_wipe()
|
||||
|
||||
# #122: the prologue leaves the player movement and nothing else. Handled
|
||||
# at the top, before any of the context detection below, so nothing can
|
||||
# turn a button back on further down.
|
||||
if GameState.intro_active:
|
||||
_hide_all_actions()
|
||||
return
|
||||
# Build is permanently under the resource counter (see
|
||||
# _layout_context_buttons) - it is the one action button nothing else
|
||||
# ever hides, so the prologue taking it away is the only thing that has
|
||||
# to give it back.
|
||||
if not build_button.visible:
|
||||
build_button.visible = true
|
||||
|
||||
if build_menu.visible:
|
||||
# Keep the greyed state live while the menu is open, so flying onto
|
||||
# a planet lights the option up without reopening it.
|
||||
|
|
@ -735,6 +748,21 @@ func _refresh_build_option_states() -> void:
|
|||
entry[1].queue_redraw()
|
||||
|
||||
|
||||
# Everything the player can PRESS, as opposed to steer with. Used by the
|
||||
# prologue (#122), which takes them all away at once.
|
||||
func _hide_all_actions() -> void:
|
||||
current_building = null
|
||||
pending_building = null
|
||||
current_extractor_index = -1
|
||||
pending_extractor_index = -1
|
||||
current_landing_planet = null
|
||||
context_actions_expanded = false
|
||||
for control in [build_button, action_button, building_action_button,
|
||||
landing_button, transfer_button, hangar_button]:
|
||||
if control != null:
|
||||
control.visible = false
|
||||
|
||||
|
||||
func _close_build_menu() -> void:
|
||||
# The popup is a child panel of this menu; leaving it "open" while its
|
||||
# parent is hidden is what blocked every button in the game.
|
||||
|
|
|
|||
|
|
@ -250,15 +250,13 @@ func _process(delta: float) -> void:
|
|||
# anchor in _process, so this only needs to report the direction. The
|
||||
# keyboard takes precedence, and releasing the keys has to stop the fleet
|
||||
# itself - unlike the stick, there is no centred-again signal to hook.
|
||||
var keyed: Vector2 = keyboard_direction()
|
||||
if keyed != Vector2.ZERO:
|
||||
keyboard_steering = true
|
||||
fleet.move_in_direction(keyed)
|
||||
elif keyboard_steering:
|
||||
# #124: the breach drives. One check here covers the stick, the keyboard
|
||||
# and the released-again path together - three separate gates would be
|
||||
# three chances for one of them to keep steering.
|
||||
if GameState.intro_locks_movement:
|
||||
keyboard_steering = false
|
||||
fleet.stop()
|
||||
elif joystick != null and joystick.direction != Vector2.ZERO:
|
||||
fleet.move_in_direction(joystick.direction)
|
||||
else:
|
||||
_apply_steering()
|
||||
|
||||
var target: Vector2 = fleet.get_centroid()
|
||||
if camera.global_position.distance_to(target) <= camera_snap_distance:
|
||||
|
|
@ -272,6 +270,18 @@ func _process(delta: float) -> void:
|
|||
camera.global_position = camera.global_position.lerp(target, t)
|
||||
|
||||
|
||||
func _apply_steering() -> void:
|
||||
var keyed: Vector2 = keyboard_direction()
|
||||
if keyed != Vector2.ZERO:
|
||||
keyboard_steering = true
|
||||
fleet.move_in_direction(keyed)
|
||||
elif keyboard_steering:
|
||||
keyboard_steering = false
|
||||
fleet.stop()
|
||||
elif joystick != null and joystick.direction != Vector2.ZERO:
|
||||
fleet.move_in_direction(joystick.direction)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventScreenTouch:
|
||||
_handle_touch(event)
|
||||
|
|
|
|||
Loading…
Reference in a new issue