pub struct Agents {
pub characters: Vec<Character>,
pub ais: Vec<CitizenAi>,
pub states: Vec<CitizenState>,
pub life: LifeRules,
pub registry: Vec<usize>,
pub events: Vec<LifeEvent>,
pub diseases: Vec<Disease>,
pub town_disease: f32,
pub carry: i32,
/* private fields */
}Expand description
The citizens’ agents: each citizen’s AI and character, and the state the iteration needs.
Fields§
§characters: Vec<Character>The citizens’ characters.
ais: Vec<CitizenAi>The citizens’ AI.
states: Vec<CitizenState>The citizens’ states.
life: LifeRulesThe CitizenDescription for the CitizenComponent’s update.
registry: Vec<usize>The living citizens, in activation order.
events: Vec<LifeEvent>Log entries the citizens asked for since the caller last took them.
diseases: Vec<Disease>Game/Disease/Diseases.rsc (GameGlobal).
town_disease: f32The town’s disease level.
carry: i32The laborer profession’s carry amount (what home stocking carries at least).
Implementations§
Source§impl Agents
impl Agents
Sourcepub fn apply_commands(
&mut self,
citizens: &mut Vec<Citizen>,
env: &mut Env<'_, '_>,
groups: &[Option<&AnimationGroup>],
newborn: &mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen,
)
pub fn apply_commands( &mut self, citizens: &mut Vec<Citizen>, env: &mut Env<'_, '_>, groups: &[Option<&AnimationGroup>], newborn: &mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen, )
Player commands and newly placed sites, applied before an iteration (where the original’s UI events and placement land between iterations).
Sourcepub fn set_tree_slot(&mut self, i: usize, slot: i32)
pub fn set_tree_slot(&mut self, i: usize, slot: i32)
Citizen i‘s place in the characters’ tree, put in by whoever made it.
Source§impl Agents
impl Agents
Sourcepub fn road_path(
&mut self,
cells: &Cells,
a: i32,
b: i32,
mask: u32,
manhattan: bool,
) -> Option<Vec<i32>>
pub fn road_path( &mut self, cells: &Cells, a: i32, b: i32, mask: u32, manhattan: bool, ) -> Option<Vec<i32>>
The cells of a road from a to b, over mask, avoiding the cells of zones. The road
tool uses it.
Original: FUN_1400a22d0.
Sourcepub fn walk_path(&mut self, cells: &Cells, a: i32, b: i32) -> Option<Vec<i32>>
pub fn walk_path(&mut self, cells: &Cells, a: i32, b: i32) -> Option<Vec<i32>>
A citizen’s walk from a to b as the path manager finds it (mask 0xe1f, mode 0), for
the Path tool; the finder’s state is kept.
Original: FUN_1400a2480, FUN_1400e2c40.
Sourcepub fn update_commute(
&mut self,
citizens: &[Citizen],
env: &mut Env<'_, '_>,
groups: &[Option<&AnimationGroup>],
dt: i64,
)
pub fn update_commute( &mut self, citizens: &[Citizen], env: &mut Env<'_, '_>, groups: &[Option<&AnimationGroup>], dt: i64, )
StockManager::Update’s commute optimisation (see crate::behaviour::commute) by dt
ticks.
Original: FUN_140091780.
Source§impl Agents
impl Agents
Sourcepub fn update(
&mut self,
citizens: &mut Vec<Citizen>,
env: &mut Env<'_, '_>,
groups: &[Option<&AnimationGroup>],
dt: f32,
newborn: &mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen,
)
pub fn update( &mut self, citizens: &mut Vec<Citizen>, env: &mut Env<'_, '_>, groups: &[Option<&AnimationGroup>], dt: f32, newborn: &mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen, )
One simulation iteration of every citizen. groups[i] is citizen i’s animation group
(None for the dead); newborn makes a child, with its random draws.
Sourcepub fn move_animals(
&mut self,
wildlife: &mut Wildlife,
cells: &Cells,
terrain: &HeightGrid<'_>,
rng: &mut Random,
materials: &[RawMaterial],
dt: f32,
)
pub fn move_animals( &mut self, wildlife: &mut Wildlife, cells: &Cells, terrain: &HeightGrid<'_>, rng: &mut Random, materials: &[RawMaterial], dt: f32, )
The wild animals’ character update: animate, run the actions, turn and move.
Deviation: the entity manager runs these updates in the order of a tree keyed by the entity’s address; the port takes them in the order they were made, which a growing heap usually gives too.
Original: FUN_14010e990; the order comes from FUN_1400c9560, FUN_1400c82b0 and the
tree at manager +0x68 (FUN_1400c90a0).