Fix lobby background not updating on join
This commit is contained in:
parent
e015978b9f
commit
aa30e21ad1
@ -36,6 +36,8 @@ impl INode3D for LobbyWorld {
|
|||||||
self.spawn_player(player.id());
|
self.spawn_player(player.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.change_map(game.bind().selected_map_idx);
|
||||||
|
|
||||||
game.signals()
|
game.signals()
|
||||||
.on_new_player()
|
.on_new_player()
|
||||||
.connect_other(self, Self::on_new_player);
|
.connect_other(self, Self::on_new_player);
|
||||||
@ -61,11 +63,11 @@ impl INode3D for LobbyWorld {
|
|||||||
|
|
||||||
impl LobbyWorld {
|
impl LobbyWorld {
|
||||||
fn change_map(&mut self, map: u8) {
|
fn change_map(&mut self, map: u8) {
|
||||||
if let Some(mut background) = self.background.take() {
|
|
||||||
background.queue_free();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.run_deferred(move |s| {
|
self.run_deferred(move |s| {
|
||||||
|
if let Some(mut background) = s.background.take() {
|
||||||
|
background.queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(map) = GameManager::singleton().bind().maps.get(map as usize) {
|
if let Some(map) = GameManager::singleton().bind().maps.get(map as usize) {
|
||||||
if let Some(scene) = &map.bind().static_scene {
|
if let Some(scene) = &map.bind().static_scene {
|
||||||
let mut background = scene.instantiate_as::<StaticMap>();
|
let mut background = scene.instantiate_as::<StaticMap>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user