Fix camera unlocking upon death
This commit is contained in:
parent
ec4a91722c
commit
5e0ff4336a
@ -176,7 +176,7 @@ pub struct Game {
|
||||
player_counter: u16,
|
||||
pub self_id: Option<u16>,
|
||||
pub players: Vec<Player>,
|
||||
game_started: bool,
|
||||
pub game_started: bool,
|
||||
|
||||
pub current_map: Option<Gd<Map>>,
|
||||
pub world_ball: Option<Gd<Ball>>,
|
||||
@ -299,6 +299,8 @@ impl Game {
|
||||
}
|
||||
|
||||
pub fn finish_game(&mut self) {
|
||||
self.game_started = false;
|
||||
|
||||
for player in &mut self.players {
|
||||
if let Some(mut character) = player.character.take() {
|
||||
character.queue_free();
|
||||
@ -320,7 +322,6 @@ impl Game {
|
||||
ball.queue_free();
|
||||
}
|
||||
self.current_map.take();
|
||||
self.game_started = false;
|
||||
|
||||
self.run_deferred(|s| {
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer
|
||||
|
||||
@ -530,9 +530,13 @@ impl ICharacterBody3D for LocalPlayer {
|
||||
}
|
||||
|
||||
fn exit_tree(&mut self) {
|
||||
if let Some(game) = Game::singleton()
|
||||
&& !game.bind().game_started
|
||||
{
|
||||
self.set_lock(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[godot_api]
|
||||
impl LocalPlayer {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user