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
@@ -178,6 +178,24 @@ describe('the run-in-editor switch', () => {
|
||||
expect(f.boxX()).toBe(0);
|
||||
});
|
||||
|
||||
it('ends the moment playing starts, before the game’s On start, not a frame later', () => {
|
||||
const f = scene();
|
||||
f.state.on('mode', () => f.run.modeChanged());
|
||||
f.state.execute(new SetOverrideCommand(f.sceneId, f.logic, 'runInEditor', true));
|
||||
f.frame(0.1);
|
||||
expect(f.run.debugInfo().running).toBe(true);
|
||||
|
||||
// The game is built right after `enterPlay` in the same click; a run ended only by the next
|
||||
// frame stopped every sound, the music its On start had just begun with them.
|
||||
f.state.enterPlay();
|
||||
expect(f.run.debugInfo().running).toBe(false);
|
||||
expect(f.keyboard.world).toBeNull();
|
||||
|
||||
f.state.exitPlay();
|
||||
f.frame(0.1);
|
||||
expect(f.run.debugInfo().running).toBe(true);
|
||||
});
|
||||
|
||||
it('does not run a behavior whose scene is not the loaded one', () => {
|
||||
const f = scene();
|
||||
f.state.execute(new SetOverrideCommand(f.sceneId, f.logic, 'runInEditor', true));
|
||||
|
||||
Reference in new issue
Block a user