Skip to content

Development ​

Layout ​

config.lua
fxmanifest.lua
shared/
  locale.lua        L(key, ...) and the merged locale table
  radarmath.lua     distances, bearings, dead reckoning, closest point of approach, TCAS levels,
                    squawk / callsign validation, contact pack / unpack (no natives, unit-tested)
  access.lua        pure access resolver: facts + config -> { mode, range, primary } (unit-tested)
  np_admin_settings.lua  the settings editable in np_admin
locales/            en.lua, de.lua
bridge/
  np_admin.lua      vendored np_admin integration lib (byte-identical to np_admin/lib/np_admin.lua)
  server.lua        framework detection (esx > qbx > qb > standalone), jobs, duty, permission nodes, items, rate limiter
  client.lua        local job, for UI hints only
integrations/
  registry.lua      optional-sibling wrapper: active(), call() with pcall, onStart() re-wiring
  server.lua        np_hud, np_phone, np_inventory, np_identification, np_discord, state-bag readers
  client.lua        np_hud notify and zone claim, np_phone app messages, np_menu radials
server/
  registry.lua      aircraft registry (entityCreated / entityRemoved, 30 s re-sync)
  access.lua        gathers facts per player, caches them, Config.CanUse and RegisterAccessCheck
  transponder.lua   np_fr_xpdr state bag, seat check, callsign resolution, emergencies
  broadcast.lua     subscriber tick: snapshot, per-subscriber filter, meta diff
  exports.lua       server exports
  main.lua          net events, subscription rate limit, start-up
  np_admin.lua      np_admin nodes, staff tools, access refresh on permission changes
client/
  radar.lua         subscription wishes (panel > phone > air), contacts and meta
  blips.lua         entity / coordinate blips, dead-reckoning thread
  proximity.lua     TCAS-lite
  transponder.lua   own transponder, /squawk, /transponder, /callsign
  nui.lua           panel, focus, NUI callbacks, /radar key mapping
  phone.lua         np_phone app bridge
  main.lua          seat detection, scanner item, client exports
html/               panel (index.html, app.js, radar.js, style.css), phone app (phone.html, phone.js),
                    dev/mock.js, vendored Nimbus UI, Quicksand and Font Awesome
tests/              plain Lua 5.4 tests
mockups/            browser renders of the NUI used in these docs

Tests ​

The tests need Lua 5.4 (lua and luac on the PATH) and no FiveM server. Run them from the resource root:

sh
tests/run.sh

The script runs luac -p on every Lua file outside html/, then each tests/test_*.lua in its own Lua process (as client and server have separate states in FiveM). It prints ALL PASSED or FAILED and exits non-zero on failure. VERBOSE=1 shows the resource's own log lines. LUA= and LUAC= point it at other binaries.

Test Covers
test_radarmath.lua Distances, bearings, compass conversion, dead reckoning, closest point of approach, TA / RA levels, squawk and callsign validation, pack / unpack
test_access.lua The access resolver: every mode, grades, duty, stations, Discord roles, admins, the np_flightradar.ground node, the licence requirement, vetoes, best-mode order
test_server.lua Server smoke test with stubbed natives (tests/harness.lua) and an ESX stub: registry add / remove, idle loop without subscribers, subscribe validation and coalescing, range filter, own vehicle excluded, transponder seat checks, rate limits and validation, primary radar, emergencies, no ghosts, access loss, exports
test_client.lua Client smoke test: panel subscribe → meta → contacts → removal, entity and coordinate blips, waypoint and range callbacks, denial, the onboard subscription and transponder request path, a head-on RA, the phone app, np_admin shared settings, resource stop
test_np_admin.lua np_admin integration against a fake np_admin: npAdmin.can delegation (and deny on export errors), the fallback (console, convar, ESX group, Config.Admin), node / settings / action registration and re-registration, the settings schema, live settings, the staff tools, emergency log forwarding

Anything that needs the engine (blip rendering, entity streaming, NUI focus, sounds, np_phone's iframe) needs a test on a server with two or more clients. See Limitations.

NUI dev mode ​

The panel and the phone app open in a normal browser. Without GetParentResourceName, ?dev=1 loads html/dev/mock.js, which feeds simulated traffic around LSIA, and NUI callbacks are logged instead of posted.

html/index.html?dev=1              onboard mode: heading-up, transponder card, a TA alert
html/index.html?dev=1&mode=ground  ground mode: north-up from the LSIA tower, no transponder card
  &units=metric                    metric units
  &alert=ra                        a resolution advisory instead of the TA
  &pinned=1                        opens without focus, as the pinned overlay
  &empty=1                         no traffic

html/phone.html?dev=1              the phone app in a phone frame, same simulated traffic
  &sheet=<id>                      opens the detail sheet of a contact (e.g. 103, the 7700 plane)
  &frame=0                         the bare app without the frame
  &lang=de                         German strings

Serve the html/ folder with any static server (for example npx serve html) and open one of these URLs.

The images in these docs are such browser renders (mockups/panel.png, panel-ground.png, phone.png), with mock traffic over a mock map. They show the layout and content, not the game's own rendering.