#166-#173: plainer words, a point to shoot at, and a catalog that says when it is broken
Eight tickets. The last one is the interesting one. #166 - PLAINER DIALOG. Every spoken line rewritten: the nine prologue lines and all twenty quest brief/done pairs. Mostly splitting em-dash subclauses into sentences and dropping the literary register ("hulls" -> "ships", "That is our hands back" -> "That frees us for other work"). Same meaning, same voice. #167 - NOTHING ANNOUNCED TWICE. Quests carry an `important` flag; seven of the twenty have it, and they are the search for the World Ship. A quest handed out with its goal ALREADY met is now credited in silence unless it is one of those - no brief, no answer, both signals still fired and the index still moved, so it appears ticked in the objectives panel. The chain used to stop the game to set a task the player had already done, then stop it again to congratulate them on it. #168 - THE KEYBOARD CAN ANSWER A DIALOG. The rule the ticket asks for (still arriving, show it all; already whole, move on) was already the rule for a click since #149, but a key press reached the banner and did nothing - and this game is played with WASD and a mouse. Touch, click and key now go through one door. Modifiers alone and auto-repeat echoes are not presses. #169 - A LOADING SCREEN. A press raises a cover, and the load happens after it has been on screen for a frame, so the wait is something the player is watching. Deliberately still a blocking load: load_threaded_request() comes back FAILED for these scenes, reporting text-parse errors that load() does not produce, because the global class names and preloads they reach each other through are not resolvable off the loading thread. A progress bar is not worth a menu that sometimes refuses to start the game, and the web build ships with thread support off anyway. Further presses while loading are ignored - on the web a button fires on PRESS, so an impatient double tap costs nothing to make and used to build the world twice. #170 - THE PICTURE BEFORE THE CAPTION. The prologue's first line was up before the scene had finished arriving, so the game opened STOPPED (#128) over a convoy nobody had seen yet. It flies for three seconds first. #171 - THE CONTROLS FOLLOW WHAT IS BEING HELD. is_touchscreen_available() asks whether a touch COULD arrive, and in a browser that is yes on any laptop whose panel reports touch support - so the web build put thumb sticks over a screen being played with a mouse, and switched mouse aiming off on the machine it exists for. The reading is now the last input actually used, it lives in GameState so the sticks and the guns cannot disagree, and it is two-way: nothing can strand a tablet, because the gesture that needs the controls is the gesture that brings them back. A touch suppresses mouse evidence for a second, so the click Godot manufactures out of a tap is not mistaken for a mouse. #172 - AIM AT A PLACE. Every gun was handed the same direction, so a fleet firing at something threw a sheet of parallel bolts past either side of it and only the middle hull could hit - worse the wider the formation. Guns now take a POINT and each hull works out its own heading to it, so the fleet's fire converges. The mouse already had a place and was flattening it into a bearing; a pushed stick names the point at the guns' reach along it, so touch loses nothing. The assist (#89) still bends a shot onto an enemy, now per hull and around that hull's own heading. The aim guide stops at the point and marks it. #173 - AND THE ONE THAT EXPLAINS ITSELF. "In the web export version the fleet can not store any resources" is not a web bug. It is the third time the Godot editor's .tres writer has quietly dropped a property it thought was default-valued: InterceptorVesselDefinition losing `capabilities` leaves cargo_capacity at 20 and takes away the "cargo" claim that fleet_cargo_capacity() actually gates on, so the hold is zero and nothing can be mined or carried. That is the symptom, word for word. test_definitions_intact caught it in the suite. What it could not do is catch it in a BUILD - an export is taken from the working tree at whatever moment the editor last touched it, which is exactly when the damage is done and exactly where nobody is running tests. The checks move to core/CatalogCheck.gd and now run at startup in every build as well as in the test, from the same function. On the web push_error lands in the on-page log web_shell.html mirrors, which is the only error a phone can read. The tree is intact today, so a fresh export should restore the hold. The point of the change is that the next time it is not, the build says so. Full suite green at 154/154. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139MmxRAJSUe1j77kftAWv3
This commit is contained in:
parent
3fcc26c8bc
commit
0fad1dd155
24 changed files with 1372 additions and 286 deletions
|
|
@ -2,6 +2,11 @@ extends Node2D
|
|||
|
||||
# Points every armed vessel's gun wherever the right-hand stick is pushed.
|
||||
#
|
||||
# #172: what it points them at is a PLACE, not a heading. The mouse names one
|
||||
# directly; a pushed stick names the one at the guns' reach along it. Each hull
|
||||
# then works out its own heading to that place, so the fleet's fire converges
|
||||
# there instead of leaving in parallel - see VesselWeaponComponent.
|
||||
#
|
||||
# The fleet's guns used to seek their own targets and fire on their own. That
|
||||
# made combat something that happened TO the player rather than something they
|
||||
# did, and left the right half of the screen with nothing on it. Aiming is now
|
||||
|
|
@ -20,6 +25,12 @@ const GUIDE_DASH: float = 14.0
|
|||
const GUIDE_GAP: float = 16.0
|
||||
const GUIDE_WIDTH: float = 2.0
|
||||
const GUIDE_COLOR: Color = Color(1.0, 0.55, 0.38, 0.28)
|
||||
# #172: the fleet aims at a PLACE now, so the guide ends in a mark on that
|
||||
# place rather than trailing off into the dark. Four ticks around a gap, not
|
||||
# a filled dot - the thing being aimed at has to stay visible inside it.
|
||||
const RETICLE_RADIUS: float = 22.0
|
||||
const RETICLE_TICK: float = 11.0
|
||||
const RETICLE_COLOR: Color = Color(1.0, 0.62, 0.42, 0.55)
|
||||
|
||||
# By path rather than by class name, for the load-order reason documented in
|
||||
# PlanetSetups and elsewhere.
|
||||
|
|
@ -30,33 +41,82 @@ const WEAPON_COMPONENT = preload("res://vessels/VesselWeaponComponent.gd")
|
|||
# runs - the guns simply stay quiet, which is the correct resting state.
|
||||
@onready var stick: Node = get_node_or_null("../UI/FireStick")
|
||||
|
||||
# The guide's heading, measured from the fleet's centre to the aimed point.
|
||||
# Derived rather than input since #172 - it is what gets DRAWN, not what gets
|
||||
# fired: each hull works out its own heading to the point (see
|
||||
# VesselWeaponComponent.firing_heading).
|
||||
var aim_direction: Vector2 = Vector2.ZERO
|
||||
# Where the fleet is shooting, in world space, and whether it is shooting at
|
||||
# all. #172: a place, not a heading, so the fleet's fire converges on it.
|
||||
var aim_point: Vector2 = Vector2.ZERO
|
||||
var has_aim: bool = false
|
||||
# Set by MouseCombatController (#80) when a desktop player holds the left
|
||||
# button. Kept as a second input rather than a second aimer, so there is still
|
||||
# exactly one thing in the scene that points a gun.
|
||||
var external_direction: Vector2 = Vector2.ZERO
|
||||
# button: the world point under the cursor, which is already a place and needs
|
||||
# no converting. Kept as a second input rather than a second aimer, so there is
|
||||
# still exactly one thing in the scene that points a gun.
|
||||
var external_target: Vector2 = Vector2.ZERO
|
||||
var has_external_target: bool = false
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var direction: Vector2 = stick.direction if stick != null else Vector2.ZERO
|
||||
if direction == Vector2.ZERO:
|
||||
var was_aiming: bool = has_aim
|
||||
if direction != Vector2.ZERO:
|
||||
# The stick wins when both are live: a finger on it is a deliberate
|
||||
# act, a mouse resting somewhere is not.
|
||||
direction = external_direction
|
||||
aim(direction)
|
||||
aim_at(stick_point(direction))
|
||||
elif has_external_target:
|
||||
aim_at(external_target)
|
||||
else:
|
||||
hold_fire()
|
||||
# The guide starts at the fleet, which is usually moving, so this redraws
|
||||
# while aiming rather than only when the heading changes. Once the stick is
|
||||
# released it redraws once more to clear the line, then stops.
|
||||
var was_aiming: bool = aim_direction != Vector2.ZERO
|
||||
aim_direction = direction
|
||||
if direction != Vector2.ZERO or was_aiming:
|
||||
if has_aim or was_aiming:
|
||||
queue_redraw()
|
||||
|
||||
|
||||
# #172: a stick reports a heading, and the guns want a place. The place is at
|
||||
# the guns' own reach along that heading - far enough out that a pushed stick
|
||||
# still reads as "everything that way", and near enough that the fleet's fire
|
||||
# meets rather than spreading for ever.
|
||||
func stick_point(direction: Vector2) -> Vector2:
|
||||
if fleet == null or direction == Vector2.ZERO:
|
||||
return Vector2.ZERO
|
||||
return fleet.get_centroid() + direction.normalized() * maxf(guide_range(), 1.0)
|
||||
|
||||
|
||||
# Also the entry point for anything driving the guns without a stick - tests
|
||||
# aim through this rather than reaching into each weapon component, so what
|
||||
# they exercise is the same path the stick uses.
|
||||
# they exercise is the same path the stick uses. Takes a HEADING, which is
|
||||
# what a stick has; aim_at() takes the place it resolves to.
|
||||
func aim(direction: Vector2) -> void:
|
||||
if direction == Vector2.ZERO:
|
||||
hold_fire()
|
||||
return
|
||||
aim_at(stick_point(direction))
|
||||
|
||||
|
||||
# Points every armed hull at one place. Each works out its own heading to it,
|
||||
# which is the whole of #172: two ships either side of a target now both hit
|
||||
# it instead of both missing it by half the gap between them.
|
||||
func aim_at(point: Vector2) -> void:
|
||||
if fleet == null:
|
||||
return
|
||||
aim_point = point
|
||||
has_aim = true
|
||||
aim_direction = point - fleet.get_centroid()
|
||||
for ship in fleet.ships:
|
||||
if not is_instance_valid(ship):
|
||||
continue
|
||||
var weapon: Node = ship.get_component("weapon")
|
||||
if weapon != null:
|
||||
weapon.aim_at(point)
|
||||
|
||||
|
||||
func hold_fire() -> void:
|
||||
has_aim = false
|
||||
aim_direction = Vector2.ZERO
|
||||
if fleet == null:
|
||||
return
|
||||
for ship in fleet.ships:
|
||||
|
|
@ -64,7 +124,7 @@ func aim(direction: Vector2) -> void:
|
|||
continue
|
||||
var weapon: Node = ship.get_component("weapon")
|
||||
if weapon != null:
|
||||
weapon.set_fire_direction(direction)
|
||||
weapon.hold_fire()
|
||||
|
||||
|
||||
# How far the guide reaches: the actual range of a gun that is actually
|
||||
|
|
@ -80,7 +140,8 @@ func guide_range() -> float:
|
|||
|
||||
|
||||
func _draw() -> void:
|
||||
if aim_direction == Vector2.ZERO or fleet == null or fleet.ships.is_empty():
|
||||
if not has_aim or aim_direction == Vector2.ZERO or fleet == null \
|
||||
or fleet.ships.is_empty():
|
||||
return
|
||||
var reach: float = guide_range()
|
||||
if reach <= 0.0:
|
||||
|
|
@ -90,12 +151,29 @@ func _draw() -> void:
|
|||
# the line keeps telling the truth about where fire is going (#89).
|
||||
var heading: Vector2 = WEAPON_COMPONENT.assisted_heading(get_tree(), origin,
|
||||
aim_direction, reach)
|
||||
# #172: the line stops at the aimed PLACE when that is inside the guns'
|
||||
# reach. Running it on to full range past a point the fleet is converging
|
||||
# on would be drawing a direction again, which is what the ticket took
|
||||
# away. Beyond reach it stops at reach, as it always did - the guide never
|
||||
# promises further than the guns carry (#86).
|
||||
var length: float = minf(aim_direction.length(), reach)
|
||||
var travelled: float = GUIDE_GAP
|
||||
while travelled < reach:
|
||||
var dash_end: float = minf(travelled + GUIDE_DASH, reach)
|
||||
while travelled < length:
|
||||
var dash_end: float = minf(travelled + GUIDE_DASH, length)
|
||||
draw_line(origin + heading * travelled, origin + heading * dash_end,
|
||||
GUIDE_COLOR, GUIDE_WIDTH, true)
|
||||
travelled = dash_end + GUIDE_GAP
|
||||
_draw_reticle(origin + heading * length)
|
||||
|
||||
|
||||
# Four ticks around the aimed point, open in the middle so whatever is being
|
||||
# shot at stays visible inside them.
|
||||
func _draw_reticle(at: Vector2) -> void:
|
||||
for step in range(4):
|
||||
var out: Vector2 = Vector2.RIGHT.rotated(TAU * float(step) / 4.0)
|
||||
draw_line(at + out * RETICLE_RADIUS,
|
||||
at + out * (RETICLE_RADIUS + RETICLE_TICK),
|
||||
RETICLE_COLOR, GUIDE_WIDTH, true)
|
||||
|
||||
|
||||
func is_firing() -> bool:
|
||||
|
|
|
|||
|
|
@ -172,22 +172,38 @@ func _handle_key(event: InputEventKey) -> void:
|
|||
|
||||
|
||||
# #85: on a computer the on-screen sticks and the pivot pair are dead weight -
|
||||
# WASD steers, the mouse aims, Q/E pivot. They are taken away together, once,
|
||||
# the first time the player uses a keyboard or a mouse.
|
||||
# WASD steers, the mouse aims, Q/E pivot.
|
||||
#
|
||||
# Two guards, both deliberate. A touch device that ALSO has a keyboard keeps
|
||||
# everything, because a finger is still a way to play it. And a device wrongly
|
||||
# reported as non-touch keeps its controls until the player has demonstrably
|
||||
# used something else - so nobody is ever left with no way to steer or shoot.
|
||||
# #171: they now come and GO, rather than being taken away once and for all.
|
||||
#
|
||||
# The old rule asked DisplayServer.is_touchscreen_available() and, if it said
|
||||
# yes, kept everything for ever - because the failure to avoid is a phone left
|
||||
# with no way to steer. In a browser that query says yes on half the laptops
|
||||
# in the world, so the web build showed thumb sticks to people holding a
|
||||
# mouse, which is the ticket. It also could not be undone: a wrong answer the
|
||||
# other way stranded a tablet with no controls until it was restarted.
|
||||
#
|
||||
# Following the LAST INPUT ACTUALLY USED fixes both ends. Touch the screen and
|
||||
# the controls are there; use the mouse or the keyboard and they go. Nobody is
|
||||
# ever stranded, because the gesture that needs them is the same gesture that
|
||||
# brings them back, and it takes one tap. GameState owns the reading (see
|
||||
# note_touch_input) so the mouse-aiming gate cannot disagree with this.
|
||||
func _note_keyboard() -> void:
|
||||
if keyboard_seen:
|
||||
return
|
||||
keyboard_seen = true
|
||||
if DisplayServer.is_touchscreen_available():
|
||||
return
|
||||
GameState.note_pointer_input()
|
||||
_sync_touch_controls()
|
||||
|
||||
|
||||
func _note_touch() -> void:
|
||||
GameState.note_touch_input()
|
||||
_sync_touch_controls()
|
||||
|
||||
|
||||
func _sync_touch_controls() -> void:
|
||||
var offered: bool = GameState.pointer_is_touch
|
||||
for control in [joystick, fire_stick, pivot_cw_button, pivot_ccw_button]:
|
||||
if control != null:
|
||||
control.visible = false
|
||||
if control != null and control.visible != offered:
|
||||
control.visible = offered
|
||||
|
||||
|
||||
func _button_holds(button: IconButton, at_position: Vector2) -> bool:
|
||||
|
|
@ -339,6 +355,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
|
||||
|
||||
func _handle_touch(event: InputEventScreenTouch) -> void:
|
||||
# #171: a finger on the glass is the one unambiguous piece of evidence
|
||||
# that this is a touch device being played by touch, and it is recorded
|
||||
# before anything gets a chance to claim the event - a touch swallowed by
|
||||
# the joystick is still a touch.
|
||||
_note_touch()
|
||||
# The joystick gets first refusal on every touch, and only claims ones
|
||||
# that begin inside its own rect - so pinch-to-zoom still works anywhere
|
||||
# else on screen.
|
||||
|
|
@ -372,6 +393,8 @@ func _handle_touch(event: InputEventScreenTouch) -> void:
|
|||
|
||||
|
||||
func _handle_drag(event: InputEventScreenDrag) -> void:
|
||||
# A finger moving on the glass, same as a finger arriving on it (#171).
|
||||
_note_touch()
|
||||
if gas_bomb_controller != null and gas_bomb_controller.handle_drag(event):
|
||||
return
|
||||
if laser_controller != null and laser_controller.handle_drag(event):
|
||||
|
|
|
|||
|
|
@ -10,10 +10,15 @@ extends Node2D
|
|||
#
|
||||
# Touch is unaffected, and deliberately so: Godot emulates a mouse button from
|
||||
# every touch, so without a guard a tap anywhere on a phone would fire the
|
||||
# guns. The guard is the presence of a touchscreen rather than a "has used a
|
||||
# mouse" flag, because the wrong answer has to fail safe - a desktop wrongly
|
||||
# reported as touch-capable loses a convenience, while a phone wrongly treated
|
||||
# as a desktop fires its weapons at every tap.
|
||||
# guns.
|
||||
#
|
||||
# #171 changed what that guard asks. It used to be the presence of a
|
||||
# touchscreen, which fails safe but fails often: a desktop browser reporting a
|
||||
# touch-capable panel switched mouse aiming off on exactly the machine it was
|
||||
# written for. It now asks what the player last actually used
|
||||
# (GameState.pointer_is_touch), which still fails safe - a tap makes the
|
||||
# reading "touch" before the emulated click arrives, so a phone can never fire
|
||||
# through this path - and stops being wrong about desktops.
|
||||
|
||||
# A literal, not PackedStringArray(...): a constructor call is not a constant
|
||||
# expression, and the script fails to PARSE rather than to run - which shows up
|
||||
|
|
@ -42,11 +47,11 @@ func _ready() -> void:
|
|||
abilities.append(controller)
|
||||
|
||||
|
||||
# AUTO decides from the display, which is what every scene ships with. The
|
||||
# explicit settings exist because "is there a touchscreen" is not a question
|
||||
# that can be answered honestly in every environment - headless reports one,
|
||||
# so with AUTO alone the aiming below could never be exercised by a test at
|
||||
# all, and the only covered behaviour would be the guard itself.
|
||||
# AUTO follows the last input the player actually used, which is what every
|
||||
# scene ships with. The explicit settings exist because that reading is seeded
|
||||
# from the display in an environment - headless - where the answer varies by
|
||||
# platform, so with AUTO alone the aiming below could never be exercised by a
|
||||
# test at all, and the only covered behaviour would be the guard itself.
|
||||
enum PointerMode { AUTO, ON, OFF }
|
||||
|
||||
@export var pointer_mode: PointerMode = PointerMode.AUTO
|
||||
|
|
@ -58,7 +63,7 @@ func is_enabled() -> bool:
|
|||
return true
|
||||
PointerMode.OFF:
|
||||
return false
|
||||
return not DisplayServer.is_touchscreen_available()
|
||||
return not GameState.pointer_is_touch
|
||||
|
||||
|
||||
func weapon_count() -> int:
|
||||
|
|
@ -117,7 +122,11 @@ func _process(_delta: float) -> void:
|
|||
# there is still exactly one thing in the scene that aims a gun. The stick
|
||||
# wins when both are live - a finger on it is a deliberate act, while a
|
||||
# mouse merely resting somewhere is not.
|
||||
var heading: Vector2 = Vector2.ZERO
|
||||
if is_enabled() and firing and selected_weapon == 0 and not fleet.ships.is_empty():
|
||||
heading = aim_world - fleet.get_centroid()
|
||||
fire_stick_controller.external_direction = heading
|
||||
#
|
||||
# #172: the cursor's world position goes across as a PLACE. It always was
|
||||
# one; it used to be flattened into a heading from the fleet's centre on
|
||||
# the way out, which threw away the distance and made every hull fire
|
||||
# parallel past the thing being clicked on.
|
||||
fire_stick_controller.has_external_target = is_enabled() and firing \
|
||||
and selected_weapon == 0 and not fleet.ships.is_empty()
|
||||
fire_stick_controller.external_target = aim_world
|
||||
|
|
|
|||
Loading…
Reference in a new issue