pub struct AreMiniGameBullet {
pub damage: u32,
pub lifespan: f32,
pub rate_of_fire: f32,
pub speed: f32,
pub target_type: u32,
pub bullet_model: ResRef,
pub collision_sound: ResRef,
}Expand description
The ballistics of one gun bank (Bullet).
The first five fields are a presence-gated chain: each read reports
whether the file supplied the field, and that gates whether the next one
is attempted at all. If any is genuinely absent the chain truncates and
the bank is never created, so there is no such thing as a partial bank
built from defaults. Bullet_Model and Collision_Sound are read
unconditionally once the chain completes.
The view models all seven as plain fields rather than making the chain
visible in the type. A file missing one of the five is malformed, and
saying so is a diagnostic’s job: the schema marks them required and lint
reports the dropped bank. Seven Options would push that judgement onto
every caller that only wanted to read a rate of fire.
Fields§
§damage: u32Damage per hit (Damage).
lifespan: f32Seconds before the bullet expires (Lifespan).
rate_of_fire: f32Seconds between shots (Rate_Of_Fire).
speed: f32Travel speed (Speed).
target_type: u32What the bank is allowed to shoot at (Target_Type).
bullet_model: ResRefBullet model resref (Bullet_Model).
collision_sound: ResRefSound played on impact (Collision_Sound).
Implementations§
Source§impl AreMiniGameBullet
impl AreMiniGameBullet
Sourcepub const PARTS: &'static [&'static [Field]]
pub const PARTS: &'static [&'static [Field]]
This type’s schema in parts, which is what a container holding it references.
Own fields first, then one part per flattened child in the order they are declared.
Sourcepub fn read_declared(root: &GffStruct) -> Self
pub fn read_declared(root: &GffStruct) -> Self
Reads every declared field off root.
Absent fields take the entry’s own answer, so a fallback is derived from the declaration rather than restated beside it.
A field declaring a hand-written read is left at that answer for the view to overwrite.
Sourcepub fn write_declared(&self, root: &mut GffStruct)
pub fn write_declared(&self, root: &mut GffStruct)
Writes every declared field onto root, leaving out the ones
their entry says the engine’s own writer leaves out.
A field declaring a hand-written write is not touched here.
Sourcepub fn read_element(structure: &GffStruct) -> Self
pub fn read_element(structure: &GffStruct) -> Self
Reads one element of a list of this type.
Sourcepub fn write_element(&self, structure: &mut GffStruct)
pub fn write_element(&self, structure: &mut GffStruct)
Writes one element of a list of this type.
Trait Implementations§
Source§impl Clone for AreMiniGameBullet
impl Clone for AreMiniGameBullet
Source§fn clone(&self) -> AreMiniGameBullet
fn clone(&self) -> AreMiniGameBullet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AreMiniGameBullet
impl Debug for AreMiniGameBullet
Source§impl Default for AreMiniGameBullet
impl Default for AreMiniGameBullet
Source§impl HasSchema for AreMiniGameBullet
impl HasSchema for AreMiniGameBullet
Source§impl PartialEq for AreMiniGameBullet
impl PartialEq for AreMiniGameBullet
Source§fn eq(&self, other: &AreMiniGameBullet) -> bool
fn eq(&self, other: &AreMiniGameBullet) -> bool
self and other values to be equal, and is used by ==.