From f1725fcab5f3c195101f78e82bfa1fdcb97c2c1a Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 14 May 2024 07:27:43 +0200 Subject: [PATCH] show achievements in golden color in the log --- src/chat.rs | 3 +++ src/game.rs | 3 ++- src/hud.rs | 3 +++ src/var.rs | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index becd4ea..905e1fb 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -705,6 +705,9 @@ pub fn handle_chat_events( hud::LogLevel::Info => { log.info(message.into()); } + hud::LogLevel::Achievement => { + log.add(message.into(), "".into(), hud::LogLevel::Achievement); + } hud::LogLevel::Warning => { log.warning(message.into()); } diff --git a/src/game.rs b/src/game.rs index 209f7cc..c4077e8 100644 --- a/src/game.rs +++ b/src/game.rs @@ -148,7 +148,8 @@ pub fn handle_game_event( } GameEvent::Achievement(name) => { ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Achieve)); - log.info(format!("Achievement accomplished: {name}!")); + log.add(format!("Achievement accomplished: {name}!"), + "".to_string(), hud::LogLevel::Achievement); } } } diff --git a/src/hud.rs b/src/hud.rs index d285912..d103b9d 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -117,6 +117,7 @@ pub struct AugmentedRealityOverlay { struct FPSUpdateTimer(Timer); pub enum LogLevel { + Achievement, Always, Warning, //Error, @@ -847,6 +848,7 @@ fn update_hud( } else { |msg: &&Message| { match msg.level { LogLevel::Always => true, + LogLevel::Achievement => true, _ => false }} }; @@ -862,6 +864,7 @@ fn update_hud( let opacity: f32 = (freshness.powf(1.5) as f32).clamp(0.0, 1.0); freshest_line = freshest_line.max(freshness); chat.sections[row].style.color = match msg.level { + LogLevel::Achievement => settings.hud_color_console_achievement, LogLevel::Warning => settings.hud_color_console_warn, LogLevel::Info => settings.hud_color_console_system, _ => settings.hud_color_console, diff --git a/src/var.rs b/src/var.rs index 6f677b5..70efdd1 100644 --- a/src/var.rs +++ b/src/var.rs @@ -64,6 +64,7 @@ pub struct Settings { pub hud_color_console: Color, pub hud_color_console_warn: Color, pub hud_color_console_system: Color, + pub hud_color_console_achievement: Color, pub hud_color_alert: Color, pub hud_color_subtitles: Color, pub hud_color_choices: Color, @@ -183,6 +184,7 @@ impl Default for Settings { hud_color: Color::hex("#BE1251").unwrap(), hud_color_fps: Color::hex("#181818").unwrap(), hud_color_console: Color::hex("#BE1251").unwrap(), + hud_color_console_achievement: Color::hex("#F0D50C").unwrap(), hud_color_console_warn: Color::hex("#CCCCCC").unwrap(), hud_color_console_system: Color::hex("#7F7F7F").unwrap(), hud_color_alert: Color::hex("#CCCCCC").unwrap(),