Add ledge getup, ledge intangibility limit & fix walk-off velocity
CI / build-and-test (pull_request) Failing after 1m50s
CI / production-build (pull_request) Canceled after 9m14s

This commit is contained in:
2026-10-13 12:14:12 +02:00
parent 4fe1b24b1a
commit 7819b95bc6
11 changed files with 195 additions and 54 deletions
+33 -5
View File
@@ -24,6 +24,13 @@ impl FighterStateImpl for LedgeWaitState {
} else if state_context.input.has_command(FighterCommands::TapJump) {
return Some(FighterState::LedgeAction(LedgeActionState::create_jump(self.ledge_id, JumpStateInitiator::Tap)));
}
if is_ledge_getup_input(state_context.input.get_last_frame().movement.x,
state_context.game_settings.input_common.run_stick_threshold,
state_context.facing_direction) {
return Some(FighterState::LedgeAction(LedgeActionState::create_getup(self.ledge_id)));
}
if is_ledge_drop_input(state_context.input.get_last_frame().movement.x,
state_context.game_settings.input_common.run_stick_threshold,
state_context.facing_direction) {
@@ -58,14 +65,20 @@ impl FighterStateImpl for LedgeWaitState {
fn on_enter(&mut self, state_context: &mut EnterContext) {
state_context.velocity.0 = FGVec2::ZERO;
state_context.knockback_velocity.0 = FGVec2::ZERO;
*state_context.vulnerability = FighterInvulnerabilityState::Intangible {
frames_remaining: Some(
state_context
if state_context.ledge_info.grab_count < state_context.game_settings.fighter_common.max_ledge_regrab_count {
*state_context.vulnerability = FighterInvulnerabilityState::Intangible {
frames_remaining: Some(
state_context
.game_settings
.fighter_common
.ledge_grab_invulnerability_duration,
),
};
),
};
}
state_context.ledge_info.grab_count = state_context.ledge_info.grab_count.saturating_add(1);
let Some(ledge) = state_context.stage_collision.find_ledge_by_vertex(self.ledge_id) else {
return;
};
@@ -135,3 +148,18 @@ fn is_ledge_drop_input(
false
}
fn is_ledge_getup_input(
horizontal_input: crate::math::int::FGi32,
threshold: crate::math::int::FGi32,
facing_dir: &FighterFacingDirection,
) -> bool {
let dir = facing_dir.to_sign();
if horizontal_input.abs() > threshold {
if dir == horizontal_input.signum() {
return true;
}
}
false
}