experiment: mute reaction wheels, unless inside vehicle

This commit is contained in:
yuni 2024-04-11 21:42:42 +02:00
parent 629f6ac900
commit 86ce38eda1

View file

@ -176,6 +176,7 @@ pub fn apply_input_to_player(
&mut AngularVelocity,
&mut LinearVelocity,
&mut ExternalTorque,
Option<&actor::PlayerDrivesThis>,
), (With<actor::PlayerCamera>, Without<Camera>)>,
) {
let dt = time.delta_seconds();
@ -200,7 +201,7 @@ pub fn apply_input_to_player(
DVec3::splat(0.0)
};
if let Ok((player_transform, mut engine, mut angularvelocity, mut v, mut torque)) = q_playercam.get_single_mut() {
if let Ok((player_transform, mut engine, mut angularvelocity, mut v, mut torque, bike)) = q_playercam.get_single_mut() {
// Handle key input
if focused {
if key_input.pressed(settings.key_forward) {
@ -335,7 +336,7 @@ pub fn apply_input_to_player(
let volume = sink.volume();
let speed = sink.speed();
let action = pitch_yaw_rot.length_squared().powf(0.2) * 0.0005;
if play_reactionwheel_sound && !settings.mute_sfx {
if play_reactionwheel_sound && !settings.mute_sfx && bike.is_some() {
sink.set_volume((volume + action).clamp(0.0, 1.0));
sink.set_speed((speed + action * 0.2).clamp(0.2, 0.5));
sink.play()