Skip to main content

Growth

Struct Growth 

Source
pub struct Growth {
    pub maximum: f32,
    pub timer: i64,
    pub smoothed: f32,
    pub scheduled: bool,
    pub smoothing: bool,
    pub allow_negative: bool,
}
Expand description

The growth state of a natural resource (a tree, a crop, a herb).

Fields§

§maximum: f32

The growth at which the resource is fully grown (a random value).

§timer: i64

System::Time, not an accumulated f32.

§smoothed: f32

Visible value, separate from NaturalResourceComponent.

§scheduled: bool

Whether the scheduled update still runs (false once fully grown).

§smoothing: bool

Whether the visible value still moves towards the growth.

§allow_negative: bool

NaturalResourceComponent capability bit 0x100000; false on newly seeded resources.

Implementations§

Source§

impl Growth

Source

pub fn initialise( d: &GrowthDescription, maximum: f32, fraction: f32, rng: &mut Random, ) -> (Self, f32, [f32; 4])

Set the growth, the visible scale and the random timer, without another random draw for the maximum (seeding has drawn it already).

Original: FUN_140126280.

Source

pub fn update( &mut self, d: &GrowthDescription, value: &mut f32, dt: i64, temperature: f32, disabled: bool, ) -> GrowthTick

One scheduled update of a growing resource. The season comes from the environment’s temperature, not from the renderer’s autumn and leaf values.

Original: FUN_140125520.

Source

pub fn smooth( &mut self, d: &GrowthDescription, value: f32, output: &mut [f32; 4], ) -> bool

One smoothing step per active rendered update, including pause. Returns whether the instance scale changed.

Original: FUN_140125370.

Trait Implementations§

Source§

impl Clone for Growth

Source§

fn clone(&self) -> Growth

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Growth

Source§

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

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

impl PartialEq for Growth

Source§

fn eq(&self, other: &Growth) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Growth

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.