Expand description
The lives of citizens and their homes: needs, age, death, health, happiness, disease, homes, partners and births. See Citizens, docs/CITIZEN-NEEDS-AND-HOUSEHOLDS.md and docs/CITIZEN-LIFE.md.
The citizen description is kept as a table by offset, so the port reads the same values as the original.
Deviations: the entity references the original keeps (home, partner, guardian, dependents) are citizen and entity indices; the dependents’ ring is a vector in ring order.
Original: CitizenComponent (vtable 0x1401689a0), ResidenceComponent (vtable
0x14016a6a0); disease spread FUN_140117940.
Modules§
- reason
- The causes of death and the life events, as the event log’s types.
- service
- Which service an attendance search is for (
D/).
Structs§
- Home
- ResidenceComponent: the family slots and the fire.
- Life
Event - An event the citizens’ update asks the log for.
- Life
Rules - The CitizenDescription values, by offset.
- People
- Everything one citizen’s update touches.
Functions§
- eat
- Citizen message 2: eat from
storageuntil the citizen is no longer hungry: one unit of food per point of hunger. Each kind of food is remembered (for variety) and counts as used. - happiness_
after - A citizen’s happiness after its events: the events move it at once, then it steps half a point toward a target made of the needs met, the work, the food variety, the home’s bonus and the chapel, scaled by an eighth of the maximum; it stays within 0 and the maximum.
- health_
after - A citizen’s health after an interval’s events: up 0.5 for a good interval, down for a poor one, down 1 for each of the two worst events, down 0.25 for an adult not at school with no work done; then no lower than 0 and no higher than the maximum.
- home_
bonus - The home’s bonus to a citizen’s happiness: how many of the entrance cell’s first five happiness layers are set, less the sixth, at least 0; a quarter of that (rounded down) when the home holds more than one family.
- immunity_
after - The immunity a citizen has after recovering:
D[0x9c]× 300 s. - outbreak_
check - The disease check of a citizen with no disease: the immunity runs down by
dt, and the odds come from the citizen’s weakness and the town’s disease. With odds of 0 or less the clock is cleared and nothing is drawn. Otherwise oneRandFloatagainst the time on the clock over the odds’ span, and the clock is cleared. True when the citizen falls ill (the caller starts the outbreak). - recovers
- Whether a citizen whose illness has ended recovers: one
RandFloatdrawn first, then the citizen lives when one over the disease’s recovery, over the doctor’s factor (1 without a doctor), is below it. - spread_
target - Which of the citizens near a sick one is offered the disease, from the characters’ tree’s list in its order: each entry is (the sick citizen itself, has a disease). The first that is neither, or none. Only one is ever offered, even when it then turns the disease away.
- stored
- The units of a category in
storagethat nobody has reserved: food (bit 5) or firewood (bit 6). - update_
home - A residence’s update. The fire burns down; with residents, while it is colder than the house’s
warmth, one unit of firewood keeps it burning for seconds. The food and firewood status icons
clear when there is some. The ClearStorage work comes first
(
crate::town::Sim::residence_clear_storage). The firewood burned counts as used in the stock manager. - warm_at
- Citizen message 0: warm up at
homeif it is warm.