pxt-common-packages 9.5.3 → 9.5.6

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 (40) hide show
  1. package/built/common-sim.d.ts +5 -0
  2. package/built/common-sim.js +52 -22
  3. package/libs/controller/built/debug/binary.js +39 -39
  4. package/libs/controller---none/built/debug/binary.js +39 -39
  5. package/libs/game/built/debug/binary.js +39 -39
  6. package/libs/game/docs/reference/sprites/sprite/follow.md +66 -0
  7. package/libs/game/docs/reference/sprites/sprite/set-bounce-on-wall.md +2 -2
  8. package/libs/game/docs/reference/sprites/sprite-kind.md +70 -0
  9. package/libs/game/docs/reference/tiles/get-neighboring-location.md +123 -0
  10. package/libs/game/docs/reference/tiles/get-tile-location.md +71 -30
  11. package/libs/game/docs/reference/tiles/get-tiles-by-type.md +66 -32
  12. package/libs/game/docs/reference/tiles/location.md +246 -0
  13. package/libs/game/docs/reference/tiles/place-on-random-tile.md +54 -21
  14. package/libs/game/docs/reference/tiles/place-on-tile.md +88 -0
  15. package/libs/game/docs/reference/tiles/set-current-tilemap.md +90 -0
  16. package/libs/game/docs/reference/tiles/set-tile-at.md +47 -30
  17. package/libs/game/docs/reference/tiles/set-tilemap.md +90 -0
  18. package/libs/game/docs/reference/tiles/set-wall-at.md +67 -68
  19. package/libs/game/docs/reference/tiles/tile-at-location-equals.md +97 -0
  20. package/libs/game/docs/reference/tiles/tile-at-location-is-wall.md +98 -0
  21. package/libs/game/docs/reference/tiles/tilemap.md +145 -0
  22. package/libs/game/sprite.ts +2 -1
  23. package/libs/game/spritekind.ts +1 -0
  24. package/libs/game/tilemap.ts +12 -11
  25. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  26. package/libs/net-game/built/debug/binary.js +39 -39
  27. package/libs/palette/built/debug/binary.js +39 -39
  28. package/libs/radio/_locales/radio-jsdoc-strings.json +2 -0
  29. package/libs/radio/_locales/radio-strings.json +4 -1
  30. package/libs/radio/radio.cpp +56 -3
  31. package/libs/radio/radio.ts +13 -2
  32. package/libs/radio/shims.d.ts +16 -1
  33. package/libs/radio/sim/radio.ts +18 -5
  34. package/libs/radio/sim/state.ts +37 -17
  35. package/libs/radio-broadcast/_locales/radio-broadcast-strings.json +2 -1
  36. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  37. package/libs/radio-broadcast/radio-broadcast.ts +2 -0
  38. package/libs/sprite-scaling/built/debug/binary.js +6782 -6782
  39. package/libs/storyboard/built/debug/binary.js +39 -39
  40. package/package.json +2 -2
@@ -4842,7 +4842,7 @@ switch (step) {
4842
4842
  return leaveAccessor(s, r0)
4843
4843
  default: oops()
4844
4844
  } } }
4845
- Sprite_height__P171134.info = {"start":11642,"length":61,"line":413,"column":4,"endLine":415,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"height","argumentNames":["this"]}
4845
+ Sprite_height__P171134.info = {"start":11668,"length":61,"line":413,"column":4,"endLine":415,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"height","argumentNames":["this"]}
4846
4846
  Sprite_height__P171134.isGetter = true;
4847
4847
 
4848
4848
  function Sprite_height__P171134_mk(s) {
@@ -5056,7 +5056,7 @@ switch (step) {
5056
5056
  return leave(s, r0)
5057
5057
  default: oops()
5058
5058
  } } }
5059
- Sprite_top__P171140.info = {"start":12788,"length":256,"line":454,"column":4,"endLine":464,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"top","argumentNames":["this","value"]}
5059
+ Sprite_top__P171140.info = {"start":12814,"length":256,"line":454,"column":4,"endLine":464,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"top","argumentNames":["this","value"]}
5060
5060
 
5061
5061
  function Sprite_top__P171140_mk(s) {
5062
5062
  checkStack(s.depth);
@@ -5172,7 +5172,7 @@ switch (step) {
5172
5172
  return leaveAccessor(s, r0)
5173
5173
  default: oops()
5174
5174
  } } }
5175
- Sprite_top__P171139.info = {"start":12645,"length":53,"line":449,"column":4,"endLine":451,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"top","argumentNames":["this"]}
5175
+ Sprite_top__P171139.info = {"start":12671,"length":53,"line":449,"column":4,"endLine":451,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"top","argumentNames":["this"]}
5176
5176
  Sprite_top__P171139.isGetter = true;
5177
5177
 
5178
5178
  function Sprite_top__P171139_mk(s) {
@@ -16522,7 +16522,7 @@ switch (step) {
16522
16522
  return leave(s, r0)
16523
16523
  default: oops()
16524
16524
  } } }
16525
- Sprite_destroy__P171164.info = {"start":30100,"length":293,"line":963,"column":4,"endLine":972,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"destroy","argumentNames":["this","effect","duration"]}
16525
+ Sprite_destroy__P171164.info = {"start":30126,"length":293,"line":963,"column":4,"endLine":972,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"destroy","argumentNames":["this","effect","duration"]}
16526
16526
 
16527
16527
  function Sprite_destroy__P171164_mk(s) {
16528
16528
  checkStack(s.depth);
@@ -16657,7 +16657,7 @@ switch (step) {
16657
16657
  return leave(s, r0)
16658
16658
  default: oops()
16659
16659
  } } }
16660
- Sprite__destroyCore__P171165.info = {"start":30399,"length":522,"line":974,"column":4,"endLine":986,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"_destroyCore","argumentNames":["this"]}
16660
+ Sprite__destroyCore__P171165.info = {"start":30425,"length":522,"line":974,"column":4,"endLine":986,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"_destroyCore","argumentNames":["this"]}
16661
16661
 
16662
16662
  function Sprite__destroyCore__P171165_mk(s) {
16663
16663
  checkStack(s.depth);
@@ -16702,7 +16702,7 @@ switch (step) {
16702
16702
  return leave(s, r0)
16703
16703
  default: oops()
16704
16704
  } } }
16705
- forEach_inline__P176915.info = {"start":30844,"length":26,"line":984,"column":20,"endLine":984,"endColumn":46,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
16705
+ forEach_inline__P176915.info = {"start":30870,"length":26,"line":984,"column":20,"endLine":984,"endColumn":46,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
16706
16706
 
16707
16707
  function forEach_inline__P176915_mk(s) {
16708
16708
  checkStack(s.depth);
@@ -16750,7 +16750,7 @@ switch (step) {
16750
16750
  return leave(s, r0)
16751
16751
  default: oops()
16752
16752
  } } }
16753
- Sprite__destroyCore_inline__P176922.info = {"start":30893,"length":20,"line":985,"column":21,"endLine":985,"endColumn":41,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
16753
+ Sprite__destroyCore_inline__P176922.info = {"start":30919,"length":20,"line":985,"column":21,"endLine":985,"endColumn":41,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
16754
16754
 
16755
16755
  function Sprite__destroyCore_inline__P176922_mk(s) {
16756
16756
  checkStack(s.depth);
@@ -16882,7 +16882,7 @@ switch (step) {
16882
16882
  return leave(s, r0)
16883
16883
  default: oops()
16884
16884
  } } }
16885
- Sprite_kind__P171143.info = {"start":13674,"length":41,"line":486,"column":4,"endLine":488,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"kind","argumentNames":["this"]}
16885
+ Sprite_kind__P171143.info = {"start":13700,"length":41,"line":486,"column":4,"endLine":488,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"kind","argumentNames":["this"]}
16886
16886
 
16887
16887
  function Sprite_kind__P171143_mk(s) {
16888
16888
  checkStack(s.depth);
@@ -17402,7 +17402,7 @@ switch (step) {
17402
17402
  return leave(s, r0)
17403
17403
  default: oops()
17404
17404
  } } }
17405
- Sprite_setImage__P171125.info = {"start":9273,"length":131,"line":332,"column":4,"endLine":336,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setImage","argumentNames":["this","img"]}
17405
+ Sprite_setImage__P171125.info = {"start":9299,"length":131,"line":332,"column":4,"endLine":336,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setImage","argumentNames":["this","img"]}
17406
17406
 
17407
17407
  function Sprite_setImage__P171125_mk(s) {
17408
17408
  checkStack(s.depth);
@@ -17482,7 +17482,7 @@ switch (step) {
17482
17482
  return leave(s, r0)
17483
17483
  default: oops()
17484
17484
  } } }
17485
- Sprite_recalcSize__P171131.info = {"start":11085,"length":176,"line":396,"column":4,"endLine":400,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"recalcSize","argumentNames":["this"]}
17485
+ Sprite_recalcSize__P171131.info = {"start":11111,"length":176,"line":396,"column":4,"endLine":400,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"recalcSize","argumentNames":["this"]}
17486
17486
 
17487
17487
  function Sprite_recalcSize__P171131_mk(s) {
17488
17488
  checkStack(s.depth);
@@ -17530,7 +17530,7 @@ switch (step) {
17530
17530
  return leave(s, r0)
17531
17531
  default: oops()
17532
17532
  } } }
17533
- Sprite_resetHitbox__P171127.info = {"start":9532,"length":76,"line":342,"column":4,"endLine":345,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"resetHitbox","argumentNames":["this"]}
17533
+ Sprite_resetHitbox__P171127.info = {"start":9558,"length":76,"line":342,"column":4,"endLine":345,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"resetHitbox","argumentNames":["this"]}
17534
17534
 
17535
17535
  function Sprite_resetHitbox__P171127_mk(s) {
17536
17536
  checkStack(s.depth);
@@ -17698,7 +17698,7 @@ switch (step) {
17698
17698
  return leave(s, r0)
17699
17699
  default: oops()
17700
17700
  } } }
17701
- Sprite_setHitbox__P171128.info = {"start":9614,"length":1324,"line":347,"column":4,"endLine":386,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setHitbox","argumentNames":["this"]}
17701
+ Sprite_setHitbox__P171128.info = {"start":9640,"length":1324,"line":347,"column":4,"endLine":386,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setHitbox","argumentNames":["this"]}
17702
17702
 
17703
17703
  function Sprite_setHitbox__P171128_mk(s) {
17704
17704
  checkStack(s.depth);
@@ -17857,7 +17857,7 @@ switch (step) {
17857
17857
  return leave(s, r0)
17858
17858
  default: oops()
17859
17859
  } } }
17860
- Sprite_calcDimensionalHash__P171126.info = {"start":9410,"length":116,"line":338,"column":4,"endLine":340,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"calcDimensionalHash","argumentNames":["this"]}
17860
+ Sprite_calcDimensionalHash__P171126.info = {"start":9436,"length":116,"line":338,"column":4,"endLine":340,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"calcDimensionalHash","argumentNames":["this"]}
17861
17861
 
17862
17862
  function Sprite_calcDimensionalHash__P171126_mk(s) {
17863
17863
  checkStack(s.depth);
@@ -18433,7 +18433,7 @@ switch (step) {
18433
18433
  return leaveAccessor(s, r0)
18434
18434
  default: oops()
18435
18435
  } } }
18436
- Sprite_image__P171124.info = {"start":8997,"length":54,"line":322,"column":4,"endLine":324,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"image","argumentNames":["this"]}
18436
+ Sprite_image__P171124.info = {"start":9023,"length":54,"line":322,"column":4,"endLine":324,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"image","argumentNames":["this"]}
18437
18437
  Sprite_image__P171124.isGetter = true;
18438
18438
 
18439
18439
  function Sprite_image__P171124_mk(s) {
@@ -18668,7 +18668,7 @@ switch (step) {
18668
18668
  return leave(s, r0)
18669
18669
  default: oops()
18670
18670
  } } }
18671
- Sprite_setFlag__P171155.info = {"start":24029,"length":130,"line":784,"column":4,"endLine":787,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setFlag","argumentNames":["this","flag","on"]}
18671
+ Sprite_setFlag__P171155.info = {"start":24055,"length":130,"line":784,"column":4,"endLine":787,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setFlag","argumentNames":["this","flag","on"]}
18672
18672
 
18673
18673
  function Sprite_setFlag__P171155_mk(s) {
18674
18674
  checkStack(s.depth);
@@ -18976,7 +18976,7 @@ switch (step) {
18976
18976
  return leaveAccessor(s, r0)
18977
18977
  default: oops()
18978
18978
  } } }
18979
- Sprite_width__P171133.info = {"start":11475,"length":59,"line":408,"column":4,"endLine":410,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"width","argumentNames":["this"]}
18979
+ Sprite_width__P171133.info = {"start":11501,"length":59,"line":408,"column":4,"endLine":410,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"width","argumentNames":["this"]}
18980
18980
  Sprite_width__P171133.isGetter = true;
18981
18981
 
18982
18982
  function Sprite_width__P171133_mk(s) {
@@ -19037,7 +19037,7 @@ switch (step) {
19037
19037
  return leave(s, r0)
19038
19038
  default: oops()
19039
19039
  } } }
19040
- Sprite_left__P171136.info = {"start":11954,"length":257,"line":424,"column":4,"endLine":434,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"left","argumentNames":["this","value"]}
19040
+ Sprite_left__P171136.info = {"start":11980,"length":257,"line":424,"column":4,"endLine":434,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"left","argumentNames":["this","value"]}
19041
19041
 
19042
19042
  function Sprite_left__P171136_mk(s) {
19043
19043
  checkStack(s.depth);
@@ -19079,7 +19079,7 @@ switch (step) {
19079
19079
  return leaveAccessor(s, r0)
19080
19080
  default: oops()
19081
19081
  } } }
19082
- Sprite_left__P171135.info = {"start":11810,"length":53,"line":419,"column":4,"endLine":421,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"left","argumentNames":["this"]}
19082
+ Sprite_left__P171135.info = {"start":11836,"length":53,"line":419,"column":4,"endLine":421,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"left","argumentNames":["this"]}
19083
19083
  Sprite_left__P171135.isGetter = true;
19084
19084
 
19085
19085
  function Sprite_left__P171135_mk(s) {
@@ -19704,7 +19704,7 @@ switch (step) {
19704
19704
  return leave(s, r0)
19705
19705
  default: oops()
19706
19706
  } } }
19707
- Sprite_setKind__P171144.info = {"start":13942,"length":663,"line":497,"column":4,"endLine":517,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setKind","argumentNames":["this","value"]}
19707
+ Sprite_setKind__P171144.info = {"start":13968,"length":663,"line":497,"column":4,"endLine":517,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"setKind","argumentNames":["this","value"]}
19708
19708
 
19709
19709
  function Sprite_setKind__P171144_mk(s) {
19710
19710
  checkStack(s.depth);
@@ -25296,7 +25296,7 @@ switch (step) {
25296
25296
  return leave(s, r0)
25297
25297
  default: oops()
25298
25298
  } } }
25299
- SpriteKind_create__P171205.info = {"start":750,"length":112,"line":25,"column":4,"endLine":28,"endColumn":5,"fileName":"pxt_modules/game/spritekind.ts","functionName":"create","argumentNames":[]}
25299
+ SpriteKind_create__P171205.info = {"start":783,"length":112,"line":26,"column":4,"endLine":29,"endColumn":5,"fileName":"pxt_modules/game/spritekind.ts","functionName":"create","argumentNames":[]}
25300
25300
 
25301
25301
  function SpriteKind_create__P171205_mk(s) {
25302
25302
  checkStack(s.depth);
@@ -27132,7 +27132,7 @@ switch (step) {
27132
27132
  return leave(s, r0)
27133
27133
  default: oops()
27134
27134
  } } }
27135
- Sprite_isStatic__P171129.info = {"start":10944,"length":57,"line":388,"column":4,"endLine":390,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isStatic","argumentNames":["this"]}
27135
+ Sprite_isStatic__P171129.info = {"start":10970,"length":57,"line":388,"column":4,"endLine":390,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isStatic","argumentNames":["this"]}
27136
27136
 
27137
27137
  function Sprite_isStatic__P171129_mk(s) {
27138
27138
  checkStack(s.depth);
@@ -29004,7 +29004,7 @@ switch (step) {
29004
29004
  return leave(s, r0)
29005
29005
  default: oops()
29006
29006
  } } }
29007
- tiles_getTileImage__P171501.info = {"start":21828,"length":207,"line":673,"column":4,"endLine":677,"endColumn":5,"fileName":"pxt_modules/game/tilemap.ts","functionName":"getTileImage","argumentNames":["loc"]}
29007
+ tiles_getTileImage__P171501.info = {"start":21835,"length":207,"line":673,"column":4,"endLine":677,"endColumn":5,"fileName":"pxt_modules/game/tilemap.ts","functionName":"getTileImage","argumentNames":["loc"]}
29008
29008
 
29009
29009
  function tiles_getTileImage__P171501_mk(s) {
29010
29010
  checkStack(s.depth);
@@ -29790,7 +29790,7 @@ switch (step) {
29790
29790
  return leave(s, r0)
29791
29791
  default: oops()
29792
29792
  } } }
29793
- Sprite_registerObstacle__P171162.info = {"start":28620,"length":965,"line":922,"column":4,"endLine":942,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"registerObstacle","argumentNames":["this","direction","other","tm"]}
29793
+ Sprite_registerObstacle__P171162.info = {"start":28646,"length":965,"line":922,"column":4,"endLine":942,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"registerObstacle","argumentNames":["this","direction","other","tm"]}
29794
29794
 
29795
29795
  function Sprite_registerObstacle__P171162_mk(s) {
29796
29796
  checkStack(s.depth);
@@ -29841,7 +29841,7 @@ switch (step) {
29841
29841
  return leave(s, r0)
29842
29842
  default: oops()
29843
29843
  } } }
29844
- forEach_inline__P180473.info = {"start":29018,"length":26,"line":929,"column":24,"endLine":929,"endColumn":50,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29844
+ forEach_inline__P180473.info = {"start":29044,"length":26,"line":929,"column":24,"endLine":929,"endColumn":50,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29845
29845
 
29846
29846
  function forEach_inline__P180473_mk(s) {
29847
29847
  checkStack(s.depth);
@@ -29889,7 +29889,7 @@ switch (step) {
29889
29889
  return leave(s, r0)
29890
29890
  default: oops()
29891
29891
  } } }
29892
- Sprite_registerObstacle_inline__P180479.info = {"start":29071,"length":20,"line":930,"column":25,"endLine":930,"endColumn":45,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29892
+ Sprite_registerObstacle_inline__P180479.info = {"start":29097,"length":20,"line":930,"column":25,"endLine":930,"endColumn":45,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29893
29893
 
29894
29894
  function Sprite_registerObstacle_inline__P180479_mk(s) {
29895
29895
  checkStack(s.depth);
@@ -29926,7 +29926,7 @@ switch (step) {
29926
29926
  return leave(s, r0)
29927
29927
  default: oops()
29928
29928
  } } }
29929
- wallHandlersToRun_inline__P180492.info = {"start":29277,"length":32,"line":935,"column":24,"endLine":935,"endColumn":56,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29929
+ wallHandlersToRun_inline__P180492.info = {"start":29303,"length":32,"line":935,"column":24,"endLine":935,"endColumn":56,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29930
29930
 
29931
29931
  function wallHandlersToRun_inline__P180492_mk(s) {
29932
29932
  checkStack(s.depth);
@@ -29975,7 +29975,7 @@ switch (step) {
29975
29975
  return leave(s, r0)
29976
29976
  default: oops()
29977
29977
  } } }
29978
- Sprite_registerObstacle_inline__P180521.info = {"start":29517,"length":36,"line":939,"column":29,"endLine":939,"endColumn":65,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29978
+ Sprite_registerObstacle_inline__P180521.info = {"start":29543,"length":36,"line":939,"column":29,"endLine":939,"endColumn":65,"fileName":"pxt_modules/game/sprite.ts","functionName":"inline","argumentNames":["h"]}
29979
29979
 
29980
29980
  function Sprite_registerObstacle_inline__P180521_mk(s) {
29981
29981
  checkStack(s.depth);
@@ -31868,7 +31868,7 @@ switch (step) {
31868
31868
  return leave(s, r0)
31869
31869
  default: oops()
31870
31870
  } } }
31871
- Sprite_overlapsWith__P171156.info = {"start":24447,"length":1575,"line":797,"column":4,"endLine":844,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"overlapsWith","argumentNames":["this","other"]}
31871
+ Sprite_overlapsWith__P171156.info = {"start":24473,"length":1575,"line":797,"column":4,"endLine":844,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"overlapsWith","argumentNames":["this","other"]}
31872
31872
 
31873
31873
  function Sprite_overlapsWith__P171156_mk(s) {
31874
31874
  checkStack(s.depth);
@@ -32091,7 +32091,7 @@ switch (step) {
32091
32091
  return leave(s, r0)
32092
32092
  default: oops()
32093
32093
  } } }
32094
- Sprite_isScaled__P171132.info = {"start":11267,"length":100,"line":402,"column":4,"endLine":404,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isScaled","argumentNames":["this"]}
32094
+ Sprite_isScaled__P171132.info = {"start":11293,"length":100,"line":402,"column":4,"endLine":404,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isScaled","argumentNames":["this"]}
32095
32095
 
32096
32096
  function Sprite_isScaled__P171132_mk(s) {
32097
32097
  checkStack(s.depth);
@@ -32637,7 +32637,7 @@ switch (step) {
32637
32637
  return leaveAccessor(s, r0)
32638
32638
  default: oops()
32639
32639
  } } }
32640
- Sprite_right__P171137.info = {"start":12319,"length":57,"line":438,"column":4,"endLine":440,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"right","argumentNames":["this"]}
32640
+ Sprite_right__P171137.info = {"start":12345,"length":57,"line":438,"column":4,"endLine":440,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"right","argumentNames":["this"]}
32641
32641
  Sprite_right__P171137.isGetter = true;
32642
32642
 
32643
32643
  function Sprite_right__P171137_mk(s) {
@@ -32688,7 +32688,7 @@ switch (step) {
32688
32688
  return leaveAccessor(s, r0)
32689
32689
  default: oops()
32690
32690
  } } }
32691
- Sprite_bottom__P171141.info = {"start":13153,"length":59,"line":468,"column":4,"endLine":470,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"bottom","argumentNames":["this"]}
32691
+ Sprite_bottom__P171141.info = {"start":13179,"length":59,"line":468,"column":4,"endLine":470,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"bottom","argumentNames":["this"]}
32692
32692
  Sprite_bottom__P171141.isGetter = true;
32693
32693
 
32694
32694
  function Sprite_bottom__P171141_mk(s) {
@@ -33422,7 +33422,7 @@ switch (step) {
33422
33422
  return leave(s, r0)
33423
33423
  default: oops()
33424
33424
  } } }
33425
- Sprite_clearObstacles__P171161.info = {"start":28560,"length":54,"line":918,"column":4,"endLine":920,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"clearObstacles","argumentNames":["this"]}
33425
+ Sprite_clearObstacles__P171161.info = {"start":28586,"length":54,"line":918,"column":4,"endLine":920,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"clearObstacles","argumentNames":["this"]}
33426
33426
 
33427
33427
  function Sprite_clearObstacles__P171161_mk(s) {
33428
33428
  checkStack(s.depth);
@@ -35027,7 +35027,7 @@ switch (step) {
35027
35027
  return leave(s, r0)
35028
35028
  default: oops()
35029
35029
  } } }
35030
- Sprite_toString__P171170.info = {"start":37683,"length":93,"line":1169,"column":4,"endLine":1171,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"toString","argumentNames":["this"]}
35030
+ Sprite_toString__P171170.info = {"start":37744,"length":93,"line":1170,"column":4,"endLine":1172,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"toString","argumentNames":["this"]}
35031
35031
 
35032
35032
  function Sprite_toString__P171170_mk(s) {
35033
35033
  checkStack(s.depth);
@@ -35374,7 +35374,7 @@ switch (step) {
35374
35374
  return leave(s, r0)
35375
35375
  default: oops()
35376
35376
  } } }
35377
- Sprite___update__P171152.info = {"start":21606,"length":1363,"line":714,"column":4,"endLine":750,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__update","argumentNames":["this","camera","dt"]}
35377
+ Sprite___update__P171152.info = {"start":21632,"length":1363,"line":714,"column":4,"endLine":750,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__update","argumentNames":["this","camera","dt"]}
35378
35378
 
35379
35379
  function Sprite___update__P171152_mk(s) {
35380
35380
  checkStack(s.depth);
@@ -35478,7 +35478,7 @@ switch (step) {
35478
35478
  return leave(s, r0)
35479
35479
  default: oops()
35480
35480
  } } }
35481
- Sprite_bottom__P171142.info = {"start":13305,"length":73,"line":473,"column":4,"endLine":475,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"bottom","argumentNames":["this","value"]}
35481
+ Sprite_bottom__P171142.info = {"start":13331,"length":73,"line":473,"column":4,"endLine":475,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"bottom","argumentNames":["this","value"]}
35482
35482
 
35483
35483
  function Sprite_bottom__P171142_mk(s) {
35484
35484
  checkStack(s.depth);
@@ -35532,7 +35532,7 @@ switch (step) {
35532
35532
  return leave(s, r0)
35533
35533
  default: oops()
35534
35534
  } } }
35535
- Sprite_right__P171138.info = {"start":12468,"length":71,"line":443,"column":4,"endLine":445,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"right","argumentNames":["this","value"]}
35535
+ Sprite_right__P171138.info = {"start":12494,"length":71,"line":443,"column":4,"endLine":445,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"right","argumentNames":["this","value"]}
35536
35536
 
35537
35537
  function Sprite_right__P171138_mk(s) {
35538
35538
  checkStack(s.depth);
@@ -35667,7 +35667,7 @@ switch (step) {
35667
35667
  return leave(s, r0)
35668
35668
  default: oops()
35669
35669
  } } }
35670
- Sprite_isOutOfScreen__P171150.info = {"start":18931,"length":358,"line":640,"column":4,"endLine":644,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isOutOfScreen","argumentNames":["this","camera"]}
35670
+ Sprite_isOutOfScreen__P171150.info = {"start":18957,"length":358,"line":640,"column":4,"endLine":644,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"isOutOfScreen","argumentNames":["this","camera"]}
35671
35671
 
35672
35672
  function Sprite_isOutOfScreen__P171150_mk(s) {
35673
35673
  checkStack(s.depth);
@@ -38182,7 +38182,7 @@ switch (step) {
38182
38182
  return leave(s, r0)
38183
38183
  default: oops()
38184
38184
  } } }
38185
- Sprite___drawCore__P171151.info = {"start":19295,"length":2305,"line":646,"column":4,"endLine":712,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__drawCore","argumentNames":["this","camera"]}
38185
+ Sprite___drawCore__P171151.info = {"start":19321,"length":2305,"line":646,"column":4,"endLine":712,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__drawCore","argumentNames":["this","camera"]}
38186
38186
 
38187
38187
  function Sprite___drawCore__P171151_mk(s) {
38188
38188
  checkStack(s.depth);
@@ -38317,7 +38317,7 @@ switch (step) {
38317
38317
  return leave(s, r0)
38318
38318
  default: oops()
38319
38319
  } } }
38320
- Sprite___visible__P171130.info = {"start":11007,"length":72,"line":392,"column":4,"endLine":394,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__visible","argumentNames":["this"]}
38320
+ Sprite___visible__P171130.info = {"start":11033,"length":72,"line":392,"column":4,"endLine":394,"endColumn":5,"fileName":"pxt_modules/game/sprite.ts","functionName":"__visible","argumentNames":["this"]}
38321
38321
 
38322
38322
  function Sprite___visible__P171130_mk(s) {
38323
38323
  checkStack(s.depth);
@@ -2,6 +2,8 @@
2
2
  "radio": "Communicate data using radio packets",
3
3
  "radio._packetProperty": "Gets a packet property.",
4
4
  "radio._packetProperty|param|type": "the packet property type, eg: PacketProperty.time",
5
+ "radio.off": "Disables the radio for use as a multipoint sender/receiver.\nDisabling radio will help conserve battery power when it is not in use.",
6
+ "radio.on": "Initialises the radio for use as a multipoint sender/receiver\nOnly useful when the radio.off() is used beforehand.",
5
7
  "radio.onDataReceived": "Used internally by the library.",
6
8
  "radio.onReceivedBuffer": "Registers code to run when the radio receives a buffer.",
7
9
  "radio.onReceivedNumber": "Registers code to run when the radio receives a number.",
@@ -18,5 +18,8 @@
18
18
  "radio.setTransmitPower|block": "radio set transmit power %power",
19
19
  "radio.setTransmitSerialNumber|block": "radio set transmit serial number %transmit",
20
20
  "radio|block": "radio",
21
- "{id:category}Radio": "Radio"
21
+ "{id:category}Radio": "Radio",
22
+ "{id:group}Group": "Group",
23
+ "{id:group}Receive": "Receive",
24
+ "{id:group}Send": "Send"
22
25
  }
@@ -73,28 +73,80 @@ CODAL_RADIO* getRadio() {
73
73
  #endif // #else
74
74
 
75
75
  bool radioEnabled = false;
76
+ bool init = false;
76
77
  int radioEnable() {
77
78
  #ifdef CODAL_RADIO
78
79
  auto radio = getRadio();
79
80
  if (NULL == radio)
80
81
  return DEVICE_NOT_SUPPORTED;
81
82
 
83
+ if (init && !radioEnabled) {
84
+ //If radio was explicitly disabled from a call to off API
85
+ //We don't want to enable it here. User needs to call on API first.
86
+ return DEVICE_NOT_SUPPORTED;
87
+ }
88
+
82
89
  int r = radio->enable();
83
90
  if (r != DEVICE_OK) {
84
91
  target_panic(43);
85
92
  return r;
86
93
  }
87
- if (!radioEnabled) {
88
- getRadio()->setGroup(pxt::programHash());
94
+ if (!init) {
95
+ getRadio()->setGroup(0); //Default group zero. This used to be pxt::programHash()
89
96
  getRadio()->setTransmitPower(6); // start with high power by default
90
- radioEnabled = true;
97
+ init = true;
91
98
  }
99
+ radioEnabled = true;
92
100
  return r;
93
101
  #else
94
102
  return DEVICE_NOT_SUPPORTED;
95
103
  #endif
96
104
  }
97
105
 
106
+ /**
107
+ * Disables the radio for use as a multipoint sender/receiver.
108
+ * Disabling radio will help conserve battery power when it is not in use.
109
+ */
110
+ //% help=radio/off
111
+ void off() {
112
+ #ifdef CODAL_RADIO
113
+ auto radio = getRadio();
114
+ if (NULL == radio)
115
+ return;
116
+
117
+ int r = radio->disable();
118
+ if (r != DEVICE_OK) {
119
+ target_panic(43);
120
+ } else {
121
+ radioEnabled = false;
122
+ }
123
+ #else
124
+ return;
125
+ #endif
126
+ }
127
+
128
+ /**
129
+ * Initialises the radio for use as a multipoint sender/receiver
130
+ * Only useful when the radio.off() is used beforehand.
131
+ */
132
+ //% help=radio/on
133
+ void on() {
134
+ #ifdef CODAL_RADIO
135
+ auto radio = getRadio();
136
+ if (NULL == radio)
137
+ return;
138
+
139
+ int r = radio->enable();
140
+ if (r != DEVICE_OK) {
141
+ target_panic(43);
142
+ } else {
143
+ radioEnabled = true;
144
+ }
145
+ #else
146
+ return;
147
+ #endif
148
+ }
149
+
98
150
  /**
99
151
  * Sends an event over radio to neigboring devices
100
152
  */
@@ -185,6 +237,7 @@ CODAL_RADIO* getRadio() {
185
237
  //% weight=100
186
238
  //% blockId=radio_set_group block="radio set group %ID"
187
239
  //% id.min=0 id.max=255
240
+ //% group="Group"
188
241
  void setGroup(int id) {
189
242
  #ifdef CODAL_RADIO
190
243
  if (radioEnable() != DEVICE_OK) return;
@@ -14,7 +14,7 @@ enum RadioPacketProperty {
14
14
  /**
15
15
  * Communicate data using radio packets
16
16
  */
17
- //% color=#E3008C weight=96 icon="\uf012"
17
+ //% color=#E3008C weight=96 icon="\uf012" groups='["Group", "Broadcast", "Send", "Receive"]'
18
18
  namespace radio {
19
19
 
20
20
  // keep in sync with CODAL
@@ -95,6 +95,8 @@ namespace radio {
95
95
  //% help=radio/on-received-number
96
96
  //% blockId=radio_on_number_drag block="on radio received" blockGap=16
97
97
  //% useLoc="radio.onDataPacketReceived" draggableParameters=reporter
98
+ //% group="Receive"
99
+ //% weight=20
98
100
  export function onReceivedNumber(cb: (receivedNumber: number) => void) {
99
101
  init();
100
102
  onReceivedNumberHandler = cb;
@@ -106,6 +108,8 @@ namespace radio {
106
108
  //% help=radio/on-received-value
107
109
  //% blockId=radio_on_value_drag block="on radio received" blockGap=16
108
110
  //% useLoc="radio.onDataPacketReceived" draggableParameters=reporter
111
+ //% group="Receive"
112
+ //% weight=19
109
113
  export function onReceivedValue(cb: (name: string, value: number) => void) {
110
114
  init();
111
115
  onReceivedValueHandler = cb;
@@ -117,6 +121,8 @@ namespace radio {
117
121
  //% help=radio/on-received-string
118
122
  //% blockId=radio_on_string_drag block="on radio received" blockGap=16
119
123
  //% useLoc="radio.onDataPacketReceived" draggableParameters=reporter
124
+ //% group="Receive"
125
+ //% weight=18
120
126
  export function onReceivedString(cb: (receivedString: string) => void) {
121
127
  init();
122
128
  onReceivedStringHandler = cb;
@@ -138,8 +144,10 @@ namespace radio {
138
144
  * @param type the type of property to retrieve from the last packet
139
145
  */
140
146
  //% help=radio/received-packet
141
- //% weight=11 blockGap=8
147
+ //% blockGap=8
142
148
  //% blockId=radio_received_packet block="received packet %type=radio_packet_property" blockGap=16
149
+ //% group="Receive"
150
+ //% weight=16
143
151
  export function receivedPacket(type: number) {
144
152
  if (lastPacket) {
145
153
  switch (type) {
@@ -272,6 +280,7 @@ namespace radio {
272
280
  //% help=radio/send-number
273
281
  //% weight=60
274
282
  //% blockId=radio_datagram_send block="radio send number %value" blockGap=8
283
+ //% group="Send"
275
284
  export function sendNumber(value: number) {
276
285
  let packet: RadioPacket;
277
286
 
@@ -296,6 +305,7 @@ namespace radio {
296
305
  //% help=radio/send-value
297
306
  //% weight=59
298
307
  //% blockId=radio_datagram_send_value block="radio send|value %name|= %value" blockGap=8
308
+ //% group="Send"
299
309
  export function sendValue(name: string, value: number) {
300
310
  let packet: RadioPacket;
301
311
 
@@ -319,6 +329,7 @@ namespace radio {
319
329
  //% weight=58
320
330
  //% blockId=radio_datagram_send_string block="radio send string %msg"
321
331
  //% msg.shadowOptions.toString=true
332
+ //% group="Send"
322
333
  export function sendString(value: string) {
323
334
  const packet = RadioPacket.mkPacket(PACKET_TYPE_STRING);
324
335
  packet.stringPayload = value;
@@ -5,6 +5,20 @@
5
5
  //% color=#E3008C weight=96 icon="\uf012"
6
6
  declare namespace radio {
7
7
 
8
+ /**
9
+ * Disables the radio for use as a multipoint sender/receiver.
10
+ * Disabling radio will help conserve battery power when it is not in use.
11
+ */
12
+ //% help=radio/off shim=radio::off
13
+ function off(): void;
14
+
15
+ /**
16
+ * Initialises the radio for use as a multipoint sender/receiver
17
+ * Only useful when the radio.off() is used beforehand.
18
+ */
19
+ //% help=radio/on shim=radio::on
20
+ function on(): void;
21
+
8
22
  /**
9
23
  * Sends an event over radio to neigboring devices
10
24
  */
@@ -44,7 +58,8 @@ declare namespace radio {
44
58
  //% help=radio/set-group
45
59
  //% weight=100
46
60
  //% blockId=radio_set_group block="radio set group %ID"
47
- //% id.min=0 id.max=255 shim=radio::setGroup
61
+ //% id.min=0 id.max=255
62
+ //% group="Group" shim=radio::setGroup
48
63
  function setGroup(id: int32): void;
49
64
 
50
65
  /**
@@ -22,11 +22,13 @@ namespace pxsim.radio {
22
22
  export function sendRawPacket(buf: RefBuffer) {
23
23
  let cb = getResume();
24
24
  const state = pxsim.getRadioState();
25
- state.datagram.send({
26
- type: 0,
27
- groupId: state.groupId,
28
- bufferData: buf.data
29
- });
25
+ if (state.enable) {
26
+ state.datagram.send({
27
+ type: 0,
28
+ groupId: state.groupId,
29
+ bufferData: buf.data
30
+ });
31
+ }
30
32
  setTimeout(cb, 1);
31
33
  }
32
34
 
@@ -50,4 +52,15 @@ namespace pxsim.radio {
50
52
  const state = pxsim.getRadioState();
51
53
  state.datagram.onReceived(handler);
52
54
  }
55
+
56
+ export function off(){
57
+ const state = pxsim.getRadioState();
58
+ state.off();
59
+ }
60
+
61
+ export function on(){
62
+ const state = pxsim.getRadioState();
63
+ state.on();
64
+ }
65
+
53
66
  }