api
`local Gear = require("gearKit.api")`: the whole public surface of gearKit. Rolling (`roll`, `rollDrop`, `describe`, `isGear`), comparing (`compare`, `compareEquipped`, `equippedFor`, `card`), applying (`bind`, `autoBind`, `unbind`, `applyEquipment`, `refresh`, `totals`, `bonuses…
gearKit.api
local Gear = require("gearKit.api"): the whole public surface of gearKit. Rolling (roll, rollDrop, describe, isGear), comparing (compare, compareEquipped, equippedFor, card), applying (bind, autoBind, unbind, applyEquipment, refresh, totals, bonuses, attackDamage, rollHit), content (defineBase, defineAffix, defineTable, defineStat, defineTheme, catalogue), looks (setLook, setTheme) and the HUD (setup, toggleStats). The package README lists every signature.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
emit(event: string, ...: any) → void
| arg | type | description |
|---|---|---|
| event | string | |
| ... | any |
on(event: string, fn: (...any) → void
Listen on this engine: "applied" (entityId, bonuses, changed), "look" (name), "theme" (name), "stats" (open). Returns a function that stops listening.
| arg | type | description |
|---|---|---|
| event | string | |
| fn | (...any |
defineAkStats( ) → void
iconOf(itemId: string) → void
| arg | type | description |
|---|---|---|
| itemId | string |
describe(id: string) → any
Rebuild an item from its id: { id, base, name, rarity, level, slot, kind, stats, implicit, affixes = { { id, label, stat, value, mode } }, power, icon, ... }, or nil when the id is not gearKit gear.
| arg | type | description |
|---|---|---|
| id | string |
isGear(id: string?) → boolean
Is this item id gearKit gear?
| arg | type | description |
|---|---|---|
| id | string? |
resolver(id: string) → any
| arg | type | description |
|---|---|---|
| id | string |
roll(opts: any?) → string
Roll an item id: opts { base?, slot?, kind?, rarity?, level? (1..50), seed?, rarityWeights?, theme? }. Deterministic: the same opts and seed give the same id. Errors when nothing fits.
| arg | type | description |
|---|---|---|
| opts | any? |
rollDrop(opts: any?) → string
Roll a loot drop: opts { level, depth?, luck?, seed?, table?, theme? }. Returns an id, or nil for no drop.
| arg | type | description |
|---|---|---|
| opts | any? |
defineStat(name: string, raw: any) → any
Add or change a gear stat: { label, mode = "flat"|"percent", akStat?, akMode?, weight? }; an `akStat` abilitiesKit does not know is defined with `akDef`.
| arg | type | description |
|---|---|---|
| name | string | |
| raw | any |
compare(newId: string, oldId: string?) → any
Compare two items (old may be nil or not gear: an empty slot): { rows = { { stat, label, new, old, delta, better } }, powerDelta, verdict = "upgrade"|"downgrade"|"sidegrade" }.
| arg | type | description |
|---|---|---|
| newId | string | |
| oldId | string? |
equippedFor(slot: string, player: any?) → string
The item in an equipment slot of the local player (or `player`, a peer number or inventory entity), or nil.
| arg | type | description |
|---|---|---|
| slot | string | |
| player | any? |
compareEquipped(id: string, player: any?) → any
Compare an item against what the local player wears in that item's slot now.
| arg | type | description |
|---|---|---|
| id | string | |
| player | any? |
setLook(name: string) → boolean
Switch the card and stats panel look: fantasy, scifi, pixel, cartoon or minimal.
| arg | type | description |
|---|---|---|
| name | string |
look( ) → string return S
setTheme(name: string) → boolean
Switch the affix naming theme new rolls use: fantasy ("of the Bear", "Serrated") or scifi ("Mk II", "Overclocked"), or one added with defineTheme.
| arg | type | description |
|---|---|---|
| name | string |
theme( ) → string return S
card(id: string, opts: any?) → any
The comparison card for an item as a widget tree: opts { compareTo? (an id, or true for what is equipped in its slot), look?, width?, title?, hint?, id? }.
| arg | type | description |
|---|---|---|
| id | string | |
| opts | any? |
catalogue( ) → any
Everything a game can choose from: { bases, affixes, rarities, stats, looks, themes, tables, version }.
bonusesOf(equipment: { [string]: string }) → void
The summed stats of every gearKit item in an equipment map ({ [slot] = id }).
| arg | type | description |
|---|---|---|
| equipment | { [string]: string } |
bonuses(player: any?) → void
The summed gear bonuses the local player (or `player`) wears now: { [gearStat] = value }.
| arg | type | description |
|---|---|---|
| player | any? |
idOf(e: any) → string
| arg | type | description |
|---|---|---|
| e | any |
owns(id: string) → boolean
| arg | type | description |
|---|---|---|
| id | string |
clearMods(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
applyEquipment(e: any, equipment: { [string]: string }) → void
Put the stats of an equipment map ({ [slot] = id }) on an abilitiesKit character, replacing what gearKit put there before. Only the character's owner changes its stats. Returns (true, bonuses) or (false, why).
| arg | type | description |
|---|---|---|
| e | any | |
| equipment | { [string]: string } |
equipmentOf(b: any) → void
| arg | type | description |
|---|---|---|
| b | any |
signature(eq: { [string]: string }) → string
| arg | type | description |
|---|---|---|
| eq | { [string]: string } |
bind(e: any, opts: any?) → void
Bind an abilitiesKit character to the local player's equipment (attaching a Character, with no ability keys, if it has none). From then on, whenever the equipment changes, gearKit swaps its modifiers. opts: { equipment = fn() -> { [slot] = id } } to read another source (tests, NPCs). Returns true, or false and why.
| arg | type | description |
|---|---|---|
| e | any | |
| opts | any? |
unbind(e: any) → void
Stop applying gear to a character and take gearKit's modifiers off it.
| arg | type | description |
|---|---|---|
| e | any |
refresh(e: any?) → void
Re-apply the equipment of one bound character now (or every bound character).
| arg | type | description |
|---|---|---|
| e | any? |
bound( ) → void
The entity ids gearKit applies gear to on this engine.
localCharacter( ) → any
The local player's character entity (the avatar inventoryKit dresses), or nil.
autoBind(on: boolean?) → void
Bind the local player's character automatically as soon as it exists (and again after a respawn).
| arg | type | description |
|---|---|---|
| on | boolean? |
defaultEntity(e: any?) → string
| arg | type | description |
|---|---|---|
| e | any? |
totals(e: any?) → void
The abilitiesKit stats of a character (default: the local player's), with gear applied: { [akStat] = value } for every stat the stats panel lists. Without a character, the base values plus gear bonuses.
| arg | type | description |
|---|---|---|
| e | any? |
baseTotals(e: any?) → void
The base values (without gearKit's modifiers) of the stats panel's stats for a character.
| arg | type | description |
|---|---|---|
| e | any? |
attackDamage(e: any, base: number?) → number
Damage of one hit from a character: (base + weaponDamage) x abilitiesKit's damage multiplier.
| arg | type | description |
|---|---|---|
| e | any | |
| base | number? |
rollHit(e: any, base: number?, rng: Random?) → void
Roll one hit: attackDamage, critical with critChance percent for critDamage percent. Returns (amount, crit).
| arg | type | description |
|---|---|---|
| e | any | |
| base | number? | |
| rng | Random? |
setup(opts: any?) → any
Configure gearKit's HUD (and turn it on, in play): { compare (ground and inventory compare card), statsPanel, statsOpen, look, theme, hotkey ("C"), radius (metres to a ground item), autoBind, lookSwitcher, statsButton (a tap button for phones), hover (cards for hovered inventory slots) }. Returns the settings.
| arg | type | description |
|---|---|---|
| opts | any? |
config( ) → any return table
setStatsOpen(open: boolean) → void
Open or close the character stats panel.
| arg | type | description |
|---|---|---|
| open | boolean |
isStatsOpen( ) → boolean return S
toggleStats( ) → void
inPlay( ) → boolean
_ensureHost( ) → void
Internal: start the HUD host on this engine (in play).
_step(_dt: number) → void
Internal: per-frame work (the host calls it): auto-binding and re-applying changed equipment.
| arg | type | description |
|---|---|---|
| _dt | number |
gearKit front door: roll random-stat gear whose id encodes the roll, describe and compare items, register them with inventoryKit, apply equipped gear as abilitiesKit stat modifiers on the local player, five card looks and two naming themes, loot drops by tier, and the compare and stats HUD.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.