mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Update common/src/comp/energy.rs, energy.rs, common/src/sys/controller.rs, common/src/sys/movement.rs, movement.rs files
This commit is contained in:
@ -17,6 +17,8 @@ use std::time::Duration;
|
||||
use vek::*;
|
||||
|
||||
const CHARGE_COST: i32 = 200;
|
||||
const ROLL_COST: i32 = 30;
|
||||
|
||||
|
||||
/// # Controller System
|
||||
/// #### Responsible for validating controller inputs and setting new Character
|
||||
@ -568,14 +570,16 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Try to climb
|
||||
if let (true, Some(_wall_dir)) = (
|
||||
|
||||
if let (true, Some(_wall_dir)) = (
|
||||
(inputs.climb.is_pressed() | inputs.climb_down.is_pressed())
|
||||
&& can_climb(body),
|
||||
physics.on_wall,
|
||||
) {
|
||||
character.movement = Climb;
|
||||
continue;
|
||||
}
|
||||
physics.on_wall,)
|
||||
{
|
||||
|
||||
character.movement = Climb;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to swim
|
||||
if !physics.on_ground {
|
||||
@ -603,7 +607,8 @@ impl<'a> System<'a> for Sys {
|
||||
{
|
||||
character.action = Charge {
|
||||
time_left: Duration::from_millis(250),
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -613,10 +618,18 @@ impl<'a> System<'a> for Sys {
|
||||
&& inputs.roll.is_pressed()
|
||||
&& body.is_humanoid()
|
||||
{
|
||||
character.action = Roll {
|
||||
time_left: ROLL_DURATION,
|
||||
was_wielding: character.action.is_wield(),
|
||||
};
|
||||
if energy
|
||||
.get_mut_unchecked()
|
||||
.try_change_by(-ROLL_COST, EnergySource::Roll)
|
||||
.is_ok()
|
||||
{
|
||||
character.action = Roll {
|
||||
time_left: ROLL_DURATION,
|
||||
was_wielding: character.action.is_wield(),
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user