LockoutTracker

Struct LockoutTracker 

Source
pub struct LockoutTracker { /* private fields */ }
Expand description

Tracks tech/vcancel lockout behavior.

let mut tracker = LockoutTracker::default();

for i in 1..frames.len() {
   tracker.update(frames.pre.engine_buttons[i], frames.post.flags.as_ref().unwrap()[i]);

   if tracker.is_locked_out() {
        ...
    }

   ...
}

Implementations§

Source§

impl LockoutTracker

Source

pub fn update(&mut self, engine_inputs: u32, flags: u64)

Updates the state of the tracker with new frame information. Requires frame data to be passed in order

Source

pub fn is_locked_out(&self) -> bool

Returns true if the player is currently locked out of teching

Source

pub fn can_vcancel(&self) -> bool

Returns true if the 2 frame vcancel window is active

Source

pub fn can_tech(&self) -> bool

Returns true if the 20 frame tech window is active

Source

pub fn input_during_hitlag(&self) -> bool

Returns true if the input occurred during hitlag. For any hitlag frame except the last, pressing L or R will be treated as pressing it repeatedly every frame of hitlag, thus instantly cancelling the tech window and incurring lockout

Source

pub fn just_pressed(&self) -> bool

Returns true if the player was not pressing last frame, but is pressing this frame.

Source

pub fn lockout_window(&self) -> i32

Returns the current lockout window in frames. Negative values mean the lockout window is closed

Source

pub fn frames_since_input(&self) -> i32

Returns the number of frames since L or R was last input. Always a negative number.

Trait Implementations§

Source§

impl Debug for LockoutTracker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LockoutTracker

Source§

fn default() -> LockoutTracker

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.