gunplay
Paint in the air and what it does when it lands: Wren's shots, the Wardens'
gunplay
Paint in the air and what it does when it lands: Wren's shots, the Wardens'
greywash coming back, cover on everything paintable, and the marks left behind. WORLD state, shared by every
player: one sky of projectiles, one cover tracker, one splat store, one field of timed effects.
It joins paintKit's arms / ballistics / impact / cover / splats to the game: who fired a shot (so the offence
goes to the right player), which hits are solvent on a painter (so the right player's colour is washed), and
the moments the rest of the game and the host care about, on the hub.
local Gunplay = require("metropolisGame.logic.gunplay")
local g = Gunplay.new({ paintCfg = cfg, query = physicsQuery, hub = hub })
g.cover g.splats g.field g.air -- paintKit stores (drawn by the host through fx)
local r = g:fire("p1", arms, { origin, dir, mount, owner = actorId }) -- paintKit arms:fire's result; the shots fly
g:hostile({ by, arm, from, at, wash, speed, gravity, range, radius, splash }) -- a pursuer's shot (pursuitKit firefight)
local out = g:step(dt, { [actorId] = playerId }) -- fly everything; resolve what landed
-- out = { { type = "paint", player, report }, paintKit impact's report for a player's shot (cover, offences ...)
-- { type = "washed", player, amount, by }, solvent hit a painter
-- { type = "stripped", x, z, removed } } solvent on a surface took marks off it
g:tick(dt) -- cover wipes and returns, effects run out, marks fade
g:effectOn(id, "slow") g:slickAt(x, z) -- queries the host's movers ask each tick
g:serialise() g:restore(data) -- world splats, persistent cover (lenses, relays), effects
Hub events: "shotsFired" { player, arm, pigment, n, loudness, heard, x, z }, "shotLaunched" { shot } (every
projectile, with its id, start, velocity, gravity and range: enough to replay its flight), "shotEnded" { id, hit }
(hit nil when it was spent), "paintLanded" { player, report },
"coverEffect" { id, kind, part, effect, seconds, by }, "paintedOut" { id, kind, seconds, by }, "coverBack" { id, kind },
"hostileShot" { by, arm, from, at }, "washed" { player, amount, by }, "effectEnded" { id, effect }.
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/v2metropolisGame.logic.gunplay — paint in the air and what it does when it lands: Wren's shots, the Wardens' greywash coming back, cover on everything paintable, and the marks left behind. WORLD state, shared by every player: one sky of projectiles, one cover tracker, one splat store, one field of timed effects. It joins paintKit's arms / ballistics / impact / cover / splats to the game: who fired a shot (so the offence goes to the right player), which hits are solvent on a painter (so the right player's colour is washed), and the moments the rest of the game and the host care about, on the hub. local Gunplay = require("metropolisGame.logic.gunplay") local g = Gunplay.new({ paintCfg = cfg, query = physicsQuery, hub = hub }) g.cover g.splats g.field g.air -- paintKit stores (drawn by the host through fx) local r = g:fire("p1", arms, { origin, dir, mount, owner = actorId }) -- paintKit arms:fire's result; the shots fly g:hostile({ by, arm, from, at, wash, speed, gravity, range, radius, splash }) -- a pursuer's shot (pursuitKit firefight) local out = g:step(dt, { [actorId] = playerId }) -- fly everything; resolve what landed -- out = { { type = "paint", player, report }, paintKit impact's report for a player's shot (cover, offences ...) -- { type = "washed", player, amount, by }, solvent hit a painter -- { type = "stripped", x, z, removed } } solvent on a surface took marks off it g:tick(dt) -- cover wipes and returns, effects run out, marks fade g:effectOn(id, "slow") g:slickAt(x, z) -- queries the host's movers ask each tick g:serialise() g:restore(data) -- world splats, persistent cover (lenses, relays), effects Hub events: "shotsFired" { player, arm, pigment, n, loudness, heard, x, z }, "shotLaunched" { shot } (every projectile, with its id, start, velocity, gravity and range: enough to replay its flight), "shotEnded" { id, hit } (hit nil when it was spent), "paintLanded" { player, report }, "coverEffect" { id, kind, part, effect, seconds, by }, "paintedOut" { id, kind, seconds, by }, "coverBack" { id, kind }, "hostileShot" { by, arm, from, at }, "washed" { player, amount, by }, "effectEnded" { id, effect }.
new(o: any) → any
| arg | type | description |
|---|---|---|
| o | any |
emit(self: any, name: string, payload: any) → void
| arg | type | description |
|---|---|---|
| self | any | |
| name | string | |
| payload | any |
announce(self: any, player: string?, report: any) → void
| arg | type | description |
|---|---|---|
| self | any | |
| player | string? | |
| report | any |
fire(player: string, arms: any, aim: any) → any
A player fires the arm that is up. `aim.owner` is the firing actor (never hit by its own shots).
| arg | type | description |
|---|---|---|
| player | string | |
| arms | any | |
| aim | any |
hostile(e: any) → void
A pursuer's solvent shot (as pursuitKit's firefight makes it) takes to the air.
| arg | type | description |
|---|---|---|
| e | any |
step(dt: number, painters: any?) → void
Fly everything for dt and resolve what landed. `painters` maps an actor id to the player it is.
| arg | type | description |
|---|---|---|
| dt | number | |
| painters | any? |
tick(dt: number) → void
Cover wipes and returns, timed effects run out, fading marks age.
| arg | type | description |
|---|---|---|
| dt | number |
effectOn(id: string, effect: string) → void
Whether a thing is under a timed effect ("slow", "mark", "blind" ...), and for how long.
| arg | type | description |
|---|---|---|
| id | string | |
| effect | string |
slickAt(x: number, z: number) → string
The id of a slick covering a point of road, or nil.
| arg | type | description |
|---|---|---|
| x | number | |
| z | number |
serialise( ) → any
restore(data: any) → void
| arg | type | description |
|---|---|---|
| data | any |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ 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".
Scoped to this part · feeds back into the world's score.