Correct gas HUD and transfer rows

This commit is contained in:
Loïc Wisniewski 2026-08-13 23:25:46 +02:00
commit ac5b5415f5
3 changed files with 52 additions and 53 deletions

View file

@ -1033,10 +1033,8 @@ func _refresh_transfer() -> void:
var here: int = GameState.building_holdings(transfer_building_id) var here: int = GameState.building_holdings(transfer_building_id)
var batch: int = GameState.CARGO_LOAD_BATCH var batch: int = GameState.CARGO_LOAD_BATCH
to_building_label.text = "Unload into %s" % _transfer_place_name() to_building_label.text = "ORE"
to_fleet_label.text = "Load from %s" % _transfer_place_name() to_fleet_label.text = "GAS"
to_building_label.text = "ORE — unload / load all"
to_fleet_label.text = "GAS — unload / load all"
to_building_batch_button.visible = false to_building_batch_button.visible = false
to_building_batch_label.visible = false to_building_batch_label.visible = false
to_fleet_batch_button.visible = false to_fleet_batch_button.visible = false

View file

@ -107,18 +107,18 @@ text = "ORE"
[node name="GasCounter" type="Control" parent="UI"] [node name="GasCounter" type="Control" parent="UI"]
mouse_filter = 2 mouse_filter = 2
offset_left = 336 offset_left = 294
offset_top = 24 offset_top = 24
offset_right = 628 offset_right = 468
offset_bottom = 92 offset_bottom = 92
script = ExtResource("25") script = ExtResource("25")
digit_height = 60.0 digit_height = 60.0
[node name="GasIcon" type="Control" parent="UI"] [node name="GasIcon" type="Control" parent="UI"]
mouse_filter = 2 mouse_filter = 2
offset_left = 640 offset_left = 476
offset_top = 24 offset_top = 32
offset_right = 696 offset_right = 524
offset_bottom = 80 offset_bottom = 80
script = ExtResource("10") script = ExtResource("10")
icon = 25 icon = 25
@ -126,9 +126,9 @@ glow_color = Color(0.85, 0.52, 1, 1)
[node name="GasCaption" type="Label" parent="UI"] [node name="GasCaption" type="Label" parent="UI"]
mouse_filter = 2 mouse_filter = 2
offset_left = 336 offset_left = 294
offset_top = 22 offset_top = 22
offset_right = 428 offset_right = 380
offset_bottom = 48 offset_bottom = 48
theme_override_font_sizes/font_size = 18 theme_override_font_sizes/font_size = 18
theme_override_colors/font_color = Color(0.85, 0.52, 1, 1) theme_override_colors/font_color = Color(0.85, 0.52, 1, 1)
@ -1014,7 +1014,7 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -330 offset_left = -330
offset_right = -130 offset_right = -130
offset_top = 400 offset_top = 376
offset_bottom = 460 offset_bottom = 460
theme_override_font_sizes/font_size = 22 theme_override_font_sizes/font_size = 22
horizontal_alignment = 1 horizontal_alignment = 1
@ -1504,10 +1504,10 @@ horizontal_alignment = 1
mouse_filter = 2 mouse_filter = 2
anchor_right = 1.0 anchor_right = 1.0
offset_left = 24 offset_left = 24
offset_top = 400 offset_top = 376
offset_right = -24 offset_right = -24
offset_bottom = 452 offset_bottom = 426
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 28
text = "" text = ""
horizontal_alignment = 1 horizontal_alignment = 1
@ -1516,8 +1516,8 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -184 offset_left = -184
offset_right = -36 offset_right = -36
offset_top = 462 offset_top = 438
offset_bottom = 610 offset_bottom = 586
script = ExtResource("10") script = ExtResource("10")
icon = 3 icon = 3
glow_color = Color(0.45, 0.9, 0.55, 1) glow_color = Color(0.45, 0.9, 0.55, 1)
@ -1528,9 +1528,9 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -230 offset_left = -230
offset_right = 10 offset_right = 10
offset_top = 616 offset_top = 592
offset_bottom = 668 offset_bottom = 638
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 24
text = "" text = ""
horizontal_alignment = 1 horizontal_alignment = 1
@ -1539,8 +1539,8 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -180 offset_left = -180
offset_right = -32 offset_right = -32
offset_top = 462 offset_top = 438
offset_bottom = 610 offset_bottom = 586
script = ExtResource("10") script = ExtResource("10")
icon = 3 icon = 3
glow_color = Color(0.45, 0.9, 0.55, 1) glow_color = Color(0.45, 0.9, 0.55, 1)
@ -1551,20 +1551,20 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -230 offset_left = -230
offset_right = 10 offset_right = 10
offset_top = 616 offset_top = 592
offset_bottom = 668 offset_bottom = 638
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 24
text = "All" text = "Unload all"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="ToFleetLabel" type="Label" parent="UI/TransferMenu"] [node name="ToFleetLabel" type="Label" parent="UI/TransferMenu"]
mouse_filter = 2 mouse_filter = 2
anchor_right = 1.0 anchor_right = 1.0
offset_left = 24 offset_left = 24
offset_top = 400 offset_top = 680
offset_right = -24 offset_right = -24
offset_bottom = 452 offset_bottom = 730
theme_override_font_sizes/font_size = 34 theme_override_font_sizes/font_size = 28
text = "" text = ""
horizontal_alignment = 1 horizontal_alignment = 1
@ -1596,8 +1596,8 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = 32 offset_left = 32
offset_right = 180 offset_right = 180
offset_top = 462 offset_top = 438
offset_bottom = 610 offset_bottom = 586
script = ExtResource("10") script = ExtResource("10")
icon = 4 icon = 4
glow_color = Color(1, 0.78, 0.25, 1) glow_color = Color(1, 0.78, 0.25, 1)
@ -1608,10 +1608,10 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = 10 offset_left = 10
offset_right = 230 offset_right = 230
offset_top = 616 offset_top = 592
offset_bottom = 668 offset_bottom = 638
theme_override_font_sizes/font_size = 30 theme_override_font_sizes/font_size = 24
text = "All" text = "Load all"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="CloseButton" type="Control" parent="UI/TransferMenu"] [node name="CloseButton" type="Control" parent="UI/TransferMenu"]
@ -1630,8 +1630,8 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -180 offset_left = -180
offset_right = -32 offset_right = -32
offset_top = 740 offset_top = 742
offset_bottom = 888 offset_bottom = 890
script = ExtResource("10") script = ExtResource("10")
icon = 25 icon = 25
glow_color = Color(0.85, 0.52, 1, 1) glow_color = Color(0.85, 0.52, 1, 1)
@ -1641,8 +1641,8 @@ anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = 32 offset_left = 32
offset_right = 180 offset_right = 180
offset_top = 740 offset_top = 742
offset_bottom = 888 offset_bottom = 890
script = ExtResource("10") script = ExtResource("10")
icon = 25 icon = 25
glow_color = Color(0.85, 0.52, 1, 1) glow_color = Color(0.85, 0.52, 1, 1)
@ -1650,9 +1650,9 @@ glow_color = Color(0.85, 0.52, 1, 1)
[node name="GasTransferLabel" type="Label" parent="UI/TransferMenu"] [node name="GasTransferLabel" type="Label" parent="UI/TransferMenu"]
mouse_filter = 2 mouse_filter = 2
anchor_right = 1.0 anchor_right = 1.0
offset_top = 894 offset_top = 896
offset_bottom = 944 offset_bottom = 942
text = "GAS — unload all load all" text = "Unload all Load all"
horizontal_alignment = 1 horizontal_alignment = 1
theme_override_colors/font_color = Color(0.85, 0.52, 1, 1) theme_override_colors/font_color = Color(0.85, 0.52, 1, 1)
theme_override_font_sizes/font_size = 22 theme_override_font_sizes/font_size = 22

View file

@ -72,6 +72,12 @@ func _tap(button: Control) -> void:
button._gui_input(ev) button._gui_input(ev)
func _open_transfer() -> void:
# Contextual choices collapse into one button until it is opened.
_tap(controller.action_button)
_tap(controller.transfer_button)
func _expect(condition: bool, message: String) -> void: func _expect(condition: bool, message: String) -> void:
if not condition: if not condition:
failures.append("stage %d: %s" % [stage, message]) failures.append("stage %d: %s" % [stage, message])
@ -102,9 +108,7 @@ func _process(delta: float) -> bool:
return false return false
_expect(controller.current_building != null, _expect(controller.current_building != null,
"parking on the crafter never registered") "parking on the crafter never registered")
_expect(controller.transfer_button.visible, _open_transfer()
"the transfer button did not appear at a building")
_tap(controller.transfer_button)
_expect(controller.transfer_menu.visible, _expect(controller.transfer_menu.visible,
"tapping the transfer button did not open the panel") "tapping the transfer button did not open the panel")
_expect(controller.transfer_building_id == crafter_id, _expect(controller.transfer_building_id == crafter_id,
@ -156,9 +160,7 @@ func _process(delta: float) -> bool:
# --- 3. the mothership's holdings are the bank -------------- # --- 3. the mothership's holdings are the bank --------------
if elapsed < 1.2: if elapsed < 1.2:
return false return false
_expect(controller.transfer_button.visible, _open_transfer()
"the transfer button did not appear at the mothership")
_tap(controller.transfer_button)
_expect(controller.transfer_building_id == mothership_id, _expect(controller.transfer_building_id == mothership_id,
"panel bound to %d, mothership is %d" "panel bound to %d, mothership is %d"
% [controller.transfer_building_id, mothership_id]) % [controller.transfer_building_id, mothership_id])
@ -178,11 +180,10 @@ func _process(delta: float) -> bool:
# The handler working while the BUTTON is inert is the exact bug # The handler working while the BUTTON is inert is the exact bug
# class this project keeps hitting, so one press goes the long way. # class this project keeps hitting, so one press goes the long way.
var bank_at_tap: int = game_state.rocks var bank_at_tap: int = game_state.rocks
_tap(scene.get_node("UI/TransferMenu/ToFleetBatchButton")) _tap(scene.get_node("UI/TransferMenu/ToFleetAllButton"))
_expect(game_state.fleet_cargo == GameState.CARGO_LOAD_BATCH, _expect(game_state.fleet_cargo == bank_at_tap,
"a real tap loaded %d, expected a batch of %d" "a real tap did not load all banked ore")
% [game_state.fleet_cargo, GameState.CARGO_LOAD_BATCH]) _expect(game_state.rocks == 0,
_expect(game_state.rocks == bank_at_tap - GameState.CARGO_LOAD_BATCH,
"the bank did not pay for the tapped withdrawal") "the bank did not pay for the tapped withdrawal")
# --- 7. conservation ---------------------------------------- # --- 7. conservation ----------------------------------------