feat(rust): NPC profile and placement routes, the event picker, triggers and titles (runicnpc stage 4)
Admin: /admin/rust/npcs for profiles (create, change, delete, restore a replaced one, push now) and each server's placements (list, add from a map point, change, remove, rename, respawn). Public: the profiles a leaderboard ranks by, one profile's ranking counted as the profile says (D247, D250), and one player's kills by profile (D252). Player: your own kills by profile. The Place NPCs step offers the site's profiles first, then Rust's own (D243). rust.npc.died and rust.npc.health are triggers a phase can wait on. A title rule can rank a profile's kills. Swagger fragment, engagement and route manifests regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -19,6 +19,7 @@ const servers = require('../../model/servers/servers.model')
|
||||
const sidecar = require('../../sidecarClient')
|
||||
const titleSync = require('../../titleSync')
|
||||
const titles = require('../../model/titles/titles')
|
||||
const npcs = require('../../model/npcs/npcs.model')
|
||||
const titlesModel = require('../../model/titles/titles.model')
|
||||
const voice = require('../../model/permissions/voice')
|
||||
|
||||
@@ -255,6 +256,14 @@ async function putTitles(req, res) {
|
||||
const checked = titles.validateSettings(req.body)
|
||||
if (!checked.ok) return res.status(400).json({ message: checked.errors.join(' '), errors: checked.errors })
|
||||
|
||||
// D250: a profile's kills rank a site profile this server is pushed.
|
||||
const onServer = new Set((await npcs.boardProfiles(id)).map((p) => p.id))
|
||||
const stray = checked.value.rules.findIndex((r) => r.stat === 'profilekills' && !onServer.has(r.profile))
|
||||
if (stray >= 0) {
|
||||
const errors = [`rule ${stray + 1}: that NPC profile is not on this server`]
|
||||
return res.status(400).json({ message: errors[0], errors })
|
||||
}
|
||||
|
||||
await titlesModel.saveSettings(id, checked.value)
|
||||
await core.activity.log({
|
||||
req,
|
||||
|
||||
Reference in New Issue
Block a user