pub struct Sim<'s, 't> {Show 71 fields
pub characters: &'s mut [Character],
pub states: &'s mut [CitizenState],
pub groups: &'s [Option<&'s AnimationGroup>],
pub adult: &'s [bool],
pub rules: CitizenRulesAi,
pub size: usize,
pub cells: &'s mut Cells,
pub regions: &'s [u16],
pub sectors: &'s mut SectorGraph,
pub terrain: &'s HeightGrid<'t>,
pub placed: &'s mut Vec<Placed>,
pub templates: &'s [Template],
pub entities: &'s [EntityView],
pub storages: &'s mut [Storage],
pub storage_sites: &'s [StorageSite],
pub materials: &'s [RawMaterial],
pub rng: &'s mut Random,
pub stock: [(i32, i32); 21],
pub temperature: f32,
pub professions: &'s Professions,
pub workforce: &'s mut Workforce,
pub site_templates: &'s [SiteTemplate],
pub sites: &'s mut BTreeMap<usize, Site>,
pub homes: &'s mut BTreeMap<usize, Home>,
pub attendance: &'s mut BTreeMap<usize, Attendance>,
pub attendance_list: &'s mut Vec<usize>,
pub healers: &'s mut Vec<usize>,
pub happiness: &'s mut Vec<usize>,
pub calendar: f32,
pub year: u32,
pub fruits: &'s mut BTreeMap<usize, Fruit>,
pub wildlife: &'s mut Wildlife,
pub keep_piles: &'s mut BTreeMap<usize, bool>,
pub site_events: &'s mut Vec<(i32, i32, usize)>,
pub storage_changes: &'s mut Vec<(usize, bool)>,
pub rebuilds: &'s mut Vec<Rebuild>,
pub water: &'s mut Water,
pub game_flags: u32,
pub precipitation: bool,
pub population: i32,
pub visitors: &'s mut (f32, i64),
pub pending_roads: &'s mut BTreeMap<i32, i32>,
pub terraform_requests: &'s mut Vec<Terraform>,
pub flatten_requests: &'s mut Vec<[i32; 4]>,
pub tornadoes: &'s mut BTreeMap<usize, Tornado>,
pub tornado_kills: &'s mut Vec<usize>,
pub trackers: &'s mut BTreeMap<usize, Tracker>,
pub decals: &'s mut BTreeMap<usize, Decal>,
pub counters: &'s mut StockCounters,
pub trading_posts: &'s mut Vec<usize>,
pub trade_value: &'s mut i32,
pub known_materials: &'s mut Vec<usize>,
pub known: &'s mut Vec<usize>,
pub trade_goods: &'s [TradeGood],
pub river: &'s [[f32; 2]],
pub pathfinder: &'s mut Pathfinder,
pub names: Option<&'s (NameDatabase, NameDatabase)>,
pub site_dt: i64,
pub cemeteries: &'s mut Vec<usize>,
pub tombstones: &'s mut BTreeMap<usize, i64>,
pub burials: &'s mut Vec<(usize, i32)>,
pub site_list: &'s mut Vec<usize>,
pub events: Vec<JobEvent>,
pub piles: &'s mut BTreeMap<usize, Pile>,
pub claimed: &'s mut BTreeSet<usize>,
pub new_piles: &'s mut Vec<usize>,
pub models_dirty: &'s mut bool,
pub offers: Vec<i32>,
pub removed: Vec<usize>,
pub animation_events: Vec<(usize, String)>,
pub offers_again: bool,
/* private fields */
}Expand description
Everything a work slot or a state callback touches.
Fields§
§characters: &'s mut [Character]The citizens’ characters.
states: &'s mut [CitizenState]The citizens’ states.
groups: &'s [Option<&'s AnimationGroup>]Each citizen’s animation group.
adult: &'s [bool]Adult and not at school (the citizens assignment counts).
rules: CitizenRulesAiThe citizens’ AI rules.
size: usizeThe map’s size in cells.
cells: &'s mut CellsThe gameplay map.
regions: &'s [u16]The walkable region of each cell.
sectors: &'s mut SectorGraphThe sector graph.
terrain: &'s HeightGrid<'t>The ground’s heights.
placed: &'s mut Vec<Placed>The placed objects.
templates: &'s [Template]The object templates.
entities: &'s [EntityView]A view of each entity.
storages: &'s mut [Storage]The town’s storages.
storage_sites: &'s [StorageSite]The storage sites.
materials: &'s [RawMaterial]The raw materials.
rng: &'s mut RandomThe game’s random numbers.
stock: [(i32, i32); 21]The stock manager’s (count, limit) per slot from the last recount.
temperature: f32The environment’s temperature.
professions: &'s ProfessionsThe professions.
workforce: &'s mut WorkforceThe workers assigned to each workplace.
site_templates: &'s [SiteTemplate]The building templates.
sites: &'s mut BTreeMap<usize, Site>The buildings, by entity.
homes: &'s mut BTreeMap<usize, Home>The homes, by entity.
attendance: &'s mut BTreeMap<usize, Attendance>Who attends each service building, by entity.
attendance_list: &'s mut Vec<usize>The service buildings that people attend.
healers: &'s mut Vec<usize>The herbalists and hospitals.
happiness: &'s mut Vec<usize>The buildings that raise happiness nearby.
calendar: f32The calendar’s seconds into the year.
year: u32The current year.
fruits: &'s mut BTreeMap<usize, Fruit>The orchards’ fruit, by entity.
wildlife: &'s mut WildlifeThe animals (livestock and their pastures).
keep_piles: &'s mut BTreeMap<usize, bool>Whether removing a resource leaves its piles behind, by resource.
site_events: &'s mut Vec<(i32, i32, usize)>Building events for the event log: (kind, argument, entity).
storage_changes: &'s mut Vec<(usize, bool)>Storages that opened or closed: (entity, opened).
rebuilds: &'s mut Vec<Rebuild>The buildings to build again after they were destroyed.
water: &'s mut WaterThe town’s water sources (wells and shore points).
game_flags: u32The game’s debug flags (all four disaster bits are set when disasters are off).
precipitation: boolThe sky’s state is precipitation (environment = 0).
population: i32The town’s population.
visitors: &'s mut (f32, i64)The visitors’ timer and the time of the last visitor.
pending_roads: &'s mut BTreeMap<i32, i32>The planned road cells, each with its road-building work.
terraform_requests: &'s mut Vec<Terraform>The pending changes to the ground.
flatten_requests: &'s mut Vec<[i32; 4]>The rectangles to flatten: [x0, y0, x1, y1].
tornadoes: &'s mut BTreeMap<usize, Tornado>The tornadoes, by entity.
tornado_kills: &'s mut Vec<usize>The citizens a tornado killed.
trackers: &'s mut BTreeMap<usize, Tracker>The production trackers, by entity.
decals: &'s mut BTreeMap<usize, Decal>The ground decals of building sites, by entity.
counters: &'s mut StockCountersThe counts of goods made and used.
trading_posts: &'s mut Vec<usize>The town’s trading posts.
trade_value: &'s mut i32The total value traded.
known_materials: &'s mut Vec<usize>The raw materials the town knows; known holds the crops, orchard trees and livestock it
knows.
Original: FUN_140097330, FUN_140096ef0.
known: &'s mut Vec<usize>The crops, orchard trees and livestock the town knows.
trade_goods: &'s [TradeGood]The goods traders can bring.
river: &'s [[f32; 2]]The river’s path.
pathfinder: &'s mut PathfinderThe path manager (the trader boats’ water paths).
names: Option<&'s (NameDatabase, NameDatabase)>The citizens’ name databases (the merchants’ names).
site_dt: i64The scheduled update’s elapsed time (ticks) for the site callbacks.
cemeteries: &'s mut Vec<usize>The cemeteries.
tombstones: &'s mut BTreeMap<usize, i64>The tombstones, with the time each one stays.
burials: &'s mut Vec<(usize, i32)>The burials waiting: (cemetery, cell).
site_list: &'s mut Vec<usize>The buildings that have a site record.
events: Vec<JobEvent>The job events from this update.
piles: &'s mut BTreeMap<usize, Pile>The piles, by entity.
claimed: &'s mut BTreeSet<usize>The resources a work has claimed.
new_piles: &'s mut Vec<usize>The piles made in this update.
models_dirty: &'s mut boolSet when a model changed and must be drawn again.
offers: Vec<i32>Works a ClearArea try asked the manager to offer (WorkHost::take_offers).
removed: Vec<usize>Scratch for Sim::seeder (planting removes nothing and plays no sounds).
animation_events: Vec<(usize, String)>The animation events to play: (entity, effect).
offers_again: boolWhether the offers get a second try (as an auto-pickup’s do).
Original: FUN_1400fdaf0(.., 1).
Implementations§
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_commute(
&mut self,
job: &mut Commute,
citizens: &[Citizen],
dt: i64,
)
pub fn update_commute( &mut self, job: &mut Commute, citizens: &[Citizen], dt: i64, )
StockManager::Update’s part: the clock, then a step, or a new start when idle.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_boats(&mut self)
pub fn update_boats(&mut self)
The boats’ StateMachine updates: 0 sailing in, gone at the route’s end (the post hears it, message 0xb), approaching within eight of the dock; 1 slowing to the dock, docked within 0.2; 3 heading back to the route, sailing out within three; 4 gone at the route’s end.
Original: FUN_140045bb0, FUN_140045950, FUN_140045670, FUN_1400455a0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn trade_message(&mut self, e: usize, msg: i32)
pub fn trade_message(&mut self, e: usize, msg: i32)
The post’s state messages: 9 in 0x12 the boat docked: event 13 at severity 2, → 0x13; 0xb in 0x12 it went without docking: → 2; 0xa in 0x13 the merchant leaves now.
Original: FUN_14005b1b0, FUN_14005b320, FUN_14005bba0.
Sourcepub fn toggle_trade_work(&mut self, jobs: &mut Jobs, e: usize)
pub fn toggle_trade_work(&mut self, jobs: &mut Jobs, e: usize)
The TradeWork switched (the post’s work button): the workplace on with the work, or off without it.
Original: FUN_14005c960.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn sell_value(&self, e: usize, material: usize) -> i32
pub fn sell_value(&self, e: usize, material: usize) -> i32
sell_value at the post e.
Sourcepub fn exchange(
&mut self,
e: usize,
sell: &[(usize, i32)],
buy: &[(usize, i32)],
)
pub fn exchange( &mut self, e: usize, sell: &[(usize, i32)], buy: &[(usize, i32)], )
TradeUI’s trade button, while the merchant is docked: the visitors’ disease risk; what is sold leaves the post (used) and its value counts as traded away; what is bought leaves the merchant’s goods and arrives: raw materials in the post’s storage (known), seeds known, livestock known and at the post.
Original: FUN_1400868f0, FUN_14005b640.
Sourcepub fn trade_setting(&mut self, e: usize, setting: TradeSetting)
pub fn trade_setting(&mut self, e: usize, setting: TradeSetting)
TradeUI’s settings: see TradeSetting.
Original: FUN_140086f80, FUN_1400871d0, FUN_140087120, FUN_140087090,
FUN_140087350, FUN_1400872a0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_blight(&mut self, visits: &[(usize, i64)])
pub fn update_blight(&mut self, visits: &[(usize, i64)])
DiseaseComponent’s scheduled update of every site that has one.
Original: FUN_1400494f0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_fires(&mut self, jobs: &mut Jobs, visits: &[(usize, i64)])
pub fn update_fires(&mut self, jobs: &mut Jobs, visits: &[(usize, i64)])
FireComponent’s scheduled update of every building that has one: not burning, the ignition odds (unless fires are off); burning, the spread and the burn running out.
Original: FUN_140049910.
Sourcepub fn ignite(&mut self, jobs: &mut Jobs, e: usize)
pub fn ignite(&mut self, jobs: &mut Jobs, e: usize)
A building neither damaged nor being torn down is damaged for half the burn; it burns, gets
its FireWork (prioritised), marks the emergency around it and, as the first fire, posts
event 31. The particles and the fire sound follow burn in the app (docs/PARTICLES.md,
Ambience::drive_entities). (AutoSlow, settings, comes from the event: EventLog::add.)
Original: FireComponent::Ignite, FUN_140049f70.
Sourcepub fn put_out(&mut self, jobs: &mut Jobs, e: usize)
pub fn put_out(&mut self, jobs: &mut Jobs, e: usize)
It is rubble now; its work and emergency go; the particles fade and the fire sound stops
with burn at 0 (in the app).
Original: FireComponent::PutOut, FUN_140049e20.
Sourcepub fn fire_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)
pub fn fire_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)
FireComponent’s message slot: message 0, a bucket of water.
Original: FUN_1400499f0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_tornadoes(&mut self, jobs: &mut Jobs, dt: i64)
pub fn update_tornadoes(&mut self, jobs: &mut Jobs, dt: i64)
Every tornado’s update for dt ticks.
Original: FUN_140058630.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn place_burials(&mut self)
pub fn place_burials(&mut self)
The burials decided this update: the grave becomes plain ground and gets a tombstone turned as the cemetery, which lasts its tombstone description’s time and stamps its cell.
Original: FUN_1400473f0; the tombstone’s set-up FUN_1400581c0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn happiness_visit(&mut self, e: usize)
pub fn happiness_visit(&mut self, e: usize)
Message 0, a citizen’s visit: one unit of the first stored raw material that matches and is not reserved is used up, and counted.
Original: FUN_14004b0e0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_nomads(&mut self, dt: i64)
pub fn update_nomads(&mut self, dt: i64)
The nomads’ StateMachine updates: 0 at the town hall, it tells it (message 6) and waits; 1 waiting, it wanders now and then; 2 back where it came from, it is gone.
Original: FUN_140050320, FUN_14004ff60, FUN_14004fe90.
Sourcepub fn immigration_message(&mut self, e: usize, msg: i32)
pub fn immigration_message(&mut self, e: usize, msg: i32)
The ImmigrationComponent’s state messages: 6 a nomad arrived (in 0x10); 8 turned away (in
0x11). Message 7 (taking them in) needs the citizens:
crate::behaviour::agents::Agents::admit_band.
Original: FUN_14004d950, FUN_14004d680, FUN_14004d6f0.
Sourcepub fn take_band(&mut self, e: usize) -> Option<Vec<(usize, [f32; 3])>>
pub fn take_band(&mut self, e: usize) -> Option<Vec<(usize, [f32; 3])>>
The visitors’ disease risk (the larger of the town’s and, for the longer of the town’s and
months) and the band (each nomad and where it stands) for the citizens to be made. None
unless the band is waiting (0x11).
Original: FUN_14004ddb0 (town side).
Sourcepub fn band_taken(&mut self, e: usize)
pub fn band_taken(&mut self, e: usize)
After the citizens are made: each nomad is gone (message 0) and the town hall goes back to 2.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_attendance(&mut self, visits: &[(usize, i64)])
pub fn update_attendance(&mut self, visits: &[(usize, i64)])
The scheduled update of a school, chapel or doctor: when nobody works there, everyone leaves.
Original: FUN_140044cd0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn crop_plant_now(&mut self, e: usize)
pub fn crop_plant_now(&mut self, e: usize)
Plant now (also the field’s message 3 in state 2).
Original: FUN_14011fc80.
Sourcepub fn set_crop(&mut self, e: usize, crop: Option<usize>)
pub fn set_crop(&mut self, e: usize, crop: Option<usize>)
CropUI slot.
Original: FUN_1400b7df0.
Sourcepub fn field_action(&mut self, e: usize, action: i32)
pub fn field_action(&mut self, e: usize, action: i32)
CropFieldComponent slot: 0 sends the machine message 3 (handled in state 2: plant now), 1 message 4 (state 10: harvest now), 2 switches farming on or off.
Original: FUN_140120190.
Sourcepub fn crop_harvest_now(&mut self, e: usize)
pub fn crop_harvest_now(&mut self, e: usize)
The field’s message 4 in state 10: harvest now.
Original: FUN_14011f3d0.
Sourcepub fn crop_message(&mut self, e: usize, message: i32, index: i32)
pub fn crop_message(&mut self, e: usize, message: i32, index: i32)
CropFieldComponent’s message slot. Message 0: cell index was planted (its crop keeps the
cell’s pile flag, NaturalResource); message 1: a tending visit advances the cell’s crop by
growing time × 300 s × tend.
Original: FUN_140120020.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn update_hunts(&mut self, visits: &[(usize, i64)])
pub fn update_hunts(&mut self, visits: &[(usize, i64)])
HuntComponent’s scheduled update: the hunting time grows by the elapsed time times the workers over the most allowed.
Original: FUN_140127c10.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn orchard_clear_now(&mut self, e: usize)
pub fn orchard_clear_now(&mut self, e: usize)
Message 5: clear the orchard (0x14).
Original: FUN_140051d40.
Sourcepub fn orchard_harvest_now(&mut self, e: usize)
pub fn orchard_harvest_now(&mut self, e: usize)
Message 4: harvest now; nothing is picked yet this harvest.
Original: FUN_140051260.
Sourcepub fn orchard_message(&mut self, e: usize, message: i32, index: i32)
pub fn orchard_message(&mut self, e: usize, message: i32, index: i32)
OrchardComponent’s message slot. 0: slot index was planted (a tree with fruit stands, else
it is lost); 1: the tree was picked (its fruit starts again); 2: a tending visit ripens its
fruit by ripening time × 300 s × tend.
Original: FUN_1400522f0.
Sourcepub fn orchard_action(&mut self, e: usize, action: i32)
pub fn orchard_action(&mut self, e: usize, action: i32)
The orchard’s buttons: 0 plant now (message 3, state 2), 1 harvest now (message 4, states 10 and 12), 2 tending on/off, 3 clear (message 5, states 9–12).
Original: FUN_140052500.
Sourcepub fn set_orchard_tree(&mut self, e: usize, tree: Option<usize>)
pub fn set_orchard_tree(&mut self, e: usize, tree: Option<usize>)
The orchard’s tree list (as CropUI’s slot): choosing the first tree switches tending on.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn pasture_message(&mut self, e: usize, message: i32)
pub fn pasture_message(&mut self, e: usize, message: i32)
The pasture’s message 0: a rancher’s visit.
Original: FUN_14012cbf0.
Sourcepub fn set_pasture_kind(
&mut self,
jobs: &mut Jobs,
e: usize,
kind: Option<usize>,
)
pub fn set_pasture_kind( &mut self, jobs: &mut Jobs, e: usize, kind: Option<usize>, )
PastureUI slot: the kind of animal; choosing the first one switches the work on. The most it keeps becomes its room.
Original: FUN_1400ba110.
Sourcepub fn set_pasture_limit(&mut self, e: usize, limit: i32)
pub fn set_pasture_limit(&mut self, e: usize, limit: i32)
PastureUI slot: the slider sets the most animals kept.
Original: FUN_1400ba2f0.
Sourcepub fn pasture_query(&self, e: usize, query: i32) -> u8
pub fn pasture_query(&self, e: usize, query: i32) -> u8
Whether the window’s button query is available. 0 (send every animal away) needs room for
all of them in other pastures of the kind, 1 (send half) ten animals and room for five; 2 is
the work toggle’s state (bit 2 on).
Original: FUN_14012d2a0.
Sourcepub fn pasture_action(&mut self, jobs: &mut Jobs, e: usize, action: i32)
pub fn pasture_action(&mut self, jobs: &mut Jobs, e: usize, action: i32)
2 switches the work on or off; 0 sends every animal (1 half of them, rounded down) to other pastures of the kind, the roomiest first.
Original: FUN_14012cf30.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn clear_remaining(&self, e: usize) -> i32
pub fn clear_remaining(&self, e: usize) -> i32
The footprint cells holding another object.
Original: FUN_14011d800.
Sourcepub fn unclaim(&mut self, resource: usize)
pub fn unclaim(&mut self, resource: usize)
A removal sequence was aborted.
Original: FUN_1400cff70.
Sourcepub fn animate_resource(&mut self, resource: usize, anim: usize)
pub fn animate_resource(&mut self, resource: usize, anim: usize)
A resource with the animation flag plays clip anim.
Original: FUN_14012b910.
Sourcepub fn remove_resource(
&mut self,
c: usize,
resource: usize,
educated: bool,
priority: Option<i32>,
auto_pickup: bool,
)
pub fn remove_resource( &mut self, c: usize, resource: usize, educated: bool, priority: Option<i32>, auto_pickup: bool, )
The start of RemoveNaturalResource: queue the resource for removal; unless
another profession should have harvested it, leave a pile of yield × min(growth, 1) units
(the educated yield for educated citizens), turned RandTol(2) × 90°. priority is the
priority of a work at the resource’s cell.
Original: FUN_1400cffe0, FUN_1400fe220, FUN_14012b5c0.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn activate_piles(&mut self, jobs: &mut Jobs)
pub fn activate_piles(&mut self, jobs: &mut Jobs)
RawMaterialComponent activation: register each new pile’s Pickup work.
Original: FUN_14012e6a0.
Sourcepub fn destroy_pile(&mut self, jobs: &mut Jobs, id: usize)
pub fn destroy_pile(&mut self, jobs: &mut Jobs, id: usize)
Destroy a pile (picked up or decayed): its entity, its cell and its work.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn activate(&mut self, jobs: &mut Jobs, entity: usize)
pub fn activate(&mut self, jobs: &mut Jobs, entity: usize)
Activate a site placed since the last iteration.
Original: FUN_1400c9d70, then the activation.
Sourcepub fn update_sites(
&mut self,
jobs: &mut Jobs,
dt: i64,
visits: &[(usize, i64)],
)
pub fn update_sites( &mut self, jobs: &mut Jobs, dt: i64, visits: &[(usize, i64)], )
The sites’ StateMachine updates: every site’s bit-4 update with the iteration’s time dt,
then the scheduled update of each site its bucket visited this iteration (visits, in
visiting order) with the time since its last visit.
Original: FUN_1400c9560.
Sourcepub fn destroy_entity(&mut self, jobs: &mut Jobs, e: usize)
pub fn destroy_entity(&mut self, jobs: &mut Jobs, e: usize)
The entity manager’s removal of a destroyed site entity (then each component’s remove slot): its work goes (citizens doing it abort), the ZoneComponent frees its cells and the entity is gone.
Original: FUN_1400c8370.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn residence_clear_storage(
&mut self,
jobs: &mut Jobs,
visits: &[(usize, i64)],
)
pub fn residence_clear_storage( &mut self, jobs: &mut Jobs, visits: &[(usize, i64)], )
The residence update’s work: a house nobody lives in that still holds goods gets a ClearStorage work (mask 1); an empty storage has it removed.
Original: FUN_14012ee40.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn is_damaged(&self, e: usize) -> bool
pub fn is_damaged(&self, e: usize) -> bool
Damaged (6) or rubble (7).
Original: FUN_140123b60.
Sourcepub fn is_demolishing(&self, e: usize) -> bool
pub fn is_demolishing(&self, e: usize) -> bool
Being torn down (3 to 5).
Original: FUN_140123be0.
Sourcepub fn demolish(&mut self, jobs: &mut Jobs, e: usize)
pub fn demolish(&mut self, jobs: &mut Jobs, e: usize)
Remove Buildings and the demolish button. Damaged or rubble: clear it (message 1); else the machine runs what is pending, then goes to 3.
Original: FUN_140123470.
Sourcepub fn upgrade(&mut self, jobs: &mut Jobs, e: usize, template: usize)
pub fn upgrade(&mut self, jobs: &mut Jobs, e: usize, template: usize)
UpgradeUI’s button: the replacement is template, and the building is torn down.
Original: FUN_14008c160, FUN_140123470.
Sourcepub fn cancel_demolition(&mut self, jobs: &mut Jobs, e: usize)
pub fn cancel_demolition(&mut self, jobs: &mut Jobs, e: usize)
DestroyUI’s cancel (0x1771): message 0, and the replacement goes back to the
description’s.
Original: FUN_1401238d0.
Sourcepub fn damage(&mut self, jobs: &mut Jobs, e: usize, time: i64) -> bool
pub fn damage(&mut self, jobs: &mut Jobs, e: usize, time: i64) -> bool
Damage for time (fire, the tornado). A building not started yet takes none; else it goes
to 3 (then 6).
Original: FUN_140123c80.
Sourcepub fn to_rubble(&mut self, jobs: &mut Jobs, e: usize)
pub fn to_rubble(&mut self, jobs: &mut Jobs, e: usize)
Straight to rubble.
Original: FUN_140123ee0.
Sourcepub fn destroy_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)
pub fn destroy_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)
The StateMachine’s message slot for the Destroy states: the current state’s handler.
Source§impl Sim<'_, '_>
impl Sim<'_, '_>
Sourcepub fn plan_road(
&mut self,
jobs: &mut Jobs,
cell: i32,
kind: u8,
ty: u8,
material: Option<usize>,
)
pub fn plan_road( &mut self, jobs: &mut Jobs, cell: i32, kind: u8, ty: u8, material: Option<usize>, )
Plan a better road (a lower kind) than the cell has: a plan already there is taken back; a
cell that is neither road (types 0, 1) nor planned counts one more; a BuildRoad work is
registered, and the cell keeps the new kind while it is built.
Original: FUN_1400a1e30(cell, kind, type, material).
Sourcepub fn unplan_road(&mut self, jobs: &mut Jobs, cell: i32) -> bool
pub fn unplan_road(&mut self, jobs: &mut Jobs, cell: i32) -> bool
A planned road’s work goes and the cell gets back what it had (true); a cell without a road kind becomes ground at once (false); a road built stays (true, for the caller to clear).
Original: FUN_1400a1bd0.
Sourcepub fn complete_road(&mut self, cell: i32, built: u8, ty: u8)
pub fn complete_road(&mut self, cell: i32, built: u8, ty: u8)
The start of CompleteRoad: to ground (type 2) the cell
loses its road (one less, no kind); else it becomes the road type. Either way it leaves the
planned set. A road flattens the terrain at its cell’s corners; the road decals follow
road_revision.
Original: FUN_1400a1b10(cell, kind byte, type); FUN_1400a35b0, FUN_1400b4840.
Trait Implementations§
Source§impl WorkHost for Sim<'_, '_>
impl WorkHost for Sim<'_, '_>
Source§fn cancel(&mut self, work: &mut Work)
fn cancel(&mut self, work: &mut Work)
FUN_1400f1950 / FUN_1400eac70: clear every worker’s stack (their aborts leave the
set through the fail slot).
Source§fn profession(&self, c: usize) -> usize
fn profession(&self, c: usize) -> usize
+0x1f0, +0x248, the character’s cell, and FUN_14011b0b0.Source§fn has_emergency(&self, c: usize) -> bool
fn has_emergency(&self, c: usize) -> bool
Source§fn works_anywhere(&self, p: usize) -> bool
fn works_anywhere(&self, p: usize) -> bool
+0x4c.Source§fn rank(&mut self, a: i32, b: i32) -> i32
fn rank(&mut self, a: i32, b: i32) -> i32
FUN_1400a4ce0(map, a, b, 1), with the callers’ fallback n + (int)sqrtf(d²).Source§fn stock(&self, slot: usize) -> (i32, i32)
fn stock(&self, slot: usize) -> (i32, i32)
(count, limit) per slot (Game +0xf0 → +0x170).Source§fn take_events(&mut self) -> Vec<JobEvent>
fn take_events(&mut self) -> Vec<JobEvent>
(work, citizen, param, completed).Source§fn try_assign(&mut self, work: &mut Work, c: usize, time: i64) -> u8
fn try_assign(&mut self, work: &mut Work, c: usize, time: i64) -> u8
+0x20: 0 cannot, 1 not now, 2 assigned. time is the manager’s clock +0x130.Source§fn take_offers(&mut self) -> Vec<i32>
fn take_offers(&mut self) -> Vec<i32>
+0x20 asked the manager to offer in its place (FUN_1400fdaf0 called
from inside a try, as ClearArea does with the piles in its footprint), in order. A try
answering NESTED has queued them.Source§fn offers_again(&mut self) -> bool
fn offers_again(&mut self) -> bool
FUN_1400fdaf0(.., 1)).Source§fn resume(&mut self, work: &mut Work, c: usize) -> u8
fn resume(&mut self, work: &mut Work, c: usize) -> u8
NESTED answer none of whose offers was taken: the rest of the try
(ConsumeProduce goes on to work a cycle).Source§fn complete(&mut self, work: &mut Work, c: usize, param: i32) -> bool
fn complete(&mut self, work: &mut Work, c: usize, param: i32) -> bool
+0x30: a CompleteTask finished; true removes the work.