Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage pursuitKit.package·originates fromworld 0a0b119f-a…

director

The kit assembled: one object a game ticks once a frame.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

director

The kit assembled: one object a game ticks once a frame.

It runs perception for every registered observer, fills their awareness, opens and lands reports, adds heat,
advances the incident, runs every pursuer's reach and, when one lands, the arrest sequence. It moves nothing
and draws nothing. The game tells it where things are and listens to its hub.

  local Director = require("~.modules.director")
  local dir = Director.new(cfg, {
      hasLine = function(observer, suspect) return true end,   -- is the line between them clear? (required)
      light = function(x, z) return 1 end,                     -- 0 dark .. 1 day at a place (default 1)
      bill = function(level, ctx) return {} end,               -- the arrest's bill (arrest.bill) (optional)
  }, hub?)

  dir:setObserver("w1", { kind = "guard", x, y, z, fx, fz, active = true, relay = "box3"?, atRelay = false?,
                            knows = false? })     -- y: height (default 0); knows: it knows the suspect's face
  dir:removeObserver("w1")
  (cfg.acts must name "wanted": what an observer that is already certain takes the suspect to be doing;
   cfg.heat.offences must name "seen" and cfg.arrest.breakOffence.)
  dir:setSuspect({ x, y, z, act = "idle", concealment = { "crowd" } (pass {} to clear), hidden = false, strikes = 0,
                   appearance = { jacket = "ochre" }, inVehicle = false, speed = 0, charges = 1,
                   fillFactor = 1,      -- a host factor on being noticed (a hot car 1.4, a taxi 0.6)
                   grabFactor = 1 })    -- scales a pursuer's reach (a suspect who cannot run: 2)
  dir:input({ breakHeld = false, skip = false })       -- the suspect's inputs during an arrest
  dir:offence("vandalism")                              -- heat for a named offence, if anyone saw (returns points)
  dir:stun("w1", 4)                                     -- an observer cannot see or reach for that long
  dir:jamRelay("box3")                                  -- cancels the reports that need that relay (returns count)
  dir:report({ x, z, offence = "stolenVehicle"?, delay = 0?, appearance = {}?, quiet = false? })
                                                        -- a report from outside the observers (a car's owner, an
                                                        -- accomplice's incident); quiet: the place only, no heat
  dir:noise({ x, z, radius })                           -- a loud thing happened there: observers in earshot turn
                                                        -- suspicious whatever they can see (returns how many heard)
  local view = dir:tick(dt)
  -- view = incident:view() plus:
  --   watchers = { { id, kind, value, stage } }   highest first
  --   reports = { { id, left, delay, via, relay, held } }
  --   grab = { by, progress } | nil      a reach winding up, or the vehicle box filling (by = "box")
  --   arrest = arrestSeq:view() | nil
  --   described = { tags }               what of the current appearance they know

Parts, all public: dir.heat, dir.incident, dir.awareness, dir.reports, dir.description, dir.arrest, dir.hub.
Hub events beyond those of heat and incident: "observer" { type = suspicious | alert | calm, id, kind },
"cheer" { id }, "reportOpened" { id, delay, via, relay }, "reportLanded" { id, offence, x, z },
"grabWindup" { by }, "grabMissed" { by }, "arrestStage" { stage, sequence, ctx }, "arrestBroke" {}, "arrestDone"
{ bill, level, sequence, outcome }, "heard" { x, z, by = { id, ... } }.

Who grabs decides what follows: an observer kind may name `sequence` (cfg.arrest.sequences[name], its own
stages and `outcome`); kinds that name none run cfg.arrest.stages with outcome "arrest". A sequence may say
`handover = { atLevel }`: when it ends with the heat at that level or above, the main arrest follows at once
(private guards who detain and call the real pursuers).

The interface is documented in the header of init.luau; this file repeats it for the asset browser.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

pursuitKit.modules.director — the kit assembled: one object a game ticks once a frame. It runs perception for every registered observer, fills their awareness, opens and lands reports, adds heat, advances the incident, runs every pursuer's reach and, when one lands, the arrest sequence. It moves nothing and draws nothing. The game tells it where things are and listens to its hub. local Director = require("~.modules.director") local dir = Director.new(cfg, { hasLine = function(observer, suspect) return true end, -- is the line between them clear? (required) light = function(x, z) return 1 end, -- 0 dark .. 1 day at a place (default 1) bill = function(level, ctx) return {} end, -- the arrest's bill (arrest.bill) (optional) }, hub?) dir:setObserver("w1", { kind = "guard", x, y, z, fx, fz, active = true, relay = "box3"?, atRelay = false?, knows = false? }) -- y: height (default 0); knows: it knows the suspect's face dir:removeObserver("w1") (cfg.acts must name "wanted": what an observer that is already certain takes the suspect to be doing; cfg.heat.offences must name "seen" and cfg.arrest.breakOffence.) dir:setSuspect({ x, y, z, act = "idle", concealment = { "crowd" } (pass {} to clear), hidden = false, strikes = 0, appearance = { jacket = "ochre" }, inVehicle = false, speed = 0, charges = 1, fillFactor = 1, -- a host factor on being noticed (a hot car 1.4, a taxi 0.6) grabFactor = 1 }) -- scales a pursuer's reach (a suspect who cannot run: 2) dir:input({ breakHeld = false, skip = false }) -- the suspect's inputs during an arrest dir:offence("vandalism") -- heat for a named offence, if anyone saw (returns points) dir:stun("w1", 4) -- an observer cannot see or reach for that long dir:jamRelay("box3") -- cancels the reports that need that relay (returns count) dir:report({ x, z, offence = "stolenVehicle"?, delay = 0?, appearance = {}?, quiet = false? }) -- a report from outside the observers (a car's owner, an -- accomplice's incident); quiet: the place only, no heat dir:noise({ x, z, radius }) -- a loud thing happened there: observers in earshot turn -- suspicious whatever they can see (returns how many heard) local view = dir:tick(dt) -- view = incident:view() plus: -- watchers = { { id, kind, value, stage } } highest first -- reports = { { id, left, delay, via, relay, held } } -- grab = { by, progress } | nil a reach winding up, or the vehicle box filling (by = "box") -- arrest = arrestSeq:view() | nil -- described = { tags } what of the current appearance they know Parts, all public: dir.heat, dir.incident, dir.awareness, dir.reports, dir.description, dir.arrest, dir.hub. Hub events beyond those of heat and incident: "observer" { type = suspicious | alert | calm, id, kind }, "cheer" { id }, "reportOpened" { id, delay, via, relay }, "reportLanded" { id, offence, x, z }, "grabWindup" { by }, "grabMissed" { by }, "arrestStage" { stage, sequence, ctx }, "arrestBroke" {}, "arrestDone" { bill, level, sequence, outcome }, "heard" { x, z, by = { id, ... } }. Who grabs decides what follows: an observer kind may name `sequence` (cfg.arrest.sequences[name], its own stages and `outcome`); kinds that name none run cfg.arrest.stages with outcome "arrest". A sequence may say `handover = { atLevel }`: when it ends with the heat at that level or above, the main arrest follows at once (private guards who detain and call the real pursuers).

new(cfg: any, adapters: any, hub: any?) → any

Assemble the kit. See the header for `adapters`.

argtypedescription
cfgany
adaptersany
hubany?

_sequence(name: string?) → any

An arrest object for a named sequence (nil: the main one), with hooks that carry the sequence's name.

argtypedescription
namestring?

onStage(stage: ?, ctx: ?) → void

argtypedescription
stage?
ctx?

onBreak(_ctx: ?) → void

argtypedescription
_ctx?

onDone(ctx: ?) → void

argtypedescription
ctx?

setObserver(id: string, o: any) → void

Register or update an observer.

argtypedescription
idstring
oany

removeObserver(id: string) → void

argtypedescription
idstring

setSuspect(s: any) → void

Update what is known about the suspect this frame (fields given replace, others keep).

argtypedescription
sany

input(i: any) → void

argtypedescription
iany

stun(id: string, seconds: number) → void

An observer can neither see nor reach for `seconds` (blinded, knocked down).

argtypedescription
idstring
secondsnumber

isStunned(id: string) → boolean

argtypedescription
idstring

jamRelay(relay: string) → number

Cancel every pending report that goes through a relay.

argtypedescription
relaystring

witnessed( ) → boolean

Whether anyone can see the suspect right now (as of the last tick).

report(spec: any) → void

A report from outside the observers. See the header. With a delay it joins the pending reports (and can be seen on the HUD); without, it lands on the next tick.

argtypedescription
specany

noise(n: any) → number

A loud thing happened: every active observer within `radius` of it turns at least suspicious, seen or not. Returns how many heard. Emits "heard" with the pursuers among them.

argtypedescription
nany

offence(name: string, force: boolean?) → number

Heat for a named offence. It counts only if someone saw it (or `force`). Returns the points added.

argtypedescription
namestring
forceboolean?

beginArrest(self: any, by: string, sequence: string?) → void

argtypedescription
selfany
bystring
sequencestring?

tick(dt: number) → any

Advance everything by dt. Returns the view described in the header.

argtypedescription
dtnumber

view( ) → any

The whole state as one plain table for a HUD (also what tick returns).

senses(id: string) → any

For a pursuer's brain: whether this observer has eyes on the suspect now, and its reach's phase.

argtypedescription
idstring

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.