@rpgjs/client 5.0.0-alpha.43 → 5.0.0-alpha.44
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/dist/Game/AnimationManager.js +25 -24
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/Event.js +11 -10
- package/dist/Game/Event.js.map +1 -1
- package/dist/Game/Map.js +78 -94
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.js +182 -216
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Player.js +11 -10
- package/dist/Game/Player.js.map +1 -1
- package/dist/Gui/Gui.js +440 -473
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/NotificationManager.js +48 -50
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/Resource.js +132 -113
- package/dist/Resource.js.map +1 -1
- package/dist/RpgClientEngine.js +1333 -1486
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js +162 -92
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.js +6 -0
- package/dist/components/animations/animation.ce.js +22 -19
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/hit.ce.js +67 -68
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/animations/index.js +9 -8
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +390 -314
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/parse-value.js +42 -52
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/text.ce.js +71 -139
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +26 -25
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +202 -149
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +190 -138
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +90 -33
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/index.js +14 -0
- package/dist/components/gui/menu/equip-menu.ce.js +478 -346
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +52 -33
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +341 -226
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +414 -205
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +46 -26
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +104 -50
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/index.js +18 -21
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js +76 -15
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +62 -36
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +386 -239
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +649 -319
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +187 -145
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/prebuilt/hp-bar.ce.js +114 -104
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/index.js +2 -0
- package/dist/components/prebuilt/light-halo.ce.js +92 -74
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +58 -42
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +87 -64
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +26 -16
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +11 -10
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.js +13 -13
- package/dist/core/setup.js.map +1 -1
- package/dist/index.js +44 -41
- package/dist/module.js +169 -168
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_di@2.8.3/node_modules/@signe/di/dist/index.js +209 -298
- package/dist/node_modules/.pnpm/@signe_di@2.8.3/node_modules/@signe/di/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +430 -507
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_room@2.8.3/node_modules/@signe/room/dist/index.js +2062 -2571
- package/dist/node_modules/.pnpm/@signe_room@2.8.3/node_modules/@signe/room/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +8 -3
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/client/index.js +78 -101
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/client/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/index.js +264 -401
- package/dist/node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +9 -7
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js +106 -165
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +361 -461
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3633 -4280
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -1
- package/dist/presets/animation.js +37 -25
- package/dist/presets/animation.js.map +1 -1
- package/dist/presets/faceset.js +49 -22
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/icon.js +13 -13
- package/dist/presets/icon.js.map +1 -1
- package/dist/presets/index.js +15 -14
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/lpc.js +96 -93
- package/dist/presets/lpc.js.map +1 -1
- package/dist/presets/rmspritesheet.js +40 -39
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/services/AbstractSocket.js +10 -8
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/keyboardControls.js +20 -18
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/loadMap.js +120 -36
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mmorpg.js +128 -136
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/save.js +74 -66
- package/dist/services/save.js.map +1 -1
- package/dist/services/standalone.js +165 -167
- package/dist/services/standalone.js.map +1 -1
- package/dist/utils/getEntityProp.js +49 -51
- package/dist/utils/getEntityProp.js.map +1 -1
- package/package.json +8 -8
- package/src/components/character.ce +1 -1
- package/src/components/scenes/draw-map.ce +3 -1
- package/dist/index.js.map +0 -1
|
@@ -1,316 +1,392 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { inject } from "../core/inject.js";
|
|
2
|
+
import { RpgGui } from "../Gui/Gui.js";
|
|
3
|
+
import { RpgClientEngine } from "../RpgClientEngine.js";
|
|
4
|
+
import { Container, Sprite, animatedSignal, computed, cond, h, loop, mount, on, signal, tick, useDefineProps, useProps } from "canvasengine";
|
|
5
|
+
import { Particle } from "@canvasengine/presets";
|
|
6
|
+
import { Direction, ModulesToken } from "@rpgjs/common";
|
|
7
|
+
import { combineLatest, filter, lastValueFrom, map, pairwise, startWith } from "rxjs";
|
|
8
|
+
//#region src/components/character.ce
|
|
9
9
|
function component($$props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
var
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
});
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
});
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
10
|
+
useProps($$props);
|
|
11
|
+
const defineProps = useDefineProps($$props);
|
|
12
|
+
var __assign = this && this.__assign || function() {
|
|
13
|
+
__assign = Object.assign || function(t) {
|
|
14
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
+
s = arguments[i];
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
return __assign.apply(this, arguments);
|
|
21
|
+
};
|
|
22
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
23
|
+
function adopt(value) {
|
|
24
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
25
|
+
resolve(value);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
29
|
+
function fulfilled(value) {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.next(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function rejected(value) {
|
|
37
|
+
try {
|
|
38
|
+
step(generator["throw"](value));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
reject(e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function step(result) {
|
|
44
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
45
|
+
}
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
50
|
+
var _ = {
|
|
51
|
+
label: 0,
|
|
52
|
+
sent: function() {
|
|
53
|
+
if (t[0] & 1) throw t[1];
|
|
54
|
+
return t[1];
|
|
55
|
+
},
|
|
56
|
+
trys: [],
|
|
57
|
+
ops: []
|
|
58
|
+
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
59
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
60
|
+
return this;
|
|
61
|
+
}), g;
|
|
62
|
+
function verb(n) {
|
|
63
|
+
return function(v) {
|
|
64
|
+
return step([n, v]);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function step(op) {
|
|
68
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
69
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
70
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
71
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
72
|
+
switch (op[0]) {
|
|
73
|
+
case 0:
|
|
74
|
+
case 1:
|
|
75
|
+
t = op;
|
|
76
|
+
break;
|
|
77
|
+
case 4:
|
|
78
|
+
_.label++;
|
|
79
|
+
return {
|
|
80
|
+
value: op[1],
|
|
81
|
+
done: false
|
|
82
|
+
};
|
|
83
|
+
case 5:
|
|
84
|
+
_.label++;
|
|
85
|
+
y = op[1];
|
|
86
|
+
op = [0];
|
|
87
|
+
continue;
|
|
88
|
+
case 7:
|
|
89
|
+
op = _.ops.pop();
|
|
90
|
+
_.trys.pop();
|
|
91
|
+
continue;
|
|
92
|
+
default:
|
|
93
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
94
|
+
_ = 0;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
98
|
+
_.label = op[1];
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
102
|
+
_.label = t[1];
|
|
103
|
+
t = op;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (t && _.label < t[2]) {
|
|
107
|
+
_.label = t[2];
|
|
108
|
+
_.ops.push(op);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
if (t[2]) _.ops.pop();
|
|
112
|
+
_.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
op = body.call(thisArg, _);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
op = [6, e];
|
|
118
|
+
y = 0;
|
|
119
|
+
} finally {
|
|
120
|
+
f = t = 0;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] & 5) throw op[1];
|
|
123
|
+
return {
|
|
124
|
+
value: op[0] ? op[1] : void 0,
|
|
125
|
+
done: true
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var _a = defineProps(), object = _a.object, id = _a.id;
|
|
130
|
+
var client = inject(RpgClientEngine);
|
|
131
|
+
var hooks = inject(ModulesToken);
|
|
132
|
+
var guiService = inject(RpgGui);
|
|
133
|
+
client.spritesheets;
|
|
134
|
+
var playerId = client.playerId;
|
|
135
|
+
var componentsBehind = client.spriteComponentsBehind;
|
|
136
|
+
var componentsInFront = client.spriteComponentsInFront;
|
|
137
|
+
var isMe = computed(function() {
|
|
138
|
+
return id() === playerId;
|
|
139
|
+
});
|
|
140
|
+
var normalizeComponent = function(comp) {
|
|
141
|
+
var componentRef;
|
|
142
|
+
var propsValue;
|
|
143
|
+
var dependenciesFn;
|
|
144
|
+
if (typeof comp === "function" || comp && typeof comp === "object" && !comp.component) {
|
|
145
|
+
componentRef = comp;
|
|
146
|
+
propsValue = void 0;
|
|
147
|
+
dependenciesFn = void 0;
|
|
148
|
+
} else if (comp && typeof comp === "object" && comp.component) {
|
|
149
|
+
componentRef = comp.component;
|
|
150
|
+
propsValue = comp.props !== void 0 ? comp.props : comp.data;
|
|
151
|
+
dependenciesFn = comp.dependencies;
|
|
152
|
+
} else {
|
|
153
|
+
componentRef = comp;
|
|
154
|
+
propsValue = void 0;
|
|
155
|
+
dependenciesFn = void 0;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
component: componentRef,
|
|
159
|
+
props: typeof propsValue === "function" ? propsValue(object) : propsValue || {},
|
|
160
|
+
dependencies: dependenciesFn ? dependenciesFn(object) : []
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
var normalizeComponents = function(components) {
|
|
164
|
+
return components.map(function(comp) {
|
|
165
|
+
return normalizeComponent(comp);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
var normalizedComponentsBehind = computed(function() {
|
|
169
|
+
return normalizeComponents(componentsBehind());
|
|
170
|
+
});
|
|
171
|
+
var normalizedComponentsInFront = computed(function() {
|
|
172
|
+
return normalizeComponents(componentsInFront());
|
|
173
|
+
});
|
|
174
|
+
var shouldFollowCamera = computed(function() {
|
|
175
|
+
var cameraTargetId = client.cameraFollowTargetId();
|
|
176
|
+
if (cameraTargetId !== null) return id() === cameraTargetId;
|
|
177
|
+
return isMe();
|
|
178
|
+
});
|
|
179
|
+
var attachedGuis = computed(function() {
|
|
180
|
+
return guiService.getAttachedGuis();
|
|
181
|
+
});
|
|
182
|
+
var shouldDisplayAttachedGui = computed(function() {
|
|
183
|
+
return guiService.shouldDisplayAttachedGui(id());
|
|
184
|
+
}), x = object.x, y = object.y, tint = object.tint, direction = object.direction, animationName = object.animationName, animationCurrentIndex = object.animationCurrentIndex, emitParticleTrigger = object.emitParticleTrigger, particleName = object.particleName;
|
|
185
|
+
object.graphics;
|
|
186
|
+
var hitbox = object.hitbox, isConnected = object.isConnected, graphicsSignals = object.graphicsSignals, flashTrigger = object.flashTrigger;
|
|
187
|
+
var flashType = signal("alpha");
|
|
188
|
+
var flashDuration = signal(300);
|
|
189
|
+
var flashCycles = signal(1);
|
|
190
|
+
var flashAlpha = signal(.3);
|
|
191
|
+
var flashTint = signal(16777215);
|
|
192
|
+
on(flashTrigger, function(data) {
|
|
193
|
+
if (data && typeof data === "object") {
|
|
194
|
+
if (data.type !== void 0) flashType.set(data.type);
|
|
195
|
+
if (data.duration !== void 0) flashDuration.set(data.duration);
|
|
196
|
+
if (data.cycles !== void 0) flashCycles.set(data.cycles);
|
|
197
|
+
if (data.alpha !== void 0) flashAlpha.set(data.alpha);
|
|
198
|
+
if (data.tint !== void 0) flashTint.set(data.tint);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
var flashConfig = computed(function() {
|
|
202
|
+
return {
|
|
203
|
+
trigger: flashTrigger,
|
|
204
|
+
type: flashType(),
|
|
205
|
+
duration: flashDuration(),
|
|
206
|
+
cycles: flashCycles(),
|
|
207
|
+
alpha: flashAlpha(),
|
|
208
|
+
tint: flashTint()
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
var particleSettings = client.particleSettings;
|
|
212
|
+
var canControls = function() {
|
|
213
|
+
return isMe() && object.canMove();
|
|
214
|
+
};
|
|
215
|
+
var keyboardControls = client.globalConfig.keyboardControls;
|
|
216
|
+
var visible = computed(function() {
|
|
217
|
+
if (object.type === "event") return true;
|
|
218
|
+
return isConnected();
|
|
219
|
+
});
|
|
220
|
+
var controls = signal({
|
|
221
|
+
down: {
|
|
222
|
+
repeat: true,
|
|
223
|
+
bind: keyboardControls.down,
|
|
224
|
+
keyDown: function() {
|
|
225
|
+
if (canControls()) client.processInput({ input: Direction.Down });
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
up: {
|
|
229
|
+
repeat: true,
|
|
230
|
+
bind: keyboardControls.up,
|
|
231
|
+
keyDown: function() {
|
|
232
|
+
if (canControls()) client.processInput({ input: Direction.Up });
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
left: {
|
|
236
|
+
repeat: true,
|
|
237
|
+
bind: keyboardControls.left,
|
|
238
|
+
keyDown: function() {
|
|
239
|
+
if (canControls()) client.processInput({ input: Direction.Left });
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
right: {
|
|
243
|
+
repeat: true,
|
|
244
|
+
bind: keyboardControls.right,
|
|
245
|
+
keyDown: function() {
|
|
246
|
+
if (canControls()) client.processInput({ input: Direction.Right });
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
action: {
|
|
250
|
+
bind: keyboardControls.action,
|
|
251
|
+
keyDown: function() {
|
|
252
|
+
if (canControls()) client.processAction({ action: "action" });
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
escape: {
|
|
256
|
+
bind: keyboardControls.escape,
|
|
257
|
+
keyDown: function() {
|
|
258
|
+
if (canControls()) client.processAction({ action: "escape" });
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
gamepad: { enabled: true }
|
|
262
|
+
});
|
|
263
|
+
var smoothX = animatedSignal(x(), { duration: isMe() ? 0 : 0 });
|
|
264
|
+
var smoothY = animatedSignal(y(), { duration: isMe() ? 0 : 0 });
|
|
265
|
+
var z = computed(function() {
|
|
266
|
+
return object.y() + object.z();
|
|
267
|
+
});
|
|
268
|
+
var realAnimationName = signal(animationName());
|
|
269
|
+
var xSubscription = x.observable.subscribe(function(value) {
|
|
270
|
+
smoothX.set(value);
|
|
271
|
+
});
|
|
272
|
+
var ySubscription = y.observable.subscribe(function(value) {
|
|
273
|
+
smoothY.set(value);
|
|
274
|
+
});
|
|
275
|
+
var sheet = function(graphicObject) {
|
|
276
|
+
return {
|
|
277
|
+
definition: graphicObject,
|
|
278
|
+
playing: realAnimationName(),
|
|
279
|
+
params: { direction: direction() },
|
|
280
|
+
onFinish: function() {
|
|
281
|
+
animationCurrentIndex.update(function(index) {
|
|
282
|
+
return index + 1;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
var movementAnimations = ["walk", "stand"];
|
|
288
|
+
var epsilon = 0;
|
|
289
|
+
var stateX$ = smoothX.animatedState.observable;
|
|
290
|
+
var stateY$ = smoothY.animatedState.observable;
|
|
291
|
+
var animationName$ = animationName.observable;
|
|
292
|
+
var moving$ = combineLatest([stateX$, stateY$]).pipe(map(function(_a) {
|
|
293
|
+
var sx = _a[0], sy = _a[1];
|
|
294
|
+
var xFinished = Math.abs(sx.value.current - sx.value.end) <= epsilon;
|
|
295
|
+
var yFinished = Math.abs(sy.value.current - sy.value.end) <= epsilon;
|
|
296
|
+
return !xFinished || !yFinished;
|
|
297
|
+
}), startWith(false));
|
|
298
|
+
var animationMovementSubscription = combineLatest([animationName$.pipe(startWith(animationName()), pairwise(), filter(function(_a) {
|
|
299
|
+
return _a[0] !== _a[1];
|
|
300
|
+
})), moving$]).subscribe(function(_a) {
|
|
301
|
+
var _b = _a[0];
|
|
302
|
+
_b[0];
|
|
303
|
+
var curr = _b[1], isMoving = _a[1];
|
|
304
|
+
if (curr == "stand" && !isMoving) realAnimationName.set(curr);
|
|
305
|
+
else if (curr == "walk" && isMoving) realAnimationName.set(curr);
|
|
306
|
+
else if (!movementAnimations.includes(curr)) realAnimationName.set(curr);
|
|
307
|
+
if (!isMoving && object.animationIsPlaying && object.animationIsPlaying()) {
|
|
308
|
+
if (movementAnimations.includes(curr)) {
|
|
309
|
+
if (typeof object.resetAnimationState === "function") object.resetAnimationState();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
var onBeforeDestroy = function() {
|
|
314
|
+
return __awaiter(void 0, void 0, void 0, function() {
|
|
315
|
+
return __generator(this, function(_a) {
|
|
316
|
+
switch (_a.label) {
|
|
317
|
+
case 0:
|
|
318
|
+
animationMovementSubscription.unsubscribe();
|
|
319
|
+
xSubscription.unsubscribe();
|
|
320
|
+
ySubscription.unsubscribe();
|
|
321
|
+
return [4, lastValueFrom(hooks.callHooks("client-sprite-onDestroy", object))];
|
|
322
|
+
case 1:
|
|
323
|
+
_a.sent();
|
|
324
|
+
return [4, lastValueFrom(hooks.callHooks("client-sceneMap-onRemoveSprite", client.sceneMap, object))];
|
|
325
|
+
case 2:
|
|
326
|
+
_a.sent();
|
|
327
|
+
return [2];
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
mount(function(element) {
|
|
333
|
+
hooks.callHooks("client-sprite-onAdd", object).subscribe();
|
|
334
|
+
hooks.callHooks("client-sceneMap-onAddSprite", client.sceneMap, object).subscribe();
|
|
335
|
+
if (isMe()) client.setKeyboardControls(element.directives.controls);
|
|
336
|
+
});
|
|
337
|
+
var onAttachedGuiFinish = function(gui, data) {
|
|
338
|
+
guiService.guiClose(gui.name, data);
|
|
339
|
+
};
|
|
340
|
+
var onAttachedGuiInteraction = function(gui, name, data) {
|
|
341
|
+
guiService.guiInteraction(gui.name, name, data);
|
|
342
|
+
};
|
|
343
|
+
tick(function() {
|
|
344
|
+
hooks.callHooks("client-sprite-onUpdate").subscribe();
|
|
345
|
+
});
|
|
346
|
+
return h(Container, {
|
|
347
|
+
x: smoothX,
|
|
348
|
+
y: smoothY,
|
|
349
|
+
zIndex: z,
|
|
350
|
+
viewportFollow: shouldFollowCamera,
|
|
351
|
+
controls,
|
|
352
|
+
onBeforeDestroy,
|
|
353
|
+
visible
|
|
354
|
+
}, [
|
|
355
|
+
loop(normalizedComponentsBehind, (compConfig) => h(Container, null, h(compConfig.component, {
|
|
356
|
+
object,
|
|
357
|
+
...compConfig.props
|
|
358
|
+
}))),
|
|
359
|
+
h(Particle, {
|
|
360
|
+
emit: emitParticleTrigger,
|
|
361
|
+
settings: particleSettings,
|
|
362
|
+
zIndex: 1e3,
|
|
363
|
+
name: particleName
|
|
364
|
+
}),
|
|
365
|
+
h(Container, null, loop(graphicsSignals, (graphicObj) => h(Sprite, {
|
|
366
|
+
sheet: computed(() => sheet(graphicObj)),
|
|
367
|
+
direction,
|
|
368
|
+
tint,
|
|
369
|
+
hitbox,
|
|
370
|
+
flash: flashConfig
|
|
371
|
+
}))),
|
|
372
|
+
loop(normalizedComponentsInFront, (compConfig) => h(Container, { dependencies: compConfig.dependencies }, h(compConfig.component, {
|
|
373
|
+
object,
|
|
374
|
+
...compConfig.props
|
|
375
|
+
}))),
|
|
376
|
+
loop(attachedGuis, (attachedGui) => cond(shouldDisplayAttachedGui, () => h(Container, null, h(attachedGui.component, {
|
|
377
|
+
...attachedGui.data(),
|
|
378
|
+
dependencies: attachedGui.dependencies,
|
|
379
|
+
object,
|
|
380
|
+
onFinish: (data) => {
|
|
381
|
+
onAttachedGuiFinish(attachedGui, data);
|
|
382
|
+
},
|
|
383
|
+
onInteraction: (name, data) => {
|
|
384
|
+
onAttachedGuiInteraction(attachedGui, name, data);
|
|
385
|
+
}
|
|
386
|
+
}))))
|
|
387
|
+
]);
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
315
390
|
export { component as default };
|
|
316
|
-
|
|
391
|
+
|
|
392
|
+
//# sourceMappingURL=character.ce.js.map
|