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:
@@ -47,6 +47,9 @@ export const FEED_KINDS = Object.freeze([
|
||||
// Rust's own world events (protocol 14, PLAN_REDESIGNS §14.3.1): the server
|
||||
// reads each one for the viewer, so a name is here only where it may be.
|
||||
'world.event',
|
||||
// Dynamic PVP's zones opening (§14.3.3). A closing (`pvp.zone.deleted`) is
|
||||
// staff's and is not asked for here; the map shows a zone go.
|
||||
'pvp.zone.created',
|
||||
])
|
||||
|
||||
/** The filters the feed offers, and the kinds each one asks the API for. */
|
||||
@@ -61,7 +64,7 @@ export const FILTERS = Object.freeze([
|
||||
},
|
||||
{ id: 'server', label: 'Server', kinds: ['server.wipe', 'server.initialized', 'server.shutdown'] },
|
||||
{ id: 'bosses', label: 'Bosses', kinds: ['npc.boss.spawned', 'npc.boss.died'] },
|
||||
{ id: 'world', label: 'World events', kinds: ['world.event'] },
|
||||
{ id: 'world', label: 'World events', kinds: ['world.event', 'pvp.zone.created'] },
|
||||
])
|
||||
|
||||
export function kindsFor(filterId) {
|
||||
@@ -151,6 +154,10 @@ export function describe(row) {
|
||||
case 'world.event':
|
||||
return worldLine(frame)
|
||||
|
||||
case 'pvp.zone.created':
|
||||
case 'pvp.zone.deleted':
|
||||
return pvpLine(row.kind, frame)
|
||||
|
||||
default:
|
||||
return { tone: 'other', actor: name, verb: String((row && row.kind) || 'unknown'), subject: null, detail: '' }
|
||||
}
|
||||
@@ -303,4 +310,40 @@ function worldLine(frame) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What a Dynamic PVP zone is around, by its event (Dynamic PVP 5.2.0's own
|
||||
* names). The server sends `event` to the public only for these; a monument's or
|
||||
* an operator's own event reaches staff as written.
|
||||
*/
|
||||
export const PVP_AROUND = Object.freeze({
|
||||
Helicopter: 'the downed patrol helicopter',
|
||||
Bradley: 'the destroyed Bradley',
|
||||
Satellite: 'the crashed satellite',
|
||||
TimedSupply: 'an airdrop',
|
||||
SupplySignal: 'a signalled airdrop',
|
||||
CargoShip: 'the cargo ship',
|
||||
HackableCrate: 'a locked crate',
|
||||
ExcavatorIgnition: 'the Giant Excavator',
|
||||
GhostShip: 'a ghost ship',
|
||||
DeepSeaIsland: 'a Deep Sea island',
|
||||
IslandCannon: 'an island cannon',
|
||||
})
|
||||
|
||||
/** How long a zone was given, as a detail: "for 10 min", or cargo's whole visit. */
|
||||
function pvpLasts(frame) {
|
||||
const sec = Number(frame.durationSec)
|
||||
if (!(sec > 0)) return frame.event === 'CargoShip' ? 'while the ship is here' : ''
|
||||
return sec < 120 ? `for ${Math.round(sec)} s` : `for ${Math.round(sec / 60)} min`
|
||||
}
|
||||
|
||||
/** Dynamic PVP's zones (protocol 14, PLAN_REDESIGNS §14.3.3). The line names nobody. */
|
||||
function pvpLine(kind, frame) {
|
||||
const around = PVP_AROUND[frame.event] ? ` around ${PVP_AROUND[frame.event]}` : frame.event ? ` (${frame.event})` : ''
|
||||
if (kind === 'pvp.zone.deleted') {
|
||||
return { tone: 'server', actor: null, verb: `The PvP zone${around} has closed`, subject: null, detail: '' }
|
||||
}
|
||||
const detail = [frame.grid || null, pvpLasts(frame) || null].filter(Boolean).join(' · ')
|
||||
return { tone: 'kill', actor: null, verb: `A PvP zone opened${around}`, subject: null, detail }
|
||||
}
|
||||
|
||||
export default { describe, FEED_KINDS, FILTERS, kindsFor }
|
||||
|
||||
Reference in New Issue
Block a user