From b5f8933a21f1982d47336eac35e863dd3994034a Mon Sep 17 00:00:00 2001 From: Bandit-HaxUnit <100861363+Bandit-HaxUnit@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:18:11 +0100 Subject: [PATCH 1/2] Light sources: lighting a candle lantern says so and plays its sound Live sends "You light the lantern." as a spam line and synth 3226 on the tick a tinderbox lights the white candle lantern (rsprox local 1000134, 1000135, 1000140: 6 of 6). The black one, not captured, does the same, as it already shares the white one's Extinguish line. Co-Authored-By: Claude Opus 5.5 --- docs/light-sources.md | 6 ++++ server/plugins/items/LightSources.plugin.js | 16 +++++++--- server/tests/light-sources.test.cjs | 34 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/docs/light-sources.md b/docs/light-sources.md index 1cf0f0c416..d0c953283b 100644 --- a/docs/light-sources.md +++ b/docs/light-sources.md @@ -10,6 +10,10 @@ Tests: `server/tests/light-sources.test.cjs`. - **Candle lantern, Extinguish** (lit white 4531 -> unlit 4529): "You extinguish the lantern." as a spam line, the item changes in its slot (1000134 ticks 365, 575, 599; 1000135; 1000140). The black one (4534 -> 4532) was not captured and is put out the same way. +- **Candle lantern, light** (tinderbox on unlit white 4529 -> lit 4531): "You light the lantern." + as a spam line and synth 3226 on the click tick, no sequence (1000134 ticks 438, 585, 780, 1144; + 1000135 tick 221; 1000140 tick 763). The black one (4532 -> 4534) was not captured and is lit the + same way. - **Last light, Extinguish:** with nothing else lit in the caves, the item stays lit and a game message says why: - candle lantern: "Extinguishing the lantern would leave you without a light source." @@ -23,6 +27,8 @@ Tests: `server/tests/light-sources.test.cjs`. ## Ours +- The black candle lantern's lighting line and sound are the white one's (not captured). + - The lit emerald lantern (9065 -> 9064) is put out with the candle lantern's lines ("You extinguish the lantern." spam, and its refusal as the last light): its own were not captured. - The oil, bullseye and sapphire lanterns use the candle lantern's refusal line; they share its diff --git a/server/plugins/items/LightSources.plugin.js b/server/plugins/items/LightSources.plugin.js index 8400ccad85..5bf6048d13 100644 --- a/server/plugins/items/LightSources.plugin.js +++ b/server/plugins/items/LightSources.plugin.js @@ -14,7 +14,9 @@ * wording, not Wiki text or recorded dialogue. * * Captured (rsprox 70 tick 1626, 75 tick 11666): lighting a torch says "You light your torch." and plays - * no sequence and no sound. Nothing else was captured, so no other item gets a message or an animation, and + * no sequence and no sound. The white candle lantern says "You light the lantern." as a spam (filterable) + * line and plays synth 3226, with no sequence (rsprox local 1000134, 1000135, 1000140: 6 of 6 lightings); + * the black candle lantern does the same (Ours, as its Extinguish). Nothing else was captured, so no other item gets a message, sound or animation, and * the level refusal reuses OilLights' wording. The lit item replaces the unlit one in its slot (setId), so a * preset, untradeable or unbankable copy stays one, and the current level counts, so a boost lights what it * should (Wiki). @@ -37,15 +39,19 @@ const { isCooker } = require("../skills/Cooking.plugin"); const Darkness = require("../world/Darkness.plugin"); let core; -/** Unlit item id -> { lit, level, message? }. */ +/** Synth played when a lantern is lit (the oil, bullseye and sapphire lanterns in OilLights use it too). */ +const LANTERN_LIGHT_SOUND = 3226; +/** Unlit item id -> { lit, level, message?, spam?, sound? }. */ let lights; function build(I) { return new Map([ [I.UNLIT_TORCH, { lit: I.LIT_TORCH, level: 1, message: "You light your torch." }], [I.CANDLE, { lit: I.LIT_CANDLE, level: 1 }], - [I.CANDLE_LANTERN, { lit: I.CANDLE_LANTERN_3, level: 4 }], // white - [I.CANDLE_LANTERN_4, { lit: I.CANDLE_LANTERN_6, level: 4 }], // black + // White: the spam line and synth 3226 on the click tick (rsprox local 1000134 t438/t585/t780/t1144, + // 1000135 t221, 1000140 t763). Ours: the black one (not captured) is lit the same way, as it is put out. + [I.CANDLE_LANTERN, { lit: I.CANDLE_LANTERN_3, level: 4, spam: "You light the lantern.", sound: LANTERN_LIGHT_SOUND }], + [I.CANDLE_LANTERN_4, { lit: I.CANDLE_LANTERN_6, level: 4, spam: "You light the lantern.", sound: LANTERN_LIGHT_SOUND }], [I.UNLIT_BUG_LANTERN, { lit: I.LIT_BUG_LANTERN, level: 33 }], [I.EMERALD_LANTERN, { lit: I.EMERALD_LANTERN_2, level: 49 }], ]); @@ -99,6 +105,8 @@ function applyLight(player, item, source) { item.setId(source.lit); player.getInventory().refreshItems(); if (source.message) player.sendMessage(source.message); + if (source.spam) player.getPacketSender().sendTypedMessage(core.ChatType.SPAM, source.spam); + if (source.sound) player.getPacketSender().sendSound(source.sound, 100, 0); // `light-sources:lit` { player, itemId }: the lit item, on its tick (the league's "Light a Torch", // rsprox 237/1098 tick 16024, the tick the tinderbox was used). core.PluginManager?.emitCustomEvent?.("light-sources:lit", { player, itemId: source.lit }); diff --git a/server/tests/light-sources.test.cjs b/server/tests/light-sources.test.cjs index 79d88e58f2..690d87df18 100644 --- a/server/tests/light-sources.test.cjs +++ b/server/tests/light-sources.test.cjs @@ -167,6 +167,40 @@ test("as captured (rsprox 70, 75): the torch says 'You light your torch.' and pl assert.deepEqual(f.animations, [], "no sequence in the capture"); }); +// rsprox local 1000134 t438/t585/t780/t1144, 1000135 t221, 1000140 t763 (rev 226): tinderbox on the unlit +// white candle lantern (4529) -> slot becomes 4531, spam "You light the lantern." and synth 3226, same tick. +test("as captured: a candle lantern says 'You light the lantern.' as spam and plays synth 3226", async (t) => { + // White as captured; black (not captured) is lit the same way. + for (const [unlit, lit] of [[I.CANDLE_LANTERN, I.CANDLE_LANTERN_3], [I.CANDLE_LANTERN_4, I.CANDLE_LANTERN_6]]) { + const f = actor(t, 4); + const typed = []; + const sounds = []; + const sender = f.p.getPacketSender(); + t.mock.method(sender, "sendTypedMessage", (type, message) => { typed.push([type, message]); return sender; }); + t.mock.method(sender, "sendSound", (id) => { sounds.push(id); return sender; }); + f.inv.setItem(0, item(unlit)); + f.inv.setItem(1, item(I.TINDERBOX)); + await useOn(f, 1, 0); + assert.deepEqual(carried(f), [lit, I.TINDERBOX]); + assert.deepEqual(typed, [[core.ChatType.SPAM, "You light the lantern."]]); + assert.deepEqual(sounds, [3226]); + assert.deepEqual(f.animations, [], "no sequence in the capture"); + } + + // Below 4 Firemaking it stays unlit: no line, no sound. + const low = actor(t, 3); + const lowTyped = []; + const lowSounds = []; + const lowSender = low.p.getPacketSender(); + t.mock.method(lowSender, "sendTypedMessage", (type, message) => { lowTyped.push(message); return lowSender; }); + t.mock.method(lowSender, "sendSound", (id) => { lowSounds.push(id); return lowSender; }); + low.inv.setItem(0, item(I.CANDLE_LANTERN)); + low.inv.setItem(1, item(I.TINDERBOX)); + await useOn(low, 1, 0); + assert.deepEqual(carried(low), [I.CANDLE_LANTERN, I.TINDERBOX]); + assert.deepEqual([lowTyped, lowSounds], [[], []]); +}); + test("the other new lights play no animation either (none captured, none invented)", async (t) => { for (const [label, unlit, , level] of LIGHTS.slice(1)) { const f = actor(t, level); From 4db9a65959d2b7bc38ccc6a635e8bf46478d3df8 Mon Sep 17 00:00:00 2001 From: Bandit-HaxUnit <100861363+Bandit-HaxUnit@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:23:25 +0100 Subject: [PATCH 2/2] Light sources: tidy the doc list and header wrap Co-Authored-By: Claude Opus 5.5 --- docs/light-sources.md | 1 - server/plugins/items/LightSources.plugin.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/light-sources.md b/docs/light-sources.md index d0c953283b..5424684ede 100644 --- a/docs/light-sources.md +++ b/docs/light-sources.md @@ -28,7 +28,6 @@ Tests: `server/tests/light-sources.test.cjs`. ## Ours - The black candle lantern's lighting line and sound are the white one's (not captured). - - The lit emerald lantern (9065 -> 9064) is put out with the candle lantern's lines ("You extinguish the lantern." spam, and its refusal as the last light): its own were not captured. - The oil, bullseye and sapphire lanterns use the candle lantern's refusal line; they share its diff --git a/server/plugins/items/LightSources.plugin.js b/server/plugins/items/LightSources.plugin.js index 5bf6048d13..8484e0f9ec 100644 --- a/server/plugins/items/LightSources.plugin.js +++ b/server/plugins/items/LightSources.plugin.js @@ -16,8 +16,8 @@ * Captured (rsprox 70 tick 1626, 75 tick 11666): lighting a torch says "You light your torch." and plays * no sequence and no sound. The white candle lantern says "You light the lantern." as a spam (filterable) * line and plays synth 3226, with no sequence (rsprox local 1000134, 1000135, 1000140: 6 of 6 lightings); - * the black candle lantern does the same (Ours, as its Extinguish). Nothing else was captured, so no other item gets a message, sound or animation, and - * the level refusal reuses OilLights' wording. The lit item replaces the unlit one in its slot (setId), so a + * the black candle lantern does the same (Ours, as its Extinguish). Nothing else was captured, so no other + * item gets a message, sound or animation, and the level refusal reuses OilLights' wording. The lit item replaces the unlit one in its slot (setId), so a * preset, untradeable or unbankable copy stays one, and the current level counts, so a boost lights what it * should (Wiki). *