Run snap before regular movement controls.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2022-03-30 13:15:12 -05:00
parent 43137cfb36
commit 3fb03d6b41

View File

@ -405,16 +405,17 @@ where
.add_system(update_direction)
.add_system(speak_direction.chain(error_handler))
.add_system_to_stage(CoreStage::PostUpdate, remove_speed);
const MOVEMENT_CONTROLS: &str = "MOVEMENT_CONTROLS";
if config.movement_control_states.is_empty() {
app.add_system(movement_controls::<S, A>)
.add_system(snap::<S, A>.chain(error_handler));
app.add_system(movement_controls::<S, A>.label(MOVEMENT_CONTROLS))
.add_system(snap::<S, A>.chain(error_handler).before(MOVEMENT_CONTROLS));
} else {
let states = config.movement_control_states;
for state in states {
app.add_system_set(
SystemSet::on_update(state)
.with_system(movement_controls::<S, A>)
.with_system(snap::<S, A>.chain(error_handler)),
.with_system(movement_controls::<S, A>.label(MOVEMENT_CONTROLS))
.with_system(snap::<S, A>.chain(error_handler).before(MOVEMENT_CONTROLS)),
);
}
}