feat(rust): event NPCs named on the map, and a Place NPCs step's progress line (runicnpc stage 8)
- rust.npc.place's progress() (MODULE_API 1.12.0, D304). It reports the
step's NPCs still standing, by its key, of how many it placed, with
the profile's label: "Bandit: 2 of 3 left". A boss step is its
health, "Walk Juggernaut: 59%", and a boss's adds are not counted.
The data comes from the map's live answer, so it costs the game no
extra ask. A reader who may not see the map's events layer gets no
line.
- The map (D302, D303):
- an NPC's tooltip is its name and its event's title, read from
core's public calendar, which lists only announced events;
- a boss is bigger and in its own colour, and an add says so;
- a boss outside any event is in the world layer;
- a boss's health is removed from what a viewer is sent.
- The world layer's visibility hint mentions those bosses.
coreApi stays ^1.11.0: an older core ignores the optional member, and
the action works without a progress line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -130,6 +130,24 @@ test('D113: widening both the layer and presence does show them', async (t) => {
|
||||
assert.equal(map.project(LIVE, acc).players.length, LIVE.players.length)
|
||||
})
|
||||
|
||||
test("runicnpc D303: a boss's health is not sent to the map, and its name, key and flags are", async (t) => {
|
||||
settings(t)
|
||||
const live = {
|
||||
...LIVE,
|
||||
events: [
|
||||
{ kind: 'npc', runId: '4', x: 1, z: 1, prefab: 'profile:jugg', key: 'k1', name: 'The Juggernaut', boss: true, health: 0.62 },
|
||||
{ kind: 'npc', runId: '4', x: 2, z: 2, prefab: 'profile:bandit', key: 'k2', name: 'Bandit', add: true },
|
||||
],
|
||||
}
|
||||
const out = map.project(live, await map.access({}, 'main'))
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(out.events[0], 'health'), false)
|
||||
assert.equal(out.events[0].name, 'The Juggernaut')
|
||||
assert.equal(out.events[0].boss, true)
|
||||
assert.equal(out.events[0].key, 'k1')
|
||||
assert.deepStrictEqual(out.events[1], live.events[1], 'a row without health passes untouched')
|
||||
assert.equal(live.events[0].health, 0.62, "the cache's own row is not changed")
|
||||
})
|
||||
|
||||
test('a hidden layer is absent from the answer, not an empty array', async (t) => {
|
||||
settings(t)
|
||||
const out = map.project(LIVE, await map.access({}, 'main'))
|
||||
|
||||
Reference in New Issue
Block a user