From 1fd0481ec49465a0a47d050459ff206145287644 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 13 Apr 2024 01:34:18 +0200 Subject: [PATCH] implement chat speed setting --- src/chat.rs | 8 +++++--- src/settings.rs | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index ce7637a..ccaf18c 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1,7 +1,7 @@ extern crate yaml_rust; use bevy::prelude::*; use yaml_rust::{Yaml, YamlLoader}; -use crate::{audio, hud, world}; +use crate::{audio, hud, settings, world}; pub const CHATS: &[&str] = &[ include_str!("chats/serenity.yaml"), @@ -9,7 +9,8 @@ pub const CHATS: &[&str] = &[ ]; pub const TOKEN_CHAT: &str = "chat"; -pub const TALKER_SPEED_FACTOR: f32 = 1.0 / 17.0; +pub const LETTERS_PER_SECOND: f32 = 17.0; +pub const TALKER_SPEED_FACTOR: f32 = settings::DEFAULT_CHAT_SPEED / LETTERS_PER_SECOND; pub const CHAT_SPEED_MIN_LEN: f32 = 40.0; pub const NAME_FALLBACK: &str = "Unknown"; @@ -176,6 +177,7 @@ pub fn handle_chat_events( q_choices: Query>, mut q_chats: Query<(Entity, &mut Chat)>, time: Res