Skip to main content

CitizenState

Struct CitizenState 

Source
pub struct CitizenState {
Show 40 fields pub health: f32, pub happiness: f32, pub hunger: f32, pub cold: f32, pub sick: bool, pub work: Option<usize>, pub status: u32, pub tool_status: i32, pub tool_uses: i32, pub clothing_status: i32, pub clothing: i32, pub clothing_remaining: i64, pub health_events: u32, pub flags: u32, pub supply_activity: i32, pub job: i32, pub home: Option<usize>, pub carried: Storage, pub profession: usize, pub workplace: Option<usize>, pub shown_tool: i32, pub home_slot: i32, pub reproduction: f32, pub health_timer: i64, pub happiness_timer: i64, pub foods: Vec<usize>, pub dependents: Vec<usize>, pub school_time: i64, pub school: Option<usize>, pub doctor: Option<usize>, pub priest: Option<usize>, pub disease: Option<usize>, pub disease_left: i64, pub immunity: i64, pub spread: i64, pub disease_clock: i64, pub field_84: i32, pub schooled: bool, pub accident: Option<usize>, pub accident_timer: i64,
}
Expand description

Citizen fields read/written by equipment activities and Citizen messages 1/6/7.

Fields§

§health: f32

The health.

§happiness: f32

The happiness.

§hunger: f32

The hunger.

§cold: f32

The cold.

§sick: bool

Whether the citizen is sick.

§work: Option<usize>

The work it is assigned, if any (inferred).

§status: u32

StatusIconComponent (Citizen points to that component).

§tool_status: i32

The tool level shown in the citizen window.

§tool_uses: i32

The uses left on its tool.

§clothing_status: i32

The clothing level shown in the citizen window.

§clothing: i32

The clothing level: 0 none, 1 or 2.

§clothing_remaining: i64

The time its clothing lasts.

§health_events: u32

Flags of health events.

§flags: u32

Status flags.

§supply_activity: i32

The supply errand it runs for its home: 1 food, 2 firewood.

§job: i32

The id of the work it does (−1 none).

§home: Option<usize>

The home, if any.

§carried: Storage

What it carries.

§profession: usize

Profession (index into the profession list).

§workplace: Option<usize>

Workplace entity.

§shown_tool: i32

The tool ShowTool attached (−1 none, −2 carried goods).

§home_slot: i32

Family slot in the home’s ResidenceComponent (−1 none).

§reproduction: f32

Pregnancy (positive, counting down) or the wait after a birth (negative).

§health_timer: i64

Time towards the next health step.

§happiness_timer: i64

Time towards the next happiness step.

§foods: Vec<usize>

Every kind of food eaten.

§dependents: Vec<usize>

The children and other dependents, in ring order.

§school_time: i64

Time attending school.

§school: Option<usize>

The school’s AttendanceComponent entity (Citizen::school mirrors it).

§doctor: Option<usize>

The doctor’s AttendanceComponent entity.

§priest: Option<usize>

The chapel’s AttendanceComponent entity.

§disease: Option<usize>

The disease (index into the disease list).

§disease_left: i64

The illness left while sick.

§immunity: i64

The immunity left after an illness.

§spread: i64

Time to the next spread attempt.

§disease_clock: i64

Time since the last disease check.

§field_84: i32

The work count the happiness compares with _workForHappiness; never written in 1.0.7, so 0.

§schooled: bool

Has had a school place.

§accident: Option<usize>

The profession whose work it had an accident at.

Original: FUN_14011bb20.

§accident_timer: i64

Time since the last injury check.

Implementations§

Source§

impl CitizenState

Source

pub fn newborn(rules: &LifeRules) -> CitizenState

The state of a new citizen.

Original: FUN_140119c40, set-up FUN_140119520.

Source§

impl CitizenState

Source

pub fn message(&mut self, m: Message, rules: CitizenRulesAi)

Handle a message about equipment (a tool or clothing given, worn out or used).

Original: the equipment branches of FUN_140117730 and FUN_1401152b0.

Trait Implementations§

Source§

impl Clone for CitizenState

Source§

fn clone(&self) -> CitizenState

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 CitizenState

Source§

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

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

impl Default for CitizenState

Source§

fn default() -> CitizenState

Returns the “default value” for a type. Read more

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.