pxt-common-packages 10.3.4 → 10.3.5
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.
- package/built/common-sim.d.ts +12 -0
- package/built/common-sim.js +24 -0
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/color/built/debug/binary.js +8 -8
- package/libs/color-sensor/built/debug/binary.js +8 -8
- package/libs/controller/built/debug/binary.js +6980 -6980
- package/libs/controller---none/built/debug/binary.js +6960 -6960
- package/libs/datalogger/built/debug/binary.js +63 -63
- package/libs/edge-connector/built/debug/binary.js +8 -8
- package/libs/esp32/built/debug/binary.js +462 -462
- package/libs/game/built/debug/binary.js +6895 -6895
- package/libs/game/multiplayer.cpp +3 -0
- package/libs/game/multiplayer.ts +45 -0
- package/libs/game/sim/multiplayer.ts +32 -0
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
- package/libs/lora/built/debug/binary.js +8 -8
- package/libs/matrix-keypad/built/debug/binary.js +8 -8
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/multiplayer/fieldEditors.ts +1 -1
- package/libs/multiplayer/mp.ts +44 -26
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +8488 -8488
- package/libs/palette/built/debug/binary.js +6898 -6898
- package/libs/pixel/built/debug/binary.js +8 -8
- package/libs/power/built/debug/binary.js +8 -8
- package/libs/proximity/built/debug/binary.js +8 -8
- package/libs/radio/built/debug/binary.js +8 -8
- package/libs/radio-broadcast/built/debug/binary.js +8 -8
- package/libs/rotary-encoder/built/debug/binary.js +8 -8
- package/libs/screen/built/debug/binary.js +50 -50
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +6898 -6898
- package/libs/storyboard/built/debug/binary.js +6898 -6898
- package/package.json +1 -1
package/libs/game/multiplayer.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
namespace multiplayer {
|
|
2
|
+
enum IconType {
|
|
3
|
+
Player = 0,
|
|
4
|
+
Reaction = 1,
|
|
5
|
+
}
|
|
6
|
+
|
|
2
7
|
//% shim=multiplayer::getCurrentImage
|
|
3
8
|
declare function getCurrentImage(): Image;
|
|
4
9
|
|
|
5
10
|
//% shim=multiplayer::postImage
|
|
6
11
|
declare function postImage(im: Image): void;
|
|
7
12
|
|
|
13
|
+
//% shim=multiplayer::postIcon
|
|
14
|
+
declare function postIcon(type: IconType, slot: number, im: Image): void;
|
|
15
|
+
|
|
8
16
|
//% shim=multiplayer::setOrigin
|
|
9
17
|
declare function setOrigin(origin: string): void;
|
|
10
18
|
|
|
@@ -34,4 +42,41 @@ namespace multiplayer {
|
|
|
34
42
|
})
|
|
35
43
|
}
|
|
36
44
|
}
|
|
45
|
+
|
|
46
|
+
export function postPresenceIcon(slot: number, im: Image, implicit?: boolean) {
|
|
47
|
+
initIconState();
|
|
48
|
+
if (slot < 1 || slot > 4)
|
|
49
|
+
return;
|
|
50
|
+
|
|
51
|
+
const presenceSetExplicitly = explicitlySetIcons[IconType.Player];
|
|
52
|
+
if (implicit && presenceSetExplicitly[slot])
|
|
53
|
+
return;
|
|
54
|
+
if (!implicit)
|
|
55
|
+
presenceSetExplicitly[slot] = true;
|
|
56
|
+
|
|
57
|
+
postIcon(IconType.Player, slot, im);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function postReactionIcon(slot: number, im: Image, implicit?: boolean) {
|
|
61
|
+
initIconState();
|
|
62
|
+
if (slot < 1 || slot > 6)
|
|
63
|
+
return;
|
|
64
|
+
|
|
65
|
+
const reactionsSetExplicitly = explicitlySetIcons[IconType.Reaction];
|
|
66
|
+
if (implicit && reactionsSetExplicitly[slot])
|
|
67
|
+
return;
|
|
68
|
+
if (!implicit)
|
|
69
|
+
reactionsSetExplicitly[slot] = true;
|
|
70
|
+
|
|
71
|
+
postIcon(IconType.Reaction, slot, im);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let explicitlySetIcons: boolean[][];
|
|
75
|
+
function initIconState() {
|
|
76
|
+
if (explicitlySetIcons)
|
|
77
|
+
return;
|
|
78
|
+
explicitlySetIcons = [];
|
|
79
|
+
explicitlySetIcons[IconType.Player] = [];
|
|
80
|
+
explicitlySetIcons[IconType.Reaction] = [];
|
|
81
|
+
}
|
|
37
82
|
}
|
|
@@ -16,6 +16,25 @@ namespace pxsim.multiplayer {
|
|
|
16
16
|
} as pxsim.MultiplayerImageMessage);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export function postIcon(iconType: IconType, slot: number, im: pxsim.RefImage) {
|
|
20
|
+
if (getMultiplayerState().origin !== "server")
|
|
21
|
+
return;
|
|
22
|
+
if (im._width * im._height > 64 * 64) {
|
|
23
|
+
// setting 64x64 as max size for icon for now
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const asBuf = pxsim.image.toBuffer(im);
|
|
27
|
+
const sb = board() as ScreenBoard;
|
|
28
|
+
const screenState = sb && sb.screenState;
|
|
29
|
+
getMultiplayerState().send({
|
|
30
|
+
content: "Icon",
|
|
31
|
+
slot: slot,
|
|
32
|
+
icon: asBuf,
|
|
33
|
+
iconType: iconType,
|
|
34
|
+
palette: screenState.paletteToUint8Array(),
|
|
35
|
+
} as pxsim.MultiplayerIconMessage);
|
|
36
|
+
}
|
|
37
|
+
|
|
19
38
|
|
|
20
39
|
export function getCurrentImage(): pxsim.RefImage {
|
|
21
40
|
return getMultiplayerState().backgroundImage;
|
|
@@ -56,6 +75,19 @@ namespace pxsim {
|
|
|
56
75
|
palette: Uint8Array;
|
|
57
76
|
}
|
|
58
77
|
|
|
78
|
+
export enum IconType {
|
|
79
|
+
Player = 0,
|
|
80
|
+
Reaction = 1,
|
|
81
|
+
}
|
|
82
|
+
export interface MultiplayerIconMessage extends SimulatorMultiplayerMessage {
|
|
83
|
+
content: "Icon";
|
|
84
|
+
icon: RefBuffer;
|
|
85
|
+
slot: number;
|
|
86
|
+
iconType: IconType;
|
|
87
|
+
// 48bytes, [r0,g0,b0,r1,g1,b1,...]
|
|
88
|
+
palette: Uint8Array;
|
|
89
|
+
}
|
|
90
|
+
|
|
59
91
|
export interface MultiplayerButtonEvent extends SimulatorMultiplayerMessage {
|
|
60
92
|
content: "Button";
|
|
61
93
|
button: number; // pxsim.Key.A, ...
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P48577(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___48820 = (undefined);
|
|
70
|
+
globals._pollEventQueue___48833 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48577.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48577.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48577_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48577, 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___P48572_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48577
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P98063(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___98306 = (undefined);
|
|
70
|
+
globals._pollEventQueue___98319 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P98063.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P98063.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P98063_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P98063, 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___P98048_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P98063
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P59879(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___60122 = (undefined);
|
|
70
|
+
globals._pollEventQueue___60135 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P59879.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P59879.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P59879_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P59879, 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___P59874_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P59879
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P190559(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___190802 = (undefined);
|
|
70
|
+
globals._pollEventQueue___190815 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P190559.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P190559.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P190559_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P190559, 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___P190524_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P190559
|
|
92
92
|
})
|