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,
|
mut force_updates,
|
||||||
): Self::SystemData,
|
): Self::SystemData,
|
||||||
) {
|
) {
|
||||||
for (entity, pos, control, mut dir, mut vel) in (
|
for (entity, pos, control, stats, mut dir, mut vel) in (
|
||||||
&entities,
|
&entities,
|
||||||
&positions,
|
&positions,
|
||||||
&controls,
|
&controls,
|
||||||
|
&stats,
|
||||||
&mut directions,
|
&mut directions,
|
||||||
&mut velocities,
|
&mut velocities,
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
{
|
{
|
||||||
|
// Disable while dead TODO: Replace with client states
|
||||||
|
if stats.is_dead {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle held-down control
|
// Handle held-down control
|
||||||
let on_ground = terrain
|
let on_ground = terrain
|
||||||
.get((pos.0 - Vec3::unit_z() * 0.1).map(|e| e.floor() as i32))
|
.get((pos.0 - Vec3::unit_z() * 0.1).map(|e| e.floor() as i32))
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::phys::{Pos, Vel},
|
comp::{
|
||||||
|
phys::{Pos, Vel},
|
||||||
|
Stats,
|
||||||
|
},
|
||||||
state::DeltaTime,
|
state::DeltaTime,
|
||||||
terrain::TerrainMap,
|
terrain::TerrainMap,
|
||||||
vol::{ReadVol, Vox},
|
vol::{ReadVol, Vox},
|
||||||
@ -16,12 +19,18 @@ impl<'a> System<'a> for Sys {
|
|||||||
type SystemData = (
|
type SystemData = (
|
||||||
ReadExpect<'a, TerrainMap>,
|
ReadExpect<'a, TerrainMap>,
|
||||||
Read<'a, DeltaTime>,
|
Read<'a, DeltaTime>,
|
||||||
|
ReadStorage<'a, Stats>,
|
||||||
WriteStorage<'a, Pos>,
|
WriteStorage<'a, Pos>,
|
||||||
WriteStorage<'a, Vel>,
|
WriteStorage<'a, Vel>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn run(&mut self, (terrain, dt, mut positions, mut velocities): Self::SystemData) {
|
fn run(&mut self, (terrain, dt, stats, mut positions, mut velocities): Self::SystemData) {
|
||||||
for (pos, vel) in (&mut positions, &mut velocities).join() {
|
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
|
// Gravity
|
||||||
vel.0.z = (vel.0.z - GRAVITY * dt.0).max(-50.0);
|
vel.0.z = (vel.0.z - GRAVITY * dt.0).max(-50.0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user