Skip to content

Network ​

Signal, coverage and what needs it. np_phone has no towers of its own: without a network provider every phone has full service, and nothing on this page changes anything.

A provider is a separate resource, an addon of np_phone such as np_cellnet. It tells np_phone, per player, how good the connection is. np_phone then:

  • shows real bars and the network type in the status bar, Control Center and Settings → Cellular;
  • gates every action by what it needs (texts, calls, light or full data), with readable errors;
  • queues plain texts in an outbox that sends itself on reconnect;
  • grades calls by the weaker side, adds voice drop-outs on a bad link and drops a call on lost service;
  • keeps the emergency lines (911, 912) working on any network, unless the player is jammed.

Status bar and lock screen in every network state: full service, 5G, EDGE, no service, Wi-Fi, SOS, jammed, roaming

For server owners ​

  • Install a provider to turn it on: np_cellnet. np_phone itself needs no change.
  • Without a provider the status bar shows full bars and Config.Carrier ('LS Mobile').
  • Players get three new settings under Settings → Cellular: Wi-Fi Calling (default on), Low Data Mode (default off: feeds load text-only, media waits for a tap) and Roaming (default on; off = no service while roaming, except emergency calls). Media also waits for a tap when the player has fewer bars than the data minimum and no Wi-Fi.
  • Tune what needs which signal in shared/config/network.lua (below).
  • Your own phone apps keep working: their RPCs need light data by default (Needs).

Needs ​

Every phone action needs one of five levels:

Need Default minimum Used by
sms 1 bar, or Wi-Fi Text, location and contact messages, messages.open, group changes
voice 1 bar, or Wi-Fi with Wi-Fi Calling on calls.start, calls.accept
data-lite 1 bar, or Wi-Fi Feeds, maps data, mail, Yellow Pages, news, wallet history, custom apps
data 2 bars, or Wi-Fi Photos and voice notes in Messages, live location, money in Messages, Chirp posts with images, wallet transfers, uploads
emergency always, unless jammed Calls to Config.Comms.emergency.lines

Actions that are not listed always work: settings, contacts, notes, the local photo library, reading the message history, hanging up, mute and speaker. calls.start decides by itself: an emergency line needs emergency, a payphone is a landline and needs nothing from the caller's phone. Dial codes (*#06#, *3001#12345#*, ...) need nothing: they never leave the phone, so a provider can catch them even without service.

Wi-Fi always counts as enough, except for voice with Wi-Fi Calling turned off. SOS, and roaming while the player switched Roaming off, count as no service.

When an action lacks its need it fails with one of four codes, which have proper text in every app (the call screen, Messages, Wallet and the social apps):

Code When Shown as
no_signal 0 bars and no Wi-Fi (also SOS, or roaming with Roaming off) No Service
no_data Fewer bars than the need's minimum Connection too weak
jammed The provider says the player is jammed No Service
network_busy Returned by the provider (tower full) Network Busy, try again

Outbox ​

When messages.send lacks its need and the message is a text, location or contact (Config.Network.outbox.types):

  • It is stored in phone_outbox instead of failing. The thread shows it with a clock and Waiting for network.
  • When the sender may send texts again, the outbox is sent in order through the normal send path. The Dynamic Island shows Back online · sending N.
  • Data-only messages (image, voice, live location, money) still fail with No Service / Connection too weak, and the bubble offers Retry. Money is never moved before the check.
  • Queued messages survive relogs and restarts. After a player loads, np_phone waits 5 seconds for the provider's first state, then sends what it may. At most 50 per player (maxPerPlayer); past that the send fails with outbox_full.

Incoming: messages to a player without sms are stored as usual. Their notification is held back and delivered on reconnect, as one notification (the message, or N new messages).

Queued and failed bubbles Back online
Messages: queued and failed bubbles Back online · sending

Calls ​

  • Calling a number whose owner has no voice service answers unreachable, like a switched-off phone. Dispatchers without service are skipped by their emergency line.
  • Quality is the minimum of both sides' bars; Wi-Fi Calling counts as 4. At 2 bars or less the call screen shows a pill (Poor connection · Joe has 1 bar) with Text instead.
  • Voice drop-outs at quality 1: short random gaps in the partner's voice (pma-voice; other voice resources show only the UI). The volume is always restored when the quality changes or the call ends.
  • Dropping: when either side reaches 0 (or is jammed) for 3 seconds (voice.dropAfter), the call ends as Call Failed. Emergency calls are never dropped for SOS, only for jamming.

None of this runs for calls where neither side has a provider state.

Poor connection Call failed
Call: poor connection Call failed

Where it shows ​

Place Shows
Status bar 0–4 bars (crossed out at 0), 5G / LTE / 3G / E, SOS, the Wi-Fi icon, R when roaming; the lock screen shows the carrier (No Service, SOS)
Control Center Cellular module with carrier · type, tower, dBm and a load bar (tap: Settings → Cellular); the Wi-Fi tile shows the SSID; a Low Data tile
Settings → Cellular Carrier, plan usage, Wi-Fi Calling, Low Data Mode, roaming, network type, tower
Dynamic Island No Service when service is lost; Back online · sending N while the outbox drains
Call screen The quality pill, Text instead when voice fails
Messages Queued bubbles with a clock, failed data bubbles with Retry; incoming photos tap-to-load on a slow link
Chirp Slow connection / Low Data Mode banner, images tap-to-load
Control Center Settings → Cellular
Control Center with a provider Settings → Cellular
Control Center without a provider Chirp on a slow link
Control Center without a provider Chirp: slow connection
No Service
No Service

Configuration ​

shared/config/network.lua:

Option Default Description
Config.Carrier 'LS Mobile' Carrier label without a provider
Config.Network.needs see the file Method or '<app>.*' → need. Values: a need, false (never gated) or function(src, params) -> need | nil. needs.messages sets the need per message type
Config.Network.minBars sms 1, voice 1, data-lite 1, data 2 Bars per need; single methods can ask for more, e.g. ['wallet.send'] = 3
Config.Network.storeAppNeed 'data-lite' Need of custom App Store apps that don't set network
outbox.types / maxPerPlayer / sendInterval text location contact / 50 / 400 ms
voice.effects / dropoutChance / dropoutMin / dropoutMax / dropAfter true / 0.35 / 150 / 650 ms / 3 s

The player settings wifiCalling, lowData and roaming are normal phone settings (Config.Settings.defaults).

For developers ​

Writing a provider ​

A provider is an addon that sets each player's state with setNetwork. It is owner-tracked: when the provider stops, every state it set is cleared and the phones go back to full service.

lua
-- server, inside npAddon.attach('np_phone', fn, { api = 1 })
exports.np_phone:setNetwork(src, {
  bars = 3,                         -- required, 0..4
  type = 'LTE',                     -- '5G' | 'LTE' | '3G' | 'E' | 'none'
  carrier = 'Badger',               -- status bar, Control Center, Settings
  tint = 'green',                   -- Nimbus tint of the carrier
  tower = { id = 'LS-07', label = 'Vinewood Hills' },   -- optional
  dbm = -97, load = 41,             -- optional, Control Center
  wifi = { ssid = 'Bean Machine' }, -- or nil: data at full speed, Wi-Fi Calling when enabled
  roaming = false,                  -- "R" next to the type
  sos = false,                      -- no own network, emergency calls only
  jammed = false,                   -- nothing at all, not even 911
  plan = { name = 'Badger Plus', used = 3.2, limit = 10 },   -- GB, Settings → Cellular
})
  • setNetwork(src, nil) clears a player's state (back to full service).
  • Errors: no_player (not online), invalid_state (no bars 0–4). Out-of-range numbers are clamped and unknown fields dropped.
  • An equal state is not pushed again, so a provider may simply call setNetwork on every tick.
  • A provider returns network_busy from an rpc hook to refuse a call on a full tower:
lua
exports.np_phone:addHook('rpc', function(src, method, params)
  if method == 'calls.start' and towerFull(src) then return false, 'network_busy' end
end)
  • Read the emergency numbers from exports.np_phone:getConfig().emergencyLines and the player's switches (wifiCalling, lowData, roaming) from getSettings(src).

Reading the state ​

Side API
server exports.np_phone:getNetwork(src) → state | nil (nil: no provider, full service)
server exports.np_phone:canUse(src, need) → true | false, code; need = 'sms', 'voice', 'data-lite', 'data' or 'emergency'
server Event np_phone:network:changed (src, state, previous)
server Event np_phone:calls:quality (callId, level, { [src] = bars })
client exports.np_phone:getNetwork() and the event np_phone:network (state, previous)
custom app phone.network() and phone.on('network', fn) (SDK 1.2, Writing an app)

state is nil when the player is back to full service (provider stopped or cleared it).

Your own RPCs ​

Declare what your RPCs need with an owner-tracked export. Your entry beats Config.Network.needs:

lua
exports.np_phone:setRpcNeed('racing.join', 'data')
exports.np_phone:setRpcNeed('racing.list', function(src, params) return 'data-lite' end)
exports.np_phone:setRpcNeed('racing.settings', false)   -- never gated ('none' works too); nil removes your entry

A custom App Store app can set network = 'sms' | 'voice' | 'data-lite' | 'data' | 'none' on its store entry (default data-lite); its app RPCs inherit that need. 'none' lets the app work without service, as np_cellnet's CellNet app does.

The gate runs in the RPC pipeline after the blocked check and before the rpc hooks. exports.np_phone:call(src, method, params) is trusted server code and skips it, like the rate limit and the item check.

Browser preview ​

The dev build (npm run dev in web/) has no provider:

  • ?net=full|3|2|1|0|wifi|sos|jammed|roam starts in a state; ?netdev=1 adds a button that cycles them; npDev.network('sos') / npDev.network(null) switch from the console.
  • ?net=0&outbox=1&app=messages&thread=1 shows queued and failed bubbles; ?incoming=1&quality=1&weak=them the poor connection pill.

The rules are covered by tests/test_network.lua (sh tests/run.sh).