From cf68bd7887b1664db981c501c38d71a9b767cb6a Mon Sep 17 00:00:00 2001 From: Sofia Date: Thu, 30 Jul 2026 01:11:10 +0300 Subject: [PATCH] Allow maps to be hidden --- godot/maps/default_map.tres | 1 + godot/maps/diner.tres | 1 + rust/src/map_resource.rs | 2 ++ rust/src/ui/lobby.rs | 15 ++++++++++++--- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/godot/maps/default_map.tres b/godot/maps/default_map.tres index 3d5df88..4fd7939 100644 --- a/godot/maps/default_map.tres +++ b/godot/maps/default_map.tres @@ -14,3 +14,4 @@ scene = ExtResource("1_k5804") teams = Array[TeamResource]([ExtResource("2_kkbjr"), ExtResource("3_o48fm")]) music = Array[AudioStream]([ExtResource("1_bjd18"), ExtResource("2_an43b"), ExtResource("3_e1bs0")]) icon = ExtResource("1_an43b") +hidden = true diff --git a/godot/maps/diner.tres b/godot/maps/diner.tres index 9888136..0db8d81 100644 --- a/godot/maps/diner.tres +++ b/godot/maps/diner.tres @@ -8,3 +8,4 @@ name = "Diner" scene = ExtResource("1_yteo6") teams = Array[TeamResource]([ExtResource("2_47vax"), ExtResource("3_i3gdq")]) +hidden = true diff --git a/rust/src/map_resource.rs b/rust/src/map_resource.rs index 9fd7802..e190c2e 100644 --- a/rust/src/map_resource.rs +++ b/rust/src/map_resource.rs @@ -18,6 +18,8 @@ pub struct MapResource { pub music: Array>, #[export] pub icon: Option>, + #[export] + pub hidden: bool, base: Base, } diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index b75a7eb..786e388 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -97,11 +97,20 @@ impl IPanel for LobbyPanel { }; if let Some(map_selection) = &mut self.map_selection { let prev_selection = game.bind().selected_map_idx as i32; - for map in game.bind().maps.iter_shared() { + for (id, map) in game.bind().maps.iter_shared().enumerate() { + if map.bind().hidden { + continue; + } if let Some(icon) = &map.bind().icon { - map_selection.add_icon_item(icon, &map.bind().name); + map_selection + .add_icon_item_ex(icon, &map.bind().name) + .id(id as i32) + .done(); } else { - map_selection.add_item(&map.bind().name); + map_selection + .add_item_ex(&map.bind().name) + .id(id as i32) + .done(); } } map_selection.select(prev_selection);