mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Fixing motor direction block to also work when the motor is on indefinitely.
This commit is contained in:
parent
82df80a04c
commit
35a2411f92
1 changed files with 7 additions and 3 deletions
|
@ -995,9 +995,13 @@ class Scratch3WeDo2Blocks {
|
|||
log.warn(`Unknown motor direction in setMotorDirection: ${args.DIRECTION}`);
|
||||
break;
|
||||
}
|
||||
// keep the motor on if it's running, and update the pending timeout
|
||||
if (motor.isOn && motor.pendingTimeoutDelay) {
|
||||
motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
||||
// keep the motor on if it's running, and update the pending timeout if needed
|
||||
if (motor.isOn) {
|
||||
if (motor.pendingTimeoutDelay) {
|
||||
motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
||||
} else {
|
||||
motor.setMotorOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue