pub struct World<'a> {Show 24 fields
pub size: usize,
pub types: &'a [CellType],
pub objects: &'a [Option<usize>],
pub occupants: &'a [Option<usize>],
pub flags: &'a [u8],
pub roads: &'a [u8],
pub floors: &'a Floors,
pub regions: &'a [u16],
pub terrain: &'a HeightGrid<'a>,
pub pathfinder: &'a mut Pathfinder,
pub rng: &'a mut Random,
pub messages: &'a mut Vec<Message>,
pub used: &'a mut Vec<(usize, i32)>,
pub storages: &'a mut [Storage],
pub materials: &'a [RawMaterial],
pub carried: &'a mut Storage,
pub storage_search: Option<&'a mut StorageSearch<'a>>,
pub pushes: Vec<Action>,
pub tool_uses: &'a mut i32,
pub shown_tool: &'a mut i32,
pub animating: &'a mut [bool],
pub accident: &'a mut Option<usize>,
pub accident_timer: &'a mut i64,
pub accident_odds: Option<(usize, f32, f32)>,
}Expand description
What a character needs from the world to move: the map, the ground and the path finder.
Fields§
§size: usizeThe map’s size in cells.
types: &'a [CellType]The type of each map cell.
objects: &'a [Option<usize>]The object stamped into each map cell.
occupants: &'a [Option<usize>]The occupant of each map cell.
flags: &'a [u8]The flags of each map cell.
roads: &'a [u8]The road kind planned or built (0xff none).
floors: &'a FloorsThe floors (bridge decks) that characters walk on.
regions: &'a [u16]The walkable region of each cell.
terrain: &'a HeightGrid<'a>The ground’s heights.
pathfinder: &'a mut PathfinderThe pathfinder.
rng: &'a mut RandomThe game’s random numbers.
messages: &'a mut Vec<Message>The messages that actions send, delivered after the update.
used: &'a mut Vec<(usize, i32)>What ConsumeRawMaterial used up (material, amount), for the stock manager’s count.
storages: &'a mut [Storage]The town’s storages.
materials: &'a [RawMaterial]The raw materials.
carried: &'a mut StorageWhat the character carries.
storage_search: Option<&'a mut StorageSearch<'a>>The drop-off redirect’s storage search (citizens only).
pushes: Vec<Action>Actions an action pushed from its start (ActionStack::Push), pushed once it returns.
tool_uses: &'a mut i32Citizen: tool uses left (PerformWork with a tool spends one).
shown_tool: &'a mut i32The tool ShowTool attached (-1 none, -2 carried goods).
animating: &'a mut [bool]Per placed entity: its model is playing an animation (MeshInstance::IsAnimating).
accident: &'a mut Option<usize>A citizen’s accident: the profession whose work it had the accident at.
accident_timer: &'a mut i64The time since the last check for an injury at work.
accident_odds: Option<(usize, f32, f32)>The current job’s profession (→ the work’s slot) and its accident odds.
Implementations§
Source§impl World<'_>
impl World<'_>
Sourcepub fn injury_check(&mut self) -> bool
pub fn injury_check(&mut self) -> bool
Already hurt, or, at a job whose profession has accidents, RandFloat < time since the last check / (× 12 × 300 s ×) (the time restarts at every check). Not ported: the debug flag
that stops it (Game bit 8).
Original: Citizen::InjuryCheck, FUN_14011bb20, FUN_1400ae760.
Sourcepub fn cell(&self, p: [f32; 3]) -> i32
pub fn cell(&self, p: [f32; 3]) -> i32
Cell under a map position (clamped, as every caller in the original does).
Sourcepub fn cell_centre(&self, cell: i32) -> [f32; 3]
pub fn cell_centre(&self, cell: i32) -> [f32; 3]
Centre of a cell on the ground (on a bridge’s floor).
Original: FUN_1400a48b0.