Skip to content

SceneSwitcher: Grant DEBUG_ABILITIES when URL hash changes#2100

Merged
manuq merged 1 commit intomainfrom
wjt/sceneswitcher-grant-debug-abilities-when-url-hash-changes
Apr 2, 2026
Merged

SceneSwitcher: Grant DEBUG_ABILITIES when URL hash changes#2100
manuq merged 1 commit intomainfrom
wjt/sceneswitcher-grant-debug-abilities-when-url-hash-changes

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented Apr 2, 2026

Previously, if you launched a single scene in the editor, you would have
the ability to repel and grapple; while if you jumped directly to a
scene in a web build via the URL hash, you would have no abilities.

This is because when running a single scene in the editor, it is
GameState._ready() which applies various changes like disabling
persistence and granting repel + grapple; while URL hash changes go
through SceneSwitcher. Even the initial hash restoration is done in (a
deferred call from) SceneSwitcher._ready().

It would be possible to teach the JavaScript side to inspect the URL
hash and pass --scene res://... to Godot when launching the game, but
this would mean reimplementing SceneSwitcher on the Godot side, and the
game failing to launch if the URL hash does not match an extant scene.

And I believe we want to grant debug abilities if you edit the URL hash
on a running game.

Add the same logic to grant GameState.DEBUG_ABILITIES to SceneSwitcher.

Previously, if you launched a single scene in the editor, you would have
the ability to repel and grapple; while if you jumped directly to a
scene in a web build via the URL hash, you would have no abilities.

This is because when running a single scene in the editor, it is
GameState._ready() which applies various changes like disabling
persistence and granting repel + grapple; while URL hash changes go
through SceneSwitcher. Even the initial hash restoration is done in (a
deferred call from) SceneSwitcher._ready().

It would be possible to teach the JavaScript side to inspect the URL
hash and pass `--scene res://...` to Godot when launching the game, but
this would mean reimplementing SceneSwitcher on the Godot side, and the
game failing to launch if the URL hash does not match an extant scene.

And I believe we want to grant debug abilities if you edit the URL hash
on a running game.

Add the same logic to grant GameState.DEBUG_ABILITIES to SceneSwitcher.
@wjt wjt requested a review from a team as a code owner April 2, 2026 17:32
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/sceneswitcher-grant-debug-abilities-when-url-hash-changes/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

Copy link
Copy Markdown
Collaborator

@manuq manuq left a comment

Choose a reason for hiding this comment

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

Thanks for the Easters present. Yes, edit the URL hash on a running game is what I usually do too, it saves reloading.

@manuq manuq merged commit ced4bc9 into main Apr 2, 2026
6 checks passed
@manuq manuq deleted the wjt/sceneswitcher-grant-debug-abilities-when-url-hash-changes branch April 2, 2026 18:18
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.

2 participants