disable chat timer

This commit is contained in:
yuni 2024-10-26 00:59:44 +02:00
parent b01d53833b
commit 092feccc84

View file

@ -48,6 +48,7 @@ pub const TOKEN_IF_INLINE: &str = "if "; // for lines like `- if foo:`
pub const DEFAULT_SOUND: &str = "chat"; pub const DEFAULT_SOUND: &str = "chat";
pub const MAX_BRANCH_DEPTH: usize = 64; pub const MAX_BRANCH_DEPTH: usize = 64;
pub const ENABLE_CHOICE_TIMER: bool = false;
pub const CHOICE_TIMER: f64 = 40.0 * var::DEFAULT_CHAT_SPEED as f64; pub const CHOICE_TIMER: f64 = 40.0 * var::DEFAULT_CHAT_SPEED as f64;
pub const LETTERS_PER_SECOND: f32 = 17.0; pub const LETTERS_PER_SECOND: f32 = 17.0;
pub const TALKER_SPEED_FACTOR: f32 = var::DEFAULT_CHAT_SPEED / LETTERS_PER_SECOND; pub const TALKER_SPEED_FACTOR: f32 = var::DEFAULT_CHAT_SPEED / LETTERS_PER_SECOND;
@ -770,11 +771,15 @@ pub fn handle_chat_events(
); );
} }
} }
chat.timer = now if ENABLE_CHOICE_TIMER {
+ ((message.len() as f32).max(CHAT_SPEED_MIN_LEN) chat.timer = now
* TALKER_SPEED_FACTOR + ((message.len() as f32).max(CHAT_SPEED_MIN_LEN)
* chat.talker.talking_speed * TALKER_SPEED_FACTOR
/ settings.chat_speed) as f64; * chat.talker.talking_speed
/ settings.chat_speed) as f64;
} else {
chat.timer = f64::INFINITY;
}
let sfx = audio::str2sfx(sound); let sfx = audio::str2sfx(sound);
ew_sfx.send(audio::PlaySfxEvent(sfx)); ew_sfx.send(audio::PlaySfxEvent(sfx));
@ -794,7 +799,7 @@ pub fn handle_chat_events(
}, },
)); ));
choice_key += 1; choice_key += 1;
if !nowait { if ENABLE_CHOICE_TIMER && !nowait {
chat.timer = now + CHOICE_TIMER / settings.chat_speed as f64; chat.timer = now + CHOICE_TIMER / settings.chat_speed as f64;
} }
} }