From 941664eef407050510a47e7377acd8c0379dabb1 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 8 Sep 2021 18:05:29 +0200 Subject: [PATCH] disabled "when this scene starts" hat blocks to directly switch to another scene --- HISTORY.md | 1 + src/threads.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 48b43e60..a8e1bd3c 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -37,6 +37,7 @@ * objects: changed category for "switch to scene" to control * blocks, objects, threads: new hat block for "when this scene starts" * blocks, threads: changed "switch to scene" to be a stop block +* threads: disabled "when this scene starts" hat blocks to directly switch to another scene ### 2021-09-07 * blocks, objects, threads: new change-of-scene event diff --git a/src/threads.js b/src/threads.js index 7e44c76d..3eef925f 100644 --- a/src/threads.js +++ b/src/threads.js @@ -4710,7 +4710,12 @@ Process.prototype.doSwitchToScene = function (id) { ide, scenes, num, scene; this.assertAlive(rcvr); - if (this.readyToTerminate) {return; } // let the user press "stop" or "esc" + if (this.readyToTerminate || this.topBlock.selector === 'receiveOnScene') { + // let the user press "stop" or "esc", + // prevent "when this scene starts" hat blocks from directly + // switching to another + return; + } ide = rcvr.parentThatIsA(IDE_Morph); scenes = ide.scenes;