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