diff --git a/common/src/sys/inputs.rs b/common/src/sys/inputs.rs index 1cf3f6a907..0a32422607 100644 --- a/common/src/sys/inputs.rs +++ b/common/src/sys/inputs.rs @@ -58,15 +58,21 @@ impl<'a> System<'a> for Sys { mut force_updates, ): Self::SystemData, ) { - for (entity, pos, control, mut dir, mut vel) in ( + for (entity, pos, control, stats, mut dir, mut vel) in ( &entities, &positions, &controls, + &stats, &mut directions, &mut velocities, ) .join() { + // Disable while dead TODO: Replace with client states + if stats.is_dead { + continue; + } + // Handle held-down control let on_ground = terrain .get((pos.0 - Vec3::unit_z() * 0.1).map(|e| e.floor() as i32)) diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 99a8ce8db4..8325431c68 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,5 +1,8 @@ use crate::{ - comp::phys::{Pos, Vel}, + comp::{ + phys::{Pos, Vel}, + Stats, + }, state::DeltaTime, terrain::TerrainMap, vol::{ReadVol, Vox}, @@ -16,12 +19,18 @@ impl<'a> System<'a> for Sys { type SystemData = ( ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, + ReadStorage<'a, Stats>, WriteStorage<'a, Pos>, WriteStorage<'a, Vel>, ); - fn run(&mut self, (terrain, dt, mut positions, mut velocities): Self::SystemData) { - for (pos, vel) in (&mut positions, &mut velocities).join() { + fn run(&mut self, (terrain, dt, stats, mut positions, mut velocities): Self::SystemData) { + for (stats, pos, vel) in (&stats, &mut positions, &mut velocities).join() { + // Disable while dead TODO: Replace with client states + if stats.is_dead { + continue; + } + // Gravity vel.0.z = (vel.0.z - GRAVITY * dt.0).max(-50.0);