❒
package · drop-in viewer
arenaHazardsKit
A storm ring that closes in and lanes that burn in turn, for arena shooters, twin-stick games, brawlers, battle royale rounds and wave survival.
by·posted 10d ago
What it does
Arena Hazards Kit
A storm ring that closes in and lanes that burn in turn, for arena shooters, twin-stick games, brawlers, battle royale rounds and wave survival.
local Hazards = require("arenaHazardsKit.api")
Hazards.configure({ health = require("SecondWind.api"), arena = "Arena" })
local settings = { shrinkFrom = 19, shrinkTo = 7, shrinkSeconds = 150, lanePeriod = 9, laneOn = 3, laneDamage = 12 }
function update(dt) -- on every peer
Hazards.step(dt, settings, myPlayerBody, roundIsPlaying)
end
What it does
- Storm ring. After
shrinkDelayseconds (20 by default) a ring of glowing markers around the arena centre closes fromshrinkFromtoshrinkTometres overshrinkSeconds. Standing outside costsshrinkDamage(10) everytick(0.7 s). - Burning lanes. The arena's lane strips (
Lane1..N, or any names you give) take turns: each slot oflanePeriod / laneCountseconds glows amber as a warning, then burns forlaneOnseconds. Standing in the burning lane costslaneDamageper second. - Multiplayer for free. Every peer runs
stepwith its own player; nobody sends anything, and everyone takes the same hazards on the same clock.
API
step(dt, settings, body, playing)runs one frame. The clock only moves whileplayingis true.radiusAt(settings, t)andlaneAt(settings, t)are pure: the ring radius, and which lane burns (and whether it is still warning), at any time.outside(settings, pos)says whether a position is in the storm now;time()reads the clock;reset()clears the clock and the markers.configure(config)sets:health(a SecondWind-style module withdamageandisAlive), ordamage = fn(body, amount, label, kind);arena(entity name or fn returning the centre);lanePrefixes(laneiis the first entity namedprefix .. i);laneVisual;markerPrefix,markerMaterial,ringSegments;shrinkDelay,shrinkDamage,tick;team,stormLabel,laneLabel;onEnter(kind, body).new(config)makes an independent runner with its own clock, for a second arena.settingsFromPlan(plan)turns an arenaLayoutKit plan'sshrinkandlanesinto settings.
Damage is handed in rather than looked up, so the package works in any world: give it SecondWind with configure({ health = require("SecondWind.api") }), or any function. Without either, hazards still draw and time but warn once and hurt nobody.
The test suite arenaHazardsKit covers the timing, the runners, the storm and lane damage.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.