Skip to main content

Wild

Struct Wild 

Source
pub struct Wild<'a, 't> {
    pub wildlife: &'a mut Wildlife,
    pub placed: &'a mut Vec<Placed>,
    pub templates: &'a [Template],
    pub cells: &'a Cells,
    pub terrain: &'a HeightGrid<'t>,
    pub rng: &'a mut Random,
    pub scheduler: &'a mut EntityScheduler<usize>,
}
Expand description

The town state wildlife reads and writes.

Fields§

§wildlife: &'a mut Wildlife

The animals.

§placed: &'a mut Vec<Placed>

The placed objects.

§templates: &'a [Template]

The object templates.

§cells: &'a Cells

The gameplay map.

§terrain: &'a HeightGrid<'t>

The ground’s heights.

§rng: &'a mut Random

The game’s random numbers.

§scheduler: &'a mut EntityScheduler<usize>

The entity scheduler.

Implementations§

Source§

impl Wild<'_, '_>

Source

pub fn start_population(&mut self, template: usize)

Start one population of a new town: its entity, then its herds.

Original: FUN_140054b80, called by FUN_1400a5eb0.

Source

pub fn retarget(&mut self, h: usize)

A new target in the herd’s block; every animal keeps to the area around it. Without habitat the herd’s animals are removed.

Original: FUN_140127810.

Source

pub fn scheduled(&mut self, e: usize, elapsed: i64)

A scheduled visit of entity e with elapsed ticks.

Source

pub fn update_animal(&mut self, a: usize, dt: i64)

AnimalComponent’s scheduled update.

Original: FUN_14010b8f0.

Source

pub fn hunted(&mut self, a: usize)

A hunter has the animal: it stops what it does and stands.

Original: FUN_14010c730.

Source

pub fn assign(&mut self, a: usize, to: Option<usize>)

The animal joins pasture to (or the town’s list) and leaves its old one; leaving a pasture it turns wild, joining one it keeps to its area.

Original: FUN_140129190.

Source

pub fn fill(&mut self, p: usize)

A pasture with room takes the waiting livestock of its kind, in the town list’s order, until full.

Original: FUN_14012c610.

Source

pub fn births(&mut self, p: usize) -> Vec<usize>

Each animal with young due has them, while the pasture holds fewer than three over its room (the animals born join the end of the list and are seen too). Born animals are registered by the caller.

Original: FUN_14012c840.

Source

pub fn give_birth( &mut self, p: usize, parent: Option<usize>, buckets: bool, ) -> Option<usize>

A young animal of the pasture’s kind next to its parent (or anywhere in the pasture, any age under a year, without one); male more likely the more females there are. With buckets it joins the entity manager’s buckets here, else the caller’s.

Original: FUN_14012db40.

Source

pub fn start_livestock( &mut self, template: usize, count: i32, at: [f32; 3], spread: f32, )

The starting livestock of a kind, count animals around at (spread either way), males and females in turn from a random first; any age under a year. They wait, wild, for a pasture.

Original: FUN_1400a5fe0.

Source

pub fn trade_livestock( &mut self, template: usize, count: i32, a: [f32; 3], b: [f32; 3], area: [i16; 4], )

Livestock bought at a trading post, count animals at random between its first two create points (a, b), males and females in turn from a random first, turned at random; not wild, they keep to the cells between the points (area) until a pasture takes them. Each is RandFloat × half its lifespan old, which is still unset here (before the setup), so none. The owner registers the entities.

Original: FUN_14005b640.

Source

pub fn mark_breeder(&mut self, p: usize)

The pasture’s message 0 (a rancher’s visit): a random animal of it may breed.

Original: FUN_14012cbf0.

Source

pub fn release(&mut self, p: usize)

A pasture is removed: every animal goes back to the town’s list, last first, and the pasture leaves the town’s list.

Original: FUN_14012c310 (state 3) and FUN_14012ccb0 (removal).

Source

pub fn bury(&mut self) -> bool

The entity manager’s removal of the queued animals (their components’ removal slots).

Auto Trait Implementations§

§

impl<'a, 't> !UnwindSafe for Wild<'a, 't>

§

impl<'a, 't> Freeze for Wild<'a, 't>

§

impl<'a, 't> RefUnwindSafe for Wild<'a, 't>

§

impl<'a, 't> Send for Wild<'a, 't>

§

impl<'a, 't> Sync for Wild<'a, 't>

§

impl<'a, 't> Unpin for Wild<'a, 't>

§

impl<'a, 't> UnsafeUnpin for Wild<'a, 't>

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.