2020-01-09 16:23:20 +00:00
|
|
|
use super::utils::*;
|
2020-03-14 21:17:27 +00:00
|
|
|
use crate::{
|
|
|
|
comp::StateUpdate,
|
|
|
|
sys::character_behavior::{CharacterBehavior, JoinData},
|
|
|
|
};
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-07 19:55:15 +00:00
|
|
|
// const BLOCK_ACCEL: f32 = 30.0;
|
|
|
|
// const BLOCK_SPEED: f32 = 75.0;
|
2020-01-07 15:49:08 +00:00
|
|
|
|
2020-03-14 21:17:27 +00:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
|
|
|
pub struct Data;
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-14 21:17:27 +00:00
|
|
|
impl CharacterBehavior for Data {
|
|
|
|
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
2020-03-21 21:16:26 +00:00
|
|
|
let mut update = StateUpdate::from(data);
|
2020-02-24 19:57:33 +00:00
|
|
|
|
2020-03-14 21:17:27 +00:00
|
|
|
handle_move(&data, &mut update);
|
|
|
|
|
2020-03-16 12:40:14 +00:00
|
|
|
if !data.physics.on_ground
|
|
|
|
|| !(data.inputs.secondary.is_pressed() || data.inputs.primary.is_pressed())
|
|
|
|
{
|
2020-03-14 21:17:27 +00:00
|
|
|
attempt_wield(data, &mut update);
|
|
|
|
}
|
|
|
|
update
|
2019-12-26 14:43:59 +00:00
|
|
|
}
|
|
|
|
}
|