veloren/common/src/states/basic_block.rs
Adam Whitehurst 819c2767bc * move swap loadout to handle_swap_loadout util fn
* impl From<JoinData> for StateUpdate
2020-03-21 14:16:26 -07:00

27 lines
680 B
Rust

use super::utils::*;
use crate::{
comp::StateUpdate,
sys::character_behavior::{CharacterBehavior, JoinData},
};
// const BLOCK_ACCEL: f32 = 30.0;
// const BLOCK_SPEED: f32 = 75.0;
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct Data;
impl CharacterBehavior for Data {
fn behavior(&self, data: &JoinData) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_move(&data, &mut update);
if !data.physics.on_ground
|| !(data.inputs.secondary.is_pressed() || data.inputs.primary.is_pressed())
{
attempt_wield(data, &mut update);
}
update
}
}