From 609a803104fe0a4e955339eee18ad5454a1e9cdd Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 22 Jul 2026 00:03:03 +0300 Subject: [PATCH] Fix team selection, maintain team after map change --- godot/maps/diner.tres | 3 +++ godot/scenes/ui/player_listing.tscn | 3 ++- rust/src/ui/player_listing.rs | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/godot/maps/diner.tres b/godot/maps/diner.tres index 508e69d..c1d5d65 100644 --- a/godot/maps/diner.tres +++ b/godot/maps/diner.tres @@ -1,7 +1,10 @@ [gd_resource type="MapResource" format=3 uid="uid://bsjoandgu476y"] [ext_resource type="PackedScene" uid="uid://ylj40hkjsgjc" path="res://maps/diner/diner.tscn" id="1_yteo6"] +[ext_resource type="TeamResource" uid="uid://p2fqqnaejjn7" path="res://maps/teams/blue_team.tres" id="2_47vax"] +[ext_resource type="TeamResource" uid="uid://db4b3sjsftg15" path="res://maps/teams/red_ream.tres" id="3_i3gdq"] [resource] name = "Diner" scene = ExtResource("1_yteo6") +teams = Array[TeamResource]([ExtResource("2_47vax"), ExtResource("3_i3gdq")]) diff --git a/godot/scenes/ui/player_listing.tscn b/godot/scenes/ui/player_listing.tscn index 5ad1a98..5180c98 100644 --- a/godot/scenes/ui/player_listing.tscn +++ b/godot/scenes/ui/player_listing.tscn @@ -1,9 +1,10 @@ [gd_scene format=3 uid="uid://ccd0wj2usx5os"] -[node name="player_listing" type="PlayerListing" unique_id=772938280 node_paths=PackedStringArray("name_label", "ping_label", "ready_label")] +[node name="player_listing" type="PlayerListing" unique_id=772938280 node_paths=PackedStringArray("name_label", "ping_label", "ready_label", "team_dropdown")] name_label = NodePath("name") ping_label = NodePath("ping") ready_label = NodePath("ready") +team_dropdown = NodePath("option_button") offset_right = 319.0 offset_bottom = 23.0 columns = 4 diff --git a/rust/src/ui/player_listing.rs b/rust/src/ui/player_listing.rs index 6235a5c..59397ef 100644 --- a/rust/src/ui/player_listing.rs +++ b/rust/src/ui/player_listing.rs @@ -48,10 +48,12 @@ impl PlayerListing { pub fn update_teams(&mut self, teams: Array>) { if let Some(dropdown) = &mut self.team_dropdown { + let prev_selection = dropdown.get_selected(); dropdown.clear(); for team in teams.iter_shared() { dropdown.add_item(&team.bind().name); } + dropdown.select(prev_selection); } } }