pub struct People<'a, 'b> {Show 29 fields
pub citizens: &'a mut Vec<Citizen>,
pub states: &'a mut Vec<CitizenState>,
pub registry: &'a mut Vec<usize>,
pub homes: &'a mut BTreeMap<usize, Home>,
pub rules: &'a LifeRules,
pub town: &'a TownView<'b>,
pub layers: &'a [[u8; 12]],
pub rng: &'a mut Random,
pub temperature: f32,
pub diseases: &'a [Disease],
pub town_disease: f32,
pub storages: &'a mut [Storage],
pub materials: &'a [RawMaterial],
pub idle: &'a [bool],
pub events: &'a mut Vec<LifeEvent>,
pub dying: &'a mut Vec<(usize, i32)>,
pub newborn: &'a mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen,
pub born: &'a mut Vec<usize>,
pub attendance: &'a mut BTreeMap<usize, Attendance>,
pub attendance_list: &'a [usize],
pub workforce: &'a mut Workforce,
pub professions: &'a Professions,
pub sites: &'a BTreeMap<usize, Site>,
pub cemeteries: &'a [usize],
pub tombstones: &'a BTreeMap<usize, i64>,
pub burials: &'a mut Vec<(usize, i32)>,
pub sectors: &'a mut SectorGraph,
pub terrain: &'a HeightGrid<'b>,
pub tree: &'a CharacterTree,
}Expand description
Everything one citizen’s update touches.
Fields§
§citizens: &'a mut Vec<Citizen>The citizens.
states: &'a mut Vec<CitizenState>The citizens’ states.
registry: &'a mut Vec<usize>The living citizens, in activation order.
homes: &'a mut BTreeMap<usize, Home>The homes, by entity.
rules: &'a LifeRulesThe citizen description’s rules.
town: &'a TownView<'b>A view of the town.
layers: &'a [[u8; 12]]Map cells (crate::nature::seeding::Cells::layers).
rng: &'a mut RandomThe game’s random numbers.
temperature: f32The environment’s temperature.
diseases: &'a [Disease]The diseases.
town_disease: f32The extra disease risk that visitors bring (0 until they are ported).
storages: &'a mut [Storage]The town’s storages.
materials: &'a [RawMaterial]The raw materials.
idle: &'a [bool]The character’s action stack is empty (stack_top + 1 < 1).
events: &'a mut Vec<LifeEvent>The log events asked for.
dying: &'a mut Vec<(usize, i32)>Citizens whose entity was queued for deletion, with the reason.
Original: FUN_1400c8370.
newborn: &'a mut dyn FnMut(&mut Random, &Citizen, bool) -> CitizenMakes a child of mother: name, sex, appearance and lifespan, with their random draws.
The caller of this closure adds it to citizens.
Original: FUN_14011c550, called from FUN_140117060.
born: &'a mut Vec<usize>Children born this update (new citizen indices).
attendance: &'a mut BTreeMap<usize, Attendance>The AttendanceComponents, by entity.
attendance_list: &'a [usize]The service buildings that people attend.
workforce: &'a mut WorkforceThe workplaces and residences.
professions: &'a ProfessionsThe professions.
sites: &'a BTreeMap<usize, Site>The sites (their works’ priorities, a cemetery’s graves).
cemeteries: &'a [usize]The town’s cemeteries.
tombstones: &'a BTreeMap<usize, i64>The tombstones standing, with the time each one stays.
burials: &'a mut Vec<(usize, i32)>Burials decided this update (cemetery, grave cell); the tombstones follow.
sectors: &'a mut SectorGraphThe path-rank cache.
terrain: &'a HeightGrid<'b>The ground’s heights.
tree: &'a CharacterTreeThe characters’ tree (Game): a disease spreads to the citizens about the sick.
Implementations§
Source§impl People<'_, '_>
impl People<'_, '_>
Sourcepub fn reaches(&mut self, c: usize, entity: usize) -> bool
pub fn reaches(&mut self, c: usize, entity: usize) -> bool
The home’s entrance is reachable from the citizen’s cell.
Original: FUN_14011ada0.
Sourcepub fn set_home(&mut self, c: usize, home: Option<usize>, slot: i32)
pub fn set_home(&mut self, c: usize, home: Option<usize>, slot: i32)
Move citizen c (and its dependents) to home family slot.
Original: FUN_14011b8a0.
Sourcepub fn set_guardian(&mut self, c: usize, guardian: Option<usize>)
pub fn set_guardian(&mut self, c: usize, guardian: Option<usize>)
Make guardian the guardian of c.
Original: FUN_140117470.
Sourcepub fn join_service(
&mut self,
c: usize,
service: usize,
exclude: Option<usize>,
) -> bool
pub fn join_service( &mut self, c: usize, service: usize, exclude: Option<usize>, ) -> bool
Join the nearest school, chapel or doctor; the school also sets.
Original: FUN_140116d10, FUN_140116bc0, FUN_140116a60.
Sourcepub fn leave_service(&mut self, c: usize, service: usize, again: bool)
pub fn leave_service(&mut self, c: usize, service: usize, again: bool)
Leave; the school can be swapped for another at once (again).
Original: FUN_14011af20, FUN_140116b20, FUN_14011ae80.
Sourcepub fn lesson(&mut self, c: usize)
pub fn lesson(&mut self, c: usize)
Citizen message 4: a lesson; at D[0x118] lessons, or after D[0x11c] hours at school,
educated (flag 0x400), out of school and an adult (9).
Original: FUN_140116c70.
Sourcepub fn treated(&mut self, c: usize)
pub fn treated(&mut self, c: usize)
Citizen message 5: the doctor shortens the illness by D[0x12c] minutes.
Original: FUN_140116a10.
Sourcepub fn die(
&mut self,
c: usize,
reason: i32,
extra: Option<(Option<String>, String)>,
) -> bool
pub fn die( &mut self, c: usize, reason: i32, extra: Option<(Option<String>, String)>, ) -> bool
Queue the citizen’s death (reason) and tell the family. When the citizen is buried in a
cemetery (found from the home’s entrance, else from where the citizen stands), the
family’s bit is 0x40; otherwise it is 2 for old age, else 0x80. Not ported: the debug
flag that stops deaths (Game bit 8).
Original: FUN_14011c2a0; the cemetery search is FUN_14008ec10.
Sourcepub fn bury(&mut self, c: usize)
pub fn bury(&mut self, c: usize)
The family part of a citizen’s removal: the citizen leaves school, the doctor, the chapel, the home and the guardian. A widow or widower takes the dependents; otherwise children die (orphaned) and older dependents leave. The partner is single again.
Original: FUN_140119170 (the removal of a CitizenComponent).