Update common/src/sys/movement.rs

This commit is contained in:
Ben Simpson 2020-02-13 08:13:36 +00:00
parent a49482503d
commit 0cd8150e98

View File

@ -232,18 +232,18 @@ impl<'a> System<'a> for Sys {
character.movement == Climb && vel.0.z <= CLIMB_SPEED,
physics.on_wall,
) {
if inputs.climb_down.is_pressed() && !inputs.climb.is_pressed() {
if energy
if inputs.climb_down.is_pressed() && !inputs.climb.is_pressed() && energy
.get_mut_unchecked()
.try_change_by(-CLIMB_COST, EnergySource::Climb)
.is_ok(){
.is_ok()
{
vel.0 -= dt.0 * vel.0.map(|e| e.abs().powf(1.5) * e.signum() * 6.0);
}
} else if inputs.climb.is_pressed() && !inputs.climb_down.is_pressed() {
if energy
} else if inputs.climb.is_pressed() && !inputs.climb_down.is_pressed() && energy
.get_mut_unchecked()
.try_change_by(-CLIMB_COST, EnergySource::Climb)
.is_ok(){
.is_ok()
{
vel.0.z = (vel.0.z + dt.0 * GRAVITY * 1.25).min(CLIMB_SPEED).max(0.0);
}
} else {