mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -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}`);
|
log.warn(`Unknown motor direction in setMotorDirection: ${args.DIRECTION}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// keep the motor on if it's running, and update the pending timeout
|
// keep the motor on if it's running, and update the pending timeout if needed
|
||||||
if (motor.isOn && motor.pendingTimeoutDelay) {
|
if (motor.isOn) {
|
||||||
motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
if (motor.pendingTimeoutDelay) {
|
||||||
|
motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
||||||
|
} else {
|
||||||
|
motor.setMotorOn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue