Skip to content

Breach & alarms ​

np_doors has no minigame code. Every breach is a game of np_minigames, a hard dependency: np_doors stores a crime profile per door, calls exports.np_minigames:Play(src, game, opts) on the server (or Chain for multi-step profiles), and the server-validated result decides whether the door opens. Tools, their wear and breaking go through the game's opts.item.

The Lock & crime tab of the manager: lock chain and the crime profile with game, difficulty and tool per method

Methods and games ​

Method np_minigames game Default difficulty Tool (opts.item) Breaks the door
lockpick lockpick medium lockpick, lost on a fail 35 % of the time no
ram ram (fallback skillcheck) medium door_ram (checked by np_doors, police only) yes
thermite thermite hard thermite, always used up yes
hack hexhack, or wires with game = 'wires' medium – no
bruteforce crack (a keypad) medium – no
drill drill hard drill, never used up yes
a method with chain Chain({ ... }): every step in a row, stopping at the first failure per step per step –

The defaults live in Config.Breach.methods and a door's profile overrides them per method. The game card shows the door's label and the method as subtitle; the player may move Config.Breach.maxMove (3 m) while playing.

The crime profile ​

lua
crime = {
  methods = {
    lockpick = { difficulty = 'hard', item = 'lockpick' },
    hack = { game = 'wires', difficulty = 'expert' },
    ram = { difficulty = 'hard' },
    hack2 = { chain = { 'hack', 'thermite' } },   -- multi-step
  },
  cooldown = 900,          -- seconds between two attempts (default Config.Breach.cooldown)
  alarm = 'silent',        -- 'silent' | 'loud' | nil
  alarmChance = 0.5,       -- chance a failed attempt trips the alarm
}

A player only sees the methods listed on the door (plus the ram for police, see below), and only while the door is locked and not broken. The server checks again when the game starts: the door is locked, the player is in reach and in routing bucket 0, no other game runs for them and the door's cooldown has run out.

A game np_minigames refuses before it starts (the tool is missing, the player is busy, the game is disabled) is not an attempt: no cooldown, no log entry, no alarm. The player is told why (no_item, busy, ...) or that the method is not available.

Police ram ​

The battering ram game of np_minigames

Police use the door_ram item in front of a locked door. The game is np_minigames' battering ram (new in np_minigames 1.2.0): hold SPACE to wind up, let go in the sweet spot, mind your stamina. The door's integrity comes from Config.Ram.doorHp for the difficulty (100 / 120 / 150 / 125 for easy to expert; expert doors are reinforced, 1.5 ×). A door's profile can set ram = { doorHp = 200, reinforced = true } itself. While np_minigames has no ram game (GetGames()), the ram falls back to the skill ring.

  • Who: jobs in Config.Ram.jobs (police, sheriff, statepolice by default), on duty (Config.Ram.onduty), with the item (Config.Ram.item).
  • Which doors: every locked door with Config.Ram.anyDoor (the default), otherwise only doors whose profile lists ram.
  • Warrant: with Config.Ram.warrant the player is asked for an optional warrant reference. It goes into the activity log with the attempt.
  • Lawful entry: a ram never trips the alarm unless Config.Ram.alarm is on.

Success, failure and repairs ​

  • Success opens the door. Methods with breaks (ram, thermite, drill) leave it broken: open, unlockable and shown as broken until somebody repairs it. The others unlock it like a normal toggle (auto-lock included).
  • Failure may trip the alarm: with the door's alarmChance (default Config.Breach.alarmChance, 0.5) when the door has an alarm.
  • A successful breach always trips the alarm of a door that has one (except a lawful ram). A door without an alarm still sends a security alert to its owner's Keys app.
  • Every attempt is logged (breach, the method, the game, the score, the warrant) and fires np_doors:breach.
  • Repair: use a door_repair_kit at the broken door (Config.Repair.seconds, 8 s). Who may: the jobs in Config.Repair.jobs (mechanic, police), anybody with a kit while anyoneWithKit is on, and staff with np_doors.manage (1 s, no kit). The repaired door returns to its configured lock state. For staff the manager's toggle button repairs a broken door too; owners need a kit. Scripts call setBroken(id, false).

Addons add their own methods with registerBreachMethod (a game and options, or their own run function).

Alarms ​

A door alarm (door.alarm = { enabled, kind = 'silent' | 'loud', keypad, face }, or the profile's alarm) trips on a breach, a keypad lockout (keypad), a denied face (face), a forced door or by hand. A tripped alarm:

What With Setting
The door shows the alarm state – Config.Alarm.duration (120 s)
Fires np_doors:alarm (id, kind) – –
Police dispatch, silent alarms too (silent only means no bell on site) np_mdt, ps-dispatch, cd_dispatch, qs-dispatch, else a toast and blip for police on duty Config.Alarm.dispatch, Config.Dispatch
A door_alarm point on the ops map (pingSource on the source np_doors; intel on a case only with a caseId) np_surveillance Config.Alarm.intel
An event "Door alarm" with a clip from the cameras within 25 m np_cctv Config.Alarm.cctv, clipSeconds (60)
A push to the owner or the owning job np_phone Config.Alarm.ownerPush
A bell for players nearby (loud alarms) – Config.Alarm.sound, soundRange (60 m)

Security alerts are the quiet version: lockpick attempts, breaches of doors without an alarm and bursts of wrong codes land in the owner's Keys app and as a push, without the police. See Phone app.