pub struct FluidPool {
pub position: Vec3,
pub radius: f32,
pub fluid_type: FluidType,
pub depth: f32,
pub age: f32,
pub max_lifetime: f32,
pub absorbed_count: u32,
}Expand description
A settled pool of fluid on the floor, providing area gameplay effects.
Fields§
§position: Vec3Centre position (Y is FLOOR_Y).
radius: f32Radius of the pool on the XZ plane.
fluid_type: FluidTypeType of fluid in this pool.
depth: f32Depth of the pool (increases as more particles settle).
age: f32Age in seconds since creation.
max_lifetime: f32Maximum lifetime — pool evaporates after this (0 = infinite).
absorbed_count: u32Number of particles that have been absorbed into this pool.
Implementations§
Source§impl FluidPool
impl FluidPool
Sourcepub fn new(position: Vec3, radius: f32, fluid_type: FluidType) -> Self
pub fn new(position: Vec3, radius: f32, fluid_type: FluidType) -> Self
Create a new pool at position with initial radius.
Sourcepub fn absorb_particle(&mut self)
pub fn absorb_particle(&mut self)
Absorb a particle into this pool, growing it slightly.
Sourcepub fn contains_xz(&self, point: Vec3) -> bool
pub fn contains_xz(&self, point: Vec3) -> bool
Whether a world-space point (XZ only) falls inside this pool.
Sourcepub fn life_fraction(&self) -> f32
pub fn life_fraction(&self) -> f32
Fraction of lifetime remaining.
Sourcepub fn merge_from(&mut self, other: &FluidPool)
pub fn merge_from(&mut self, other: &FluidPool)
Merge another pool into this one (absorb its area/depth).
Sourcepub fn distance_to(&self, other: &FluidPool) -> f32
pub fn distance_to(&self, other: &FluidPool) -> f32
Distance between pool centres (XZ plane).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FluidPool
impl RefUnwindSafe for FluidPool
impl Send for FluidPool
impl Sync for FluidPool
impl Unpin for FluidPool
impl UnsafeUnpin for FluidPool
impl UnwindSafe for FluidPool
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.