2021-02-22 20:30:53 +00:00
|
|
|
use specs::{
|
2021-03-08 08:36:53 +00:00
|
|
|
shred::ResourceId, Entities, Join, LazyUpdate, Read, ReadStorage, SystemData, World,
|
|
|
|
WriteStorage,
|
2021-02-22 20:30:53 +00:00
|
|
|
};
|
2021-01-08 19:12:09 +00:00
|
|
|
|
2020-12-01 00:28:00 +00:00
|
|
|
use common::{
|
2019-12-20 13:30:37 +00:00
|
|
|
comp::{
|
2021-03-21 18:22:14 +00:00
|
|
|
self,
|
2021-02-23 20:29:27 +00:00
|
|
|
inventory::{
|
|
|
|
item::MaterialStatManifest,
|
|
|
|
slot::{EquipSlot, Slot},
|
|
|
|
},
|
2021-03-23 09:51:53 +00:00
|
|
|
Beam, Body, CharacterState, Combo, Controller, Density, Energy, Health, Inventory, Mass,
|
|
|
|
Melee, Mounting, Ori, PhysicsState, Poise, PoiseState, Pos, SkillSet, StateUpdate, Stats,
|
|
|
|
Vel,
|
2019-12-20 13:30:37 +00:00
|
|
|
},
|
2019-12-26 14:43:59 +00:00
|
|
|
event::{EventBus, LocalEvent, ServerEvent},
|
2020-12-01 00:28:00 +00:00
|
|
|
resources::DeltaTime,
|
|
|
|
states::{
|
|
|
|
self,
|
2021-02-22 20:30:53 +00:00
|
|
|
behavior::{CharacterBehavior, JoinData, JoinStruct},
|
2020-12-01 00:28:00 +00:00
|
|
|
},
|
2021-02-22 20:30:53 +00:00
|
|
|
uid::Uid,
|
2019-12-20 13:30:37 +00:00
|
|
|
};
|
2021-03-08 22:40:02 +00:00
|
|
|
use common_ecs::{Job, Origin, Phase, System};
|
2021-01-27 03:05:13 +00:00
|
|
|
use std::time::Duration;
|
2019-12-20 13:30:37 +00:00
|
|
|
|
2021-03-12 04:53:25 +00:00
|
|
|
fn incorporate_update(join: &mut JoinStruct, mut state_update: StateUpdate) {
|
2020-07-06 05:56:02 +00:00
|
|
|
// TODO: if checking equality is expensive use optional field in StateUpdate
|
2021-02-22 20:30:53 +00:00
|
|
|
if join.char_state.get_unchecked() != &state_update.character {
|
|
|
|
*join.char_state.get_mut_unchecked() = state_update.character
|
2020-07-06 05:56:02 +00:00
|
|
|
};
|
2021-02-22 20:30:53 +00:00
|
|
|
*join.pos = state_update.pos;
|
|
|
|
*join.vel = state_update.vel;
|
|
|
|
*join.ori = state_update.ori;
|
2021-03-23 09:51:53 +00:00
|
|
|
*join.density = state_update.density;
|
2020-07-06 05:56:02 +00:00
|
|
|
// Note: might be changed every tick by timer anyway
|
2021-02-22 20:30:53 +00:00
|
|
|
if join.energy.get_unchecked() != &state_update.energy {
|
|
|
|
*join.energy.get_mut_unchecked() = state_update.energy
|
2020-07-06 05:56:02 +00:00
|
|
|
};
|
2021-03-12 04:53:25 +00:00
|
|
|
join.controller
|
|
|
|
.queued_inputs
|
|
|
|
.append(&mut state_update.queued_inputs);
|
|
|
|
for input in state_update.removed_inputs {
|
|
|
|
join.controller.queued_inputs.remove(&input);
|
|
|
|
}
|
2021-02-08 17:31:17 +00:00
|
|
|
if state_update.swap_equipped_weapons {
|
2021-02-22 20:30:53 +00:00
|
|
|
let mut inventory = join.inventory.get_mut_unchecked();
|
2021-01-08 19:12:09 +00:00
|
|
|
let inventory = &mut *inventory;
|
2021-04-09 07:34:58 +00:00
|
|
|
assert!(
|
|
|
|
inventory
|
|
|
|
.swap(
|
|
|
|
Slot::Equip(EquipSlot::Mainhand),
|
|
|
|
Slot::Equip(EquipSlot::Offhand),
|
|
|
|
)
|
|
|
|
.first()
|
|
|
|
.is_none(),
|
|
|
|
"Swapping main and offhand never results in leftover items",
|
|
|
|
);
|
2020-07-06 05:56:02 +00:00
|
|
|
}
|
2020-03-24 07:38:16 +00:00
|
|
|
}
|
|
|
|
|
2021-02-22 20:30:53 +00:00
|
|
|
#[derive(SystemData)]
|
2021-02-22 21:02:37 +00:00
|
|
|
pub struct ReadData<'a> {
|
2021-02-22 20:30:53 +00:00
|
|
|
entities: Entities<'a>,
|
|
|
|
server_bus: Read<'a, EventBus<ServerEvent>>,
|
|
|
|
local_bus: Read<'a, EventBus<LocalEvent>>,
|
|
|
|
dt: Read<'a, DeltaTime>,
|
|
|
|
lazy_update: Read<'a, LazyUpdate>,
|
|
|
|
healths: ReadStorage<'a, Health>,
|
|
|
|
bodies: ReadStorage<'a, Body>,
|
2021-03-23 09:51:53 +00:00
|
|
|
masses: ReadStorage<'a, Mass>,
|
2021-02-22 20:30:53 +00:00
|
|
|
physics_states: ReadStorage<'a, PhysicsState>,
|
|
|
|
melee_attacks: ReadStorage<'a, Melee>,
|
|
|
|
beams: ReadStorage<'a, Beam>,
|
|
|
|
uids: ReadStorage<'a, Uid>,
|
|
|
|
mountings: ReadStorage<'a, Mounting>,
|
|
|
|
stats: ReadStorage<'a, Stats>,
|
2021-04-14 15:35:34 +00:00
|
|
|
skill_sets: ReadStorage<'a, SkillSet>,
|
2021-02-23 20:29:27 +00:00
|
|
|
msm: Read<'a, MaterialStatManifest>,
|
2021-02-27 23:01:07 +00:00
|
|
|
combos: ReadStorage<'a, Combo>,
|
2021-03-21 18:22:14 +00:00
|
|
|
alignments: ReadStorage<'a, comp::Alignment>,
|
2021-02-22 20:30:53 +00:00
|
|
|
}
|
|
|
|
|
2020-03-21 22:55:20 +00:00
|
|
|
/// ## Character Behavior System
|
2020-08-25 12:21:25 +00:00
|
|
|
/// Passes `JoinData` to `CharacterState`'s `behavior` handler fn's. Receives a
|
2020-03-21 22:55:20 +00:00
|
|
|
/// `StateUpdate` in return and performs updates to ECS Components from that.
|
2021-03-04 14:00:16 +00:00
|
|
|
#[derive(Default)]
|
2019-12-20 13:30:37 +00:00
|
|
|
pub struct Sys;
|
|
|
|
|
2021-03-08 11:13:59 +00:00
|
|
|
impl<'a> System<'a> for Sys {
|
2020-06-10 19:47:36 +00:00
|
|
|
#[allow(clippy::type_complexity)]
|
2019-12-20 13:30:37 +00:00
|
|
|
type SystemData = (
|
2021-02-22 21:02:37 +00:00
|
|
|
ReadData<'a>,
|
2019-12-20 13:30:37 +00:00
|
|
|
WriteStorage<'a, CharacterState>,
|
2019-12-21 15:57:15 +00:00
|
|
|
WriteStorage<'a, Pos>,
|
|
|
|
WriteStorage<'a, Vel>,
|
|
|
|
WriteStorage<'a, Ori>,
|
2021-03-23 09:51:53 +00:00
|
|
|
WriteStorage<'a, Density>,
|
2020-02-24 18:17:16 +00:00
|
|
|
WriteStorage<'a, Energy>,
|
2021-01-08 19:12:09 +00:00
|
|
|
WriteStorage<'a, Inventory>,
|
2020-03-24 07:38:16 +00:00
|
|
|
WriteStorage<'a, Controller>,
|
2021-01-27 03:05:13 +00:00
|
|
|
WriteStorage<'a, Poise>,
|
2019-12-20 13:30:37 +00:00
|
|
|
);
|
2020-02-24 18:17:16 +00:00
|
|
|
|
2021-03-04 14:00:16 +00:00
|
|
|
const NAME: &'static str = "character_behavior";
|
|
|
|
const ORIGIN: Origin = Origin::Common;
|
|
|
|
const PHASE: Phase = Phase::Create;
|
|
|
|
|
2020-06-10 19:47:36 +00:00
|
|
|
#[allow(clippy::while_let_on_iterator)] // TODO: Pending review in #587
|
2019-12-20 13:30:37 +00:00
|
|
|
fn run(
|
2021-03-08 11:13:59 +00:00
|
|
|
_job: &mut Job<Self>,
|
2019-12-20 13:30:37 +00:00
|
|
|
(
|
2021-02-22 21:02:37 +00:00
|
|
|
read_data,
|
2019-12-20 13:30:37 +00:00
|
|
|
mut character_states,
|
2019-12-21 15:57:15 +00:00
|
|
|
mut positions,
|
|
|
|
mut velocities,
|
|
|
|
mut orientations,
|
2021-03-23 09:51:53 +00:00
|
|
|
mut densities,
|
2020-02-24 18:17:16 +00:00
|
|
|
mut energies,
|
2021-01-08 19:12:09 +00:00
|
|
|
mut inventories,
|
2020-03-24 07:38:16 +00:00
|
|
|
mut controllers,
|
2021-01-27 03:05:13 +00:00
|
|
|
mut poises,
|
2019-12-20 13:30:37 +00:00
|
|
|
): Self::SystemData,
|
|
|
|
) {
|
2021-02-22 21:02:37 +00:00
|
|
|
let mut server_emitter = read_data.server_bus.emitter();
|
|
|
|
let mut local_emitter = read_data.local_bus.emitter();
|
2020-03-22 04:49:32 +00:00
|
|
|
|
2021-02-22 20:30:53 +00:00
|
|
|
for (
|
|
|
|
entity,
|
|
|
|
uid,
|
|
|
|
mut char_state,
|
|
|
|
mut pos,
|
|
|
|
mut vel,
|
|
|
|
mut ori,
|
2021-03-23 09:51:53 +00:00
|
|
|
mass,
|
|
|
|
mut density,
|
2021-02-22 20:30:53 +00:00
|
|
|
energy,
|
|
|
|
inventory,
|
|
|
|
mut controller,
|
|
|
|
health,
|
|
|
|
body,
|
|
|
|
physics,
|
2021-03-23 09:51:53 +00:00
|
|
|
(stat, skill_set),
|
2021-02-27 23:01:07 +00:00
|
|
|
combo,
|
2021-02-22 20:30:53 +00:00
|
|
|
) in (
|
2021-02-22 21:02:37 +00:00
|
|
|
&read_data.entities,
|
|
|
|
&read_data.uids,
|
2020-07-06 05:56:02 +00:00
|
|
|
&mut character_states.restrict_mut(),
|
2019-12-21 15:57:15 +00:00
|
|
|
&mut positions,
|
|
|
|
&mut velocities,
|
|
|
|
&mut orientations,
|
2021-03-23 09:51:53 +00:00
|
|
|
&read_data.masses,
|
|
|
|
&mut densities,
|
2020-07-06 05:56:02 +00:00
|
|
|
&mut energies.restrict_mut(),
|
2021-01-08 19:12:09 +00:00
|
|
|
&mut inventories.restrict_mut(),
|
2020-03-24 07:38:16 +00:00
|
|
|
&mut controllers,
|
2021-03-22 17:37:15 +00:00
|
|
|
read_data.healths.maybe(),
|
2021-02-22 21:02:37 +00:00
|
|
|
&read_data.bodies,
|
|
|
|
&read_data.physics_states,
|
2021-03-23 09:51:53 +00:00
|
|
|
(&read_data.stats, &read_data.skill_sets),
|
2021-02-27 23:01:07 +00:00
|
|
|
&read_data.combos,
|
2019-12-20 13:30:37 +00:00
|
|
|
)
|
2020-07-06 05:56:02 +00:00
|
|
|
.join()
|
|
|
|
{
|
2019-12-29 23:47:42 +00:00
|
|
|
// Being dead overrides all other states
|
2021-03-22 17:37:15 +00:00
|
|
|
if health.map_or(false, |h| h.is_dead) {
|
2020-03-24 07:38:16 +00:00
|
|
|
// Do nothing
|
|
|
|
continue;
|
2019-12-29 23:47:42 +00:00
|
|
|
}
|
2020-03-24 07:38:16 +00:00
|
|
|
|
2021-01-27 03:05:13 +00:00
|
|
|
// Enter stunned state if poise damage is enough
|
2021-02-22 20:30:53 +00:00
|
|
|
if let Some(mut poise) = poises.get_mut(entity) {
|
|
|
|
let was_wielded = char_state.get_unchecked().is_wield();
|
2021-01-27 03:05:13 +00:00
|
|
|
let poise_state = poise.poise_state();
|
|
|
|
match poise_state {
|
|
|
|
PoiseState::Normal => {},
|
|
|
|
PoiseState::Interrupted => {
|
|
|
|
poise.reset();
|
2021-02-22 20:30:53 +00:00
|
|
|
*char_state.get_mut_unchecked() =
|
2021-01-27 03:05:13 +00:00
|
|
|
CharacterState::Stunned(common::states::stunned::Data {
|
|
|
|
static_data: common::states::stunned::StaticData {
|
2021-04-15 06:49:12 +00:00
|
|
|
buildup_duration: Duration::from_millis(125),
|
|
|
|
recover_duration: Duration::from_millis(125),
|
|
|
|
movement_speed: 0.80,
|
2021-01-27 03:05:13 +00:00
|
|
|
poise_state,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: common::states::utils::StageSection::Buildup,
|
|
|
|
was_wielded,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
PoiseState::Stunned => {
|
|
|
|
poise.reset();
|
2021-02-22 20:30:53 +00:00
|
|
|
*char_state.get_mut_unchecked() =
|
2021-01-27 03:05:13 +00:00
|
|
|
CharacterState::Stunned(common::states::stunned::Data {
|
|
|
|
static_data: common::states::stunned::StaticData {
|
2021-04-15 06:49:12 +00:00
|
|
|
buildup_duration: Duration::from_millis(300),
|
2021-01-29 23:40:40 +00:00
|
|
|
recover_duration: Duration::from_millis(300),
|
2021-04-15 06:49:12 +00:00
|
|
|
movement_speed: 0.65,
|
2021-01-27 03:05:13 +00:00
|
|
|
poise_state,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: common::states::utils::StageSection::Buildup,
|
|
|
|
was_wielded,
|
|
|
|
});
|
|
|
|
server_emitter.emit(ServerEvent::Knockback {
|
2021-02-22 20:30:53 +00:00
|
|
|
entity,
|
2021-01-27 03:05:13 +00:00
|
|
|
impulse: 5.0 * poise.knockback(),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
PoiseState::Dazed => {
|
|
|
|
poise.reset();
|
2021-02-22 20:30:53 +00:00
|
|
|
*char_state.get_mut_unchecked() =
|
2021-01-27 03:05:13 +00:00
|
|
|
CharacterState::Stunned(common::states::stunned::Data {
|
|
|
|
static_data: common::states::stunned::StaticData {
|
2021-04-15 06:49:12 +00:00
|
|
|
buildup_duration: Duration::from_millis(600),
|
2021-01-29 23:40:40 +00:00
|
|
|
recover_duration: Duration::from_millis(250),
|
2021-04-15 06:49:12 +00:00
|
|
|
movement_speed: 0.45,
|
2021-01-27 03:05:13 +00:00
|
|
|
poise_state,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: common::states::utils::StageSection::Buildup,
|
|
|
|
was_wielded,
|
|
|
|
});
|
|
|
|
server_emitter.emit(ServerEvent::Knockback {
|
2021-02-22 20:30:53 +00:00
|
|
|
entity,
|
2021-01-27 03:05:13 +00:00
|
|
|
impulse: 10.0 * poise.knockback(),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
PoiseState::KnockedDown => {
|
|
|
|
poise.reset();
|
2021-02-22 20:30:53 +00:00
|
|
|
*char_state.get_mut_unchecked() =
|
2021-01-27 03:05:13 +00:00
|
|
|
CharacterState::Stunned(common::states::stunned::Data {
|
|
|
|
static_data: common::states::stunned::StaticData {
|
2021-04-15 06:49:12 +00:00
|
|
|
buildup_duration: Duration::from_millis(750),
|
|
|
|
recover_duration: Duration::from_millis(500),
|
|
|
|
movement_speed: 0.4,
|
2021-01-27 03:05:13 +00:00
|
|
|
poise_state,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: common::states::utils::StageSection::Buildup,
|
|
|
|
was_wielded,
|
|
|
|
});
|
|
|
|
server_emitter.emit(ServerEvent::Knockback {
|
2021-02-22 20:30:53 +00:00
|
|
|
entity,
|
2021-01-27 03:05:13 +00:00
|
|
|
impulse: 10.0 * poise.knockback(),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Controller actions
|
2021-02-22 20:30:53 +00:00
|
|
|
let actions = std::mem::replace(&mut controller.actions, Vec::new());
|
|
|
|
|
|
|
|
let mut join_struct = JoinStruct {
|
|
|
|
entity,
|
|
|
|
uid: &uid,
|
|
|
|
char_state,
|
|
|
|
pos: &mut pos,
|
|
|
|
vel: &mut vel,
|
|
|
|
ori: &mut ori,
|
2021-03-23 09:51:53 +00:00
|
|
|
mass: &mass,
|
|
|
|
density: &mut density,
|
2021-02-22 20:30:53 +00:00
|
|
|
energy,
|
|
|
|
inventory,
|
|
|
|
controller: &mut controller,
|
2021-03-22 17:37:15 +00:00
|
|
|
health,
|
2021-02-22 20:30:53 +00:00
|
|
|
body: &body,
|
|
|
|
physics: &physics,
|
2021-02-22 21:02:37 +00:00
|
|
|
melee_attack: read_data.melee_attacks.get(entity),
|
|
|
|
beam: read_data.beams.get(entity),
|
2021-02-22 20:30:53 +00:00
|
|
|
stat: &stat,
|
2021-04-14 15:35:34 +00:00
|
|
|
skill_set: &skill_set,
|
2021-02-27 23:01:07 +00:00
|
|
|
combo: &combo,
|
2021-03-21 18:22:14 +00:00
|
|
|
alignment: read_data.alignments.get(entity),
|
2021-02-22 20:30:53 +00:00
|
|
|
};
|
|
|
|
|
2020-03-24 07:38:16 +00:00
|
|
|
for action in actions {
|
2021-02-23 20:29:27 +00:00
|
|
|
let j = JoinData::new(
|
|
|
|
&join_struct,
|
|
|
|
&read_data.lazy_update,
|
|
|
|
&read_data.dt,
|
|
|
|
&read_data.msm,
|
|
|
|
);
|
2020-03-24 07:38:16 +00:00
|
|
|
let mut state_update = match j.character {
|
|
|
|
CharacterState::Idle => states::idle::Data.handle_event(&j, action),
|
2021-01-31 20:29:50 +00:00
|
|
|
CharacterState::Talk => states::talk::Data.handle_event(&j, action),
|
2021-03-20 16:13:59 +00:00
|
|
|
CharacterState::Climb(data) => data.handle_event(&j, action),
|
2021-04-27 14:41:48 +00:00
|
|
|
CharacterState::Glide(data) => data.handle_event(&j, action),
|
2020-06-16 21:32:39 +00:00
|
|
|
CharacterState::GlideWield => {
|
|
|
|
states::glide_wield::Data.handle_event(&j, action)
|
|
|
|
},
|
2020-12-05 18:23:45 +00:00
|
|
|
CharacterState::Stunned(data) => data.handle_event(&j, action),
|
2020-03-24 07:38:16 +00:00
|
|
|
CharacterState::Sit => {
|
|
|
|
states::sit::Data::handle_event(&states::sit::Data, &j, action)
|
|
|
|
},
|
2020-05-27 06:41:55 +00:00
|
|
|
CharacterState::Dance => {
|
|
|
|
states::dance::Data::handle_event(&states::dance::Data, &j, action)
|
|
|
|
},
|
2020-08-02 05:09:11 +00:00
|
|
|
CharacterState::Sneak => {
|
|
|
|
states::sneak::Data::handle_event(&states::sneak::Data, &j, action)
|
|
|
|
},
|
2021-04-10 03:40:20 +00:00
|
|
|
CharacterState::BasicBlock(data) => data.handle_event(&j, action),
|
2020-03-24 07:38:16 +00:00
|
|
|
CharacterState::Roll(data) => data.handle_event(&j, action),
|
|
|
|
CharacterState::Wielding => states::wielding::Data.handle_event(&j, action),
|
|
|
|
CharacterState::Equipping(data) => data.handle_event(&j, action),
|
2020-09-04 01:54:59 +00:00
|
|
|
CharacterState::ComboMelee(data) => data.handle_event(&j, action),
|
2020-03-24 07:38:16 +00:00
|
|
|
CharacterState::BasicMelee(data) => data.handle_event(&j, action),
|
|
|
|
CharacterState::BasicRanged(data) => data.handle_event(&j, action),
|
|
|
|
CharacterState::Boost(data) => data.handle_event(&j, action),
|
|
|
|
CharacterState::DashMelee(data) => data.handle_event(&j, action),
|
2020-07-03 15:40:12 +00:00
|
|
|
CharacterState::LeapMelee(data) => data.handle_event(&j, action),
|
2020-07-08 19:58:41 +00:00
|
|
|
CharacterState::SpinMelee(data) => data.handle_event(&j, action),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterState::ChargedMelee(data) => data.handle_event(&j, action),
|
2020-07-26 03:06:53 +00:00
|
|
|
CharacterState::ChargedRanged(data) => data.handle_event(&j, action),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterState::RepeaterRanged(data) => data.handle_event(&j, action),
|
2020-10-04 01:24:15 +00:00
|
|
|
CharacterState::Shockwave(data) => data.handle_event(&j, action),
|
2020-08-27 00:08:29 +00:00
|
|
|
CharacterState::BasicBeam(data) => data.handle_event(&j, action),
|
2021-03-06 21:29:00 +00:00
|
|
|
CharacterState::BasicAura(data) => data.handle_event(&j, action),
|
2021-03-02 19:26:45 +00:00
|
|
|
CharacterState::HealingBeam(data) => data.handle_event(&j, action),
|
2021-03-21 03:28:13 +00:00
|
|
|
CharacterState::Blink(data) => data.handle_event(&j, action),
|
2021-03-21 05:53:39 +00:00
|
|
|
CharacterState::BasicSummon(data) => data.handle_event(&j, action),
|
2020-03-24 07:38:16 +00:00
|
|
|
};
|
|
|
|
local_emitter.append(&mut state_update.local_events);
|
|
|
|
server_emitter.append(&mut state_update.server_events);
|
2021-02-22 20:30:53 +00:00
|
|
|
incorporate_update(&mut join_struct, state_update);
|
2019-12-29 23:47:42 +00:00
|
|
|
}
|
|
|
|
|
2021-03-15 04:26:19 +00:00
|
|
|
// Mounted occurs after control actions have been handled
|
|
|
|
// If mounted, character state is controlled by mount
|
|
|
|
// TODO: Make mounting a state
|
|
|
|
if let Some(Mounting(_)) = read_data.mountings.get(entity) {
|
|
|
|
let sit_state = CharacterState::Sit {};
|
|
|
|
if join_struct.char_state.get_unchecked() != &sit_state {
|
|
|
|
*join_struct.char_state.get_mut_unchecked() = sit_state;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-02-23 20:29:27 +00:00
|
|
|
let j = JoinData::new(
|
|
|
|
&join_struct,
|
|
|
|
&read_data.lazy_update,
|
|
|
|
&read_data.dt,
|
|
|
|
&read_data.msm,
|
|
|
|
);
|
2020-03-24 07:38:16 +00:00
|
|
|
|
2020-03-07 18:15:02 +00:00
|
|
|
let mut state_update = match j.character {
|
2020-03-15 13:34:17 +00:00
|
|
|
CharacterState::Idle => states::idle::Data.behavior(&j),
|
2021-01-31 20:29:50 +00:00
|
|
|
CharacterState::Talk => states::talk::Data.behavior(&j),
|
2021-03-20 16:13:59 +00:00
|
|
|
CharacterState::Climb(data) => data.behavior(&j),
|
2021-04-27 14:41:48 +00:00
|
|
|
CharacterState::Glide(data) => data.behavior(&j),
|
2020-06-16 21:32:39 +00:00
|
|
|
CharacterState::GlideWield => states::glide_wield::Data.behavior(&j),
|
2020-12-05 18:23:45 +00:00
|
|
|
CharacterState::Stunned(data) => data.behavior(&j),
|
2020-03-14 21:17:27 +00:00
|
|
|
CharacterState::Sit => states::sit::Data::behavior(&states::sit::Data, &j),
|
2020-05-27 06:41:55 +00:00
|
|
|
CharacterState::Dance => states::dance::Data::behavior(&states::dance::Data, &j),
|
2020-08-02 05:09:11 +00:00
|
|
|
CharacterState::Sneak => states::sneak::Data::behavior(&states::sneak::Data, &j),
|
2021-04-10 03:40:20 +00:00
|
|
|
CharacterState::BasicBlock(data) => data.behavior(&j),
|
2020-03-15 13:34:17 +00:00
|
|
|
CharacterState::Roll(data) => data.behavior(&j),
|
|
|
|
CharacterState::Wielding => states::wielding::Data.behavior(&j),
|
|
|
|
CharacterState::Equipping(data) => data.behavior(&j),
|
2020-09-04 01:54:59 +00:00
|
|
|
CharacterState::ComboMelee(data) => data.behavior(&j),
|
2020-03-16 11:32:57 +00:00
|
|
|
CharacterState::BasicMelee(data) => data.behavior(&j),
|
|
|
|
CharacterState::BasicRanged(data) => data.behavior(&j),
|
|
|
|
CharacterState::Boost(data) => data.behavior(&j),
|
2020-03-16 15:34:53 +00:00
|
|
|
CharacterState::DashMelee(data) => data.behavior(&j),
|
2020-07-03 15:40:12 +00:00
|
|
|
CharacterState::LeapMelee(data) => data.behavior(&j),
|
2020-07-08 19:58:41 +00:00
|
|
|
CharacterState::SpinMelee(data) => data.behavior(&j),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterState::ChargedMelee(data) => data.behavior(&j),
|
2020-07-26 03:06:53 +00:00
|
|
|
CharacterState::ChargedRanged(data) => data.behavior(&j),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterState::RepeaterRanged(data) => data.behavior(&j),
|
2020-10-04 01:24:15 +00:00
|
|
|
CharacterState::Shockwave(data) => data.behavior(&j),
|
2020-08-27 00:08:29 +00:00
|
|
|
CharacterState::BasicBeam(data) => data.behavior(&j),
|
2021-03-06 21:29:00 +00:00
|
|
|
CharacterState::BasicAura(data) => data.behavior(&j),
|
2021-03-02 19:26:45 +00:00
|
|
|
CharacterState::HealingBeam(data) => data.behavior(&j),
|
2021-03-21 03:28:13 +00:00
|
|
|
CharacterState::Blink(data) => data.behavior(&j),
|
2021-03-21 05:53:39 +00:00
|
|
|
CharacterState::BasicSummon(data) => data.behavior(&j),
|
2020-03-07 18:15:02 +00:00
|
|
|
};
|
2019-12-26 14:43:59 +00:00
|
|
|
|
2020-03-22 04:49:32 +00:00
|
|
|
local_emitter.append(&mut state_update.local_events);
|
|
|
|
server_emitter.append(&mut state_update.server_events);
|
2021-02-22 20:30:53 +00:00
|
|
|
incorporate_update(&mut join_struct, state_update);
|
2019-12-29 23:47:42 +00:00
|
|
|
}
|
2019-12-22 16:08:48 +00:00
|
|
|
}
|
|
|
|
}
|