From 93630bd9cc7556894bb1210fb7577d8b78ea0cc8 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Sun, 18 Aug 2024 21:41:59 +0100 Subject: [PATCH] Add system currency in galaxy map @skip-notify --- galaxy/map/galaxy_map.gd | 17 +++++++++++++++-- galaxy/map/galaxy_map_window.tscn | 19 ++++++++++++++++++- screens/game/game.tscn | 4 ++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/galaxy/map/galaxy_map.gd b/galaxy/map/galaxy_map.gd index 3ddfdb58..d0e5e48e 100644 --- a/galaxy/map/galaxy_map.gd +++ b/galaxy/map/galaxy_map.gd @@ -23,6 +23,8 @@ class_name GalaxyMap @export var ports_label: Label @export var facilities_heading: Label @export var facilities_label: Label +@export var currency_heading: Label +@export var currency_label: Label @export var commodities_heading: Label @export var commodities_label: Label @@ -93,10 +95,12 @@ func _update_selection_state() -> void: if not presented_system.planets: self.ports_label.text = "(none)" - self.facilities_label.visible = false self.facilities_heading.visible = false - self.commodities_label.visible = false + self.facilities_label.visible = false + self.currency_heading.visible = false + self.currency_label.visible = false self.commodities_heading.visible = false + self.commodities_label.visible = false return self.facilities_heading.visible = true @@ -131,6 +135,15 @@ func _update_selection_state() -> void: self.commodities_label.text = "\n".join(commodities) else: self.commodities_label.text = "(none)" + + var money := presented_system.preferred_money() + if money: + self.currency_heading.visible = true + self.currency_label.visible = true + self.currency_label.text = money.name + else: + self.currency_heading.visible = false + self.currency_label.visible = false func _input(event: InputEvent) -> void: if event.is_action_pressed("toggle_galaxy_map"): diff --git a/galaxy/map/galaxy_map_window.tscn b/galaxy/map/galaxy_map_window.tscn index 5540c508..d53716a8 100644 --- a/galaxy/map/galaxy_map_window.tscn +++ b/galaxy/map/galaxy_map_window.tscn @@ -8,7 +8,7 @@ [ext_resource type="Material" uid="uid://cs5s3tb7vagsi" path="res://screens/shared_ui/premultiplied_canvas_material.tres" id="6_00km2"] [ext_resource type="LabelSettings" uid="uid://dcpdwtq5b48gc" path="res://galaxy/map/multiline_label_settings.tres" id="7_073cv"] -[node name="GalaxyMapWindow" type="Window" node_paths=PackedStringArray("galaxy_map_3d", "camera", "current_or_destination_heading", "system_name_label", "ports_label", "facilities_heading", "facilities_label", "commodities_heading", "commodities_label")] +[node name="GalaxyMapWindow" type="Window" node_paths=PackedStringArray("galaxy_map_3d", "camera", "current_or_destination_heading", "system_name_label", "ports_label", "facilities_heading", "facilities_label", "currency_heading", "currency_label", "commodities_heading", "commodities_label")] own_world_3d = true transparent_bg = true title = "Galaxy Map" @@ -26,6 +26,8 @@ system_name_label = NodePath("PanelContainer/HSplitContainer/RightContainer/VBox ports_label = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/PortsLabel") facilities_heading = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/FacilitiesHeading") facilities_label = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/FacilitiesLabel") +currency_heading = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/CurrencyHeading") +currency_label = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/CurrencyLabel") commodities_heading = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/CommoditiesHeading") commodities_label = NodePath("PanelContainer/HSplitContainer/RightContainer/VBoxContainer/CommoditiesLabel") @@ -120,6 +122,21 @@ label_settings = ExtResource("7_073cv") custom_minimum_size = Vector2(2.08165e-12, 14) layout_mode = 2 +[node name="CurrencyHeading" type="Label" parent="PanelContainer/HSplitContainer/RightContainer/VBoxContainer"] +use_parent_material = true +layout_mode = 2 +text = "Currency" +uppercase = true + +[node name="CurrencyLabel" type="Label" parent="PanelContainer/HSplitContainer/RightContainer/VBoxContainer"] +use_parent_material = true +layout_mode = 2 +label_settings = ExtResource("7_073cv") + +[node name="Padding4" type="Control" parent="PanelContainer/HSplitContainer/RightContainer/VBoxContainer"] +custom_minimum_size = Vector2(2.08165e-12, 14) +layout_mode = 2 + [node name="CommoditiesHeading" type="Label" parent="PanelContainer/HSplitContainer/RightContainer/VBoxContainer"] use_parent_material = true layout_mode = 2 diff --git a/screens/game/game.tscn b/screens/game/game.tscn index f79313cc..099d53a6 100644 --- a/screens/game/game.tscn +++ b/screens/game/game.tscn @@ -99,7 +99,7 @@ script = ExtResource("11_ag0i7") max_volume = 10.0 commodities = {} -[sub_resource type="Resource" id="Resource_ytpox"] +[sub_resource type="Resource" id="Resource_82t4m"] resource_local_to_scene = true script = ExtResource("13_q2g24") max_fuel = 6.0 @@ -180,7 +180,7 @@ hull = SubResource("Resource_ffax2") shield = SubResource("Resource_75c8j") battery = SubResource("Resource_xpwk4") cargo_hold = SubResource("Resource_bsv1l") -hyperdrive = SubResource("Resource_ytpox") +hyperdrive = SubResource("Resource_82t4m") [node name="CombatObject" parent="HyperspaceSceneSwitcher/Sol/PlayerCorvette" index="3" node_paths=PackedStringArray("targeted_sound")] targeted_sound = NodePath("../Player/TargetedSound")