From cc1678fa9e61860ad5748c5eb47adbbc3b09ca2c Mon Sep 17 00:00:00 2001 From: DD Liu Date: Fri, 28 Jul 2017 14:38:26 -0400 Subject: [PATCH] Also run monitor blocks every frame --- src/engine/runtime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 591d6243e..53b31eb8a 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -478,7 +478,8 @@ class Runtime extends EventEmitter { }, opts); // Remove any existing thread. for (let i = 0; i < this.threads.length; i++) { - if (this.threads[i].topBlock === topBlockId) { + // Toggling a script that's already running turns it off + if (this.threads[i].topBlock === topBlockId && this.threads[i].status !== Thread.STATUS_DONE) { const blockContainer = opts.target.blocks; const opcode = blockContainer.getOpcode(blockContainer.getBlock(topBlockId)); @@ -487,7 +488,6 @@ class Runtime extends EventEmitter { // edge activated hat thread that runs every frame continue; } - this._removeThread(this.threads[i]); return; }