Skip to content

Commit

Permalink
Add system currency in galaxy map
Browse files Browse the repository at this point in the history
@skip-notify
  • Loading branch information
jspahrsummers committed Aug 18, 2024
1 parent 0b67eed commit 93630bd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
17 changes: 15 additions & 2 deletions galaxy/map/galaxy_map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"):
Expand Down
19 changes: 18 additions & 1 deletion galaxy/map/galaxy_map_window.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions screens/game/game.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 93630bd

Please sign in to comment.