pub struct FuelSystem {
pub fuel_level: f32,
pub max_fuel: f32,
pub current_fuel_type: FuelType,
pub is_burning: bool,
}Expand description
Manages fuel for a workbench that requires heat.
Fields§
§fuel_level: f32§max_fuel: f32§current_fuel_type: FuelType§is_burning: boolImplementations§
Source§impl FuelSystem
impl FuelSystem
pub fn new(max_fuel: f32) -> Self
Sourcepub fn add_fuel(&mut self, fuel_type: FuelType, items: u32) -> u32
pub fn add_fuel(&mut self, fuel_type: FuelType, items: u32) -> u32
Add fuel items of a given type. Returns overflow (items that wouldn’t fit).
Sourcepub fn consume(&mut self, dt: f32) -> bool
pub fn consume(&mut self, dt: f32) -> bool
Consume fuel for dt seconds of crafting. Returns true if fuel remains.
Sourcepub fn heat_quality_bonus(&self) -> u32
pub fn heat_quality_bonus(&self) -> u32
Current heat quality bonus (0 if no fuel).
pub fn ignite(&mut self)
pub fn extinguish(&mut self)
pub fn is_empty(&self) -> bool
Sourcepub fn level_fraction(&self) -> f32
pub fn level_fraction(&self) -> f32
Fuel as a fraction of max [0.0, 1.0].
Trait Implementations§
Source§impl Clone for FuelSystem
impl Clone for FuelSystem
Source§fn clone(&self) -> FuelSystem
fn clone(&self) -> FuelSystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FuelSystem
impl RefUnwindSafe for FuelSystem
impl Send for FuelSystem
impl Sync for FuelSystem
impl Unpin for FuelSystem
impl UnsafeUnpin for FuelSystem
impl UnwindSafe for FuelSystem
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.