feat: rng is now initialzed on _enter_tree

main
Sara 2024-10-05 22:16:51 +02:00
parent 79c37a3ccc
commit 76fa8d3e3f
2 changed files with 4 additions and 3 deletions

View File

@ -40,6 +40,7 @@ void GameRoot3D::_enter_tree() { GDGAMEONLY();
// TODO: Replace this with detecting input devices
this->player_input_connected();
this->grab_singleton();
this->rng = godot::Ref<godot::RandomNumberGenerator>(memnew(godot::RandomNumberGenerator));
}
void GameRoot3D::_ready() { GDGAMEONLY();

View File

@ -159,7 +159,7 @@ private:
*
* `*get_game_mode()`
*/
GameMode *game_mode{};
GameMode *game_mode{};
/*! Active game state.
*
* Will be assigned loaded save data, or game_state_prototype if no save data is found.
@ -171,14 +171,14 @@ private:
*
* `get_first_boot_level()` `set_first_boot_level(value)`
*/
gd::Ref<gd::PackedScene> first_boot_level{};
gd::Ref<gd::PackedScene> first_boot_level{};
/*! The default game state data.
*
* Duplicated and assigned to game_state if no save data is available.
*
* `get_game_state_prototype()` `set_game_state_prototype(value)`
*/
gd::Ref<GameState> game_state_prototype{};
gd::Ref<GameState> game_state_prototype{};
};
}