Remove unnecessary sets/speech from navigation controls.

This commit is contained in:
Nolan Darilek 2024-12-01 14:12:32 -06:00
parent 827cae1a4b
commit 44c40f6473

View File

@ -99,7 +99,6 @@ impl Default for Speed {
}
fn snap(
mut tts: ResMut<Tts>,
mut snap_timers: ResMut<SnapTimers>,
mut query: Query<
(
@ -110,7 +109,7 @@ fn snap(
),
With<Player>,
>,
) -> Result<(), Box<dyn Error>> {
) {
for (entity, actions, mut transform, direction) in &mut query {
if snap_timers.contains_key(&entity) {
continue;
@ -138,11 +137,12 @@ fn snap(
let yaw: Rot2 = direction.into();
let yaw = yaw.as_radians();
println!("Yaw: {yaw}");
transform.rotation = Quat::from_rotation_z(yaw);
tts.speak(direction.to_string(), true)?;
let rotation = Quat::from_rotation_z(yaw);
if transform.rotation != rotation {
transform.rotation = rotation;
}
}
}
Ok(())
}
fn tick_snap_timers(time: Res<Time>, mut snap_timers: ResMut<SnapTimers>) {
@ -380,7 +380,7 @@ impl Plugin for NavigationPlugin {
.add_systems(PreUpdate, (update_direction, add_speed))
.add_systems(
Update,
(snap.pipe(error_handler), controls)
(snap, controls)
.chain()
.in_set(Movement),
)