heistKit
Version 1.1.3.** Light Fingers: the loot half of a heist game for any multiplayer Zero world. 23 kinds of valuable modelled in code as original art, each with a value, a weight and a label; eight ways each one is kept (out in the open, a locked display case with a lock-picking mi…
heistKit
Version 1.1.3. Light Fingers: the loot half of a heist game for any multiplayer Zero world. 23 kinds of valuable modelled in code as original art, each with a value, a weight and a label; eight ways each one is kept (out in the open, a locked display case with a lock-picking minigame, a wall safe with a dial you turn and listen to, a painting cut from its frame, a key-locked drawer or chest, a pressure-plate pedestal you swap a sandbag onto, a hidden panel); four rules (steal everything listed, reach a value quota, grab one and run before the alarm countdown ends, take any N of the listed pieces); five escapes that unlock when the rule is met (front door, cellar hatch, window and rope, servants' gate, a waiting carriage); six looks for the per-player loot list (ledger, pocket notebook, pinned polaroids, minimal, luggage tags, blueprint); and four things that happen when a player is caught (knocked out and waking at the floor's checkpoint, game over, back to the start with the loot returned, or left to the game), each of which calms the guards and gives the woken player a few seconds' grace. Every choice is one field. Minigames are played with the one interact button on keyboard, gamepad and touch, can be walked away from, and every slip, dial click and cut is a noise aiKit's guards and monsters hear. Heavy loot slows its carrier and makes their steps louder. Every word a player reads is in English and Brazilian Portuguese, following the player's language. Every player sees the same loot taken and the same progress; late joiners too. A walkable gallery scene (heistKit.Gallery) shows all of it.
Install: search ZeroMind for heistKit or run zero zeromind installAsset <heistKit package guid> in the engine shell. It brings interactKit 1.6.8 (prompts), aiKit 1.4.0 (noise), navUiKit 1.3.15 (waypoints, toasts) and juiceKit 1.2.12 (alarm shake).
First example
In a scene's build.luau, inside content(), with a player already set up:
local Heist = require("heistKit.api")
Heist.setup({ rules = "stealAll", hud = "ledger", title = "The Wrenmoor Job" })
Heist.addLoot({ kind = "pocketWatch", access = "open", position = { 2, 0, 4 } })
Heist.addLoot({ kind = "necklace", access = "safe", position = { -3, 0, 8 }, yaw = 180 })
Heist.addLoot({ kind = "painting", access = "frame", position = { 3, 0, 8 }, yaw = 180 })
Heist.addEscape({ kind = "servantsGate", position = { 0, 0, -10 } })
Press Play. The ledger in the top right lists the three pieces. Walk to the watch and press E (gamepad west button, the touch Interact button): it is struck off the list. At the safe, press E to start: hold to turn the dial, let go on the heavy click, three times. At the painting, hold E to cut the canvas from its frame. When all three are taken the gate's lamp turns green and a ring appears; walk into it to escape.
Every entity these calls make (the director, each piece, key, sandbag and escape) is spawned synced (entity.spawnSynced) in a build too, so the scene records it as shared and every player in a session sees the same heist. Any of these calls also works from a script in play: there it spawns shared entities on the room host (and does nothing on other peers, whose copies arrive from the host). The components heistKit.HeistDirector, heistKit.Loot and heistKit.Escape carry the same fields for building in the editor without code.
Loot kinds (kind)
| kind | label | value | weight kg |
|---|---|---|---|
pocketWatch | Gold Pocket Watch | 1,200 | 0.2 |
necklace | Jewelled Necklace | 9,500 | 0.4 |
tiara | Diamond Tiara | 14,000 | 0.5 |
signetRing | Signet Ring | 2,200 | 0.1 |
jewelledEgg | Jewelled Egg (an original enamel-and-gold design) | 22,000 | 0.9 |
goldIdol | Gold Idol | 16,000 | 6 (heavy) |
candelabra | Silver Candelabra | 3,400 | 4.5 (heavy) |
chessSet | Ivory Chess Set | 4,800 | 3 |
rareBook | Rare Book | 6,500 | 1.6 |
sealedLetters | Sealed Letters (and the deed) | 5,000 | 0.3 |
painting | Oil Painting | 18,000 | 2.5 |
miniature | Miniature Portrait | 3,800 | 0.2 |
musicBox | Music Box | 2,600 | 1.2 |
decanter | Crystal Decanter | 1,800 | 1.8 |
coinPurse | Coin Purse | 900 | 0.6 |
ruby | The Wrenmoor Ruby | 30,000 | 0.1 |
mantelClock | Mantel Clock | 2,900 | 5 (heavy) |
jadeFigurine | Jade Figurine | 7,200 | 1.4 |
astrolabe | Brass Astrolabe | 8,800 | 2.2 |
pistolCase | Dueling Pistols | 6,000 | 3.5 |
porcelainVase | Porcelain Vase | 12,500 | 4 (heavy) |
cameoBrooch | Cameo Brooch | 2,400 | 0.1 |
silverTeapot | Silver Teapot | 2,100 | 1.5 |
Loot of 4 kg or more is heavy: its carrier walks slower (down to 55%) and clanks (a noise every step of the way). value, weight and label override the kind's own on any piece.
Access methods (access)
| access | how it opens | noise |
|---|---|---|
open | On a marble pedestal; walk up and take it. surface = "none" puts it on your own furniture. | none |
displayCase | Locked glass case. Lock-picking minigame: press Interact while the pick sits in the gold mark; 3 to 5 pins. A miss loses a pin and rattles the case. minigame = false: hold to rake the pins (louder). | 5 m per slip |
safe | Wall safe with a dial. Hold Interact to turn, let go on the heavy clunk; 2 to 4 numbers. Every few ticks of the dial are heard nearby. minigame = false: hold to work it by ear. | 2 m per click |
frame | Painting in a gilt frame on the wall. Hold Interact to cut the canvas out; progress is kept while you stay. Leaves the empty frame with cut edges. | 3 m a second |
keyDrawer | Writing desk with a locked drawer. Needs a key (Heist.addKey), any key or the one with the same keyId. The drawer slides out with the loot in it. | none |
keyChest | Iron-banded chest, key-locked as above. | none |
pressurePlate | Marble plinth with a brass plate. Carry a sandbag (Heist.addSandbag) and it is swapped silently; lift it bare and the alarm bell rings (a loud noise, the director's alarm). | 24 m alarm |
hiddenPanel | Wall panelling; only close up (1.5 m) does a prompt appear. Hold to feel for the catch and slide the panel aside. | 2 m |
difficulty (easy, normal, hard) sets pins, numbers and seconds. noiseScale multiplies every noise a piece makes. Locked pieces open first and are taken with a second press, so one player can crack the safe while another keeps watch and grabs it.
Rules (rules) and options on the director
| field | values | what it does |
|---|---|---|
rules | stealAll (default) | Every listed piece must be taken. |
quota | Take loot until its value reaches quota (0: half of everything on offer). | |
grabAndRun | The first piece taken rings the alarm and starts a countdown (timer, default 90 s); the escapes open at once. With quota set, the escapes open at the quota instead. | |
takeAny | Take any take of the listed pieces, whichever the crew likes (take = 0: half of them, rounded up). | |
take | number, 0 | takeAny's N. |
items | listed / any | Which pieces count and are shown: only listed = true ones (unlisted loot is a bonus), or every piece. |
timer | seconds | grabAndRun's countdown; for the other rules a limit on the whole heist (0 = none). Running out fails the heist. |
hud | ledger, pocketNotebook, polaroids, minimal, tags, blueprint, none | The loot list look, the same for every player, drawn per player. |
title | text | The heading of the list (left at "The Job", it reads in the player's language). |
caught | knockout (default), gameOver, jail, none | What Heist.caught(player, by) does; see When a player is caught. |
caughtLoot | drop (default), return, keep | knockout: what they carried lies where they fell, goes back to its place, or stays carried. jail always returns it. |
grace | 4 | Seconds after a knockout or jail in which no guard sees the woken player (aiKit setConcealed) and no second catch lands. |
calmGuards | true | A catch (and Heist.reset) calms the guards. |
guardsReturn | teleport (default), walk | Calmed guards are put back at their posts at once, or forget and walk their routes back. |
guards | prefix, list or function | Which aiKit brains count as guards: a name prefix ("Watchman_"), or (in Heist.setup) a list or a function answering one. Default: every brain not on a player-friendly team. |
checkpoints | points or function | Where a knocked-out player wakes: the point on their floor (nearest in height, then distance). Heist.setup takes a point or a list of points (vectors, {x,y,z}, { x =, y =, z = }, entities, entity ids or names), or fn(player, fellAt) -> point or list of any of those. |
start | points or function | jail: where the caught player is sent, the point on their floor (nearest in height, then distance); a point, a list or fn(player) -> point or list, read as checkpoints is. Default where they first stood in play. |
dropOnKnockout | false | On: a player who goes down (SecondWind, when the game has it) drops what they carry. Off: loot stays stolen once taken. |
heavySlows | true | Heavy loot slows its carrier and makes them noisy. |
tracker | true | Waypoints and toasts through navUiKit. |
Escapes (Heist.addEscape / heistKit.Escape)
| kind | what it is | default radius |
|---|---|---|
frontDoor | Grand double door with a fanlight and steps | 2.5 |
cellarHatch | Stone surround with double cellar doors | 2.2 |
windowRope | Tall sash window; a rope hangs out when open | 2.0 |
servantsGate | Iron gate between brick pillars | 2.5 |
carriage | A waiting carriage, door swinging open | 3.0 |
Each has a red lamp while shut and a solid door or gate (collider) where it has one; once the rule is met it opens, the lamp turns green, a ring shows the zone, and navUiKit marks it. requireAll = true: every player must stand in the ring together (players inside are told how many of the crew are there). Otherwise any player reaching it wins for the whole crew. radius and label override.
Loot list looks (hud)
| look | what it looks like |
|---|---|
ledger | A handwritten paper list with values; taken items are struck through in ink. |
pocketNotebook | A small ruled notebook with a leather spine; pencil ticks in boxes. |
polaroids | Pinned instant photos of every piece on a cork board, crossed out in red. |
minimal | Corner text, nothing else. |
tags | Brown luggage tags on string, stamped TAKEN. |
blueprint | The house plans on cyanotype paper with a drafting grid: each piece a numbered white-ink mark, ringed in red chalk once taken. |
Every look sits top right inside the safe area, moves down past any on-screen control a game states there (ui.safeArea().controls), shows the rule's progress line, the countdown when there is one, and how much the player carries. The list sizes itself to the room the safe area leaves it: the panel is never wider than the screen, every label wraps inside it (prices and stamps keep their own width), the scale comes down on narrow or short screens and when a long list would run past the bottom, and the countdown moves into the band left of the list when centred it would touch it. Heist.hudTree(style?) and require("heistKit.hud").build(d, st, canvas) lay the list out for another screen size.
When a player is caught (caught)
Your guards, traps or dogs decide when someone is caught; heistKit decides what happens. Call Heist.caught(player, by) from any peer (the director's owner applies it):
| consequence | what happens |
|---|---|
knockout | Knocked out: a black-out on their screen, then they come to at the nearest checkpoints point on the floor they were caught on. What they carried drops where they fell (caughtLoot = "drop"), goes back to its place ("return") or stays carried ("keep"). |
gameOver | The run ends for the crew: the heist fails with reason "caught", the failed event your defeat screen listens for. |
jail | Sent back to the start (start, else where they first stood); every piece they carried goes back to its place. |
none | Only the caught event; your game does the rest. |
A knockout and jail calm the house, so the guards do not stand on the wake-up spot and catch the player again: every guard forgets (aiKit AI.forget), concealKit's guard reactions are cleared and its guards put back at their posts (Hide.resetGuards, with navKit's warp) when concealKit is installed, stealthKit's area alert is reset when stealthKit is installed, each guard goes back to the post and route it had when the heist began (taken once per guard in play) and the woken player has grace seconds the guards cannot see them, during which another catch is ignored. Heist.reset() calms the guards the same way, so a Retry starts a quiet night. aiKit, concealKit, stealthKit and navKit stay optional: heistKit finds them with pcall(require).
Heist.setup({ caught = "knockout", caughtLoot = "drop", grace = 4, guards = "Watchman_",
checkpoints = function(player, fellAt) return Manor.anchors("checkpoint", Manor.floorAt(fellAt)) end }) -- Manor = require("manorKit.api")
-- in your guard logic, on the host:
Heist.caught(playerBody, guardEntity)
Heist.on("caught", function(ev) print(ev.consequence, ev.at, #ev.loot) end)
Languages
Every prompt ("Crack the safe" / "Abrir o cofre"), the loot list, the minigames, banners and toasts, loot and escape names, are read from heistKit.package/locales/<tag>/heistkit.json (en, pt-BR) in the language the player reads (i18n.textLocale(): their own choice, their ZeroMind language, their device), and change when they change it. A world changes any word by stating the same key in its own /zero/source/locales/<tag>/heistkit.json, or adds a language the same way. A label you give a piece is shown as written.
API
local Heist = require("heistKit.api")
| call | does |
|---|---|
Heist.VERSION | "1.1.3" |
Heist.setup(opts) | { rules, hud, take, quota, timer, items, title, dropOnKnockout, heavySlows, tracker, caught, caughtLoot, grace, calmGuards, guardsReturn, guards, checkpoints, start }. Makes the HeistDirector if there is none; sets its fields (functions given for guards, checkpoints and start stay on the peer that called it: call setup from game code on every peer). Returns its entity. |
Heist.addLoot(opts) | { kind, access = "open", position, yaw = 0, label, listed = true, value, weight, difficulty, minigame, keyId, consumeKey, surface, noiseScale, name }. Returns the entity. Errors on an unknown kind or access. |
Heist.addKey(opts) | { position, keyId = "", label, name }: a key players pick up with Interact. |
Heist.addSandbag(opts) | { position, name }: a sandbag for pressure plates. |
Heist.addEscape(opts) | { kind = "frontDoor", position, yaw = 0, radius, requireAll = false, label, name }. |
Heist.on(name, fn) | On every peer. Names: taken, dropped, opened, ruleMet, ruleLost, escaped, failed, caught, alarm, reset, toolTaken, plateSwapped, minigameOpened, minigameClosed, heistNoise, or "*" (fn(name, ev)). Returns an unsubscribe function. taken carries { loot, kind, label, value, weight, listed, access, by, peer }; escaped { via, value, count, time }; failed { reason }; caught { player, by, consequence, at, fellAt, loot, lootMode, grace }. |
Heist.state() | { phase, rules, hud, items, take, takeNeed, caught, caughtLoot, grace, value, count, listedTaken, listedTotal, totalValue, quota, timeLeft, alarm, escapedVia, failReason, elapsed, title, loot = {...}, escapes = {...} }, the same on every peer. phase is active, ruleMet, escaped or failed. |
Heist.carried(player?) | What a player carries. |
Heist.caught(player, by?, opts?) | A player was caught (from any peer); the director's caught decides what happens. opts.at overrides where they come to. Ignored during their grace. |
Heist.inGrace(player), Heist.graceLeft(player) | Whether a caught player is still in their grace, and the seconds left. |
Heist.calmGuards() | Calm every guard now, as a catch does, for a game's own restart. |
Heist.dropCarried(player, reason?) | Drops everything a player carries where they stand; anyone can pick it up again. |
Heist.reset() | Everything back as it started, for everyone; grace cleared and the guards calmed and sent home. |
Heist.fail(reason?) | Ends the heist as failed (all players caught). |
Heist.setHud(style) | Switch the list look for everyone. |
Heist.lootKinds(), accessKinds(), ruleKinds(), escapeKinds(), hudStyles(), caughtKinds(), toolKinds() | The lists above. |
Heist.info(family, kind) | The data behind one kind ("loot", "tool", "access", "rule", "escape", "hud", "caught"). |
Heist.hudTree(style?) | The loot list's widget tree, for menus and previews. |
require("heistKit.thumbs").of(kind) answers the texture guid of a loot kind's photo (an image widget's src), for a game's own menus.
Multiplayer
The same pattern as stealthKit's single-prize Heist, generalised to many pieces. Every shared fact is a synced field written by one peer, the entity's owner (the room host for scene objects): a piece's state (locked, open, taken, dropped), who carries it, who is working its lock (picker), the director's phase, totals and clock, and each escape's open. Players ask through interactKit's prompt (reach-checked by the owner) and heistKit's command channel (heistKit:cmd); events go to every peer on heistKit:evt. A lock is claimed by one player at a time ("Someone is working on it" for the rest) and the claim lapses if that player goes quiet. Late joiners read the fields and see the case open and the frame empty.
Every heist entity is synced: Heist.setup, addLoot, addKey, addSandbag and addEscape use entity.spawnSynced in a scene build as well as in play, so a built scene saves and reloads them as shared entities (keeping their ids), the room creator spawns them at play and joiners receive the same ones. Only the purely visual parts the components draw under them (baked art, lamps, the ring, escape blockers) are local, temporary and rebuilt on every peer. A heist entity placed by hand in the editor should be made synced too.
Who decides (require("heistKit.core").isAuthority(entity)): offline, this peer; an unsynced (local) entity, this peer, and in a connected session heistKit warns once per entity, since it means the entity was spawned with entity.spawn and every player has a heist of their own; an entity with an owner, that owner (multiplayer.isOwner); an entity nobody owns (owner 0, every scene object), the room host only. The owner is read before multiplayer.isOwner is asked, because for owner 0 the engine answers isOwner true on every peer. A peer that does not decide never writes the shared fields: a prompt use (lock claim, take, key unlock, sandbag swap) is sent to the host as heistUse even when interactKit runs it on the asking peer, and the minigame's success (heistSolve), keep-alive, walk-away, drops (heistDrop), escapes (heistEscape), fail and reset go through heistKit:cmd; the host applies them for the asking peer and everyone reads the result. Tests set core.probe = { play, isConnected, isHost, synced, owner, isOwner } to play another peer.
Art
Every piece of art (23 loot kinds, the key and sandbag, the eight access props with their moving parts, five escapes, lamps and the ring) is modelled with quick geometry in Art.sceneModule and baked by require("heistKit.bake").run() into artData, which every peer spawns as a Generator at runtime, so the art is the same in the editor, in play and in a published game. Edit Art.sceneModule, then run the bake. art/thumbs holds a photo of each loot kind.
Guides
heistKit(the kit's own guide: how to use it, start to finish)how-to-add-a-heist-with-loot-safes-and-an-escape-to-my-gameexample-build-a-small-haunted-heist-level-with-manorKit-heistKit-and-hauntKit
Open them in the Docs panel or with man <name>.
Gallery
heistKit.Gallery is a walkable scene in the package: every loot kind labelled on its pedestal, the eight access methods along the back wall, the five escapes, six floor plates that switch the loot list to each look and three rings that catch you with each consequence. layers.load("heistKit.Gallery"), then Play.
Tests
zero tests run heistKitTests in edit mode.
Known limits
- The minigame and the HUD read the default input map's
interact; a game that rebinds Interact elsewhere should keep that action. - Heavy-loot slowing scales the carrier's
CharacterController.moveSpeed; a game with its own movement controller readsHeist.carried()and slows the player itself. dropOnKnockoutuses SecondWind when the game has it; other games callHeist.caught(player)withcaught = "knockout".guardsReturn = "teleport"moves a walking guard's navigation agent with navKit'swarpwhen navKit is installed; another navigation package needsguardsReturn = "walk"or its own warp.
Changes
-
1.1.3: the loot list fits its panel in every look. Labels were single-line in fixed-width panels, so a long name ("Sealed Letters (and the deed)") or the carrying line pushed prices and text past the paper, and on a phone the centred countdown sat on top of the list. Every look now takes its width from the room the safe area leaves (
hud.placement), wraps every label inside the panel (prices, ticks, marks and the TAKEN stamp keep their own width), shrinks its scale to the screen's height when the list is long, and the list holder clips at the safe area as a last guard; the countdown moves left of the list when it would touch it. A test lays out the longest list (eight long labels, progress line, countdown, carried line) in all six looks at 390x844, 1280x720 and 844x390 and checks every widget is inside its panel and the panel inside the screen. The worked example guide is renamed for the kits it uses, manorKit and hauntKit (formerly mansionKit and ghostKit), with its calls checked against manorKit 1.1.1 and hauntKit 1.1.1 (Manor.build({ plan = "cottage" }), anchors read bypos, theghostLairanchor,Haunt.spawn("widow", at)). -
1.1.1 (issue #5):
checkpointsandstartread a single point or a list of points of any kind (vectors,{x,y,z},{ x =, y =, z = }, entities, entity ids or names), inHeist.setupand from a function. Acheckpointsfunction answering a list of vectors failed the catch (invalid argument #1 to 'create' (number expected, got vector)): the point reader took any list for an{x,y,z}triple. A table whose first entry is not a number is now a list, never a triple. Jail sends a player to thestartpoint on their floor (nearest in height, then distance), as a knockout picks the checkpoint. Acheckpointsorstartfunction that errors is warned, not silent. -
1.1.0 (issue #4): a fourth rule,
takeAny(anytakeof the listed pieces); a sixth loot-list look,blueprint; 'when caught' consequences in the kit (caught = knockout | gameOver | jail | none,Heist.caught(player, by), thecaughtevent,checkpoints,start,caughtLoot,grace). Fixes the knock-out loop a game hit: after a guard knocked a player out and they woke at the stairs checkpoint, every floor's watchman gathered at the wake spot and knocked them out again, Retry included. A catch (andHeist.reset) now calms the house: aiKit forget, concealKitresetGuards, stealthKit alert reset, each guard back to its own post and route, and a grace period no guard sees through. Every player-facing word in English and Brazilian Portuguese from the package's catalogs. A walkable gallery scene in the package, theheistKitguide, aGalleryLabelcomponent; the README's API table states the version it ships. -
1.0.4: per-frame cost (issue #3). The director rebuilt the loot list's change signature every frame (a table of strings for every loot, sorted and joined, plus a screen-size query), recounted every loot and wrote its synced totals and clock every frame, and listed what the local player carries into a new table every frame; in a web client (interpreted Luau) that was about 5 ms of script per frame for one director. Now every Loot bumps a shared revision when its state, carrier, alarm, listed, value, weight, kind or label changes (or it comes or goes); the director recounts only on that, on an items/quota change and twice a second as a safety net; the loot list redraws only when something it shows changes (the revision, a total, the phase, the timer's shown second, the carried weight's shown tenth, a banner, a flash) and polls the screen size four times a second; synced fields are written only when their value moves, and the clock reaches its synced fields when its shown second ticks over, four times a second and before every event. Loot and Escape no longer join strings or re-pose settled doors and cases every frame, Escape asks who decides four times a second and requires navUiKit only when its waypoint changes. Measured in the kit world's demo scene (native, 34 loot, 5 escapes, ledger look), script per frame: HeistDirector 0.28-0.49 ms to 0.05 ms with no allocation and no HUD rebuild in 600 idle frames, Loot x34 0.68 ms to 0.34 ms, Escape x5 0.25 ms to 0.05 ms. Rules, quota, timer, events, HUD looks and co-op authority are unchanged. New
Hud.builds()and a test that an idle HUD is not rebuilt each frame. -
1.0.3: co-op fix (issue #2). Everything heistKit placed while a scene was being built (the director, loot, keys, sandbags, escapes) was spawned with plain
entity.spawn, so the scene recorded it as local: every peer loaded its own copy, each peer decided its own copy, and a painting a non-host player cut from its frame stayed locked for the host. Those entities are now always spawned withentity.spawnSynced(in a build as in play), so a rebuilt scene shares them. An unsynced heist entity in a connected session now logs one warning instead of being silently decided by every peer. New tests: setup, addLoot, addKey, addSandbag and addEscape in edit mode make synced entities; an unsynced entity in co-op warns once. Games that build their heist inbuild.luaupick the fix up on their next rebuild. -
1.0.2: co-op fix (issue #1). A piece of loot nobody owns (every scene object) was decided by every peer:
multiplayer.isOwneranswers true on every peer for an entity with owner 0, and heistKit asked it before reading the owner, so a player on a peer that is not the host took, unlocked or cut loot only on their own screen while the host and everyone else kept it locked. heistKit now reads the owner first: no owner means the room host decides, andmultiplayer.isOwneris asked only for an owned entity. A prompt use (lock claim, take, key unlock, sandbag swap) that interactKit runs on the asking peer is sent to the host asheistUse; minigame success, keep-alive, walk-away, drops, escapes, fail and reset go throughheistKit:cmdthe same way, and the host's result reaches every peer. New test: owner 0 on a non-host peer is not the authority and its use is forwarded. -
1.0.1: the generated art data module carries its README (1.0.0 shipped it with the placeholder). Nothing plays differently.
-
1.0.0: first release.
Scoped to this part · feeds back into the world's score.