looks( ) → void
The look names this kit defines (projectileKit looks): bpOrbMagenta (default), bpOrbOrange, bpNeedleCyan, bpOrbLime, bpOrbViolet. Any projectileKit look name works too.
xyz(v: any) → void
x, y, z of a position-like value, and whether it was an entity
position(v: any) → void
{ x, y, z } of a position-like value: {x,y,z}, {1,2,3}, a vector, an entity or id, or a function returning one. nil when it is none of them (or a gone entity).
onHit(name: string, fn: (any, any) → void
Register a hit handler by name, on every peer: `fn(targetEntity, info)` runs when a shot naming it (`hit = name`) touches one of this peer's targets. info = { pattern, pos = {x,y,z}, angle (heading at impact), speed, data, shotId, volley, synced, source (sender peer id for synced volleys), pierceLeft }.
| arg | type | description |
|---|
| name | string | |
| fn | (any, any | |
setTargets(name: string, fn: () → void
Register a named target set, on every peer: `fn()` returns what THIS peer hit-tests and may damage: entities, ids, or { entity = e, radius = r } entries for a per-target radius. e.g. "localPlayers" = the players this peer owns. Synced volleys name a set; each peer tests its own.
| arg | type | description |
|---|
| name | string | |
| fn | ( | |
defaultLocalPlayers( ) → void
the default "localPlayers": this client's own player body
targetsOf(name: string) → void
The function behind a named target set (the default "localPlayers" included), or nil when no set of that name is registered.
| arg | type | description |
|---|
| name | string | |
readSet(key: any, fn: (() → void
One read of a target set per frame (or per BP.step): ids, XZ positions and radii in reused arrays.
| arg | type | description |
|---|
| key | any | |
| fn | (( | |
deliver(s: any, id: string, x: number, y: number, z: number) → void
| arg | type | description |
|---|
| s | any | |
| id | string | |
| x | number | |
| y | number | |
| z | number | |
steer(s: any, v: any, dt: number) → void
homing: turn the heading toward the nearest entity of the homing set, at most `homing` deg/s
| arg | type | description |
|---|
| s | any | |
| v | any | |
| dt | number | |
hitTest(s: any, dt: number?) → string
projectileKit calls this after every step of a BP shot: homing, then an XZ segment
test against the volley's targets. Pierce delivers the hit and keeps flying.
| arg | type | description |
|---|
| s | any | |
| dt | number? | |
onShotEnd(s: any, hit: any) → void
| arg | type | description |
|---|
| s | any | |
| hit | any | |
launch(spec: any) → void
| arg | type | description |
|---|
| spec | any | |
fireResolved(pattern: string, o: any, x: number, y: number, z: number, angle: number) → number
Fire one volley whose numbers are all settled (origin, angle, seed, t).
| arg | type | description |
|---|
| pattern | string | |
| o | any | |
| x | number | |
| y | number | |
| z | number | |
| angle | number | |
aimAngle(o: any, x: number, z: number) → number
| arg | type | description |
|---|
| o | any | |
| x | number | |
| z | number | |
fire(pattern: string, opts: any?) → number
Fire one volley of `pattern` here (this peer only) through projectileKit. opts: `from` ({x,y,z}, vector, entity or id), `angle` (radians, 0 = +X, pi/2 = +Z) or `aimAt` (position or entity), `count`, `arc`, `speed`, `look` (default bpOrbMagenta), `size`, `range` (m, 40), `radius` (shot hit radius, 0.22), `targetRadius` (default target radius, 0.5), `height` (added to an entity origin, 1), `seed`, `t`, `hit` (registered handler name), `onHit` (function, local fire only), `targets` (function -> entities, ids or { entity, radius } this peer may hit) or `targetSet` (registered name, default "localPlayers"), `logic` (false = drawn only, no hits), `draw` (false = not drawn), `impact` (burst look where a shot ends), `data` (small table of strings/numbers; travels in synced events and reaches handlers as info.data), `pierce` (extra targets a shot passes through, 0; never the same target twice), `homing` (turn rate in deg/s toward the nearest target, 0), `homeOn` (target-set name or function the homing steers toward; default the hit targets; name a set listing the same entities on every peer for identical curves), plus any pattern option. Returns how many shots the volley holds (delayed ones included).
| arg | type | description |
|---|
| pattern | string | |
| opts | any? | |
shots(pattern: string, opts: any?) → void
The shots of one volley as pure data (re-export of patterns.shots).
| arg | type | description |
|---|
| pattern | string | |
| opts | any? | |
catalog( ) → void
Every pattern's catalog entry: { name, title, description, tags, defaults }.
names( ) → void
Every pattern name, in catalog order.
plainData(d: any, depth: number) → any
| arg | type | description |
|---|
| d | any | |
| depth | number | |
encode(pattern: string, o: any, x: number, y: number, z: number, angle: number) → any
| arg | type | description |
|---|
| pattern | string | |
| o | any | |
| x | number | |
| y | number | |
| z | number | |
| angle | number | |
decodeAndFire(ev: any, source: any) → number
| arg | type | description |
|---|
| ev | any | |
| source | any | |
fireSynced(pattern: string, opts: any?) → number
Fire a volley on EVERY peer: this peer (the authority, e.g. the host that owns the enemy) sends { pattern, origin, angle, seed, t, numeric opts, hit-handler name, target-set name, look, data, homeOn } with multiplayer.send on the "bulletPatternsKit.fire" channel and fires it locally too; every peer fires the identical deterministic volley and hit-tests its own `targetSet` (default "localPlayers"). Functions are never sent: register handlers (BP.onHit) and target sets (BP.setTargets) by name on every peer. Returns the shot count.
| arg | type | description |
|---|
| pattern | string | |
| opts | any? | |
encodeVolley(pattern: string, opts: any?) → any
The event fireSynced would send, without sending or firing it (for tests and custom transports). Fire it anywhere with BP.fireEvent(ev).
| arg | type | description |
|---|
| pattern | string | |
| opts | any? | |
fireEvent(ev: any, source: any?) → number
Fire a volley from an event made by encodeVolley or received on the channel. Returns the shot count.
| arg | type | description |
|---|
| ev | any | |
| source | any? | |
stop(self: any) → void
| arg | type | description |
|---|
| self | any | |
emitter(spec: any) → any
Start an emitter: spec = { pattern, from (entity, position or function returning one), aim (optional function returning an angle or a position), every (s between volleys, 0.5), volleys (count, nil = forever), rotate (radians added per volley), delay (s before the first volley, 0), synced (true = each volley via fireSynced), plus any fire opts (angle, aimAt, count, speed, look, hit, targets, targetSet, pierce, homing, data...) }. The first volley fires on the next step. Each volley's `t` is the emitter's age (unless spec.t) and its seed spec.seed + volley index. Returns a handle: handle:stop(), handle.alive, handle.fired.
| arg | type | description |
|---|
| spec | any | |
emitterSynced(spec: any) → any
An emitter whose every volley is fired on every peer (BP.fireSynced). Run it on the authority only.
| arg | type | description |
|---|
| spec | any | |
step(dt: number, alsoProjectiles: boolean?) → void
Advance emitters and delayed shots by dt. The kit's Runner calls it every frame in play; tests call it by hand. `alsoProjectiles = true` steps projectileKit too (PK.step), for tests with no runner.
| arg | type | description |
|---|
| dt | number | |
| alsoProjectiles | boolean? | |
stats( ) → any
Live counts: shots (BP shots in flight), pending (delayed shots waiting), emitters, and totals volleys, fired (shots launched), hits, syncedSent, syncedReceived.
clear( ) → void
Stop every emitter, drop delayed shots and end every BP shot in flight (no hit handlers fire). Other projectileKit shots are left alone.
resetStats( ) → void
Reset the totals in stats().