core
One-paragraph description of what this module provides and who consumes it.
core
One-paragraph description of what this module provides and who consumes it.
Exports
M.exampleFn(arg) -> result— what it does and when to call it.M.exampleValue: type— what value it carries.
Usage
local M = require("@<youridentity>::modules.core")
M.exampleFn("foo")
Notes
- Anything callers need to know about THIS module: required runtime ordering, state ownership, side effects.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2game.core — the shared ground every slice of Verdigris Cloister stands on. Constants, the grid<->world mapping, the shared board state, and the signal bus. Owned by the plan phase. EVERY slice reads it; no slice rewrites it. One thing that trips everyone once: components and modules share a single require registry, so they all see the SAME `M.state()`. An `execute` call gets its OWN registry and therefore its own empty copy. To read the real board from `execute`, go through the Director component's `snapshot()`.
monk(id: string) → any
--!desc Look up a monk record by id. --!arg id The monk id — "anselm", "meridia", "cassian" or "vespera". --!return The monk record, or nil if there is no such monk. --!example local a = Core.monk("anselm")
| arg | type | description |
|---|---|---|
| id | string |
cellCenter(x: number, y: number, elev: number?) → void
THE mapping. Every slice that puts anything on the board goes through these. Tile (1,1) is the near-left corner; x runs 1..GRID_W to the right, y runs 1..GRID_H away from the camera. The board is centred on the origin. --!desc World-space centre of a tile, at the given elevation step. --!arg x Tile column, 1..GRID_W. --!arg y Tile row, 1..GRID_H. --!arg elev Elevation in whole steps (default 0). --!return A {x, y, z} world position table. --!example local p = Core.cellCenter(4, 6, 1)
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| elev | number? |
cellAt(wx: number, wz: number) → void
--!desc Turn a world position back into the tile that contains it. --!arg wx World x. --!arg wz World z. --!return Two numbers: the tile column and row. They may fall outside the board. --!example local tx, ty = Core.cellAt(3.0, -1.0)
| arg | type | description |
|---|---|---|
| wx | number | |
| wz | number |
inBounds(x: number, y: number) → boolean
--!desc Whether a tile coordinate is on the board. --!arg x Tile column. --!arg y Tile row. --!return true when the tile exists. --!example if Core.inBounds(x, y) then ... end
| arg | type | description |
|---|---|---|
| x | number | |
| y | number |
key(x: number, y: number) → string
--!desc The key a tile is stored under in state.tiles. --!arg x Tile column. --!arg y Tile row. --!return The string key, "x,y". --!example local t = Core.state().tiles[Core.key(3, 4)]
| arg | type | description |
|---|---|---|
| x | number | |
| y | number |
neighbours(x: number, y: number) → void
--!desc The four orthogonal neighbours of a tile that are on the board. --!arg x Tile column. --!arg y Tile row. --!return An array of {x, y} tables. --!example for _, n in ipairs(Core.neighbours(2, 2)) do ... end
| arg | type | description |
|---|---|---|
| x | number | |
| y | number |
dist(ax: number, ay: number, bx: number, by: number) → number
--!desc Manhattan distance between two tiles — the board's distance metric. --!arg ax First tile column. --!arg ay First tile row. --!arg bx Second tile column. --!arg by Second tile row. --!return The number of orthogonal steps between them. --!example local d = Core.dist(1, 1, 4, 5)
| arg | type | description |
|---|---|---|
| ax | number | |
| ay | number | |
| bx | number | |
| by | number |
state( ) → any
--!desc The single shared board table. Created empty on first call. --!return The live state table. --!example local s = Core.state()
blankState( ) → any
--!desc A fresh, empty board — every tile present, nothing on it. --!return A new state table, not installed. --!example local s = Core.blankState()
resetState( ) → any
--!desc Replace the shared board with a fresh one and return it. --!return The new live state table. --!example Core.resetState()
tile(x: number, y: number) → any
--!desc Read one tile out of the shared board. --!arg x Tile column. --!arg y Tile row. --!return The tile table, or nil when off the board. --!example local t = Core.tile(3, 4)
| arg | type | description |
|---|---|---|
| x | number | |
| y | number |
on(name: string, fn: (any) → void
--!desc Subscribe to a signal. --!arg name The signal name, from Core.SIGNAL. --!arg fn Called with the signal's payload. --!return An unsubscribe function — call it to stop listening. --!example local off = Core.on(Core.SIGNAL.unitMoved, function(p) end)
| arg | type | description |
|---|---|---|
| name | string | |
| fn | (any |
emit(name: string, payload: any?) → void
--!desc Fire a signal at every listener. A listener that errors is logged --! and skipped so one broken slice cannot silence the others. --!arg name The signal name, from Core.SIGNAL. --!arg payload The table handed to each listener. --!example Core.emit(Core.SIGNAL.playSfx, { name = "ui_click" })
| arg | type | description |
|---|---|---|
| name | string | |
| payload | any? |
sfx(name: string, at: { number }?) → void
Nobody but the audio slice needs to know how a sound is made. --!desc Ask the audio slice for a sound effect by name. --!arg name The clip name the audio slice publishes. --!arg at Optional world position for a spatial one-shot. --!example Core.sfx("ui_click")
| arg | type | description |
|---|---|---|
| name | string | |
| at | { number }? |
bark(unit: string, event: string) → void
--!desc Ask a monk to say one of their lines. --!arg unit A monk id. --!arg event One of "move", "attack", "kill", "wound", "death". --!example Core.bark("vespera", "attack")
| arg | type | description |
|---|---|---|
| unit | string | |
| event | string |
director( ) → any
The `Director` COMPONENT is the referee. `Director` is also the name of the scene ANCHOR it sits under, and the two are not the same entity: the rules slice hosts the component on a `rules_referee` child. A slice that looks only on the anchor silently gets nil and falls back to a demo board, which reads as "the game is not wired up" rather than as a missing lookup. Everyone asks here instead. --!desc The live referee component, wherever it is hosted. --!return The Director component, or nil before the rules slice lands. --!example local D = Core.director(); if D then print(D:brief().round) end
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.