Remove unnecessary sets/speech from navigation controls.
This commit is contained in:
parent
827cae1a4b
commit
44c40f6473
|
@ -99,7 +99,6 @@ impl Default for Speed {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn snap(
|
fn snap(
|
||||||
mut tts: ResMut<Tts>,
|
|
||||||
mut snap_timers: ResMut<SnapTimers>,
|
mut snap_timers: ResMut<SnapTimers>,
|
||||||
mut query: Query<
|
mut query: Query<
|
||||||
(
|
(
|
||||||
|
@ -110,7 +109,7 @@ fn snap(
|
||||||
),
|
),
|
||||||
With<Player>,
|
With<Player>,
|
||||||
>,
|
>,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) {
|
||||||
for (entity, actions, mut transform, direction) in &mut query {
|
for (entity, actions, mut transform, direction) in &mut query {
|
||||||
if snap_timers.contains_key(&entity) {
|
if snap_timers.contains_key(&entity) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -138,11 +137,12 @@ fn snap(
|
||||||
let yaw: Rot2 = direction.into();
|
let yaw: Rot2 = direction.into();
|
||||||
let yaw = yaw.as_radians();
|
let yaw = yaw.as_radians();
|
||||||
println!("Yaw: {yaw}");
|
println!("Yaw: {yaw}");
|
||||||
transform.rotation = Quat::from_rotation_z(yaw);
|
let rotation = Quat::from_rotation_z(yaw);
|
||||||
tts.speak(direction.to_string(), true)?;
|
if transform.rotation != rotation {
|
||||||
|
transform.rotation = rotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tick_snap_timers(time: Res<Time>, mut snap_timers: ResMut<SnapTimers>) {
|
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(PreUpdate, (update_direction, add_speed))
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
(snap.pipe(error_handler), controls)
|
(snap, controls)
|
||||||
.chain()
|
.chain()
|
||||||
.in_set(Movement),
|
.in_set(Movement),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user