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

firefight

Pursuers who shoot back: who may fire at a heat level, when, and how well.

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

firefight

Pursuers who shoot back: who may fire at a heat level, when, and how well.

It decides and nothing more. For every armed pursuer that has eyes on the suspect it runs a readable cycle:
AIM (a telegraph the host stages: the weapon comes up, a sound) for `warn` seconds, then a BURST of shots
`interval` apart, then a REST. Each shot comes back as a muzzle point and an aim point, already led for the
suspect's movement and thrown off by the arm's spread (wider when the suspect is moving, concealed, or the
shooter has just started). The host flies the shot through whatever projectile system it has and tells its
own rules what a hit strips; this module holds no projectile and no health.

  local Firefight = require("~.modules.firefight")
  local ff = Firefight.new(cfg.firefight, rng)        -- rng() -> [0, 1), seeded by the host
  ff:provoke()                                        -- the suspect fired or hit a pursuer (see `needsProvocation`)
  local events = ff:tick(dt, {
      level = 3,                                      -- 0-based heat level
      suspect = { x, y, z, vx, vy, vz, concealed = false },
      shooters = { { id = "w3", kind = "foot", x, y, z, sees = true, stunned = false } },
  })
  -- { type = "aim", by, arm, seconds }               the weapon comes up (stage it)
  -- { type = "shot", by, arm, from = { x, y, z }, at = { x, y, z }, wash, speed, gravity, range, radius, splash }
  -- { type = "lower", by }                           it lost sight, was stunned, or the level fell
  ff:armOf("w3")            -- the arm a shooter has up (nil when it is not engaged)
  ff:phase("w3")            -- "idle" | "aim" | "burst" | "rest"
  ff:reset()                -- the incident is over
  Firefight.carries(cfg.firefight, level, kind, index) -> arm name | nil
  -- whether the index-th pursuer of a kind is armed at a level (levels[].share decides how many are)

Config (cfg.firefight):
  arms[name] = { wash, range, speed, gravity, interval, burst, rest, spread, radius, splash?, muzzle? }
      wash: what a hit strips (the host's unit); burst: shots per burst; rest: seconds between bursts;
      spread: half-angle of the error cone in degrees; muzzle: height above the shooter's feet (default 1.4)
  levels[level + 1] = { arms = { [kind] = armName }, share = 0..1, engage = { min, max }, warn,
                        needsProvocation = bool }
      arms: which arm each kind of pursuer brings out at this level (a kind with no entry does not shoot);
      share: the share of pursuers of a kind that carry it; engage: metres inside which they fire;
      needsProvocation: they fire only after `provoke()` in this incident
  accuracy = { movingAbove, moving, concealed, firstBurst }     spread multipliers

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.firefight — pursuers who shoot back: who may fire at a heat level, when, and how well. It decides and nothing more. For every armed pursuer that has eyes on the suspect it runs a readable cycle: AIM (a telegraph the host stages: the weapon comes up, a sound) for `warn` seconds, then a BURST of shots `interval` apart, then a REST. Each shot comes back as a muzzle point and an aim point, already led for the suspect's movement and thrown off by the arm's spread (wider when the suspect is moving, concealed, or the shooter has just started). The host flies the shot through whatever projectile system it has and tells its own rules what a hit strips; this module holds no projectile and no health. local Firefight = require("~.modules.firefight") local ff = Firefight.new(cfg.firefight, rng) -- rng() -> [0, 1), seeded by the host ff:provoke() -- the suspect fired or hit a pursuer (see `needsProvocation`) local events = ff:tick(dt, { level = 3, -- 0-based heat level suspect = { x, y, z, vx, vy, vz, concealed = false }, shooters = { { id = "w3", kind = "foot", x, y, z, sees = true, stunned = false } }, }) -- { type = "aim", by, arm, seconds } the weapon comes up (stage it) -- { type = "shot", by, arm, from = { x, y, z }, at = { x, y, z }, wash, speed, gravity, range, radius, splash } -- { type = "lower", by } it lost sight, was stunned, or the level fell ff:armOf("w3") -- the arm a shooter has up (nil when it is not engaged) ff:phase("w3") -- "idle" | "aim" | "burst" | "rest" ff:reset() -- the incident is over Firefight.carries(cfg.firefight, level, kind, index) -> arm name | nil -- whether the index-th pursuer of a kind is armed at a level (levels[].share decides how many are) Config (cfg.firefight): arms[name] = { wash, range, speed, gravity, interval, burst, rest, spread, radius, splash?, muzzle? } wash: what a hit strips (the host's unit); burst: shots per burst; rest: seconds between bursts; spread: half-angle of the error cone in degrees; muzzle: height above the shooter's feet (default 1.4) levels[level + 1] = { arms = { [kind] = armName }, share = 0..1, engage = { min, max }, warn, needsProvocation = bool } arms: which arm each kind of pursuer brings out at this level (a kind with no entry does not shoot); share: the share of pursuers of a kind that carry it; engage: metres inside which they fire; needsProvocation: they fire only after `provoke()` in this incident accuracy = { movingAbove, moving, concealed, firstBurst } spread multipliers

new(cfg: any, rng: (() → void

argtypedescription
cfgany
rng((

levelCfg(cfg: any, level: number) → any

argtypedescription
cfgany
levelnumber

carries(cfg: any, level: number, kind: string, index: number) → string

The arm the index-th (1-based) pursuer of a kind carries at a heat level, or nil.

argtypedescription
cfgany
levelnumber
kindstring
indexnumber

provoke( ) → void

The suspect did something that lets pursuers fire at levels marked `needsProvocation`.

reset( ) → void

phase(id: string) → string

argtypedescription
idstring

armOf(id: string) → string

argtypedescription
idstring

shotAt(self: any, s: any, u: any, suspect: any, arm: any, armName: string, first: boolean) → any

argtypedescription
selfany
sany
uany
suspectany
armany
armNamestring
firstboolean

tick(dt: number, state: any) → void

Advance every shooter. See the header for `state` and the events.

argtypedescription
dtnumber
stateany

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.