Fix fetching Game singleton

This commit is contained in:
Sofia 2026-07-26 21:56:36 +03:00
parent 8c0d5b99ff
commit 460b362d5c

View File

@ -363,9 +363,13 @@ impl Game {
pub fn on_player_killed(player: u16); pub fn on_player_killed(player: u16);
pub fn singleton() -> Option<Gd<Game>> { pub fn singleton() -> Option<Gd<Game>> {
if GameManager::singleton().get_children().len() > 0 {
GameManager::singleton() GameManager::singleton()
.get_child(0) .get_child(0)
.map(|g| g.cast::<Game>()) .map(|g| g.cast::<Game>())
} else {
None
}
} }
pub fn start_playback(&mut self, time_delta: f64, spectated_id: u16) { pub fn start_playback(&mut self, time_delta: f64, spectated_id: u16) {