From c5378b70651c064423ac2075da0d1f5dade46562 Mon Sep 17 00:00:00 2001 From: Adam Whitehurst Date: Sat, 21 Mar 2020 14:55:04 -0700 Subject: [PATCH] Better triple_strike handling --- common/src/comp/ability.rs | 1 + common/src/states/triple_strike.rs | 19 +++++++++++++++++-- voxygen/src/scene/figure/mod.rs | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index a114326870..3753ea55da 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -151,6 +151,7 @@ impl From<&CharacterAbility> for CharacterState { stage_exhausted: false, stage_time_active: Duration::default(), should_transition: true, + initialized: false, }) }, } diff --git a/common/src/states/triple_strike.rs b/common/src/states/triple_strike.rs index d8197f29ab..b5a930367f 100644 --- a/common/src/states/triple_strike.rs +++ b/common/src/states/triple_strike.rs @@ -30,11 +30,13 @@ pub struct Data { pub stage_exhausted: bool, /// Whether to go to next stage pub should_transition: bool, + /// Whether state has performed intialization logic + pub initialized: bool, } impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { - let mut update= StateUpdate::from(data); + let mut update = StateUpdate::from(data); let stage_time_active = self .stage_time_active @@ -42,6 +44,7 @@ impl CharacterBehavior for Data { .unwrap_or(Duration::default()); let mut should_transition = self.should_transition; + let mut initialized = self.initialized; // If player stops holding input, if !data.inputs.primary.is_pressed() { @@ -54,11 +57,20 @@ impl CharacterBehavior for Data { should_transition = false; } + if !initialized { + update.ori.0 = data.inputs.look_dir.normalized(); + initialized = true; + } + if self.stage < 3 { // Handling movement if stage_time_active < Duration::from_millis(STAGE_DURATION / 3) { let adjusted_accel = if self.stage == 0 { - INITIAL_ACCEL + if data.physics.touch_entity.is_none() { + INITIAL_ACCEL + } else { + 0.0 + } } else { SECONDARY_ACCEL }; @@ -94,6 +106,7 @@ impl CharacterBehavior for Data { stage_time_active, stage_exhausted: true, should_transition, + initialized, }); } else if stage_time_active > Duration::from_millis(STAGE_DURATION) { if should_transition { @@ -103,6 +116,7 @@ impl CharacterBehavior for Data { stage_time_active: Duration::default(), stage_exhausted: false, should_transition, + initialized, }); } else { // Done @@ -117,6 +131,7 @@ impl CharacterBehavior for Data { stage_time_active, stage_exhausted: self.stage_exhausted, should_transition, + initialized, }); } } else { diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 13f04ded9b..0944c8615b 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -507,7 +507,7 @@ impl FigureMgr { ) }, CharacterState::TripleStrike(s) => match s.stage { - 0 => anim::character::AttackAnimation::update_skeleton( + 0 => anim::character::ChargeAnimation::update_skeleton( &target_base, (active_tool_kind, time), state.state_time, @@ -521,7 +521,7 @@ impl FigureMgr { &mut state_animation_rate, skeleton_attr, ), - _ => anim::character::ChargeAnimation::update_skeleton( + _ => anim::character::AttackAnimation::update_skeleton( &target_base, (active_tool_kind, time), state.state_time,