Skip to main content

Seeder

Struct Seeder 

Source
pub struct Seeder<'a> {
    pub templates: &'a [Template],
    pub terrain: &'a HeightGrid<'a>,
    pub cells: &'a mut Cells,
    pub rng: &'a mut Random,
    pub placed: &'a mut Vec<Placed>,
    pub removed: &'a mut Vec<usize>,
    pub animation_events: &'a mut Vec<(usize, String)>,
}
Expand description

What the growth and spawn updates need: the cells, the templates, the random numbers, and the lists to fill.

Fields§

§templates: &'a [Template]

The object templates.

§terrain: &'a HeightGrid<'a>

The ground’s heights.

§cells: &'a mut Cells

The gameplay map.

§rng: &'a mut Random

The game’s random numbers.

§placed: &'a mut Vec<Placed>

The placed objects.

§removed: &'a mut Vec<usize>

The entities to remove, in the order they asked. They are removed after all buckets.

Original: drained by FUN_1400c9560.

§animation_events: &'a mut Vec<(usize, String)>

AnimAudioEvents that passed their probability: owning entity and the SoundEffect to play there.

Original: FUN_14008d310.

Implementations§

Source§

impl<'a> Seeder<'a>

Source

pub fn place_structures( &mut self, structures: &[(PlacedStructure, Option<usize>)], sx: i32, sy: i32, )

The profile’s start structures, relative to the start cell.

Each is built in “instant” mode (Game |= 1), so the build component shows the last (finished) mesh. Component setup draws nothing from the stream except the model’s variant; buildings do not stamp the map on activation.

Original: FUN_1400a7490, FUN_14010cfb0.

Source

pub fn spawn_child( &mut self, parent: usize, entry: usize, random_growth: bool, disabled: bool, ) -> Option<usize>

Startup uses random_growth=true; scheduled spawning uses false. The child is registered in the PARENT TEMPLATE’s bucket (not its own template’s bucket).

Original: FUN_1400560e0.

Source

pub fn plant(&mut self, template: usize, cell: i32) -> usize

CreateNaturalResource’s start on a free cell: clone the template, place it in the cell, growth 0, then a random model variant and mesh, and register it.

Original: FUN_1400cbb20, FUN_1400c8bf0, FUN_14012ba10, FUN_140126280, FUN_14012a8a0.

Source

pub fn iterate( &mut self, scheduler: &mut EntityScheduler<usize>, dt: f32, temperature: f32, disabled: bool, ) -> bool

One iteration of the placed entities’ growth components. disabled is the game’s bit 10, which stops spawning and the change at full growth, but not growth or the decay in frost. The callbacks of other components are not installed yet.

Original: FUN_1400c9560, then FUN_140125520.

Source

pub fn iterate_with( &mut self, scheduler: &mut EntityScheduler<usize>, dt: f32, temperature: f32, disabled: bool, visit: &mut dyn FnMut(&mut Seeder<'_>, &mut EntityScheduler<usize>, usize, i64) -> bool, ) -> bool

Seeder::iterate with the scheduled update of entities without growth (visit returns whether the models changed).

Source

pub fn smooth(&mut self) -> bool

A single post-iteration smoothing phase.

Original: FUN_1400c98a0, FUN_140125370.

Source

pub fn seed(&mut self, list: &[usize], sx: i32, sy: i32, radius_sq: i32)

Seed every template of the profile’s list over the map, away from the start (sx, sy) by more than sqrt(radius_sq) cells.

Original: FUN_1400a6780.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Seeder<'a>

§

impl<'a> Freeze for Seeder<'a>

§

impl<'a> RefUnwindSafe for Seeder<'a>

§

impl<'a> Send for Seeder<'a>

§

impl<'a> Sync for Seeder<'a>

§

impl<'a> Unpin for Seeder<'a>

§

impl<'a> UnsafeUnpin for Seeder<'a>

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> 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, 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.