#136, #137, #134: one build grid that cannot stack, one way to show a price

#136 - the gas burner drawn on top of the transport hub. The build menu's
rows were a written-down list of tops read with `tops[mini(row, size - 1)]`,
and with every structure researched the menu wanted a fourth row where the
list had three, so the last entry was placed on the third row's centre slot.
A list that silently stacks whatever will not fit in it is not a layout.
Rows are computed now, from a first top and a pitch that tightens to fit and
is floored at the row's own height - so two rows cannot occupy the same
space however far the catalog grows - and the column count widens rather
than adding a row the band cannot hold. Ten structures now sit in four
columns of three rows. The test unlocks the whole tree and checks every pair
of entries for overlap, which is the shape of the bug rather than a
coordinate that happens to be right today.

#137 - the game had three answers to "what does this cost". The build menu
drew a NeonNumber under each option, the craft menu drew glyph strips, and
the ship lab spelled prices out inside the caption. PriceTag is that answer
once: the resource's glyph, then what you HOLD over what it COSTS. It
replaces all three, plus the info popup and the skill panel, and
VesselPriceStrip - which was the same idea for one menu - goes with them.
The build menu also gains the resource bar the other two already had, in the
same place and at the same size, and the craft menu's - the only one not
running the full width of its panel - now matches. The bar drops its LOCAL
column where there is no building to report on, for the same reason #95
dropped it where it only repeated BANKED.

#134 - the skill panel's explanation and its price were both centred in the
same band, so a long description landed on the number. The text is the left
of the band now and the tag is the right. The shortfall it used to spell out
in a sentence - one per case, ore or research points - is the red on the tag
instead, and research points ride along as an entry of their own, so the tag
says WHICH thing is missing without a line of prose per possibility.

One trap worth recording: PriceTag and ResourceBar read the GameState
autoload, and an `extends SceneTree` test script that so much as names such
a class - or preloads the file - fails to compile, because GameState is not
an identifier in that context. GDScript then caches the failure, so the
scene the test instantiates gets a Control with no script where its resource
bar should be. The tests compare script PATHS, as strings.
This commit is contained in:
Loïc Wisniewski 2026-08-28 15:05:20 +02:00
commit ea25318201
12 changed files with 661 additions and 199 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=3]
[gd_scene load_steps=34 format=3]
[ext_resource type="Script" path="res://world/Starfield.gd" id="1"]
[ext_resource type="Script" path="res://vessels/Fleet.gd" id="2"]
@ -41,6 +41,7 @@
[ext_resource type="Script" path="res://ui/SpeedFader.gd" id="31"]
[ext_resource type="Script" path="res://world/QuestDirector.gd" id="quest_dir"]
[ext_resource type="Script" path="res://ui/QuestTracker.gd" id="quest_hud"]
[ext_resource type="Script" path="res://ui/PriceTag.gd" id="price_tag"]
[sub_resource type="ShaderMaterial" id="1"]
shader = ExtResource("5")
@ -477,19 +478,28 @@ color = Color(0.03, 0.03, 0.08, 0.94)
mouse_filter = 2
anchor_right = 1.0
offset_left = 24
offset_top = 70
offset_top = 20
offset_right = -24
offset_bottom = 196
offset_bottom = 140
text = "Build"
horizontal_alignment = 1
[node name="Bar" type="Control" parent="UI/BuildMenu"]
mouse_filter = 2
anchor_right = 1.0
offset_left = 24.0
offset_top = 148.0
offset_right = -24.0
offset_bottom = 284.0
script = ExtResource("24")
[node name="StatusLabel" type="Label" parent="UI/BuildMenu"]
mouse_filter = 2
anchor_right = 1.0
offset_left = 24
offset_top = 206
offset_top = 292
offset_right = -24
offset_bottom = 330
offset_bottom = 372
theme_override_font_sizes/font_size = 40
autowrap_mode = 2
text = ""
@ -533,9 +543,7 @@ offset_left = -200
offset_right = -80
offset_top = -96
offset_bottom = -44
script = ExtResource("19")
amount = 20
digit_height = 40.0
script = ExtResource("price_tag")
[node name="CrafterButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -575,9 +583,7 @@ offset_left = 80
offset_right = 200
offset_top = -96
offset_bottom = -44
script = ExtResource("19")
amount = 12
digit_height = 40.0
script = ExtResource("price_tag")
[node name="CommandButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -617,9 +623,7 @@ offset_left = -200
offset_right = -80
offset_top = 194
offset_bottom = 246
script = ExtResource("19")
amount = 15
digit_height = 40.0
script = ExtResource("price_tag")
[node name="ExtractorButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -659,9 +663,7 @@ offset_left = 80
offset_right = 200
offset_top = 194
offset_bottom = 246
script = ExtResource("19")
amount = 25
digit_height = 40.0
script = ExtResource("price_tag")
[node name="TransportHubButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -701,9 +703,7 @@ offset_left = -60
offset_right = 60
offset_top = 484
offset_bottom = 536
script = ExtResource("19")
amount = 30
digit_height = 40.0
script = ExtResource("price_tag")
[node name="ShipLabButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -743,9 +743,7 @@ offset_left = 80
offset_right = 200
offset_top = 484
offset_bottom = 536
script = ExtResource("19")
amount = 35
digit_height = 40.0
script = ExtResource("price_tag")
[node name="GasBurnerButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -785,9 +783,7 @@ offset_left = -60
offset_right = 60
offset_top = 774
offset_bottom = 826
script = ExtResource("19")
amount = 30
digit_height = 40.0
script = ExtResource("price_tag")
[node name="OutpostButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -827,9 +823,7 @@ offset_left = -60
offset_right = 60
offset_top = 1034
offset_bottom = 1086
script = ExtResource("19")
amount = 30
digit_height = 40.0
script = ExtResource("price_tag")
[node name="PlanningButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -869,9 +863,7 @@ offset_left = -60
offset_right = 60
offset_top = 1294
offset_bottom = 1346
script = ExtResource("19")
amount = 70
digit_height = 40.0
script = ExtResource("price_tag")
[node name="WorkshopButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 0.5
@ -911,9 +903,7 @@ offset_left = -60
offset_right = 60
offset_top = 1554
offset_bottom = 1606
script = ExtResource("19")
amount = 55
digit_height = 40.0
script = ExtResource("price_tag")
[node name="CloseButton" type="Control" parent="UI/BuildMenu"]
anchor_left = 1.0
@ -982,9 +972,7 @@ offset_left = -70
offset_right = 90
offset_top = -424
offset_bottom = -334
script = ExtResource("19")
amount = 0
digit_height = 78.0
script = ExtResource("price_tag")
[node name="BuildButton" type="Control" parent="UI/BuildMenu/InfoPopup/Panel"]
anchor_left = 0.5
@ -1850,10 +1838,11 @@ text = "Build a ship"
horizontal_alignment = 1
[node name="Bar" type="Control" parent="UI/CraftMenu"]
anchor_right = 1.0
mouse_filter = 2
offset_left = 24
offset_top = 148
offset_right = 520
offset_right = -24
offset_bottom = 284
script = ExtResource("24")
@ -2433,25 +2422,25 @@ anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 32.0
offset_top = -272.0
offset_right = -32.0
offset_right = -300.0
offset_bottom = -152.0
theme_override_font_sizes/font_size = 34
autowrap_mode = 2
horizontal_alignment = 1
horizontal_alignment = 0
text = ""
[node name="CostNumber" type="Control" parent="UI/SkillMenu"]
alignment = 2
mouse_filter = 2
anchor_left = 0.5
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -64.0
offset_top = -146.0
offset_right = 76.0
offset_bottom = -82.0
script = ExtResource("19")
digit_height = 52.0
offset_left = -288.0
offset_top = -272.0
offset_right = -32.0
offset_bottom = -152.0
script = ExtResource("price_tag")
[node name="StatusLabel" type="Label" parent="UI/SkillMenu"]
mouse_filter = 2