change thruster sound pitch while boosting

This commit is contained in:
yuni 2024-09-22 05:59:46 +02:00
parent b5e969f0f7
commit ae3e9c9b48

View file

@ -541,16 +541,16 @@ pub fn apply_input_to_player(
let right_factor = engine.thrust_sideways * engine.current_warmup;
let up_factor = engine.thrust_sideways * engine.current_warmup;
let factor = DVec3::new(right_factor as f64, up_factor as f64, forward_factor as f64);
let boost = if bike.is_none() {
engine.current_boost_factor
} else {
1.0
};
if axis_input.length_squared() > 0.003 {
engine.currently_firing = true;
let acceleration_global: DVec3 =
DVec3::from(player_transform.rotation * (axis_input * factor).as_vec3());
let boost = if bike.is_none() {
engine.current_boost_factor
} else {
1.0
};
let mut acceleration_total: DVec3 =
(actor::ENGINE_SPEED_FACTOR * dt) as f64 * boost * acceleration_global;
let threshold = 1e-5;
@ -687,21 +687,23 @@ pub fn apply_input_to_player(
let sinks = vec![
(
1.0,
boost as f32,
actor::EngineType::Monopropellant,
sinks.get(&audio::Sfx::Thruster),
),
(1.0, actor::EngineType::Ion, sinks.get(&audio::Sfx::Ion)),
(1.0, 1.0, actor::EngineType::Ion, sinks.get(&audio::Sfx::Ion)),
];
let seconds_to_max_vol = 0.05;
let seconds_to_min_vol = 0.05;
for sink_data in sinks {
if let (vol_boost, engine_type, Some(sink)) = sink_data {
if let (vol_boost, speed, engine_type, Some(sink)) = sink_data {
if settings.mute_sfx {
sink.pause();
} else {
let volume = sink.volume();
if engine.engine_type == engine_type {
if play_thruster_sound {
sink.set_speed(speed);
sink.play();
if volume < 1.0 {
let maxvol = vol_boost;