From edeb899f9cf2cbe512ce2087f0807f29740bc4de Mon Sep 17 00:00:00 2001 From: Sofia Date: Sun, 9 Aug 2026 21:52:15 +0300 Subject: [PATCH] Fix main scene, add checksum error --- godot/scenes/main.tscn | 21 +++++++++++++++++++-- rust/src/net/network_manager.rs | 2 +- rust/src/net/protocol.rs | 14 +++++++++++++- rust/src/ui/main_menu.rs | 1 + teanet-rust | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/godot/scenes/main.tscn b/godot/scenes/main.tscn index 6c49049..e7be56c 100644 --- a/godot/scenes/main.tscn +++ b/godot/scenes/main.tscn @@ -1,12 +1,29 @@ [gd_scene format=3 uid="uid://lahirbqfppvw"] [ext_resource type="PackedScene" uid="uid://bbmc2gmy7g8ag" path="res://scenes/player/menu_player.tscn" id="1_o5qli"] +[ext_resource type="PackedScene" uid="uid://dsxu0y8pjbw3k" path="res://scenes/ui/credits.tscn" id="1_tefeu"] [ext_resource type="PackedScene" uid="uid://n3u0jr4wiib1" path="res://scenes/ui/settings.tscn" id="2_0wfyh"] [ext_resource type="Theme" uid="uid://drydbnrcdv4pk" path="res://default_theme.tres" id="3_jscy8"] [ext_resource type="Texture2D" uid="uid://3gpd2qpyw5eq" path="res://assets/title.png" id="4_pm3ni"] [ext_resource type="PackedScene" uid="uid://c62c5iq0w72ka" path="res://maps/precipice/precipice_static.scn" id="6_tefeu"] -[node name="menu" type="Node3D" unique_id=2036763876] +[node name="menu" type="MainMenu" unique_id=1896387088 node_paths=PackedStringArray("camera", "main_position", "host_position", "main_panel", "host_panel", "join_panel", "host_port", "join_addr", "join_port", "recent_servers_button", "popup_panel", "popup_title", "popup_text", "popup_button", "open_replay_dialog")] +camera = NodePath("camera_3d") +main_position = NodePath("main_pos") +host_position = NodePath("host_pos") +main_panel = NodePath("menus/main_panel") +host_panel = NodePath("menus/host_panel") +join_panel = NodePath("menus/join_panel") +host_port = NodePath("menus/host_panel/v_box_container/host_port") +join_addr = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/address_text") +join_port = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/port_text") +recent_servers_button = NodePath("menus/join_panel/v_box_container/margin_container/v_box_container/recent_servers") +popup_panel = NodePath("menus/popup_panel") +popup_title = NodePath("menus/popup_panel/v_box_container/title") +popup_text = NodePath("menus/popup_panel/v_box_container/text") +popup_button = NodePath("menus/popup_panel/v_box_container/ok") +credits = ExtResource("1_tefeu") +open_replay_dialog = NodePath("open_replay_dialog") [node name="camera_3d" type="Camera3D" parent="." unique_id=1513321931] transform = Transform3D(0.98629165, -0.031186381, 0.16203775, -1.4054481e-08, 0.981978, 0.1889952, -0.16501158, -0.18640438, 0.9685167, 1.0974052, 1.7166122, 1.4909106) @@ -134,7 +151,7 @@ metadata/_edit_lock_ = true [node name="label" type="CommitHashLabel" parent="menus/main_panel/v_box_container/margin_container/v_box_container" unique_id=1742881725] layout_mode = 2 -text = "Checksum: 33fbeb" +text = "Checksum: 03ddc0" [node name="host_panel" type="Panel" parent="menus" unique_id=1633876079] visible = false diff --git a/rust/src/net/network_manager.rs b/rust/src/net/network_manager.rs index 38ab882..35e25b4 100644 --- a/rust/src/net/network_manager.rs +++ b/rust/src/net/network_manager.rs @@ -336,7 +336,7 @@ impl NetworkManager { } } - fn identifier() -> String { + pub fn identifier() -> String { format!("{}@{}", env!("CARGO_PKG_NAME"), env!("GIT_HASH")) } } diff --git a/rust/src/net/protocol.rs b/rust/src/net/protocol.rs index b1d3d75..92e1ac4 100644 --- a/rust/src/net/protocol.rs +++ b/rust/src/net/protocol.rs @@ -53,7 +53,19 @@ impl NetworkManager { } else { PopupQueue::singleton().bind_mut().queue(Popup { title: "Disconnected".to_owned(), - message: reason.to_string(), + message: match reason { + teanet::package::CloseReason::InvalidIdentifier(ident) => { + format!( + "Checksum mismatch: {} != {}", + ident.chars().take(6).collect::(), + NetworkManager::identifier() + .chars() + .take(6) + .collect::() + ) + } + _ => reason.to_string(), + }, ok: true, }); } diff --git a/rust/src/ui/main_menu.rs b/rust/src/ui/main_menu.rs index 72af24b..9296be0 100644 --- a/rust/src/ui/main_menu.rs +++ b/rust/src/ui/main_menu.rs @@ -249,6 +249,7 @@ impl MainMenu { #[func] pub fn go_to_host_game(&mut self) { + godot_print!("what?"); self.current_menu = Menu::HostMenu; } diff --git a/teanet-rust b/teanet-rust index e43a010..93eeb7c 160000 --- a/teanet-rust +++ b/teanet-rust @@ -1 +1 @@ -Subproject commit e43a010704bf18b1a75b69d4d28ec3770238fd7a +Subproject commit 93eeb7c740c55a269ad8032ca1a58e2e21d024f5