Building, tests & screenshots ​
Layout ​
fxmanifest.lua shared, client and server globs; np_admin_settings / np_admin_config entries
shared/lib/ 00 NpPool global, bridge selection, util · 01 locale · 02 format
config/*.lua main, tables, rules, gear, physics, natives (all shared)
shared/physics/ 00 rng · 01 table geometry (cushions, jaws, pockets) · 02 the simulation
shared/rules/ 00 common · 01 8-ball · 02 9-ball · 03 straight pool (14.1)
shared/elo.lua ELO, tiers, odds, soft reset (shared so UI and server agree)
bridge/np_admin.lua np_admin lib, vendored byte-identical
shared/np_admin_settings.lua np_admin Resource settings
shared/locales/en.lua
bridge/framework/server/ esx | qbx | qb | standalone (esx first)
bridge/inventory/server/ np_inventory | ox | qb | esx | none
bridge/society/server/ esx | qb | renewed | none
server/NN_*.lua core · db · rpc · money + escrow · tables · lobby · match (referee) · spectate + bets ·
profile · gear · drunk · owner · cups · integrations · phone · rpcs · exports · boot
client/NN_*.lua core (NUI, focus, theme) · world (binding, markers, np_menu, blips, calibration) ·
balls (props, replay) · camera · play · spectate · screens · keys
web/ React + Vite NUI (index.html) and the phone app (phone.html), one package
design/ Nimbus UI tokens and CSS, never edited
sql/ np_billiards.sql, items_esx.sql
tests/ plain-Lua harness, one process per suite
shared/physics is pure Lua without natives: the server simulates every shot with it, and every client re-runs the
same strike from the same start to animate it. Fixed 5 ms steps with continuous collision detection and only
+ - * / sqrt inside the loop keep the result bit-identical on every machine.
Build ​
cd web
npm ci
npm run build # FiveM guard check + tsc --noEmit + vite build → web/dist/index.html, web/dist/phone.html
npm test # vitest (web/tests: format, geometry, wire, silver line)
npm run dev # browser mock on http://localhost:5184
npm run screenshots # headless Chrome → web/screenshots/*.png
npm run build first runs scripts/check-fivem-guard.mjs: in FiveM a blurred surface renders as a black box over the
game, so the HTML sets html.nb-fivem before the first paint and the CSS turns backdrop-filter off under it. The
guard fails the build when that rule or the code that sets the class is missing.
Browser mock ​
npm run dev runs the UI without FiveM, with mock data and a fake Lua backend (src/dev/). URL parameters pick a
screen:
| Parameter | Values |
|---|---|
screen |
aim, shoulder, place, wait, spectate, lobby, cues, profile, owner, world, ended |
material |
liquid |
shot |
1: no animations, for screenshots |
The phone app runs at phone.html with tab (league, cups, challenges, tables), material=liquid and
shot=1.
npm run screenshots builds the UI and a --mode mock build into web/dist-mock, serves it with vite preview and
renders every screen at 1920 × 1080, the Liquid Glass lobby and the four phone tabs (cropped to the phone frame) into
web/screenshots/, plus phone.png with all four side by side. SCALE=3 renders at 3× for edge checks; a name
filter renders only matching shots (npm run screenshots -- phone). The screenshots on these pages come from there.
Tests ​
bash tests/run.sh # luac -p on every Lua file, then the physics, rules, server, bridges and client suites
VERBOSE=1 bash tests/run.sh # with resource log lines and stubbed natives
The suites run in plain Lua 5.4, each in its own process like FiveM's separate client and server states. The
harness (tests/harness.lua, tests/harness_fakes.lua) stubs the FiveM natives, oxmysql (an in-memory repository
in place of server/01_db.lua), es_extended players, qb-core, np_inventory, np_payments, esx_addonaccount, np_hud,
np_phone, np_drugs, np_discord and np_prophandler.
| Suite | Covers |
|---|---|
test_physics.lua |
Determinism, collisions, cushions, pockets, spin |
test_rules.lua |
8-ball, 9-ball, straight pool and ELO, with synthetic shot results and real racks through the physics |
test_server.lua |
The ESX + np_inventory + np_payments stack: boot and bridges, lobby, challenges, escrow, fees, the referee loop, shot clock, payouts, ELO, side bets, spectators, disconnects, voids, restart refunds, gear, drinks, cups, owner tablet, phone app, exports, np_admin |
test_bridges.lua |
ESX with its default inventory (no metadata) and esx_addonaccount; money through the framework without np_payments |
test_client.lua |
NUI boot handshake, binding to the vanilla prop with hidden vanilla balls, turn focus and camera, inputs-only shots, local replay, releasing focus at the end |
Conventions ​
- One global
NpPool(plusConfig,L). Lua 5.4; every file parses with plainluac -p. - RPC handlers return
{ ok = true, ... }orS.err(code); every code has a text inshared/locales/en.lua. - Money is whole dollars, timestamps unix seconds, table coordinates in the table frame (x along the long axis).
- Every call into another resource is
pcall'd and started-checked. - No ACE anywhere: every staff check is
npAdmin.can(src, node).