pub struct Arsenal {
pub have: [bool; 11],
pub ammo: [i32; 10],
pub current: usize,
pub pending: usize,
pub state: WeaponState,
pub qav: u32,
pub qav_time: i32,
pub last_frame: i32,
pub alt: bool,
pub barrels: u8,
pub akimbo: bool,
rng: u32,
}Fields§
§have: [bool; 11]§ammo: [i32; 10]§current: usize§pending: usize§state: WeaponState§qav: u32Currently playing QAV and ticks since it started.
qav_time: i32§last_frame: i32§alt: boolThe running attack is the alternate fire.
barrels: u8Loaded sawed-off barrels (0..=2).
akimbo: boolDual-wield power-up active.
rng: u32Implementations§
Source§impl Arsenal
impl Arsenal
pub fn def(&self) -> &'static WeaponDef
fn dual(&self) -> Option<[u32; 4]>
pub fn has_ammo_for(&self, w: usize, alt: bool) -> bool
pub fn has_ammo(&self, w: usize) -> bool
pub fn add_ammo(&mut self, kind: usize, n: i32) -> bool
Sourcepub fn give_weapon(&mut self, w: usize, ammo_amount: i32) -> bool
pub fn give_weapon(&mut self, w: usize, ammo_amount: i32) -> bool
Picks up a weapon; returns true if anything changed.
pub fn select(&mut self, w: usize)
fn start(&mut self, st: WeaponState, qav: u32)
fn idle_qav(&self) -> u32
fn up_qav(&self) -> u32
fn fire_qav(&mut self, alt: bool) -> u32
Sourcepub fn best_available(&self) -> usize
pub fn best_available(&self) -> usize
Best weapon with ammo, used when the current one runs dry.
fn try_fire(&mut self, alt: bool) -> bool
Sourcepub fn tick(
&mut self,
fire_held: bool,
alt_held: bool,
qav_len: impl Fn(u32) -> i32,
) -> bool
pub fn tick( &mut self, fire_held: bool, alt_held: bool, qav_len: impl Fn(u32) -> i32, ) -> bool
Advances one tick. qav_len(id) returns the animation length in ticks.
Returns true when an attack animation just started.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Arsenal
impl<'de> Deserialize<'de> for Arsenal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Arsenal
impl RefUnwindSafe for Arsenal
impl Send for Arsenal
impl Sync for Arsenal
impl Unpin for Arsenal
impl UnsafeUnpin for Arsenal
impl UnwindSafe for Arsenal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more