mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make roll timed
This commit is contained in:
parent
ecf0d9647c
commit
ae081b8f67
@ -98,10 +98,8 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Roll
|
||||
if on_ground.is_some() && controller.roll {
|
||||
if controller.roll && rollings.get(entity).is_none() && on_ground.is_some() {
|
||||
rollings.insert(entity, Rolling::start());
|
||||
} else {
|
||||
rollings.remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ impl<'a> System<'a> for Sys {
|
||||
ReadStorage<'a, MoveDir>,
|
||||
ReadStorage<'a, Jumping>,
|
||||
ReadStorage<'a, Gliding>,
|
||||
ReadStorage<'a, Rolling>,
|
||||
ReadStorage<'a, Stats>,
|
||||
WriteStorage<'a, Rolling>,
|
||||
WriteStorage<'a, OnGround>,
|
||||
WriteStorage<'a, Pos>,
|
||||
WriteStorage<'a, Vel>,
|
||||
@ -70,8 +70,8 @@ impl<'a> System<'a> for Sys {
|
||||
move_dirs,
|
||||
jumpings,
|
||||
glidings,
|
||||
rollings,
|
||||
stats,
|
||||
mut rollings,
|
||||
mut on_grounds,
|
||||
mut positions,
|
||||
mut velocities,
|
||||
@ -79,13 +79,12 @@ impl<'a> System<'a> for Sys {
|
||||
): Self::SystemData,
|
||||
) {
|
||||
// Apply movement inputs
|
||||
for (entity, stats, move_dir, jumping, gliding, rolling, mut pos, mut vel, mut ori) in (
|
||||
for (entity, stats, move_dir, jumping, gliding, mut pos, mut vel, mut ori) in (
|
||||
&entities,
|
||||
&stats,
|
||||
move_dirs.maybe(),
|
||||
jumpings.maybe(),
|
||||
glidings.maybe(),
|
||||
rollings.maybe(),
|
||||
&mut positions,
|
||||
&mut velocities,
|
||||
&mut orientations,
|
||||
@ -130,8 +129,12 @@ impl<'a> System<'a> for Sys {
|
||||
vel.0.z += dt.0 * lift * Vec2::<f32>::from(vel.0 * 0.15).magnitude().min(1.0);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
if rolling.is_some() {}
|
||||
if let Some(time) = rollings.get_mut(entity).map(|r| &mut r.time) {
|
||||
*time += dt.0;
|
||||
if *time > 0.7 {
|
||||
rollings.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set direction based on velocity
|
||||
if vel.0.magnitude_squared() != 0.0 {
|
||||
|
Loading…
Reference in New Issue
Block a user