diff --git a/src/actor.rs b/src/actor.rs index b64b333..bbf4962 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -78,16 +78,16 @@ impl Default for HitPoints { pub struct ExperiencesGForce { pub gforce: f32, pub damage_threshold: f32, - pub blackout_threshold: f32, - pub blackout: f32, + pub visual_effect_threshold: f32, + pub visual_effect: f32, pub last_linear_velocity: DVec3, pub ignore_gforce_seconds: f32, } impl Default for ExperiencesGForce { fn default() -> Self { Self { gforce: 0.0, damage_threshold: 100.0, - blackout_threshold: 20.0, - blackout: 0.0, + visual_effect_threshold: 20.0, + visual_effect: 0.0, last_linear_velocity: DVec3::splat(0.0), ignore_gforce_seconds: 0.0, }}} @@ -466,17 +466,14 @@ fn handle_gforce( hp.damage += (gforce.gforce - gforce.damage_threshold).powf(2.0) / 3000.0; } -// Blackout disabled for now -// if !settings.god_mode { -// if gforce.blackout > 0.0001 { -// gforce.blackout *= 0.984; -// } -// else if gforce.blackout > 0.0 { -// gforce.blackout = 0.0; -// } -// if gforce.gforce > gforce.blackout_threshold { -// gforce.blackout += (gforce.gforce - gforce.blackout_threshold).powf(2.0) / 300000.0 -// } -// } + if gforce.visual_effect > 0.0001 { + gforce.visual_effect *= 0.984; + } + else if gforce.visual_effect > 0.0 { + gforce.visual_effect = 0.0; + } + if gforce.gforce > gforce.visual_effect_threshold { + gforce.visual_effect += (gforce.gforce - gforce.visual_effect_threshold).powf(2.0) / 300000.0 + } } } diff --git a/src/camera.rs b/src/camera.rs index be89478..283410f 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -91,12 +91,12 @@ pub fn sync_camera_to_player( } pub fn update_fov( - q_player: Query<&actor::LifeForm, With>, + q_player: Query<&actor::ExperiencesGForce, With>, mouse_input: Res>, mut settings: ResMut, mut q_camera: Query<&mut Projection, With>, ) { - if let (Ok(lifeform), Ok(mut projection)) = (q_player.get_single(), q_camera.get_single_mut()) + if let (Ok(gforce), Ok(mut projection)) = (q_player.get_single(), q_camera.get_single_mut()) { let fov: f32; if settings.hud_active && mouse_input.pressed(settings.key_zoom) { @@ -105,7 +105,7 @@ pub fn update_fov( settings.is_zooming = true; } } else { - fov = (lifeform.adrenaline.powf(3.0) * 25.0 + 45.0).to_radians(); + fov = (gforce.visual_effect * 20.0 + 55.0).to_radians(); if settings.is_zooming { settings.is_zooming = false; }