show g forces when using speed cheat
This commit is contained in:
parent
9218398c77
commit
6a93193720
11
src/actor.rs
11
src/actor.rs
|
@ -454,15 +454,14 @@ fn handle_gforce(
|
|||
mut q_actor: Query<(&LinearVelocity, &mut HitPoints, &mut ExperiencesGForce)>,
|
||||
) {
|
||||
let dt = time.delta_seconds();
|
||||
let factor = 1.0 / dt / 9.81;
|
||||
let factor = 1.0 / dt / nature::EARTH_GRAVITY;
|
||||
for (v, mut hp, mut gforce) in &mut q_actor {
|
||||
if gforce.ignore_gforce_seconds > 0.0 {
|
||||
gforce.ignore_gforce_seconds -= dt;
|
||||
gforce.last_linear_velocity = v.0;
|
||||
continue;
|
||||
}
|
||||
gforce.gforce = factor * (v.0 - gforce.last_linear_velocity).length() as f32;
|
||||
gforce.last_linear_velocity = v.0;
|
||||
if gforce.ignore_gforce_seconds > 0.0 {
|
||||
gforce.ignore_gforce_seconds -= dt;
|
||||
continue;
|
||||
}
|
||||
if gforce.gforce > gforce.damage_threshold {
|
||||
hp.damage += (gforce.gforce - gforce.damage_threshold).powf(2.0) / 3000.0;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ pub const OXY_H: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0;
|
|||
pub const OXY_D: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0 * 24.0;
|
||||
pub const PARSEC2METER: f64 = 3.0857e16;
|
||||
pub const DIST_JUPTER_SUN: f64 = 778479.0e6;
|
||||
pub const EARTH_GRAVITY: f32 = 9.81;
|
||||
|
||||
pub fn star_color_index_to_rgb(color_index: f32) -> (f32, f32, f32) {
|
||||
let temperature = 4600.0 * ((1.0 / (0.92 * color_index + 1.7)) + (1.0 / (0.92 * color_index + 0.62)));
|
||||
|
|
Loading…
Reference in a new issue