mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Change turnOnForever and turnOff behavior for power = 0 case.
This commit is contained in:
parent
6326694bff
commit
f0edd10346
1 changed files with 5 additions and 2 deletions
|
@ -496,7 +496,10 @@ class BoostMotor {
|
||||||
* @param {boolean} [resetState=true] - whether to reset the state of the motor when running this command.
|
* @param {boolean} [resetState=true] - whether to reset the state of the motor when running this command.
|
||||||
*/
|
*/
|
||||||
turnOnForever (resetState = true){
|
turnOnForever (resetState = true){
|
||||||
if (this.power === 0) return;
|
if (this.power === 0) {
|
||||||
|
this.turnOff(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetState) this.status = BoostMotorState.ON_FOREVER;
|
if (resetState) this.status = BoostMotorState.ON_FOREVER;
|
||||||
this._turnOn();
|
this._turnOn();
|
||||||
}
|
}
|
||||||
|
@ -552,7 +555,7 @@ class BoostMotor {
|
||||||
* @param {boolean} [useLimiter=true] - if true, use the rate limiter
|
* @param {boolean} [useLimiter=true] - if true, use the rate limiter
|
||||||
*/
|
*/
|
||||||
turnOff (useLimiter = true) {
|
turnOff (useLimiter = true) {
|
||||||
if (this.power === 0) return;
|
// if (this.power === 0) return;
|
||||||
|
|
||||||
const cmd = this._parent.generateOutputCommand(
|
const cmd = this._parent.generateOutputCommand(
|
||||||
this._index,
|
this._index,
|
||||||
|
|
Loading…
Reference in a new issue