fix: game root now only spawns player if scene is assigned in game mode
parent
044164fa4b
commit
51f18f45b8
|
@ -171,13 +171,15 @@ void GameRoot3D::set_game_mode(Ref<GameMode> prototype) {
|
||||||
// .. except for the game state, which should be cloned as well
|
// .. except for the game state, which should be cloned as well
|
||||||
this->game_mode->set_game_state(prototype->get_game_state()->duplicate(false));
|
this->game_mode->set_game_state(prototype->get_game_state()->duplicate(false));
|
||||||
this->game_mode->_begin();
|
this->game_mode->_begin();
|
||||||
uint32_t new_player_id = this->find_empty_player_slot();
|
if(this->game_mode->get_player_scene().is_valid()) {
|
||||||
do {
|
uint32_t new_player_id = this->find_empty_player_slot();
|
||||||
IPlayer *player = this->spawn_player(new_player_id);
|
do {
|
||||||
if(player != nullptr)
|
IPlayer *player = this->spawn_player(new_player_id);
|
||||||
this->initialize_player(player, new_player_id);
|
if(player != nullptr)
|
||||||
new_player_id = this->find_empty_player_slot();
|
this->initialize_player(player, new_player_id);
|
||||||
} while(new_player_id != 0);
|
new_player_id = this->find_empty_player_slot();
|
||||||
|
} while(new_player_id != 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<GameMode> GameRoot3D::get_game_mode() const {
|
Ref<GameMode> GameRoot3D::get_game_mode() const {
|
||||||
|
|
Loading…
Reference in New Issue