Skip to content

Home teleport: casting again mid-cast restarts the cast (#6630) - #6641

Merged
UnhealthyKraken merged 1 commit into
RSPSApp:mainfrom
Bandit-HaxUnit:fix/6630-home-teleport-recast
Nov 23, 2026
Merged

UnhealthyKraken merged 1 commit into
RSPSApp:mainfrom
Bandit-HaxUnit:fix/6630-home-teleport-recast

Conversation

@Bandit-HaxUnit

@Bandit-HaxUnit Bandit-HaxUnit commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #6630

Problem

Clicking Home Teleport again while it is casting played every sound again, once per click.

Server Live
Second click mid-cast starts a second cast task beside the first; both play each step's animation and sound, and the first one lands at +24 the cast starts over on the second click's tick; nothing of the first cast plays after it, one landing 24 ticks after the second click

Each click on the spell called startHomeTeleport, which submitted a new task without stopping the running one. Before tick 21 nothing blocks the spell (normal teleports block movement immediately, so checkReqs already refuses them). The same sequence is shared by the four home teleports, Minigame Teleport and the league casts.

Fix

  • server/plugins/combat/HomeTeleportSequence.js: one cast per player (a WeakMap of the running task). A new cast stops the running one and starts over from tick 0, as live does. Once the cast has locked (tick 21) and until it lands, a new cast is refused (returns null), so the teleport goes ahead; normally checkReqs already refuses it there through the movement block.
  • docs/minigame-teleports.md: the captured re-cast.

Testing

  • server/tests/minigame-teleports.test.cjs: 19/19 pass. Two new tests: a second cast 2 ticks in gives one sound per step, from the second click's timeline, and one landing at +26; a cast after the lock is refused and the first teleport lands once.
  • Revert check: with main's HomeTeleportSequence.js both new tests fail (17/19).
  • Neighbours: league-areas 33/33, league-relics 13/13, league-fragments-sage 5/5, teleport-confirm-coverage 3/3, league-relics-demonic-pacts 113/113.
  • In game (agent MCP, fresh account at 3210,3424): Lumbridge Home Teleport, again 2 ticks later. 25 ticks after the first click the player is still at the start (the first cast would have landed at +24); it lands at 3222,3218 after the second cast's 24 ticks. The MCP doesn't report sounds, so the sound count itself is checked by the unit test.

Not covered

  • Other actions during the cast (opening an interface, eating) still don't interrupt it; only walking and combat do. This PR doesn't change that.
  • The only capture of a mid-cast re-click is on a league world (Lunar Home Teleport). The standard world's cast plays the same steps in every other recording.

Reference

  • rsprox captures: local recording 1001238 (rev 231), clicks at ticks 10286 and 10288: reset at 10288, chalk circle and sound 193 at 10289, steps from there, teleport at 10312.
  • OSRS Wiki: Home Teleport.
    Self-reviewed with the review checklist at f56d06c. Left open: a moving click gets no "You can't use that teleport at the moment." (live sends it, rsprox 1001362 tick 4552); that's outside this fix and would be its own issue.

🤖 Generated with Claude Code

Each click started another cast task while the first kept running, so
every step's sound played once per click. Keep one cast per player: a
new cast stops the running one and starts over, as live does (rsprox
1001238 ticks 10286/10288); once the cast has locked it is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bandit-HaxUnit
Bandit-HaxUnit marked this pull request as ready for review November 23, 2026 18:34
@UnhealthyKraken
UnhealthyKraken self-requested a review November 23, 2026 18:39
@UnhealthyKraken

Copy link
Copy Markdown
Collaborator

Reviewing this now (review loop, head f56d06c).

@UnhealthyKraken UnhealthyKraken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #6641 at f56d06c (main 4e684ac, integration tree 1fd2de66be6f969fd78cf6356bc0c151c2df0a72).

What it does

HomeTeleportSequence.startHomeTeleport now keeps one running cast per player (a WeakMap). A new cast before the lock tick stops the old one and starts again from tick 0. After the lock (tick 21) until landing it returns null. Shared by the four home teleports, Minigame Teleport and the league casts.

What was checked

  • Behaviour: no coins or runes are spent by the home teleport spells, and the cooldown is only set in onArrival, so a stopped cast starts no cooldown and nothing is taken twice. stop() on an unlocked cast releases nothing it didn't set. The refusal after lock is also made by TeleportHandler.checkReqs (playerReqs returns false while movement is blocked), so the new committed guard is a second line, as the PR says.
  • Parity (recording rsprox_transcripts/231/911270.txt, world 590): clicks on teleport_home_lunar at 10286 and 10288. Tick 10288 sends spotanim -1 and sequence -1, 10289 chalk circle (800 / 4847) and sound 193, then sound 196 at 10295, 194 at 10301, 195 at 10305, graphic 804 at 10309, teleport at 10312 (click + 24). No step of the first cast (its 196 would be 10293) plays after the second click. All of this matches the PR's timings. The first cast used graphic 1750 (league_twisted_chalk_circle) and the restart used 800; the server re-rolls chosenCast on every click, so that agrees.
  • Parity (second recording): rsprox_transcripts/239/900004.txt (standard world 351) shows the same restart for Minigame Teleport: cast chosen at 274 (chalk circle 275), spell clicked again at 276, choice at 280 resets, one circle and sound 193 at 281, teleport at 304 (choice + 24).
  • Wiki (Home Teleport): says the cast can be interrupted by most actions and gives no rule for casting again mid-cast, so nothing conflicts with the restart.
  • Traced: HomeTeleports.plugin.js, MinigameTeleports.plugin.js, HomeTeleport.LeagueAreaUnlocks.js, Teleport.LeagueAreaUnlocks.js, Teleports.LeagueRelics.js (all pass through checkReqs then TeleportHandler.confirm); ConnivingClues.LeagueRelics.js spends its contract in onStart just before startHomeTeleport.
  • Rules: no generated JSON, no plugin config or description change, LF endings.

Findings

No defects found.

Notes, not findings:

  • The cited "recording 1001238 (rev 231)" is rsprox_transcripts/231/911270.txt here (the 7-digit ids map to these files at a fixed offset), and every tick and sound quoted matches it. Its header says Sailing Beta World, not a league world as docs/minigame-teleports.md:25 and the PR say; the league chalk circle (1750) on the first cast is from that world's rolls. Worth correcting the wording next time the doc is touched.
  • "The only capture of a mid-cast re-click is on a league world" is not quite right: rsprox_transcripts/239/900004.txt is a standard world with a mid-cast re-click of Minigame Teleport (ticks 272/276/280), and it shows the same restart, so it backs the change further.
  • ConnivingClues.LeagueRelics.js uses up a contract in onStart before the cast starts, so with two contracts a second click before tick 21 spends a second one and restarts the cast. This was already the case before the PR (both casts ran), no recording or Wiki text settles it, and it is a different plugin.

Scope

ordinary

Verified

  • Build: yarn build in server/ on the integration commit: ok.
  • minigame-teleports.test.cjs: 19/19.
  • Consumers, each on its own: league-areas.test.cjs 33/33, league-relics.test.cjs 13/13, league-fragments-sage.test.cjs 5/5, teleport-confirm-coverage.test.cjs 3/3, league-relics-demonic-pacts.test.cjs 113/113.
  • Revert check: with main's HomeTeleportSequence.js, minigame-teleports.test.cjs is 17/19; the two new tests fail. File restored.
  • docs: yarn install --frozen-lockfile and yarn build (Yarn 1.22.22) in docs/: build complete.
  • Recording check: ticks, sound ids, animation and graphic ids of rsprox_transcripts/231/911270.txt read directly; all recordings with two home or minigame teleport clicks within 26 ticks scanned, the others are moving-click refusals or walk interrupts.
  • main+head merge tree: clean
  • generated JSON: none edited

Not verified

  • The live game run in the PR body (3210,3424 to 3222,3218) was not repeated; the unit tests and recordings cover the timing.
  • The PR's "moving click gets no message" note (recording 1001362 tick 4552, which is rsprox_transcripts/240/911378.txt): that file has two clicks at 4552 and 4556 and was not read further.
  • Sounds were checked in the unit test stubs only, not heard.
  • Whether live refuses a re-click after tick 21 by the busy flag or otherwise: no recording shows one.

Verdict

Merge

@UnhealthyKraken
UnhealthyKraken merged commit c65c121 into RSPSApp:main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Clicking a teleport spell multiple times causes the audio to overlap

2 participants