mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fixes
This commit is contained in:
parent
7b558b4542
commit
6515daddce
@ -70,10 +70,10 @@ impl CharacterState {
|
||||
}
|
||||
}
|
||||
|
||||
/// Compares `action_state`s for shallow equality (does not check internal struct equality)
|
||||
/// Compares for shallow equality (does not check internal struct equality)
|
||||
pub fn equals(&self, other: &Self) -> bool {
|
||||
// Check if state is the same without looking at the inner data
|
||||
std::mem::discriminant(&self) == std::mem::discriminant(&other)
|
||||
std::mem::discriminant(self) == std::mem::discriminant(other)
|
||||
}
|
||||
|
||||
/// Passes data to variant or subvariant handlers
|
||||
|
@ -16,7 +16,6 @@ impl StateHandler for State {
|
||||
}
|
||||
|
||||
fn handle(&self, ecs_data: &EcsStateData) -> StateUpdate {
|
||||
dbg!();
|
||||
let mut update = StateUpdate {
|
||||
pos: *ecs_data.pos,
|
||||
vel: *ecs_data.vel,
|
||||
|
@ -46,6 +46,10 @@ impl StateHandler for State {
|
||||
.unwrap_or_default()
|
||||
* ROLL_SPEED;
|
||||
|
||||
if self.remaining_duration == Duration::default() {
|
||||
// Roll duration has expired
|
||||
update.character = CharacterState::Idle(None);
|
||||
} else {
|
||||
// Otherwise, tick down remaining_duration
|
||||
update.character = CharacterState::Roll(Some(State {
|
||||
remaining_duration: self
|
||||
@ -53,8 +57,8 @@ impl StateHandler for State {
|
||||
.checked_sub(Duration::from_secs_f32(ecs_data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
}));
|
||||
}
|
||||
|
||||
// Keep rolling
|
||||
update
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,6 @@ pub fn handle_glide(ecs_data: &EcsStateData, update: &mut StateUpdate) {
|
||||
&& !ecs_data.physics.on_ground
|
||||
&& ecs_data.body.is_humanoid()
|
||||
{
|
||||
dbg!();
|
||||
update.character = CharacterState::Glide(None);
|
||||
}
|
||||
}
|
||||
|
@ -408,18 +408,18 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
),
|
||||
CharacterState::Wielding(_) => {
|
||||
anim::character::CidleAnimation::update_skeleton(
|
||||
anim::character::WieldAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, time),
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
CharacterState::Wielded(_) => {
|
||||
anim::character::CidleAnimation::update_skeleton(
|
||||
anim::character::WieldAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, time),
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
Loading…
Reference in New Issue
Block a user