pxt-common-packages 13.2.1 → 13.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/libs/azureiot/built/debug/binary.js +461 -461
  2. package/libs/color/built/debug/binary.js +8 -8
  3. package/libs/color-sensor/built/debug/binary.js +8 -8
  4. package/libs/controller/built/debug/binary.js +7756 -7829
  5. package/libs/controller---none/built/debug/binary.js +7764 -7837
  6. package/libs/datalogger/built/debug/binary.js +63 -63
  7. package/libs/edge-connector/built/debug/binary.js +8 -8
  8. package/libs/esp32/built/debug/binary.js +462 -462
  9. package/libs/game/built/debug/binary.js +7677 -7750
  10. package/libs/game/physics.ts +4 -2
  11. package/libs/game/pxt.json +4 -1
  12. package/libs/game/test.ts +60 -0
  13. package/libs/game/tilemap.ts +6 -0
  14. package/libs/lcd/built/debug/binary.js +8 -8
  15. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  16. package/libs/lora/built/debug/binary.js +8 -8
  17. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  18. package/libs/mixer/instrument.ts +5 -0
  19. package/libs/mqtt/built/debug/binary.js +176 -176
  20. package/libs/net/built/debug/binary.js +176 -176
  21. package/libs/net-game/built/debug/binary.js +9568 -9641
  22. package/libs/palette/built/debug/binary.js +7676 -7749
  23. package/libs/pixel/built/debug/binary.js +8 -8
  24. package/libs/power/built/debug/binary.js +8 -8
  25. package/libs/proximity/built/debug/binary.js +8 -8
  26. package/libs/radio/built/debug/binary.js +8 -8
  27. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  28. package/libs/radio-broadcast/docs/reference/radio/on-received-message.md +1 -1
  29. package/libs/radio-broadcast/docs/reference/radio/send-message.md +2 -2
  30. package/libs/radio-broadcast/docs/reference/radio-broadcast.md +2 -2
  31. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  32. package/libs/screen/_locales/screen-strings.json +1 -1
  33. package/libs/screen/built/debug/binary.js +50 -50
  34. package/libs/screen/fieldeditors.ts +2 -2
  35. package/libs/servo/built/debug/binary.js +8 -8
  36. package/libs/sprite-scaling/built/debug/binary.js +7676 -7749
  37. package/libs/storyboard/built/debug/binary.js +7676 -7749
  38. package/package.json +2 -2
@@ -45,6 +45,7 @@ class MovingSprite {
45
45
  ) { }
46
46
  }
47
47
 
48
+
48
49
  /**
49
50
  * A physics engine that does simple AABB bounding box check
50
51
  */
@@ -626,7 +627,8 @@ class ArcadePhysicsEngine extends PhysicsEngine {
626
627
 
627
628
  // if the sprite can move through walls, it can overlap the underlying tile.
628
629
  if (!tm.isObstacle(x0, y0) || !!(s.flags & sprites.Flag.GhostThroughWalls)) {
629
- overlappedTiles.push(tm.getTile(x0, y0));
630
+ const location = tm.getTile(x0, y0);
631
+ overlappedTiles.push(location);
630
632
  }
631
633
  }
632
634
  }
@@ -655,7 +657,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
655
657
  const tileOverlapHandlers = game.currentScene().tileOverlapHandlers;
656
658
  if (tileOverlapHandlers) {
657
659
  tileOverlapHandlers
658
- .filter(h => h.spriteKind == sprite.kind() && h.tileKind.equals(tiles.getTileImage(tile)))
660
+ .filter(h => h.spriteKind == sprite.kind() && h.tileKind.equals(tile._getOriginalImage()))
659
661
  .forEach(h => h.handler(sprite, tile));
660
662
  }
661
663
  }
@@ -59,6 +59,9 @@
59
59
  "keymap.cpp",
60
60
  "keymap.ts"
61
61
  ],
62
+ "testFiles": [
63
+ "test.ts"
64
+ ],
62
65
  "public": true,
63
66
  "dependencies": {
64
67
  "settings": "file:../settings",
@@ -66,4 +69,4 @@
66
69
  "mixer": "file:../mixer",
67
70
  "power": "file:../power"
68
71
  }
69
- }
72
+ }
@@ -0,0 +1,60 @@
1
+ namespace SpriteKind {
2
+ export const TestPlayer = SpriteKind.create();
3
+ }
4
+
5
+ const overlapTile = img`
6
+ 1
7
+ `;
8
+ const neutralTile = img`
9
+ 2
10
+ `;
11
+ const dangerTile = img`
12
+ 3
13
+ `;
14
+ const emptyTile = img`
15
+ .
16
+ `;
17
+
18
+ const baseLayer = img`
19
+ . .
20
+ . .
21
+ `;
22
+
23
+ const beforeSwap = tiles.createTilemap(
24
+ hex`0200020001020202`,
25
+ baseLayer,
26
+ [emptyTile, overlapTile, neutralTile, dangerTile],
27
+ TileScale.Eight
28
+ );
29
+
30
+ const afterSwap = tiles.createTilemap(
31
+ hex`0200020002030202`,
32
+ baseLayer,
33
+ [emptyTile, overlapTile, neutralTile, dangerTile],
34
+ TileScale.Eight
35
+ );
36
+
37
+ let overlapSwapped = 0;
38
+ let dangerHits = 0;
39
+
40
+ scene.onOverlapTile(SpriteKind.TestPlayer, overlapTile, function (sprite: Sprite, location: tiles.Location) {
41
+ overlapSwapped++;
42
+ tiles.setCurrentTilemap(afterSwap);
43
+ sprite.setPosition(100, 100);
44
+ });
45
+
46
+ scene.onOverlapTile(SpriteKind.TestPlayer, dangerTile, function (sprite: Sprite, location: tiles.Location) {
47
+ dangerHits++;
48
+ });
49
+
50
+ tiles.setCurrentTilemap(beforeSwap);
51
+
52
+ const spriteImage = image.create(16, 16);
53
+ spriteImage.fill(1);
54
+ const sprite = sprites.create(spriteImage, SpriteKind.TestPlayer);
55
+ sprite.setPosition(8, 8);
56
+
57
+ pause(100);
58
+
59
+ control.assert(overlapSwapped == 1, 0x200);
60
+ control.assert(dangerHits == 0, 0x201);
@@ -18,10 +18,12 @@ namespace tiles {
18
18
  export class Location {
19
19
  protected _row: number;
20
20
  protected _col: number;
21
+ protected _originalMap: TileMap;
21
22
 
22
23
  constructor(col: number, row: number, map: TileMap) {
23
24
  this._col = col;
24
25
  this._row = row;
26
+ this._originalMap = map;
25
27
  }
26
28
 
27
29
  get tileMap() {
@@ -103,6 +105,10 @@ namespace tiles {
103
105
  return this.tileMap.getTileImage(this.tileSet);
104
106
  }
105
107
 
108
+ _getOriginalImage(): Image {
109
+ return this._originalMap.getTileImage(this._originalMap.getTileIndex(this._col, this._row));
110
+ }
111
+
106
112
  /**
107
113
  * Returns the neighboring location in a specifc direction from a location in a tilemap
108
114
  * @param direction The direction to fetch the location in
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P49369(s) {
59
+ function _main___P49365(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___49613 = (undefined);
70
- globals._pollEventQueue___49626 = (undefined);
69
+ globals._intervals___49609 = (undefined);
70
+ globals._pollEventQueue___49622 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P49369.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P49369.continuations = [ ]
75
+ _main___P49365.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P49365.continuations = [ ]
77
77
 
78
- function _main___P49369_mk(s) {
78
+ function _main___P49365_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P49369, depth: s.depth + 1,
81
+ parent: s, fn: _main___P49365, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P49369_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P49369
90
+ return _main___P49365
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P100630(s) {
59
+ function _main___P100618(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___100874 = (undefined);
70
- globals._pollEventQueue___100887 = (undefined);
69
+ globals._intervals___100862 = (undefined);
70
+ globals._pollEventQueue___100875 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P100630.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P100630.continuations = [ ]
75
+ _main___P100618.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P100618.continuations = [ ]
77
77
 
78
- function _main___P100630_mk(s) {
78
+ function _main___P100618_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P100630, depth: s.depth + 1,
81
+ parent: s, fn: _main___P100618, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P100630_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P100630
90
+ return _main___P100618
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60652(s) {
59
+ function _main___P60648(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___60896 = (undefined);
70
- globals._pollEventQueue___60909 = (undefined);
69
+ globals._intervals___60892 = (undefined);
70
+ globals._pollEventQueue___60905 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60652.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60652.continuations = [ ]
75
+ _main___P60648.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60648.continuations = [ ]
77
77
 
78
- function _main___P60652_mk(s) {
78
+ function _main___P60648_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60652, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60648, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P60652_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P60652
90
+ return _main___P60648
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P196988(s) {
59
+ function _main___P196960(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___197232 = (undefined);
70
- globals._pollEventQueue___197245 = (undefined);
69
+ globals._intervals___197204 = (undefined);
70
+ globals._pollEventQueue___197217 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P196988.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P196988.continuations = [ ]
75
+ _main___P196960.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P196960.continuations = [ ]
77
77
 
78
- function _main___P196988_mk(s) {
78
+ function _main___P196960_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P196988, depth: s.depth + 1,
81
+ parent: s, fn: _main___P196960, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P196988_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P196988
90
+ return _main___P196960
91
91
  })
@@ -135,6 +135,11 @@ namespace music.sequencer {
135
135
  play(playbackMode: PlaybackMode) {
136
136
  if (control.deviceDalVersion() === "sim") {
137
137
  const seq = new _SimulatorSequencer();
138
+ seq.onStateChange(state => {
139
+ if (state === "stop") {
140
+ seq.dispose();
141
+ }
142
+ });
138
143
 
139
144
  if (playbackMode === PlaybackMode.UntilDone) {
140
145
  seq.play(this.buf, false);