feat(rust): Dynamic PVP's zones on the feed and the map (PLAN_REDESIGNS §14.3.3)
Stage 4 of the §14.3 integration plan, on protocol 14 (docs rust-link/PROTOCOL.md §20.7). - pvp.zone.created is a public kind, pvp.zone.deleted a staff kind. Each row is read per viewer by the new dynamicPvp.js: grid for everyone, the event's name only for Dynamic PVP's own vanilla events, position and zone id for staff only. - The feed's world filter carries the opening: "A PvP zone opened around the downed patrol helicopter · G7 · for 10 min". It names nobody. - The map gains a fifth layer, `pvp` (PvP zones), public by default with its own audience in Admin → Rust visibility, drawn as a red ring with its event's name. - Server settings' plugin line names Dynamic PVP; the swagger schemas and route descriptions carry the layer and the integration (fragment regenerated); ci/bundle.json ships dynamicPvp.js; README lists it. Tests: server 611/611 (dynamicPvp.test.js new, catalogue and map extended) and every check; client 89/89 (feed and map tooltip), build and externals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -203,7 +203,43 @@ test('every type the server knows has its own words, and an unknown one says its
|
||||
assert.equal(describe(world({ event: 'meteor.landed' })).verb, 'meteor.landed')
|
||||
})
|
||||
|
||||
test('the world filter asks for world events, which the server serves publicly', () => {
|
||||
assert.deepEqual(kindsFor('world'), ['world.event'])
|
||||
assert.ok(FEED_KINDS.includes('world.event'))
|
||||
test('the world filter asks for world events and Dynamic PVP zones opening, which the server serves publicly', () => {
|
||||
assert.deepEqual(kindsFor('world'), ['world.event', 'pvp.zone.created'])
|
||||
assert.ok(FEED_KINDS.includes('pvp.zone.created'))
|
||||
assert.ok(!FEED_KINDS.includes('pvp.zone.deleted'), 'a zone closing is a staff line')
|
||||
})
|
||||
|
||||
// ── Dynamic PVP's zones (protocol 14, PLAN_REDESIGNS §14.3.3) ─────────────
|
||||
|
||||
const pvp = (kind, frame) => row(kind, { kind, ...frame })
|
||||
|
||||
test('a zone opening says what it is around, where, and for how long, and names nobody', () => {
|
||||
const heli = describe(pvp('pvp.zone.created', { event: 'Helicopter', grid: 'G7', durationSec: 600 }))
|
||||
assert.equal(heli.verb, 'A PvP zone opened around the downed patrol helicopter')
|
||||
assert.equal(heli.detail, 'G7 · for 10 min')
|
||||
assert.equal(heli.actor, null)
|
||||
assert.equal(heli.subject, null)
|
||||
|
||||
const cargo = describe(pvp('pvp.zone.created', { event: 'CargoShip', grid: 'Q9', durationSec: -1 }))
|
||||
assert.equal(cargo.verb, 'A PvP zone opened around the cargo ship')
|
||||
assert.equal(cargo.detail, 'Q9 · while the ship is here')
|
||||
|
||||
assert.equal(describe(pvp('pvp.zone.created', { event: 'Bradley', durationSec: 90 })).detail, 'for 90 s')
|
||||
})
|
||||
|
||||
test('a zone the public are not told the event of is just a zone; staff read a monument’s name as written', () => {
|
||||
assert.equal(describe(pvp('pvp.zone.created', { grid: 'C3' })).verb, 'A PvP zone opened')
|
||||
assert.equal(describe(pvp('pvp.zone.created', { event: 'Airfield' })).verb, 'A PvP zone opened (Airfield)')
|
||||
})
|
||||
|
||||
test('a zone closing, for a staff reader, says which one closed', () => {
|
||||
assert.equal(describe(pvp('pvp.zone.deleted', { event: 'Helicopter' })).verb, 'The PvP zone around the downed patrol helicopter has closed')
|
||||
assert.equal(describe(pvp('pvp.zone.deleted', {})).verb, 'The PvP zone has closed')
|
||||
})
|
||||
|
||||
test('every one of Dynamic PVP’s own events has words, and the server and client agree on which they are', () => {
|
||||
const { GENERAL_EVENTS } = createRequire(import.meta.url)('../../server/dynamicPvp.js')
|
||||
for (const event of GENERAL_EVENTS) {
|
||||
assert.ok(!describe(pvp('pvp.zone.created', { event })).verb.includes(`(${event})`), `${event} has no words of its own`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { eventTip, isBoss, titlesFrom, unknownRuns } from '../src/lib/mapEvents.js'
|
||||
import { createRequire } from 'node:module'
|
||||
|
||||
import { eventTip, isBoss, pvpTip, PVP_NAMES, titlesFrom, unknownRuns } from '../src/lib/mapEvents.js'
|
||||
|
||||
const CALENDAR = {
|
||||
entries: [
|
||||
@@ -47,3 +49,13 @@ test('a boss is an event boss or a world one', () => {
|
||||
test('the run ids still to look up', () => {
|
||||
assert.deepEqual(unknownRuns([{ runId: '41' }, { runId: '7' }, { runId: '7' }, {}], { 41: 'x' }), ['7'])
|
||||
})
|
||||
|
||||
// Dynamic PVP's rings (PLAN_REDESIGNS §14.3.3): its own events by a plain name,
|
||||
// a monument's or an operator's as written, and nothing at all as just a zone.
|
||||
test('a Dynamic PVP ring says what it is around', () => {
|
||||
assert.equal(pvpTip({ event: 'Helicopter' }), 'PvP zone · Patrol helicopter')
|
||||
assert.equal(pvpTip({ event: 'Airfield' }), 'PvP zone · Airfield')
|
||||
assert.equal(pvpTip({}), 'PvP zone')
|
||||
const { GENERAL_EVENTS } = createRequire(import.meta.url)('../../server/dynamicPvp.js')
|
||||
assert.deepEqual(Object.keys(PVP_NAMES).sort(), [...GENERAL_EVENTS].sort())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user