Seat the HUD button columns below the resource readout, and move the planet name

The build button overlapped the resource list. ResourceReadout builds one
row per resource type AT RUNTIME (58px each), so how far down it reaches is
not knowable when the scene is authored: PlanetSurface/Main declared
offset_bottom 154, four resources actually reach 270, and BuildButton sat
at a hardcoded 160. A 110px collision that grew with every resource type
added. Because the readout spans the full width - the fleet hold column is
at x 356 - it hit both button columns, TransferButton and
EnterAtmosphereButton as well as the left one.

Rather than nudge the offsets, the layout now derives from the readout:
ResourceReadout.rows_height()/content_bottom() report the real extent and
_ready() stops the node understating its own size, and
BuildController._seat_hud_columns() seats both columns below that at load.
Adding a fifth resource type pushes the buttons down on its own, so the
overlap cannot come back.

Two details worth keeping: the height is derived from the live resource
list rather than cached in _ready(), because BuildController readies before
UI's children in scene-tree order and a cached value would answer zero. And
it translates the block rather than re-flowing it, since
BuildingActionButton and HangarButton deliberately share a row as mutually
exclusive options.

The planet name moved from the centre - where it sat across resource rows
3 and 4 - to the top-right corner, right-aligned. Right alignment is what
keeps it clear: short names sit against the right edge, well clear of the
fleet hold column, and long ones wrap downward into empty space rather than
growing left into it. That scene edit rode along in the #68 commit, both
being changes to PlanetSurface.tscn.

Also adds three .uid files orphaned by earlier commits this session; the
repo tracks them for every other script.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-17 23:20:51 +02:00
commit 75b7603f04
5 changed files with 72 additions and 0 deletions

View file

@ -61,6 +61,26 @@ func _ready() -> void:
y += ROW_HEIGHT
# Stop understating our own extent. The rows are drawn by child nodes,
# which happily paint outside this Control's rect, so the scene-authored
# height stayed at its original guess no matter how many rows appeared.
size.y = rows_height()
# How tall the rows are, derived from the live resource list rather than from
# whatever _ready() happened to have built. That matters: _ready() runs in
# scene-tree order, so a sibling laying itself out relative to this readout
# (BuildController._seat_hud_columns) can legitimately ask BEFORE this node
# has built anything, and a cached height would answer zero.
func rows_height() -> float:
return float(GameState.resource_types().size()) * ROW_HEIGHT
# Bottom edge of the rows in this Control's parent space - the line anything
# stacked below the readout has to clear.
func content_bottom() -> float:
return position.y + rows_height()
func _add_glyph(resource_type: String, at: Vector2) -> void:
var glyph: ResourceGlyph = ResourceGlyph.new()