Skip to main content

Needs

Struct Needs 

Source
pub struct Needs<'a, 'b> {
Show 18 fields pub town: &'a TownView<'b>, pub sectors: &'a mut SectorGraph, pub sites: &'a [StorageSite], pub storages: &'a mut [Storage], pub materials: &'a [RawMaterial], pub homes: &'a mut BTreeMap<usize, Home>, pub residences: &'a [usize], pub temperature: f32, pub life: &'a LifeRules, pub carry: i32, pub terrain: &'a HeightGrid<'b>, pub size: usize, pub rng: &'a mut Random, pub healers: &'a [usize], pub workplaces: &'a BTreeMap<usize, WorkPlace>, pub attendance: &'a mut BTreeMap<usize, Attendance>, pub citizens: &'a [Citizen], pub reschool: bool,
}
Expand description

What the activities read and change besides the citizen.

Fields§

§town: &'a TownView<'b>

A view of the town.

§sectors: &'a mut SectorGraph

The sector graph.

§sites: &'a [StorageSite]

The storage sites.

§storages: &'a mut [Storage]

The town’s storages.

§materials: &'a [RawMaterial]

The raw materials.

§homes: &'a mut BTreeMap<usize, Home>

The homes, by entity.

§residences: &'a [usize]

The town’s residences, in the order they were completed: the searches over residences keep the first of equal ranks.

Original: FUN_140093840, FUN_140094140.

§temperature: f32

The environment’s temperature.

§life: &'a LifeRules

The citizen description’s rules.

§carry: i32

The laborer profession’s carry.

§terrain: &'a HeightGrid<'b>

The ground’s heights.

§size: usize

The map’s size in cells.

§rng: &'a mut Random

The game’s random numbers.

§healers: &'a [usize]

The town’s HealerComponents.

§workplaces: &'a BTreeMap<usize, WorkPlace>

Every WorkPlaceComponent, by entity.

§attendance: &'a mut BTreeMap<usize, Attendance>

The AttendanceComponents, by entity.

§citizens: &'a [Citizen]

Every citizen (play follows the guardian).

§reschool: bool

Set when the school activity found no place to sit: the caller leaves the school and looks for another.

Original: FUN_14011af20(c, 1).

Implementations§

Source§

impl Needs<'_, '_>

Source

pub fn eat(&mut self, who: &mut Who<'_>) -> bool

Activities 0 and 14: eat, at home or from a storage.

Original: FUN_140112250.

Source

pub fn warm(&mut self, who: &mut Who<'_>) -> bool

Activities 1 and 15: get warm, at the nearest warm residence when the citizen is very cold, else at a warm home.

Original: FUN_140112790.

Source

pub fn stock_home( &mut self, who: &mut Who<'_>, fuel: bool, reachable: bool, ) -> bool

Activities 6 (food) and 7 (firewood, when fuel): carry food or firewood home from the nearest storage. The caller first drops off anything carried (and queues this activity again). reachable is the caller’s test that the home can be reached.

Original: FUN_140111160 (food), FUN_1401108b0 (firewood); the reach test is FUN_14011ada0.

Source§

impl Needs<'_, '_>

Source

pub fn school(&mut self, who: &mut Who<'_>) -> bool

Activity 10: sit a lesson at the school (message 4; its length is a value of the citizen description).

Original: FUN_140112a30.

Source

pub fn doctor(&mut self, who: &mut Who<'_>, me: usize) -> bool

Activity 5: with a doctor, be treated (message 5); without one, or when the doctor cannot be reached, rest at a home that can be reached. Like the original, it reports “not started” after a treatment visit.

Original: FUN_140112c60.

Source

pub fn herbs(&mut self, who: &mut Who<'_>) -> bool

Activity 4: take herbs from the nearest storage to the nearest herbalist with a worker, and be treated there (5 seconds, message 3). The caller drops off what it carries first.

Original: FUN_140111d60.

Source

pub fn play(&mut self, who: &mut Who<'_>, me: usize) -> bool

Activity 11: a child plays next to its guardian (or the guardian’s partner), then waits RandFloat · 7 + 3 seconds.

Original: FUN_14010f780.

Auto Trait Implementations§

§

impl<'a, 'b> !UnwindSafe for Needs<'a, 'b>

§

impl<'a, 'b> Freeze for Needs<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for Needs<'a, 'b>

§

impl<'a, 'b> Send for Needs<'a, 'b>

§

impl<'a, 'b> Sync for Needs<'a, 'b>

§

impl<'a, 'b> Unpin for Needs<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for Needs<'a, 'b>

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.