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

pursuer

One pursuer's decisions, and the two input buses it speaks through.

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

pursuer

One pursuer's decisions, and the two input buses it speaks through.

A pursuer never moves an entity. Each tick its brain turns what it senses and what it was ordered into an
INTENT, and a bus writer turns the intent into the fields a character or a vehicle already reads:

  character bus   inputX, inputZ (world-space velocity, units per second), inputJump
                  (the engine's CharacterController reads exactly these; any mover with the same fields works)
  vehicle bus     inputThrottle (-1..1), inputSteer (-1..1, right positive), inputBrake (0..1), inputHandbrake (0..1)

  local Pursuer = require("~.modules.pursuer")
  local brain = Pursuer.new(cfg.pursuer, "foot")           -- a profile of cfg.pursuer: "foot", "car", or any other
  -- a profile is { patrol, investigate, chase, tired, stamina, recover, arrive, leash? } for someone on foot
  -- (profile.wheels ~= true) or { street, avenue, arrive, wheels = true } for a car
  local intent = brain:decide(dt, {
      x = 0, z = 0,                       -- where this pursuer is
      order = { role = "pursue", x, z },  -- from dispatch (role: stand | investigate | pursue | sweep | cordon)
      home = { x, z }?,                   -- its post; with a `leash` in its profile it turns back that far from it
      sees = true, sx = 4, sz = 9,        -- it has eyes on the suspect, and where
      stunned = 0,                        -- seconds it cannot act (blinded, slipped)
      beat = { x, z }?,                   -- where its patrol wants it when it has no order
      path = { { x, z }, ... }?,          -- the host's route to the order (roads, a nav path); optional
      roadClass = "street" | "avenue"?,   -- for a car: sets its top speed
      grabbing = false,                   -- its reach is winding up (it plants its feet)
  })
  -- intent = { mode, x, z, speed, hold }   mode: stunned | grab | chase | investigate | sweep | cordon | patrol |
  --                                         return (leashed: it gives up and goes home) | idle
  local vx, vz = Pursuer.characterBus(intent, x, z)
  local throttle, steer, brake, handbrake = Pursuer.vehicleBus(intent, x, z, fx, fz, forwardSpeed, cfg.frame.right)
  brain:stamina()     -- 0..1 (a foot pursuer tires in a chase and slows to cfg.foot.tired)

Routing is the host's: pass `path` and the brain walks its points in order; without one it heads straight
for the target (fine in the open, wrong round buildings).

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.pursuer — one pursuer's decisions, and the two input buses it speaks through. A pursuer never moves an entity. Each tick its brain turns what it senses and what it was ordered into an INTENT, and a bus writer turns the intent into the fields a character or a vehicle already reads: character bus inputX, inputZ (world-space velocity, units per second), inputJump (the engine's CharacterController reads exactly these; any mover with the same fields works) vehicle bus inputThrottle (-1..1), inputSteer (-1..1, right positive), inputBrake (0..1), inputHandbrake (0..1) local Pursuer = require("~.modules.pursuer") local brain = Pursuer.new(cfg.pursuer, "foot") -- a profile of cfg.pursuer: "foot", "car", or any other -- a profile is { patrol, investigate, chase, tired, stamina, recover, arrive, leash? } for someone on foot -- (profile.wheels ~= true) or { street, avenue, arrive, wheels = true } for a car local intent = brain:decide(dt, { x = 0, z = 0, -- where this pursuer is order = { role = "pursue", x, z }, -- from dispatch (role: stand | investigate | pursue | sweep | cordon) home = { x, z }?, -- its post; with a `leash` in its profile it turns back that far from it sees = true, sx = 4, sz = 9, -- it has eyes on the suspect, and where stunned = 0, -- seconds it cannot act (blinded, slipped) beat = { x, z }?, -- where its patrol wants it when it has no order path = { { x, z }, ... }?, -- the host's route to the order (roads, a nav path); optional roadClass = "street" | "avenue"?, -- for a car: sets its top speed grabbing = false, -- its reach is winding up (it plants its feet) }) -- intent = { mode, x, z, speed, hold, arrived?, look? } mode: stunned | grab | chase | investigate | sweep | cordon | patrol | -- return (leashed: it gives up and goes home) | idle local vx, vz = Pursuer.characterBus(intent, x, z) local throttle, steer, brake, handbrake = Pursuer.vehicleBus(intent, x, z, fx, fz, forwardSpeed, cfg.frame.right) brain:stamina() -- 0..1 (a foot pursuer tires in a chase and slows to cfg.foot.tired) A pursuer that has arrived where it was sent and sees nobody LOOKS ROUND: its intent holds it in place and its (x, z) is a point that circles it at the profile's `scan` degrees a second (default 120), for the host to face. Routing is the host's: pass `path` and the brain walks its points in order; without one it heads straight for the target (fine in the open, wrong round buildings).

new(cfg: any, kind: string) → any

A new brain of kind "foot" or "car".

argtypedescription
cfgany
kindstring

stamina( ) → number

follow(self: any, senses: any, tx: number, tz: number, arrive: number) → void

argtypedescription
selfany
sensesany
txnumber
tznumber
arrivenumber

decide(dt: number, senses: any) → any

Decide this tick's intent. See the header for `senses`.

argtypedescription
dtnumber
sensesany

characterBus(intent: any, x: number, z: number) → void

The character bus for an intent: a world-space velocity toward the intent's point at its speed, easing to a stop over the last metre. Returns inputX, inputZ, inputJump (always false: jumping is the host's call).

argtypedescription
intentany
xnumber
znumber

vehicleBus(intent: any, x: number, z: number, fx: number, fz: number, forwardSpeed: number, right: number?) → void

The vehicle bus for an intent. (fx, fz) is the vehicle's forward on the ground plane; forwardSpeed in m/s. Steers toward the intent's point, slows for sharp turns, brakes when holding or over its speed. Returns inputThrottle, inputSteer, inputBrake, inputHandbrake. `right` is the frame's handedness (cfg.frame.right): the sign of x on the right of someone facing +z.

argtypedescription
intentany
xnumber
znumber
fxnumber
fznumber
forwardSpeednumber
rightnumber?

Problems

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

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬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.