Log inGet started
Package

gunplay.module

README.md

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.