Skip to content

Commit

Permalink
Update mission computer when cargo or bank account changes
Browse files Browse the repository at this point in the history
Resolves #113.
  • Loading branch information
jspahrsummers committed Sep 8, 2024
1 parent 3e78508 commit 08c2f02
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions screens/landing/mission_computer_window.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func _ready() -> void:

for mission in self.available_missions:
self.mission_list.add_item(mission.title)

self.cargo_hold.changed.connect(_cargo_or_bank_account_changed)
self.bank_account.changed.connect(_cargo_or_bank_account_changed)

func _on_close_requested() -> void:
self.visible = false
Expand All @@ -36,6 +39,14 @@ func _clear() -> void:
self.start_button.tooltip_text = "No mission selected."
self._selected_mission = null

func _cargo_or_bank_account_changed() -> void:
var selection := mission_list.get_selected_items()
if not selection:
return

# Update everything for the selected item again
self._on_item_selected(selection[0])

func _on_item_selected(index: int) -> void:
self._selected_mission = self.available_missions[index]
self.description_label.text = self._selected_mission.description
Expand Down

0 comments on commit 08c2f02

Please sign in to comment.