feat: changed ordering of signals in game root
parent
d095d9f2de
commit
f0bddcf074
|
@ -83,9 +83,9 @@ bool GameRoot::initialize_player(IPlayer *player, uint32_t id) {
|
||||||
found.second = player;
|
found.second = player;
|
||||||
// set player id
|
// set player id
|
||||||
player->player_id = id;
|
player->player_id = id;
|
||||||
|
this->emit_signal("player_spawned", player->to_node());
|
||||||
this->add_child(player->to_node());
|
this->add_child(player->to_node());
|
||||||
player->setup_player_input(found.first);
|
player->setup_player_input(found.first);
|
||||||
this->emit_signal("player_spawned", player->to_node());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,8 @@ void GameRoot::set_game_mode(Ref<GameMode> prototype) {
|
||||||
// allow "unsetting" the gamemode by passing an invalid gamemode
|
// allow "unsetting" the gamemode by passing an invalid gamemode
|
||||||
// shorthand for this behaviour is reset_game_mode
|
// shorthand for this behaviour is reset_game_mode
|
||||||
if(prototype.is_null() || !prototype.is_valid()) {
|
if(prototype.is_null() || !prototype.is_valid()) {
|
||||||
this->game_mode->_end();
|
if(!this->game_mode.is_null() && this->game_mode.is_valid())
|
||||||
|
this->game_mode->_end();
|
||||||
this->game_mode.unref();
|
this->game_mode.unref();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,14 +182,14 @@ Level3D *GameRoot3D::load_level_at(Ref<PackedScene> level, Transform3D at) {
|
||||||
UtilityFunctions::push_error("Unexpected failure to instantiate level scene '", level->get_path(), "'.");
|
UtilityFunctions::push_error("Unexpected failure to instantiate level scene '", level->get_path(), "'.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
// store and add to tree at desired transform
|
|
||||||
this->add_child(instance);
|
|
||||||
instance->set_global_transform(at);
|
|
||||||
this->levels.insert(level->get_path(), instance);
|
this->levels.insert(level->get_path(), instance);
|
||||||
|
// store and add to tree at desired transform
|
||||||
// if this is the first level containing a game mode currently active use it's gamemode as a prototype
|
// if this is the first level containing a game mode currently active use it's gamemode as a prototype
|
||||||
if(this->game_mode.is_null()) {
|
if(this->game_mode.is_null()) {
|
||||||
this->set_game_mode(instance->get_game_mode_prototype());
|
this->set_game_mode(instance->get_game_mode_prototype());
|
||||||
}
|
}
|
||||||
|
this->add_child(instance);
|
||||||
|
instance->set_global_transform(at);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue