feat(rust): RunicNPC is required for every Place NPCs step (runicnpc stage 9, D310)

A Place NPCs step on a server without RunicNPC, or with one older than the
bridge needs, is refused before it is sent: "<server> needs RunicNPC to place
NPCs, Rust's own scientists included: <why>". Rust's own scientists were the
fallback until now (D243); they need RunicNPC too. Crates are unaffected.

- npcs.model: API_NEEDED rises from 4 to 6, the bridge's RunicNpcApiNeeded, so a
  server the site calls ready is one the bridge will not refuse as runicnpc-old.
  The profile push follows the same floor.
- eventWorld: profileMissing becomes npcMissing, asked for every NPC step.
- Admin → Rust → Servers: each server carries `runicNpc` ({ready, absence,
  version, api}) and a server without one that will do reads "Incomplete" with
  the reason. Swagger documents the field.

The event picker is unchanged in this commit (an open question on the PR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-10-06 16:58:30 -05:00
parent 72f6c557d2
commit d140d5c66d
7 changed files with 107 additions and 20 deletions

View File

@@ -18,8 +18,13 @@ const serversDb = require('../servers/servers.db')
const db = require('./npcs.db')
const shape = require('./npcProfile')
/** The RunicNPC API the bridge's `npc.*` commands need: 3 for placements (D249), 4 for the faction table and an event's orders (stage 5). */
const API_NEEDED = 4
/**
* The RunicNPC API the bridge needs (its `RunicNpcApiNeeded`): 3 for placements
* (D249), 4 the faction table and an event's orders (stage 5), 5 bosses (stage 6),
* 6 loot (stage 7). Stage 9 (D310) makes the site's floor the bridge's, so a
* server the site calls ready is one the bridge will not refuse as `runicnpc-old`.
*/
const API_NEEDED = 6
class NpcError extends Error {
constructor(message, status = 400) {
@@ -51,6 +56,24 @@ function npcAbsence(server) {
return null
}
/**
* Each server's RunicNPC as Admin → Rust shows it (stage 9, D310): a server
* without one that will do is incomplete, because events cannot place NPCs there.
*/
async function serverStatus() {
const out = new Map()
for (const s of await db.listNpcServers()) {
const ready = npcReady(s)
out.set(s.id, {
ready,
...(ready ? {} : { absence: npcAbsence(s) }),
version: (s.runicNpc && s.runicNpc.version) || null,
api: (s.runicNpc && s.runicNpc.api) || 0,
})
}
return out
}
// ── What a server is sent ───────────────────────────────────────────────────
/**
@@ -514,6 +537,7 @@ module.exports = {
covers,
npcReady,
npcAbsence,
serverStatus,
desiredFor,
adopt,
describe,