Skip to main content

Module town

Module town 

Source
Expand description

The simulation context jobs and construction run in: Sim implements the job manager’s work slots (WorkHost) and the building state callbacks (Callbacks), over the citizens, the map, the storages and the construction state. See docs/JOBS.md.

This file holds the context’s state and a few free helpers; its methods are split by topic:

  • geometry: cells, ground heights, reachability and work points;
  • orders: a building’s workers and the actions given to citizens;
  • sites: building sites and buildings, marking them on the map, destroying them;
  • building: carrying materials to a site and building it;
  • clearing: clearing an area before building;
  • piles: loose piles of goods on the ground;
  • storage: picking up goods, finding a storage, dropping off, emptying a storage;
  • callbacks and work_host: the two trait implementations.

Structs§

Env
The world the citizens’ update borrows (everything but the citizens themselves).
Sim
Everything a work slot or a state callback touches.

Constants§

CONSTRUCTION_MASK
0x2001: the construction works’ registration mask (category 13).

Functions§

animating
MapComponent::IsAnimating per placed entity.
cell_ground
The ground at a cell’s centre, on the terrain only (bridge floors are skipped).
clear_remaining
The amount still to clear in an entity’s area, over a grid of n × n cells that maps each cell to its object.
floor_ground
The ground at a cell’s centre: on a bridge’s floor where one covers the cell above the terrain, else on the terrain.
pile_mask
A pile’s work category mask from its material’s flags.