mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-21 10:49:50 -04:00
Make the wait block's logic and behavior more consistent with Scratch 2 (#1759)
This commit is contained in:
parent
536305af1b
commit
967cab8f20
6 changed files with 126 additions and 12 deletions
src/engine
|
@ -68,6 +68,10 @@ class Sequencer {
|
|||
stepThreads () {
|
||||
// Work time is 75% of the thread stepping interval.
|
||||
const WORK_TIME = 0.75 * this.runtime.currentStepTime;
|
||||
// For compatibility with Scatch 2, update the millisecond clock
|
||||
// on the Runtime once per step (see Interpreter.as in Scratch 2
|
||||
// for original use of `currentMSecs`)
|
||||
this.runtime.updateCurrentMSecs();
|
||||
// Start counting toward WORK_TIME.
|
||||
this.timer.start();
|
||||
// Count of active threads.
|
||||
|
@ -134,6 +138,7 @@ class Sequencer {
|
|||
activeThread.status === Thread.STATUS_DONE) {
|
||||
// Finished with this thread.
|
||||
stoppedThread = true;
|
||||
this.runtime.updateCurrentMSecs();
|
||||
}
|
||||
}
|
||||
// We successfully ticked once. Prevents running STATUS_YIELD_TICK
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue