mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
c212de00c2
- replace serde_derive by feature of serde incl. source code modifications to compile - reduce futures-timer to "2.0" to be same as async_std - update notify - removed mio, bincode and lz4 compress in common as networking is now in own crate btw there is a better lz4 compress crate, which is newer than 2017 - update prometheus to 0.9 - can't update uvth yet due to usues - hashbrown to 7.2 to only need a single version - libsqlite3 update - image didn't change as there is a problem with `image 0.23` - switch old directories with newer directories-next - no num upgrade as we still depend on num 0.2 anyways - rodio and cpal upgrade - const-tewaker update - dispatch (untested) update - git2 update - iterations update
45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
use super::utils::*;
|
|
use crate::{
|
|
comp::{CharacterState, StateUpdate},
|
|
sys::character_behavior::{CharacterBehavior, JoinData},
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[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_wield(data, &mut update);
|
|
handle_jump(&data, &mut update);
|
|
|
|
// Try to Fall/Stand up/Move
|
|
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
|
update.character = CharacterState::Idle;
|
|
}
|
|
|
|
update
|
|
}
|
|
|
|
fn wield(&self, data: &JoinData) -> StateUpdate {
|
|
let mut update = StateUpdate::from(data);
|
|
attempt_wield(data, &mut update);
|
|
update
|
|
}
|
|
|
|
fn sit(&self, data: &JoinData) -> StateUpdate {
|
|
let mut update = StateUpdate::from(data);
|
|
attempt_sit(data, &mut update);
|
|
update
|
|
}
|
|
|
|
fn stand(&self, data: &JoinData) -> StateUpdate {
|
|
let mut update = StateUpdate::from(data);
|
|
// Try to Fall/Stand up/Move
|
|
update.character = CharacterState::Idle;
|
|
update
|
|
}
|
|
}
|