gain adrenaline at high velocity

This commit is contained in:
yuni 2024-03-28 23:13:59 +01:00
parent bbf4f468cd
commit 1486b6749a

View file

@ -197,16 +197,20 @@ pub fn update_physics_actors(
pub fn update_physics_lifeforms( pub fn update_physics_lifeforms(
time: Res<Time>, time: Res<Time>,
mut query: Query<(&mut LifeForm, &mut Suit)>, mut query: Query<(&mut LifeForm, &mut Suit, &Actor)>,
) { ) {
let d = time.delta_seconds(); let d = time.delta_seconds();
for (mut lifeform, mut suit) in query.iter_mut() { for (mut lifeform, mut suit, actor) in query.iter_mut() {
if lifeform.adrenaline_jolt.abs() > 1e-3 { if lifeform.adrenaline_jolt.abs() > 1e-3 {
lifeform.adrenaline_jolt *= 0.99; lifeform.adrenaline_jolt *= 0.99;
} }
else { else {
lifeform.adrenaline_jolt = 0.0 lifeform.adrenaline_jolt = 0.0
} }
let speed = actor.v.length();
if speed > 1000.0 {
lifeform.adrenaline += 0.001;
}
lifeform.adrenaline = (lifeform.adrenaline - 0.0001 + lifeform.adrenaline_jolt * 0.01).clamp(0.0, 1.0); lifeform.adrenaline = (lifeform.adrenaline - 0.0001 + lifeform.adrenaline_jolt * 0.01).clamp(0.0, 1.0);
let mut oxygen_drain = nature::OXY_S; let mut oxygen_drain = nature::OXY_S;