Make dashback more lenient
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::fighter::collision;
|
||||
use crate::fighter::state::fall::FallState;
|
||||
use crate::fighter::state::ground::{self, GroundedMotionResult, GroundedStateCommon};
|
||||
use crate::fighter::state::land::LandingState;
|
||||
use crate::fighter::state::{FighterState, air, dash, jump, wait, walk};
|
||||
use crate::fighter::state::{air, dash, jump, wait, walk, FighterState};
|
||||
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
pub struct TurnState {
|
||||
@@ -80,9 +80,13 @@ pub fn check_input(
|
||||
grounded_common: &GroundedStateCommon,
|
||||
) -> Option<FighterState> {
|
||||
let input_frame = state_context.input.get_last_frame();
|
||||
|
||||
let smash_input_frame_threshold = state_context
|
||||
.game_settings
|
||||
.input_common
|
||||
.smash_input_frame_threshold;
|
||||
if !input_frame.movement.x.is_zero()
|
||||
&& input_frame.movement.x.signum() != state_context.facing_direction.to_sign()
|
||||
&& state_context.input.get_frames_in_smash_move_deadzone() > smash_input_frame_threshold
|
||||
{
|
||||
return Some(FighterState::Turn(TurnState {
|
||||
grounded_common: grounded_common.clone(),
|
||||
|
||||
@@ -18,20 +18,18 @@ pub struct WaitState {
|
||||
impl FighterStateImpl for WaitState {
|
||||
const NAME: &'static str = "Wait";
|
||||
fn check_interrupt(&self, state_context: &mut FighterStateContext) -> Option<FighterState> {
|
||||
if let Some(state) = ground::grounded_movement_standstill_common_interrupts(
|
||||
if let Some(state) = ground::grounded_movement_common_interrupts(state_context, &self.grounded_common) {
|
||||
Some(state)
|
||||
} else if let Some(state) = ground::grounded_movement_standstill_common_interrupts(
|
||||
state_context,
|
||||
&self.grounded_common,
|
||||
) {
|
||||
// Prevent transitioning into myself
|
||||
&self.grounded_common)
|
||||
{
|
||||
// Don't transition into yourself
|
||||
if let FighterState::Wait(_) = state {
|
||||
None
|
||||
} else {
|
||||
Some(state)
|
||||
}
|
||||
} else if let Some(state) =
|
||||
ground::grounded_movement_common_interrupts(state_context, &self.grounded_common)
|
||||
{
|
||||
Some(state)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use super::{FighterStateContext, FighterStateImpl, dash, ground, wait};
|
||||
use crate::fighter::animation::AnimKind;
|
||||
use crate::fighter::state::FighterState;
|
||||
use crate::fighter::state::fall::FallState;
|
||||
use crate::fighter::state::turn;
|
||||
use crate::fighter::state::ground::{GroundedMotionResult, GroundedStateCommon};
|
||||
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
@@ -16,7 +17,10 @@ pub struct WalkState {
|
||||
impl FighterStateImpl for WalkState {
|
||||
const NAME: &'static str = "Walk";
|
||||
fn check_interrupt(&self, state_context: &mut FighterStateContext) -> Option<FighterState> {
|
||||
if let Some(state) =
|
||||
if let Some(state) = turn::check_input(state_context, &self.grounded_common) {
|
||||
return Some(state)
|
||||
}
|
||||
else if let Some(state) =
|
||||
ground::grounded_movement_common_interrupts(state_context, &self.grounded_common)
|
||||
{
|
||||
return Some(state);
|
||||
|
||||
Reference in New Issue
Block a user