diff --git a/src/compiler/irgen.js b/src/compiler/irgen.js index e84cbc21e5a..2a22749b345 100644 --- a/src/compiler/irgen.js +++ b/src/compiler/irgen.js @@ -865,14 +865,14 @@ class ScriptTreeGenerator { return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, { direction: new IntermediateInput(InputOpcode.OP_SUBTRACT, InputType.NUMBER, { left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER), - right: this.descendInputOfBlock(block, 'DEGREES') + right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER) }) }); case 'motion_turnright': return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, { direction: new IntermediateInput(InputOpcode.OP_ADD, InputType.NUMBER, { left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER), - right: this.descendInputOfBlock(block, 'DEGREES') + right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER) }) }); diff --git a/test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 b/test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 new file mode 100644 index 00000000000..4b8c5e14529 Binary files /dev/null and b/test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 differ diff --git a/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..d92f0cf7405 --- /dev/null +++ b/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot @@ -0,0 +1,17 @@ +// TW Snapshot +// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +target.setDirection(90); +target.setDirection((target.direction + 0.25)); +target.setDirection((target.direction + 0.25)); +if ((target.direction === 90.5)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..d92f0cf7405 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot @@ -0,0 +1,17 @@ +// TW Snapshot +// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +target.setDirection(90); +target.setDirection((target.direction + 0.25)); +target.setDirection((target.direction + 0.25)); +if ((target.direction === 90.5)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; })