mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'fix-moving' into 'master'
Fix moving after death (again) See merge request veloren/veloren!192 Former-commit-id: a8390094833976a009af7a1e044ff6ee9e10c4ff
This commit is contained in:
commit
e53cd7a15a
@ -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))
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user