fix choice order

This commit is contained in:
yuni 2024-04-15 02:06:10 +02:00
parent 97141ed73a
commit ba1269627d

View file

@ -661,6 +661,7 @@ pub fn handle_chat_events(
time: Res<Time>,
settings: Res<var::Settings>,
) {
let mut choice_key = q_choices.iter().len();
for event in er_chatevent.read() {
let now = time.elapsed_seconds_f64();
let chat_maybe = q_chats.get_single_mut();
@ -674,6 +675,7 @@ pub fn handle_chat_events(
for entity in &q_choices {
commands.entity(entity).despawn();
}
choice_key = 0;
}
ChatEvent::DespawnAllChats => {
commands.entity(chat_entity).despawn();
@ -695,7 +697,7 @@ pub fn handle_chat_events(
let sfx = audio::str2sfx(sound);
ew_sfx.send(audio::PlaySfxEvent(sfx));
}
ChatEvent::SpawnChoice(replytext, key, goto, nowait, condition) => {
ChatEvent::SpawnChoice(replytext, _key, goto, nowait, condition) => {
'out: {
if let Some(condition) = condition {
if !vars.evaluate_condition(condition, &chat.talker.actor_id) {
@ -706,10 +708,11 @@ pub fn handle_chat_events(
world::DespawnOnPlayerDeath,
Choice {
text: replytext.into(),
key: *key,
key: choice_key,
goto: goto.clone(),
}
));
choice_key += 1;
if !nowait {
chat.timer = now + CHOICE_TIMER / settings.chat_speed as f64;
}