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:
@@ -84,17 +84,19 @@ const LIVE = {
|
||||
{ steamId: '7005', name: 'My alt, asleep', x: 5, z: 5, sleeping: true, online: false },
|
||||
],
|
||||
bases: [{ kind: 'tc', x: 9, z: 9 }],
|
||||
pvp: [{ zoneId: '1412203045', event: 'Helicopter', x: 30, z: 40, radius: 100, shape: 'sphere' }],
|
||||
}
|
||||
|
||||
test('a fresh install shows the world and events to anybody, and positions to staff only', async (t) => {
|
||||
settings(t)
|
||||
assert.deepStrictEqual(await map.fleet(), { world: 'public', events: 'public', players: 'staff', bases: 'staff', mates: true, markers: {} })
|
||||
assert.deepStrictEqual(await map.fleet(), { world: 'public', events: 'public', players: 'staff', bases: 'staff', pvp: 'public', mates: true, markers: {} })
|
||||
|
||||
const acc = await map.access({}, 'main')
|
||||
assert.equal(acc.layers.world.visible, true)
|
||||
assert.equal(acc.layers.events.visible, true)
|
||||
assert.equal(acc.layers.players.visible, false)
|
||||
assert.equal(acc.layers.bases.visible, false)
|
||||
assert.equal(acc.layers.pvp.visible, true, 'Dynamic PVP zones name nobody (§14.3.3)')
|
||||
assert.equal(acc.mates.visible, false, 'an anonymous viewer has no accounts to be shown')
|
||||
})
|
||||
|
||||
@@ -158,6 +160,19 @@ test('a hidden layer is absent from the answer, not an empty array', async (t) =
|
||||
}
|
||||
})
|
||||
|
||||
test('§14.3.3: the pvp layer passes Dynamic PVP zones through, is empty from an older plugin, and can be hidden', async (t) => {
|
||||
settings(t)
|
||||
assert.deepStrictEqual(map.project(LIVE, await map.access({}, 'main')).pvp, LIVE.pvp)
|
||||
const { pvp, ...older } = LIVE
|
||||
assert.deepStrictEqual(map.project(older, await map.access({}, 'main')).pvp, [])
|
||||
})
|
||||
|
||||
test('§14.3.3: a pvp layer set to staff is absent for the public', async (t) => {
|
||||
settings(t, { stored: { 'map.layer.pvp.audience': 'staff' } })
|
||||
const out = map.project(LIVE, await map.access({}, 'main'))
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(out, 'pvp'), false)
|
||||
})
|
||||
|
||||
test('staff get every layer', async (t) => {
|
||||
settings(t, { viewer: { level: 'staff', userId: 1 } })
|
||||
const out = map.project({ ...LIVE, basesTruncated: true }, await map.access({}, 'main'))
|
||||
|
||||
Reference in New Issue
Block a user