From ac5b5415f5ff268b7d99eb8e9f4636b3c68afd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Wisniewski?= Date: Thu, 13 Aug 2026 23:25:46 +0200 Subject: [PATCH] Correct gas HUD and transfer rows --- BuildController.gd | 6 +-- Main.tscn | 76 ++++++++++++++++----------------- tests/test_resource_transfer.gd | 23 +++++----- 3 files changed, 52 insertions(+), 53 deletions(-) diff --git a/BuildController.gd b/BuildController.gd index aa8a950..5acd873 100644 --- a/BuildController.gd +++ b/BuildController.gd @@ -1033,10 +1033,8 @@ func _refresh_transfer() -> void: var here: int = GameState.building_holdings(transfer_building_id) var batch: int = GameState.CARGO_LOAD_BATCH - to_building_label.text = "Unload into %s" % _transfer_place_name() - to_fleet_label.text = "Load from %s" % _transfer_place_name() - to_building_label.text = "ORE — unload / load all" - to_fleet_label.text = "GAS — unload / load all" + to_building_label.text = "ORE" + to_fleet_label.text = "GAS" to_building_batch_button.visible = false to_building_batch_label.visible = false to_fleet_batch_button.visible = false diff --git a/Main.tscn b/Main.tscn index 325efcc..51ca900 100644 --- a/Main.tscn +++ b/Main.tscn @@ -107,18 +107,18 @@ text = "ORE" [node name="GasCounter" type="Control" parent="UI"] mouse_filter = 2 -offset_left = 336 +offset_left = 294 offset_top = 24 -offset_right = 628 +offset_right = 468 offset_bottom = 92 script = ExtResource("25") digit_height = 60.0 [node name="GasIcon" type="Control" parent="UI"] mouse_filter = 2 -offset_left = 640 -offset_top = 24 -offset_right = 696 +offset_left = 476 +offset_top = 32 +offset_right = 524 offset_bottom = 80 script = ExtResource("10") icon = 25 @@ -126,9 +126,9 @@ glow_color = Color(0.85, 0.52, 1, 1) [node name="GasCaption" type="Label" parent="UI"] mouse_filter = 2 -offset_left = 336 +offset_left = 294 offset_top = 22 -offset_right = 428 +offset_right = 380 offset_bottom = 48 theme_override_font_sizes/font_size = 18 theme_override_colors/font_color = Color(0.85, 0.52, 1, 1) @@ -1014,7 +1014,7 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -330 offset_right = -130 -offset_top = 400 +offset_top = 376 offset_bottom = 460 theme_override_font_sizes/font_size = 22 horizontal_alignment = 1 @@ -1504,10 +1504,10 @@ horizontal_alignment = 1 mouse_filter = 2 anchor_right = 1.0 offset_left = 24 -offset_top = 400 +offset_top = 376 offset_right = -24 -offset_bottom = 452 -theme_override_font_sizes/font_size = 34 +offset_bottom = 426 +theme_override_font_sizes/font_size = 28 text = "" horizontal_alignment = 1 @@ -1516,8 +1516,8 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -184 offset_right = -36 -offset_top = 462 -offset_bottom = 610 +offset_top = 438 +offset_bottom = 586 script = ExtResource("10") icon = 3 glow_color = Color(0.45, 0.9, 0.55, 1) @@ -1528,9 +1528,9 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -230 offset_right = 10 -offset_top = 616 -offset_bottom = 668 -theme_override_font_sizes/font_size = 30 +offset_top = 592 +offset_bottom = 638 +theme_override_font_sizes/font_size = 24 text = "" horizontal_alignment = 1 @@ -1539,8 +1539,8 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -180 offset_right = -32 -offset_top = 462 -offset_bottom = 610 +offset_top = 438 +offset_bottom = 586 script = ExtResource("10") icon = 3 glow_color = Color(0.45, 0.9, 0.55, 1) @@ -1551,20 +1551,20 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -230 offset_right = 10 -offset_top = 616 -offset_bottom = 668 -theme_override_font_sizes/font_size = 30 -text = "All" +offset_top = 592 +offset_bottom = 638 +theme_override_font_sizes/font_size = 24 +text = "Unload all" horizontal_alignment = 1 [node name="ToFleetLabel" type="Label" parent="UI/TransferMenu"] mouse_filter = 2 anchor_right = 1.0 offset_left = 24 -offset_top = 400 +offset_top = 680 offset_right = -24 -offset_bottom = 452 -theme_override_font_sizes/font_size = 34 +offset_bottom = 730 +theme_override_font_sizes/font_size = 28 text = "" horizontal_alignment = 1 @@ -1596,8 +1596,8 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = 32 offset_right = 180 -offset_top = 462 -offset_bottom = 610 +offset_top = 438 +offset_bottom = 586 script = ExtResource("10") icon = 4 glow_color = Color(1, 0.78, 0.25, 1) @@ -1608,10 +1608,10 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = 10 offset_right = 230 -offset_top = 616 -offset_bottom = 668 -theme_override_font_sizes/font_size = 30 -text = "All" +offset_top = 592 +offset_bottom = 638 +theme_override_font_sizes/font_size = 24 +text = "Load all" horizontal_alignment = 1 [node name="CloseButton" type="Control" parent="UI/TransferMenu"] @@ -1630,8 +1630,8 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = -180 offset_right = -32 -offset_top = 740 -offset_bottom = 888 +offset_top = 742 +offset_bottom = 890 script = ExtResource("10") icon = 25 glow_color = Color(0.85, 0.52, 1, 1) @@ -1641,8 +1641,8 @@ anchor_left = 0.5 anchor_right = 0.5 offset_left = 32 offset_right = 180 -offset_top = 740 -offset_bottom = 888 +offset_top = 742 +offset_bottom = 890 script = ExtResource("10") icon = 25 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"] mouse_filter = 2 anchor_right = 1.0 -offset_top = 894 -offset_bottom = 944 -text = "GAS — unload all load all" +offset_top = 896 +offset_bottom = 942 +text = "Unload all Load all" horizontal_alignment = 1 theme_override_colors/font_color = Color(0.85, 0.52, 1, 1) theme_override_font_sizes/font_size = 22 diff --git a/tests/test_resource_transfer.gd b/tests/test_resource_transfer.gd index ea25cb1..2fae6a4 100644 --- a/tests/test_resource_transfer.gd +++ b/tests/test_resource_transfer.gd @@ -72,6 +72,12 @@ func _tap(button: Control) -> void: 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: if not condition: failures.append("stage %d: %s" % [stage, message]) @@ -102,9 +108,7 @@ func _process(delta: float) -> bool: return false _expect(controller.current_building != null, "parking on the crafter never registered") - _expect(controller.transfer_button.visible, - "the transfer button did not appear at a building") - _tap(controller.transfer_button) + _open_transfer() _expect(controller.transfer_menu.visible, "tapping the transfer button did not open the panel") _expect(controller.transfer_building_id == crafter_id, @@ -156,9 +160,7 @@ func _process(delta: float) -> bool: # --- 3. the mothership's holdings are the bank -------------- if elapsed < 1.2: return false - _expect(controller.transfer_button.visible, - "the transfer button did not appear at the mothership") - _tap(controller.transfer_button) + _open_transfer() _expect(controller.transfer_building_id == mothership_id, "panel bound to %d, mothership is %d" % [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 # class this project keeps hitting, so one press goes the long way. var bank_at_tap: int = game_state.rocks - _tap(scene.get_node("UI/TransferMenu/ToFleetBatchButton")) - _expect(game_state.fleet_cargo == GameState.CARGO_LOAD_BATCH, - "a real tap loaded %d, expected a batch of %d" - % [game_state.fleet_cargo, GameState.CARGO_LOAD_BATCH]) - _expect(game_state.rocks == bank_at_tap - GameState.CARGO_LOAD_BATCH, + _tap(scene.get_node("UI/TransferMenu/ToFleetAllButton")) + _expect(game_state.fleet_cargo == bank_at_tap, + "a real tap did not load all banked ore") + _expect(game_state.rocks == 0, "the bank did not pay for the tapped withdrawal") # --- 7. conservation ----------------------------------------