diff --git a/src/chat.rs b/src/chat.rs index 552aac4..ce7637a 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -11,6 +11,7 @@ pub const CHATS: &[&str] = &[ pub const TOKEN_CHAT: &str = "chat"; pub const TALKER_SPEED_FACTOR: f32 = 1.0 / 17.0; pub const CHAT_SPEED_MIN_LEN: f32 = 40.0; +pub const NAME_FALLBACK: &str = "Unknown"; pub struct ChatPlugin; impl Plugin for ChatPlugin { @@ -194,7 +195,7 @@ pub fn handle_chat_events( commands.entity(chat_entity).despawn(); } ChatEvent::DisplayMessage(message) => { - log.chat(message.into(), "Someone".to_string()); + log.chat(message.into(), chat.talker.name.clone().unwrap_or(NAME_FALLBACK.to_string())); chat.timer = now + ((message.len() as f32).max(CHAT_SPEED_MIN_LEN) * TALKER_SPEED_FACTOR * chat.talker.talking_speed) as f64; } }