2020-01-21 22:54:32 +00:00
|
|
|
use super::utils::*;
|
2020-03-07 18:15:02 +00:00
|
|
|
use crate::{comp::StateUpdate, sys::character_state::JoinData};
|
|
|
|
use std::collections::VecDeque;
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-07 18:15:02 +00:00
|
|
|
pub fn behavior(ecs_data: &JoinData) -> StateUpdate {
|
|
|
|
let mut update = StateUpdate {
|
|
|
|
character: *ecs_data.character,
|
|
|
|
pos: *ecs_data.pos,
|
|
|
|
vel: *ecs_data.vel,
|
|
|
|
ori: *ecs_data.ori,
|
|
|
|
energy: *ecs_data.energy,
|
|
|
|
local_events: VecDeque::new(),
|
|
|
|
server_events: VecDeque::new(),
|
|
|
|
};
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-07 18:15:02 +00:00
|
|
|
handle_move(&ecs_data, &mut update);
|
|
|
|
handle_jump(&ecs_data, &mut update);
|
|
|
|
handle_sit(&ecs_data, &mut update);
|
|
|
|
handle_climb(&ecs_data, &mut update);
|
|
|
|
handle_glide(&ecs_data, &mut update);
|
|
|
|
handle_unwield(&ecs_data, &mut update);
|
|
|
|
handle_primary(&ecs_data, &mut update);
|
|
|
|
handle_secondary(&ecs_data, &mut update);
|
|
|
|
handle_dodge(&ecs_data, &mut update);
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-07 18:15:02 +00:00
|
|
|
update
|
2019-12-26 14:43:59 +00:00
|
|
|
}
|