Add ledge getup, ledge intangibility limit & fix walk-off velocity (#93)
CI / build-and-test (push) Successful in 1m40s
CI / production-build (push) Successful in 12m14s

Reviewed-on: #93
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #93.
This commit is contained in:
2026-10-13 15:52:10 +00:00
committed by EIREXE
parent 4fe1b24b1a
commit f1da5c1172
12 changed files with 208 additions and 55 deletions
+19 -18
View File
@@ -87,46 +87,47 @@ pub struct FighterHitstop {
}
#[derive(Component, Default, Copy, Clone, Hash, Debug, PartialEq, Eq)]
pub struct FighterLedgeGrabLockout {
pub remaining_frames: u32,
pub struct FighterLedgeInformation {
pub regrab_lockout_remaining_frames: u32,
pub grab_count: u32,
}
impl FighterLedgeGrabLockout {
impl FighterLedgeInformation {
pub fn start(&mut self, duration_frames: u32) {
self.remaining_frames = duration_frames;
self.regrab_lockout_remaining_frames = duration_frames;
}
pub fn is_active(&self) -> bool {
self.remaining_frames > 0
pub fn is_regrab_lockout_active(&self) -> bool {
self.regrab_lockout_remaining_frames > 0
}
fn tick(&mut self) {
self.remaining_frames = self.remaining_frames.saturating_sub(1);
self.regrab_lockout_remaining_frames = self.regrab_lockout_remaining_frames.saturating_sub(1);
}
}
#[cfg(test)]
mod ledge_grab_lockout_tests {
use super::FighterLedgeGrabLockout;
use super::FighterLedgeInformation;
#[test]
fn lockout_expires_after_the_requested_number_of_ticks() {
let mut lockout = FighterLedgeGrabLockout::default();
let mut lockout = FighterLedgeInformation::default();
lockout.start(2);
assert!(lockout.is_active());
assert!(lockout.is_regrab_lockout_active());
lockout.tick();
assert!(lockout.is_active());
assert!(lockout.is_regrab_lockout_active());
lockout.tick();
assert!(!lockout.is_active());
assert!(!lockout.is_regrab_lockout_active());
}
#[test]
fn zero_duration_does_not_enable_lockout() {
let mut lockout = FighterLedgeGrabLockout::default();
let mut lockout = FighterLedgeInformation::default();
lockout.start(0);
assert!(!lockout.is_active());
assert!(!lockout.is_regrab_lockout_active());
}
}
@@ -192,7 +193,7 @@ pub struct FighterPendingRespawn(bool);
FighterPendingHitReaction,
FighterPendingRespawn,
FighterHitstop,
FighterLedgeGrabLockout,
FighterLedgeInformation,
FighterKnockbackVelocity,
FighterTranslation,
FighterInvulnerabilityState,
@@ -298,8 +299,8 @@ impl Plugin for FighterPlugin {
.checksum_component_with_hash::<FighterPendingRespawn>()
.rollback_component_with_copy::<FighterHitstop>()
.checksum_component_with_hash::<FighterHitstop>()
.rollback_component_with_copy::<FighterLedgeGrabLockout>()
.checksum_component_with_hash::<FighterLedgeGrabLockout>()
.rollback_component_with_copy::<FighterLedgeInformation>()
.checksum_component_with_hash::<FighterLedgeInformation>()
.rollback_component_with_copy::<FighterInvulnerabilityState>()
.checksum_component_with_hash::<FighterInvulnerabilityState>()
.rollback_component_with_copy::<FighterKnockbackVelocity>()
@@ -430,7 +431,7 @@ pub fn decay_hitstop(query: Query<(&mut FighterHitstop, &mut FighterHitstopShake
}
}
pub fn decay_ledge_grab_lockout(query: Query<&mut FighterLedgeGrabLockout>) {
pub fn decay_ledge_grab_lockout(query: Query<&mut FighterLedgeInformation>) {
for mut lockout in query {
lockout.tick();
}