pxt-common-packages 12.2.6 → 12.2.7

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 (33) hide show
  1. package/libs/azureiot/built/debug/binary.js +485 -485
  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 +8466 -8762
  5. package/libs/controller---none/built/debug/binary.js +8445 -8741
  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 +486 -486
  9. package/libs/game/built/debug/binary.js +8358 -8654
  10. package/libs/game/physics.ts +51 -32
  11. package/libs/game/sprite.ts +1 -0
  12. package/libs/game/spritemap.ts +7 -3
  13. package/libs/game/sprites.ts +1 -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/mqtt/built/debug/binary.js +200 -200
  19. package/libs/multiplayer/player.ts +1 -1
  20. package/libs/net/built/debug/binary.js +200 -200
  21. package/libs/net-game/built/debug/binary.js +10507 -10803
  22. package/libs/palette/built/debug/binary.js +8249 -8545
  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/rotary-encoder/built/debug/binary.js +8 -8
  29. package/libs/screen/built/debug/binary.js +50 -50
  30. package/libs/servo/built/debug/binary.js +8 -8
  31. package/libs/sprite-scaling/built/debug/binary.js +8249 -8545
  32. package/libs/storyboard/built/debug/binary.js +8249 -8545
  33. package/package.json +1 -1
@@ -189,7 +189,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
189
189
  s._x = Fx.add(s._x, stepX);
190
190
  s._y = Fx.add(s._y, stepY);
191
191
 
192
- if (!(s.flags & SPRITE_NO_SPRITE_OVERLAPS)) {
192
+ if (!(s.flags & SPRITE_NO_SPRITE_OVERLAPS) && s._kindsOverlappedWith.length) {
193
193
  this.map.insertAABB(s);
194
194
  }
195
195
  if (tileMap && tileMap.enabled) {
@@ -311,43 +311,62 @@ class ArcadePhysicsEngine extends PhysicsEngine {
311
311
  control.enablePerfCounter("phys_collisions");
312
312
  if (!handlers.length) return;
313
313
 
314
- // sprites that have moved this step
315
- for (const ms of movedSprites) {
316
- const sprite = ms.sprite;
317
- if (sprite.flags & SPRITE_NO_SPRITE_OVERLAPS) continue;
318
- const overSprites = this.map.overlaps(ms.sprite);
319
-
320
- for (const overlapper of overSprites) {
321
- if (overlapper.flags & SPRITE_NO_SPRITE_OVERLAPS) continue;
322
- const thisKind = sprite.kind();
323
- const otherKind = overlapper.kind();
324
-
325
- // skip if no overlap event between these two kinds of sprites
326
- if (sprite._kindsOverlappedWith.indexOf(otherKind) === -1) continue;
327
-
328
- // Maintaining invariant that the sprite with the higher ID has the other sprite as an overlapper
329
- const higher = sprite.id > overlapper.id ? sprite : overlapper;
330
- const lower = higher === sprite ? overlapper : sprite;
331
-
332
- // if the two sprites are not currently engaged in an overlap event,
333
- // apply all matching overlap events
334
- if (higher._overlappers.indexOf(lower.id) === -1) {
335
- handlers
336
- .filter(h => (h.kind === thisKind && h.otherKind === otherKind)
337
- || (h.kind === otherKind && h.otherKind === thisKind)
338
- )
339
- .forEach(h => {
314
+ // clear the overlap lists on all sprites
315
+ for (const sprite of this.sprites) {
316
+ sprite._alreadyChecked = undefined;
317
+ }
318
+
319
+ for (const bucket of this.map.filledBuckets) {
320
+ if (bucket.length === 1) continue;
321
+
322
+ for (const sprite of bucket) {
323
+ if (sprite.flags & SPRITE_NO_SPRITE_OVERLAPS) continue;
324
+
325
+ for (const overlapper of bucket) {
326
+ if (overlapper === sprite) continue;
327
+ const thisKind = sprite.kind();
328
+ const otherKind = overlapper.kind();
329
+
330
+ // the sprite with the higher id maintains the overlap lists
331
+ const higher = sprite.id > overlapper.id ? sprite : overlapper;
332
+ const lower = higher === sprite ? overlapper : sprite;
333
+
334
+ if (!higher._alreadyChecked) {
335
+ higher._alreadyChecked = [];
336
+ }
337
+
338
+ // skip if we already compared these two
339
+ if (higher._alreadyChecked.indexOf(lower.id) !== -1) continue;
340
+
341
+ higher._alreadyChecked.push(lower.id);
342
+
343
+ // skip if already overlapping
344
+ if (higher._overlappers.indexOf(lower.id) !== -1) continue;
345
+
346
+ // skip if there is no overlap event between these two kinds of sprites
347
+ if (sprite._kindsOverlappedWith.indexOf(otherKind) === -1) continue;
348
+
349
+ // perform the actual overlap check
350
+ if (!higher.overlapsWith(lower)) continue;
351
+
352
+ // invoke all matching overlap event handlers
353
+ for (const h of handlers) {
354
+ if ((h.kind === thisKind && h.otherKind === otherKind)
355
+ || (h.kind === otherKind && h.otherKind === thisKind)) {
340
356
  higher._overlappers.push(lower.id);
341
357
  control.runInParallel(() => {
342
358
  if (!((sprite.flags | overlapper.flags) & SPRITE_NO_SPRITE_OVERLAPS)) {
343
- h.handler(
344
- thisKind === h.kind ? sprite : overlapper,
345
- thisKind === h.kind ? overlapper : sprite
346
- );
359
+ if (thisKind === h.kind) {
360
+ h.handler(sprite, overlapper)
361
+ }
362
+ else {
363
+ h.handler(overlapper, sprite)
364
+ }
347
365
  }
348
366
  higher._overlappers.removeElement(lower.id);
349
367
  });
350
- });
368
+ }
369
+ }
351
370
  }
352
371
  }
353
372
  }
@@ -270,6 +270,7 @@ class Sprite extends sprites.BaseSprite {
270
270
 
271
271
  _hitbox: game.Hitbox;
272
272
  _overlappers: number[];
273
+ _alreadyChecked: number[];
273
274
  _kindsOverlappedWith: number[];
274
275
 
275
276
  flags: number
@@ -5,6 +5,7 @@ namespace sprites {
5
5
  private rowCount: number;
6
6
  private columnCount: number;
7
7
  private buckets: Sprite[][];
8
+ filledBuckets: Sprite[][];
8
9
 
9
10
  constructor() {
10
11
  this.buckets = [];
@@ -64,14 +65,15 @@ namespace sprites {
64
65
  const areaWidth = tMap ? tMap.areaWidth() : screen.width;
65
66
  const areaHeight = tMap ? tMap.areaHeight() : screen.height;
66
67
 
67
- this.cellWidth = Math.clamp(8, areaWidth >> 2, maxWidth * 2);
68
- this.cellHeight = Math.clamp(8, areaHeight >> 2, maxHeight * 2);
68
+ this.cellWidth = Math.clamp(8, areaWidth >> 2, maxWidth << 1);
69
+ this.cellHeight = Math.clamp(8, areaHeight >> 2, maxHeight << 1);
69
70
  this.rowCount = Math.idiv(areaHeight, this.cellHeight);
70
71
  this.columnCount = Math.idiv(areaWidth, this.cellWidth);
71
72
  }
72
73
 
73
74
  clear() {
74
75
  this.buckets = [];
76
+ this.filledBuckets = [];
75
77
  }
76
78
 
77
79
  private key(x: number, y: number): number {
@@ -83,8 +85,10 @@ namespace sprites {
83
85
  private insertAtKey(x: number, y: number, sprite: Sprite) {
84
86
  const k = this.key(x, y);
85
87
  let bucket = this.buckets[k];
86
- if (!bucket)
88
+ if (!bucket) {
87
89
  bucket = this.buckets[k] = [];
90
+ this.filledBuckets.push(bucket);
91
+ }
88
92
  if (bucket.indexOf(sprite) < 0)
89
93
  bucket.push(sprite);
90
94
  }
@@ -56,6 +56,7 @@ namespace sprites {
56
56
  //% blockAliasFor="sprites.create"
57
57
  //% expandableArgumentMode=toggle
58
58
  //% weight=99 help=sprites/create
59
+ //% duplicateShadowOnDrag
59
60
  export function __create(img: Image, kind?: number): Sprite {
60
61
  return sprites.create(img, kind);
61
62
  }
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48805(s) {
59
+ function _main___P48753(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___49048 = (undefined);
70
- globals._pollEventQueue___49061 = (undefined);
69
+ globals._intervals___48996 = (undefined);
70
+ globals._pollEventQueue___49009 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48805.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48805.continuations = [ ]
75
+ _main___P48753.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48753.continuations = [ ]
77
77
 
78
- function _main___P48805_mk(s) {
78
+ function _main___P48753_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48805, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48753, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P48805_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48805
91
+ return _main___P48753
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P98758(s) {
59
+ function _main___P98602(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___99001 = (undefined);
70
- globals._pollEventQueue___99014 = (undefined);
69
+ globals._intervals___98845 = (undefined);
70
+ globals._pollEventQueue___98858 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P98758.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P98758.continuations = [ ]
75
+ _main___P98602.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P98602.continuations = [ ]
77
77
 
78
- function _main___P98758_mk(s) {
78
+ function _main___P98602_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P98758, depth: s.depth + 1,
81
+ parent: s, fn: _main___P98602, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P98758_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P98758
91
+ return _main___P98602
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60118(s) {
59
+ function _main___P60066(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___60361 = (undefined);
70
- globals._pollEventQueue___60374 = (undefined);
69
+ globals._intervals___60309 = (undefined);
70
+ globals._pollEventQueue___60322 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60118.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60118.continuations = [ ]
75
+ _main___P60066.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60066.continuations = [ ]
77
77
 
78
- function _main___P60118_mk(s) {
78
+ function _main___P60066_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60118, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60066, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P60118_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P60118
91
+ return _main___P60066
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P192450(s) {
59
+ function _main___P192086(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___192693 = (undefined);
70
- globals._pollEventQueue___192706 = (undefined);
69
+ globals._intervals___192329 = (undefined);
70
+ globals._pollEventQueue___192342 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P192450.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P192450.continuations = [ ]
75
+ _main___P192086.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P192086.continuations = [ ]
77
77
 
78
- function _main___P192450_mk(s) {
78
+ function _main___P192086_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P192450, depth: s.depth + 1,
81
+ parent: s, fn: _main___P192086, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P192450_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P192450
91
+ return _main___P192086
92
92
  })