Deny new connections after game has started
This commit is contained in:
parent
73c7c5b850
commit
11b6691a4e
@ -3,7 +3,10 @@ use std::net::SocketAddr;
|
|||||||
use godot::{prelude::*, tools::get_autoload_by_name};
|
use godot::{prelude::*, tools::get_autoload_by_name};
|
||||||
use serde::{Deserialize, Serialize};
|
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";
|
pub const GAME_MANAGER_GLOBAL: &str = "GameManagerGlobal";
|
||||||
|
|
||||||
@ -108,7 +111,6 @@ impl Game {
|
|||||||
|
|
||||||
pub fn start_game(&mut self) {
|
pub fn start_game(&mut self) {
|
||||||
self.game_started = true;
|
self.game_started = true;
|
||||||
godot_print!("{:?}", self.selected_map);
|
|
||||||
if let Some(map) = &self.selected_map {
|
if let Some(map) = &self.selected_map {
|
||||||
if let Some(scene) = &map.bind().scene {
|
if let Some(scene) = &map.bind().scene {
|
||||||
self.base().get_tree().change_scene_to_packed(scene);
|
self.base().get_tree().change_scene_to_packed(scene);
|
||||||
|
|||||||
@ -179,6 +179,7 @@ impl LobbyPanel {
|
|||||||
game.bind_mut().start_game();
|
game.bind_mut().start_game();
|
||||||
}
|
}
|
||||||
peer.broadcast_reliable(Package::GameStarted);
|
peer.broadcast_reliable(Package::GameStarted);
|
||||||
|
peer.set_accepting_connections(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user