Deny new connections after game has started

This commit is contained in:
Sofia 2026-07-17 23:15:46 +03:00
parent 73c7c5b850
commit 11b6691a4e
2 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,10 @@ use std::net::SocketAddr;
use godot::{prelude::*, tools::get_autoload_by_name};
use serde::{Deserialize, Serialize};
use crate::map_resource::Map;
use crate::{
map_resource::Map,
net::network_manager::{NetworkManager, PeerKind},
};
pub const GAME_MANAGER_GLOBAL: &str = "GameManagerGlobal";
@ -108,7 +111,6 @@ impl Game {
pub fn start_game(&mut self) {
self.game_started = true;
godot_print!("{:?}", self.selected_map);
if let Some(map) = &self.selected_map {
if let Some(scene) = &map.bind().scene {
self.base().get_tree().change_scene_to_packed(scene);

View File

@ -179,6 +179,7 @@ impl LobbyPanel {
game.bind_mut().start_game();
}
peer.broadcast_reliable(Package::GameStarted);
peer.set_accepting_connections(false);
}
}
}