#162 - a single tap bought a research node outright. One physical tap arrives
TWICE: Godot emulates a mouse button from every touch AND a touch from every
mouse button, both project settings are on, and the menu's dispatcher routes
InputEventScreenTouch and InputEventMouseButton alike to the tree. The second
arrival found the node already selected and took itself for the confirming
tap. Measured, not reasoned about - one tap produced two picks and two
confirms.

What is ignored is specifically the TWIN: same frame, same place, arriving
through the other input kind. Deduping on frame and position alone also
swallowed two genuine taps in one frame, which the test caught.

#164 - the build menu predicted a caption's height from the COLUMN WIDTH:
wide column, assume one line. Right for most names and wrong for the long
ones, so "Spacial Workshop" wrapped onto the price beneath it. Captions are
now measured against the font that draws them, and prices sized from
PriceTag.wanted_height(), which existed for exactly this and was not being
asked. Prices are set before anything is measured, because the old order laid
out first and priced afterwards.

The ship lab: its buy button is gone and a second tap on an option buys it,
the same rule as the research tree; the explanation drops into the room that
freed; research points move up into the resource table, where everything else
being spent already is; the second row of options is placed from the first
row's measured bottom rather than a constant; and the vessel strip is spaced
from the panel's own width, so the eighth vessel is no longer half off the
right edge.

#160 - the quest panel was drawn BEFORE the sticks and the pivot pair, so
they sat on top of it. Moved after them, under the narration banner. Its title
rule ran straight through the close button; the header band is now as tall as
that button.

#161 - the prologue widens the formation into a freight convoy by writing over
GameState.formation, and nothing put it back. The player flew the convoy's
600-unit spread for the rest of the game - a shape nobody chose, which reads
as the fleet having drifted apart.

#163 - a quest to station a vessel at the outpost, after the one that asks for
the outpost. Building one and crewing it are different acts, and an empty
outpost holds nothing.

#165 - the gas bomb's blast and a vessel arriving fast both damage a
structure. The blast used to stop politely at anything the player owned, which
made a bomb dropped on a besieged mothership a free way to sweep the attackers
off it.

Collisions are caught on ENTRY, not on the 0.7s strike tick: a vessel is only
moving fast for the instant it arrives, and a ship sent in at 900 did no
damage at all until this moved. Docking is free - the fleet sits on its own
mothership constantly to bank ore - and garrison vessels are exempt outright,
because they launch from their outpost and re-dock with it at speed. The suite
caught that one: the ram rule was destroying the garrison as it launched.

Suite 153/153. Four tests changed because what they pinned moved: the lab's
buy button, the intro's formation, the research tree's tap delivery, and the
build menu's own preview.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-30 02:27:44 +02:00
commit 3fcc26c8bc
18 changed files with 645 additions and 173 deletions

View file

@ -22,6 +22,11 @@ const TEXT: Color = Color(0.82, 0.94, 1.0)
const DONE: Color = Color(0.55, 1.0, 0.68)
const MUTED: Color = Color(0.52, 0.66, 0.76)
const PAD: float = 34.0
# #160: the rule under the title used to sit at the title's own baseline,
# which is exactly where the window's close button is - the line ran straight
# through it. The header band is now as tall as the close button, so the rule
# clears it and the content starts below both.
const HEADER_HEIGHT: float = 150.0
const TITLE_SIZE: int = 40
const HEADING_SIZE: int = 22
const QUEST_SIZE: int = 34
@ -96,8 +101,10 @@ func _layout() -> void:
var inner: float = maxf(size.x - PAD * 2.0, 0.0)
var y: float = PAD
title_label.position = Vector2(PAD, y)
title_label.size = Vector2(inner, float(TITLE_SIZE) * 1.4)
y += float(TITLE_SIZE) * 2.2
# Short of the close button, so a long title wraps rather than running
# underneath it.
title_label.size = Vector2(maxf(inner - 140.0, 0.0), float(TITLE_SIZE) * 1.4)
y = HEADER_HEIGHT + PAD * 0.6
heading_label.position = Vector2(PAD, y)
heading_label.size = Vector2(inner, float(HEADING_SIZE) * 1.4)
y += float(HEADING_SIZE) * 1.8
@ -179,7 +186,7 @@ func _draw() -> void:
Vector2(0.0, size.y), Vector2(0.0, 0.0),
]), Color(GLOW, 0.8), 0.8, 0.8)
# A rule under the title, so the header reads as a header.
var rule_y: float = PAD + float(TITLE_SIZE) * 1.6
var rule_y: float = HEADER_HEIGHT
NeonDraw.draw_glowing_line(self, Vector2(PAD, rule_y), Vector2(size.x - PAD, rule_y),
Color(GLOW, 0.5), 0.6, 0.4)

View file

@ -21,6 +21,13 @@ const VALUE_FONT_SIZE: int = 24
const RULE_COLOR: Color = Color(0.25, 0.55, 0.7)
const FLEET_COLOR: Color = Color(1.0, 0.78, 0.25)
const LOCAL_COLOR: Color = Color(0.45, 0.9, 0.55)
# #164: research points belong up here with everything else the player is
# spending, rather than buried in a sentence at the bottom of whichever panel
# happens to mention them. They are NOT a resource - no inventory, no glyph in
# the catalog, nothing carries them - so they get a written mark and only the
# banked column, exactly the treatment PriceTag already gives them.
const POINT_COLOR: Color = Color(0.72, 0.62, 1.0)
const POINT_NAME: String = "RESEARCH"
var _header_labels: Array[Label] = []
var _rows: Dictionary = {}
@ -29,6 +36,7 @@ var _rows: Dictionary = {}
# list where it would only repeat another column - see _local_is_redundant().
const VALUE_KEYS: Array = ["bank", "fleet", "local"]
var _local_shown: bool = true
var _points_row: Dictionary = {}
func _ready() -> void:
@ -56,6 +64,12 @@ func _ready() -> void:
"fleet": fleet_label, "local": local_label,
}
var point_name := _make_label(POINT_NAME, NAME_FONT_SIZE, POINT_COLOR)
add_child(point_name)
var point_value := _make_value_label(POINT_COLOR)
add_child(point_value)
_points_row = {"name": point_name, "value": point_value}
resized.connect(_layout)
_layout()
queue_redraw()
@ -121,7 +135,8 @@ func _layout() -> void:
_header_labels[i].position = Vector2(columns[i], 0.0)
_header_labels[i].size = Vector2(widths[i], HEADER_HEIGHT)
var rows: float = maxf(1.0, float(_rows.size()))
# One row per resource, plus the research-point line.
var rows: float = maxf(1.0, float(_rows.size() + 1))
# The gap is taken OUT of the available height rather than added on top of
# each row, so the table still ends exactly where its box does however many
# resources the catalog grows to.
@ -143,6 +158,18 @@ func _layout() -> void:
label.position = Vector2(columns[i + 1], y)
label.size = Vector2(widths[i + 1], row_height)
row_index += 1
if not _points_row.is_empty():
var y: float = HEADER_HEIGHT + float(row_index) * row_height
var content_height: float = row_height - ROW_GAP
# Indented to where the resource NAMES start rather than where their
# glyphs do, so the column of words stays a column and the missing
# glyph reads as "not one of these" rather than as a gap.
_points_row.name.position = Vector2(content_height + 10.0, y)
_points_row.name.size = Vector2(resource_width - content_height - 10.0, row_height)
_points_row.value.position = Vector2(columns[1], y)
_points_row.value.size = Vector2(widths[1], row_height)
queue_redraw()
@ -161,6 +188,8 @@ func _process(_delta: float) -> void:
row.fleet.text = str(GameState.fleet_resource(resource_type))
row.local.text = str(GameState.building_resource(building_id, resource_type)) \
if building_id != 0 else "—"
if not _points_row.is_empty():
_points_row.value.text = str(GameState.research_points)
static func natural_height() -> float:

View file

@ -53,6 +53,25 @@ const WHEEL_STEP: float = 90.0
# the second one is never a blind commitment.
signal node_confirmed(id: String)
# One physical tap arrives TWICE. Godot emulates a mouse button from every
# touch and a touch from every mouse button - both settings are on - and the
# menu's dispatcher routes InputEventScreenTouch and InputEventMouseButton
# here alike. The second arrival found the node already selected and took it
# for the confirming tap, so a single tap bought the research outright: the
# exact thing the two-tap rule exists to prevent (#162). Measured, not
# guessed - one tap produced two picks and two confirms.
#
# What is ignored is specifically the TWIN: a press at the same place, in the
# same frame, arriving through the OTHER input kind. Two presses of the same
# kind are always two taps however close together they are, so a player
# tapping twice quickly is never swallowed. Deduping on frame and position
# alone did swallow it, which the test caught.
enum PressSource { TOUCH, MOUSE }
var _last_press_frame: int = -1
var _last_press_at: Vector2 = Vector2.ZERO
var _last_press_source: int = -1
var selected_id: String = ""
var scroll_y: float = 0.0
var _dragging: bool = false
@ -144,7 +163,7 @@ func _state_color(node: Dictionary) -> Color:
# Returns true when the press landed on a node, so the caller knows the
# touch was consumed.
func handle_touch(event: InputEventScreenTouch) -> bool:
return handle_press(event.pressed, event.position)
return handle_press(event.pressed, event.position, PressSource.TOUCH)
func handle_drag(event: InputEventScreenDrag) -> bool:
@ -160,7 +179,7 @@ func handle_mouse_button(event: InputEventMouseButton) -> bool:
return handle_pan(Vector2(0.0, -WHEEL_STEP))
if event.button_index != MOUSE_BUTTON_LEFT:
return false
return handle_press(event.pressed, event.position)
return handle_press(event.pressed, event.position, PressSource.MOUSE)
# Only while the button is held. A touch drag cannot arrive without a finger
@ -173,12 +192,14 @@ func handle_mouse_motion(event: InputEventMouseMotion) -> bool:
return handle_pan(event.relative)
func handle_press(pressed: bool, at: Vector2) -> bool:
func handle_press(pressed: bool, at: Vector2, source: int = PressSource.TOUCH) -> bool:
if not visible:
return false
if not pressed:
_dragging = false
return true
if _is_emulated_twin(at, source):
return true
_dragging = true
var local: Vector2 = at - global_position
for node in GameState.SKILL_TREE:
@ -193,6 +214,20 @@ func handle_press(pressed: bool, at: Vector2) -> bool:
return false
# True only for the emulated twin: same frame, same place, other input kind.
func _is_emulated_twin(at: Vector2, source: int) -> bool:
var frame: int = Engine.get_process_frames()
var twin: bool = frame == _last_press_frame \
and source != _last_press_source \
and at.distance_to(_last_press_at) < 24.0
if twin:
return true
_last_press_frame = frame
_last_press_at = at
_last_press_source = source
return false
func handle_pan(relative: Vector2) -> bool:
if not visible:
return false