Keep the game's music when Play ends a run in the editor
A behavior with "Run in editor" kept its world until the frame after Play. By then the game's On start had already started its pattern or song, and ending the editor run called stopAll() on the sound library. The game came up silent. This is what turned the game blocks of e2e 64 and 65 red in suites 542 and 550. - EditorRun.modeChanged() ends the run the moment the mode leaves edit. enterPlay() announces the mode before the game is built, so the editor run's sounds stop first and the game's start after. - The Editor wires the mode event to it instead of invalidate(). Tests: - e2e 64 starts its game with an idle "Run in editor" behavior in the scene. Without the fix it fails like CI did, "game": [] and 2 FAILED. With it: ALL PASSED, 30 checks (stein2). - Unit editor-run: 21 green, 1 new. - Typecheck, ESLint, Prettier clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f1f4a57589
commit
af9b202100
4 files changed
+50
-4
No files matched your search
@@ -41,6 +41,15 @@ export class EditorRun {
|
||||
if (!this.writing) this.stale = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Playing starts: the run ends at once, not on the next frame. The game's `On start` runs in the
|
||||
* same click, and stopping the run's sounds a frame later would take its music along.
|
||||
*/
|
||||
modeChanged(): void {
|
||||
if (this.state.mode !== 'edit') this.stop();
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
/** `step` is what the global clock moved this frame – already scaled and capped. */
|
||||
tick(step: number): void {
|
||||
if (this.state.mode !== 'edit') {
|
||||
|
||||
Reference in new issue
Block a user