▣
module · drop-in viewer
rules
The shared rule sheet of Swords and Sandals NG. Every slice requires it with `require("game.rules")`.
by·posted 3d ago
What it does
game.rules
The shared rule sheet of Swords and Sandals NG. Every slice requires it with require("game.rules").
What it holds:
- Constants: the art-direction sentence (
ART), the palette (PALETTE,css(name, alpha)), the fonts, the zone layout (ZONES,ARENA_GATE), base stats (BASE), gear (WEAPONS,ARMOR), enemies (ENEMIES), arena bouts (BOUTS,bout(id)) and the romance stages (ROMANCE). - Career state:
career(),newCareer(),resetCareer(),maxHp(),maxStamina(),weapon(),armor(),addXp(n),addGold(n). It is kept inmodules.state(), so it survives hot reloads. - Live combat state:
liveholds hp, stamina, lockTarget, inBout and boutId. - Event bus:
on(name, fn)returns an unsubscribe function;emit(name, ...)raises an event. The events are listed ininit.luau. - Service registry: each slice publishes its functions into
services.<slice>. Others call them withcall(service, fn, ...), which does nothing while that slice is not built yet. - Enemy registry:
registerEnemy,unregisterEnemy,enemiesNear,damageEnemy,enemyPos. All foes register here, and the player's attacks look for targets here.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.