Painted Metropolis
README.md
dispatch
Who is sent where: the response to a heat level as assignments, not as spawns.
Pure planning over plain tables. The host owns the units (people, cars), the road junctions and the places a
unit may enter the world; dispatch chooses among them.
local Dispatch = require("~.modules.dispatch")
local orders = Dispatch.plan(cfg, level, incidentView, units)
-- units: { { id, kind = "foot" | "car", x, z, available = true } }
-- orders: { [id] = { role = "investigate" | "pursue" | "sweep" | "cordon" | "stand", x, z } }
-- in "reported": the nearest go to the last known position; in "pursuit": every assigned unit
-- pursues it; in "search": they sweep points spread over the search area. Units beyond the level's
-- counts are told to stand (return to their beat).
Dispatch.sweepPoints(x, z, radius, n, turn) -- n points over a disc, a different spread each `turn`
Dispatch.cordon(junctions, x, z, radius, n) -- the n junctions nearest the ring of that radius
Dispatch.entry(candidates, sx, sz, minDistance, canSee?) -- where a new unit may appear: far enough, unseen
Dispatch.wanted(cfg, level) -- { foot, cars, cordon, checkpoints } for a level
The interface is documented in the header of init.luau; this file repeats it for the asset browser.