SkyRace: better notifications

This commit is contained in:
yuni 2024-11-25 00:36:47 +01:00
parent 815609f852
commit 33a572eba2
2 changed files with 7 additions and 3 deletions

View file

@ -755,7 +755,7 @@ fn handle_race(
let mut deinitialize = false;
if !settings.race_active {
if race.initialized {
log.warning(format!("Stopped race! Final score: {}", race.score));
log.showalways(format!("SkyRace: Stopped! Final score: {}", race.score));
deinitialize = true;
} else {
return;
@ -780,7 +780,7 @@ fn handle_race(
let mut spawn_target = false;
if !race.initialized {
log.warning("SkyRace START!".to_string());
log.showalways("SkyRace: START!".to_string());
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Honk));
race.score = 0.0;
race.initialized = true;
@ -812,7 +812,7 @@ fn handle_race(
}
if race.timeout <= time.elapsed_seconds_f64() {
log.warning(format!("GAME OVER! Final score: {}", race.score));
log.showalways(format!("SkyRace: GAME OVER! Final score: {}", race.score));
deinitialize = true;
}
}

View file

@ -293,6 +293,10 @@ impl Log {
self.add(message, "Me".to_string(), LogLevel::Send);
}
pub fn showalways(&mut self, message: String) {
self.add(message, String::default(), LogLevel::Always);
}
pub fn warning(&mut self, message: String) {
self.add(message, "WARNING".to_string(), LogLevel::Warning);
}