Log inGet started
Package

rules.module

Newest version

README.md

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 in modules.state(), so it survives hot reloads.
  • Live combat state: live holds hp, stamina, lockTarget, inBout and boutId.
  • Event bus: on(name, fn) returns an unsubscribe function; emit(name, ...) raises an event. The events are listed in init.luau.
  • Service registry: each slice publishes its functions into services.<slice>. Others call them with call(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.