@rpgjs/client 5.0.0-beta.11 → 5.0.0-beta.13
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/CHANGELOG.md +19 -0
- package/dist/Game/AnimationManager.d.ts +1 -0
- package/dist/Game/AnimationManager.js +3 -0
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/ClientVisuals.d.ts +61 -0
- package/dist/Game/ClientVisuals.js +96 -0
- package/dist/Game/ClientVisuals.js.map +1 -0
- package/dist/Game/ClientVisuals.spec.d.ts +1 -0
- package/dist/Game/EventComponentResolver.d.ts +16 -0
- package/dist/Game/EventComponentResolver.js +52 -0
- package/dist/Game/EventComponentResolver.js.map +1 -0
- package/dist/Game/EventComponentResolver.spec.d.ts +1 -0
- package/dist/Game/Map.js +9 -0
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.d.ts +2 -0
- package/dist/Game/Object.js +22 -8
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Object.spec.d.ts +1 -0
- package/dist/Game/ProjectileManager.d.ts +11 -2
- package/dist/Game/ProjectileManager.js +19 -2
- package/dist/Game/ProjectileManager.js.map +1 -1
- package/dist/Gui/Gui.d.ts +3 -2
- package/dist/Gui/Gui.js +18 -6
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/RpgClient.d.ts +85 -1
- package/dist/RpgClientEngine.d.ts +77 -2
- package/dist/RpgClientEngine.js +290 -31
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/components/animations/fx.ce.js +58 -0
- package/dist/components/animations/fx.ce.js.map +1 -0
- package/dist/components/animations/index.d.ts +1 -0
- package/dist/components/animations/index.js +3 -1
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +192 -19
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +27 -12
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +4 -3
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +9 -8
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +7 -5
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +8 -7
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +12 -11
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +7 -5
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +4 -2
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +4 -1
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +10 -9
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +17 -16
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +4 -3
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/interaction-components.ce.js +20 -0
- package/dist/components/interaction-components.ce.js.map +1 -0
- package/dist/components/scenes/canvas.ce.js +12 -7
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +18 -13
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/i18n.d.ts +55 -0
- package/dist/i18n.js +60 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.spec.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -2
- package/dist/module.js +30 -3
- package/dist/module.js.map +1 -1
- package/dist/services/actionInput.d.ts +3 -1
- package/dist/services/actionInput.js +33 -1
- package/dist/services/actionInput.js.map +1 -1
- package/dist/services/interactions.d.ts +159 -0
- package/dist/services/interactions.js +460 -0
- package/dist/services/interactions.js.map +1 -0
- package/dist/services/interactions.spec.d.ts +1 -0
- package/dist/services/keyboardControls.d.ts +1 -0
- package/dist/services/keyboardControls.js +1 -0
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/standalone.d.ts +3 -1
- package/dist/services/standalone.js +31 -13
- package/dist/services/standalone.js.map +1 -1
- package/dist/utils/mapId.d.ts +1 -0
- package/dist/utils/mapId.js +6 -0
- package/dist/utils/mapId.js.map +1 -0
- package/package.json +4 -4
- package/src/Game/AnimationManager.ts +4 -0
- package/src/Game/ClientVisuals.spec.ts +56 -0
- package/src/Game/ClientVisuals.ts +184 -0
- package/src/Game/EventComponentResolver.spec.ts +84 -0
- package/src/Game/EventComponentResolver.ts +74 -0
- package/src/Game/Map.ts +10 -0
- package/src/Game/Object.spec.ts +59 -0
- package/src/Game/Object.ts +36 -12
- package/src/Game/ProjectileManager.spec.ts +111 -0
- package/src/Game/ProjectileManager.ts +24 -2
- package/src/Gui/Gui.spec.ts +67 -0
- package/src/Gui/Gui.ts +24 -7
- package/src/RpgClient.ts +96 -1
- package/src/RpgClientEngine.ts +378 -45
- package/src/components/animations/fx.ce +101 -0
- package/src/components/animations/index.ts +4 -2
- package/src/components/character.ce +243 -17
- package/src/components/gui/dialogbox/index.ce +35 -14
- package/src/components/gui/gameover.ce +4 -3
- package/src/components/gui/menu/equip-menu.ce +9 -8
- package/src/components/gui/menu/exit-menu.ce +4 -3
- package/src/components/gui/menu/items-menu.ce +8 -7
- package/src/components/gui/menu/main-menu.ce +12 -11
- package/src/components/gui/menu/options-menu.ce +4 -3
- package/src/components/gui/menu/skills-menu.ce +2 -1
- package/src/components/gui/notification/notification.ce +7 -1
- package/src/components/gui/save-load.ce +11 -10
- package/src/components/gui/shop/shop.ce +17 -16
- package/src/components/gui/title-screen.ce +4 -3
- package/src/components/interaction-components.ce +23 -0
- package/src/components/scenes/canvas.ce +12 -7
- package/src/components/scenes/draw-map.ce +16 -5
- package/src/i18n.spec.ts +39 -0
- package/src/i18n.ts +59 -0
- package/src/index.ts +3 -0
- package/src/module.ts +43 -10
- package/src/services/actionInput.spec.ts +54 -0
- package/src/services/actionInput.ts +68 -1
- package/src/services/interactions.spec.ts +175 -0
- package/src/services/interactions.ts +722 -0
- package/src/services/keyboardControls.ts +2 -1
- package/src/services/standalone.ts +39 -10
- package/src/utils/mapId.ts +2 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import __ce_component from "./hit.ce.js";
|
|
2
2
|
import __ce_component$1 from "./animation.ce.js";
|
|
3
|
+
import __ce_component$2 from "./fx.ce.js";
|
|
3
4
|
//#region src/components/animations/index.ts
|
|
4
5
|
var PrebuiltComponentAnimations = {
|
|
5
6
|
Hit: __ce_component,
|
|
6
|
-
Animation: __ce_component$1
|
|
7
|
+
Animation: __ce_component$1,
|
|
8
|
+
Fx: __ce_component$2
|
|
7
9
|
};
|
|
8
10
|
//#endregion
|
|
9
11
|
export { PrebuiltComponentAnimations };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/animations/index.ts"],"sourcesContent":["import Hit from \"./hit.ce\";\nimport Animation from \"./animation.ce\";\n\nexport const PrebuiltComponentAnimations = {\n Hit,\n Animation\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/animations/index.ts"],"sourcesContent":["import Hit from \"./hit.ce\";\nimport Animation from \"./animation.ce\";\nimport Fx from \"./fx.ce\";\n\nexport const PrebuiltComponentAnimations = {\n Hit,\n Animation,\n Fx\n}\n"],"mappings":";;;;AAIA,IAAa,8BAA8B;CACvC,KAAA;CACA,WAAA;CACA,IAAA;AACJ"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { inject } from "../core/inject.js";
|
|
2
|
-
import { getKeyboardControlBind, resolveKeyboardActionInput } from "../services/actionInput.js";
|
|
2
|
+
import { getKeyboardControlBind, keyboardEventMatchesBind, resolveKeyboardActionInput, resolveKeyboardDirectionInput } from "../services/actionInput.js";
|
|
3
3
|
import { getCanMoveValue } from "../utils/readPropValue.js";
|
|
4
4
|
import { RpgGui } from "../Gui/Gui.js";
|
|
5
|
+
import { normalizeEventComponent } from "../Game/EventComponentResolver.js";
|
|
5
6
|
import { RpgClientEngine } from "../RpgClientEngine.js";
|
|
6
7
|
import __ce_component$1 from "./player-components.ce.js";
|
|
8
|
+
import __ce_component$2 from "./interaction-components.ce.js";
|
|
7
9
|
import { Container, Sprite, animatedSignal, computed, cond, effect, h, loop, mount, on, signal, tick, useDefineProps, useProps } from "canvasengine";
|
|
8
10
|
import { Animation, Direction, ModulesToken } from "@rpgjs/common";
|
|
9
11
|
import { combineLatest, filter, lastValueFrom, map, pairwise, startWith } from "rxjs";
|
|
@@ -63,6 +65,14 @@ function component($$props) {
|
|
|
63
65
|
const normalizedComponentsInFront = computed(() => {
|
|
64
66
|
return normalizeComponents(componentsInFront());
|
|
65
67
|
});
|
|
68
|
+
const isEventSprite = () => {
|
|
69
|
+
return typeof sprite?.isEvent === "function" ? sprite.isEvent() : sprite?._type === "event";
|
|
70
|
+
};
|
|
71
|
+
const resolvedEventComponents = computed(() => {
|
|
72
|
+
if (!isEventSprite()) return [];
|
|
73
|
+
const eventComponent = normalizeEventComponent(client.resolveEventComponent(sprite), sprite);
|
|
74
|
+
return eventComponent ? [eventComponent] : [];
|
|
75
|
+
});
|
|
66
76
|
const shouldFollowCamera = computed(() => {
|
|
67
77
|
const cameraTargetId = client.cameraFollowTargetId();
|
|
68
78
|
if (cameraTargetId !== null) return id() === cameraTargetId;
|
|
@@ -75,6 +85,11 @@ function component($$props) {
|
|
|
75
85
|
return guiService.shouldDisplayAttachedGui(id());
|
|
76
86
|
});
|
|
77
87
|
const { x, y, tint, direction, animationName, animationCurrentIndex, emitParticleTrigger, particleName, graphics, hitbox, isConnected, graphicsSignals, flashTrigger } = sprite;
|
|
88
|
+
const renderedGraphics = computed(() => {
|
|
89
|
+
const eventComponent = resolvedEventComponents()[0];
|
|
90
|
+
if (eventComponent && !eventComponent.renderGraphic) return [];
|
|
91
|
+
return graphicsSignals();
|
|
92
|
+
});
|
|
78
93
|
const flashType = signal("alpha");
|
|
79
94
|
const flashDuration = signal(300);
|
|
80
95
|
const flashCycles = signal(1);
|
|
@@ -100,6 +115,93 @@ function component($$props) {
|
|
|
100
115
|
const particleSettings = client.particleSettings;
|
|
101
116
|
const canControls = () => isMe() && getCanMoveValue(sprite);
|
|
102
117
|
const keyboardControls = client.globalConfig.keyboardControls;
|
|
118
|
+
const activeDirectionKeys = /* @__PURE__ */ new Map();
|
|
119
|
+
const resolveHeldDirection = () => {
|
|
120
|
+
const directions = Array.from(activeDirectionKeys.values());
|
|
121
|
+
return directions[directions.length - 1];
|
|
122
|
+
};
|
|
123
|
+
const resolveSpriteDirection = () => {
|
|
124
|
+
const heldDirection = resolveHeldDirection();
|
|
125
|
+
if (heldDirection) return heldDirection;
|
|
126
|
+
if (typeof sprite.getDirection === "function") return sprite.getDirection();
|
|
127
|
+
if (typeof sprite.direction === "function") return sprite.direction();
|
|
128
|
+
return direction();
|
|
129
|
+
};
|
|
130
|
+
const directionToDashVector = (currentDirection) => {
|
|
131
|
+
switch (currentDirection) {
|
|
132
|
+
case Direction.Left: return {
|
|
133
|
+
x: -1,
|
|
134
|
+
y: 0
|
|
135
|
+
};
|
|
136
|
+
case Direction.Right: return {
|
|
137
|
+
x: 1,
|
|
138
|
+
y: 0
|
|
139
|
+
};
|
|
140
|
+
case Direction.Up: return {
|
|
141
|
+
x: 0,
|
|
142
|
+
y: -1
|
|
143
|
+
};
|
|
144
|
+
case Direction.Down:
|
|
145
|
+
default: return {
|
|
146
|
+
x: 0,
|
|
147
|
+
y: 1
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const withCurrentDirection = (payload) => {
|
|
152
|
+
if (payload.action !== "action") return payload;
|
|
153
|
+
const data = payload.data && typeof payload.data === "object" ? { ...payload.data } : {};
|
|
154
|
+
return {
|
|
155
|
+
...payload,
|
|
156
|
+
data: {
|
|
157
|
+
...data,
|
|
158
|
+
direction: data.direction ?? resolveSpriteDirection()
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
const resolveCurrentActionInput = () => withCurrentDirection(resolveKeyboardActionInput(keyboardControls.action, client, sprite));
|
|
163
|
+
const playPredictedWalkAnimation = () => {
|
|
164
|
+
if (sprite.animationFixed) return;
|
|
165
|
+
if (sprite.animationIsPlaying && sprite.animationIsPlaying()) return;
|
|
166
|
+
realAnimationName.set("walk");
|
|
167
|
+
};
|
|
168
|
+
const resumeHeldDirectionWalkAnimation = () => {
|
|
169
|
+
if (!isCurrentPlayer()) return false;
|
|
170
|
+
if (activeDirectionKeys.size === 0) return false;
|
|
171
|
+
if (!canControls()) return false;
|
|
172
|
+
if (sprite.animationFixed) return false;
|
|
173
|
+
if (sprite.animationIsPlaying && sprite.animationIsPlaying()) return false;
|
|
174
|
+
realAnimationName.set("walk");
|
|
175
|
+
return true;
|
|
176
|
+
};
|
|
177
|
+
const processMovementInput = (input) => {
|
|
178
|
+
if (!canControls()) return;
|
|
179
|
+
client.processInput({ input });
|
|
180
|
+
playPredictedWalkAnimation();
|
|
181
|
+
};
|
|
182
|
+
const processDashInput = () => {
|
|
183
|
+
if (!canControls()) return;
|
|
184
|
+
client.processDash({ direction: directionToDashVector(resolveSpriteDirection()) });
|
|
185
|
+
};
|
|
186
|
+
const actionBind = () => getKeyboardControlBind(keyboardControls.action);
|
|
187
|
+
const keyboardEventId = (event) => `${event.keyCode}:${event.code}:${event.key}`;
|
|
188
|
+
const handleNativeActionWhileMoving = (event) => {
|
|
189
|
+
const inputDirection = resolveKeyboardDirectionInput(event, keyboardControls);
|
|
190
|
+
if (inputDirection) {
|
|
191
|
+
const keyId = keyboardEventId(event);
|
|
192
|
+
if (event.type === "keydown") {
|
|
193
|
+
activeDirectionKeys.delete(keyId);
|
|
194
|
+
activeDirectionKeys.set(keyId, inputDirection);
|
|
195
|
+
resumeHeldDirectionWalkAnimation();
|
|
196
|
+
} else activeDirectionKeys.delete(keyId);
|
|
197
|
+
}
|
|
198
|
+
if (!isCurrentPlayer()) return;
|
|
199
|
+
if (event.type !== "keydown" || event.repeat) return;
|
|
200
|
+
if (activeDirectionKeys.size === 0) return;
|
|
201
|
+
if (!keyboardEventMatchesBind(event, actionBind())) return;
|
|
202
|
+
if (!canControls()) return;
|
|
203
|
+
client.processAction(resolveCurrentActionInput());
|
|
204
|
+
};
|
|
103
205
|
const visible = computed(() => {
|
|
104
206
|
if (sprite.isEvent()) return true;
|
|
105
207
|
return isConnected();
|
|
@@ -109,34 +211,40 @@ function component($$props) {
|
|
|
109
211
|
repeat: true,
|
|
110
212
|
bind: keyboardControls.down,
|
|
111
213
|
keyDown() {
|
|
112
|
-
|
|
214
|
+
processMovementInput(Direction.Down);
|
|
113
215
|
}
|
|
114
216
|
},
|
|
115
217
|
up: {
|
|
116
218
|
repeat: true,
|
|
117
219
|
bind: keyboardControls.up,
|
|
118
220
|
keyDown() {
|
|
119
|
-
|
|
221
|
+
processMovementInput(Direction.Up);
|
|
120
222
|
}
|
|
121
223
|
},
|
|
122
224
|
left: {
|
|
123
225
|
repeat: true,
|
|
124
226
|
bind: keyboardControls.left,
|
|
125
227
|
keyDown() {
|
|
126
|
-
|
|
228
|
+
processMovementInput(Direction.Left);
|
|
127
229
|
}
|
|
128
230
|
},
|
|
129
231
|
right: {
|
|
130
232
|
repeat: true,
|
|
131
233
|
bind: keyboardControls.right,
|
|
132
234
|
keyDown() {
|
|
133
|
-
|
|
235
|
+
processMovementInput(Direction.Right);
|
|
134
236
|
}
|
|
135
237
|
},
|
|
136
238
|
action: {
|
|
137
239
|
bind: getKeyboardControlBind(keyboardControls.action),
|
|
138
240
|
keyDown() {
|
|
139
|
-
if (canControls()) client.processAction(
|
|
241
|
+
if (canControls()) client.processAction(resolveCurrentActionInput());
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
dash: {
|
|
245
|
+
bind: keyboardControls.dash,
|
|
246
|
+
keyDown() {
|
|
247
|
+
processDashInput();
|
|
140
248
|
}
|
|
141
249
|
},
|
|
142
250
|
escape: {
|
|
@@ -170,7 +278,7 @@ function component($$props) {
|
|
|
170
278
|
};
|
|
171
279
|
};
|
|
172
280
|
const graphicScale = (graphicObject) => {
|
|
173
|
-
const scale = graphicObject?.scale;
|
|
281
|
+
const scale = graphicObject?.displayScale ?? graphicObject?.scale;
|
|
174
282
|
if (Array.isArray(scale)) return scale;
|
|
175
283
|
if (typeof scale === "number") return [scale, scale];
|
|
176
284
|
if (scale && typeof scale === "object") {
|
|
@@ -359,6 +467,8 @@ function component($$props) {
|
|
|
359
467
|
const graphicBounds = computed(() => {
|
|
360
468
|
const box = hitbox();
|
|
361
469
|
const fallback = hitboxBounds();
|
|
470
|
+
const customEventComponent = resolvedEventComponents()[0];
|
|
471
|
+
if (customEventComponent && !customEventComponent.renderGraphic) return fallback;
|
|
362
472
|
const dimensions = imageDimensions();
|
|
363
473
|
const graphics = graphicsSignals();
|
|
364
474
|
let bounds = null;
|
|
@@ -401,6 +511,25 @@ function component($$props) {
|
|
|
401
511
|
centerY: bounds.top + height / 2
|
|
402
512
|
};
|
|
403
513
|
});
|
|
514
|
+
const interactionBounds = () => ({
|
|
515
|
+
bounds: graphicBounds(),
|
|
516
|
+
hitbox: hitboxBounds(),
|
|
517
|
+
graphic: graphicBounds()
|
|
518
|
+
});
|
|
519
|
+
const interactionCursor = computed(() => client.interactions.cursorFor(sprite, interactionBounds()));
|
|
520
|
+
const handleInteraction = (type) => (event) => {
|
|
521
|
+
client.updatePointerFromInteractionEvent(event);
|
|
522
|
+
client.interactions.handle(sprite, type, {
|
|
523
|
+
event,
|
|
524
|
+
bounds: interactionBounds()
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
const interactionPointerOver = handleInteraction("pointerover");
|
|
528
|
+
const interactionPointerOut = handleInteraction("pointerout");
|
|
529
|
+
const interactionPointerDown = handleInteraction("pointerdown");
|
|
530
|
+
const interactionPointerUp = handleInteraction("pointerup");
|
|
531
|
+
const interactionPointerMove = handleInteraction("pointermove");
|
|
532
|
+
const interactionClick = handleInteraction("click");
|
|
404
533
|
const movementAnimations = ["walk", "stand"];
|
|
405
534
|
const epsilon = 0;
|
|
406
535
|
const stateX$ = smoothX.animatedState.observable;
|
|
@@ -443,15 +572,29 @@ function component($$props) {
|
|
|
443
572
|
if (resolveRemoveContext()) runBeforeRemove();
|
|
444
573
|
});
|
|
445
574
|
const animationMovementSubscription = combineLatest([animationChange$, moving$]).subscribe(([[prev, curr], isMoving]) => {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
575
|
+
const isMovementAnimation = movementAnimations.includes(curr);
|
|
576
|
+
const isTemporaryAnimationPlaying = sprite.animationIsPlaying && sprite.animationIsPlaying();
|
|
577
|
+
if (sprite.animationFixed && isMovementAnimation) {
|
|
578
|
+
realAnimationName.set(curr);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
if (curr == "stand" && !isMoving) {
|
|
582
|
+
if (!resumeHeldDirectionWalkAnimation()) realAnimationName.set(curr);
|
|
583
|
+
} else if (curr == "walk" && isMoving) realAnimationName.set(curr);
|
|
584
|
+
else if (!isMovementAnimation) realAnimationName.set(curr);
|
|
585
|
+
if (!isMoving && isTemporaryAnimationPlaying) {
|
|
586
|
+
if (isMovementAnimation) {
|
|
451
587
|
if (typeof sprite.resetAnimationState === "function") sprite.resetAnimationState();
|
|
452
588
|
}
|
|
453
589
|
}
|
|
454
590
|
});
|
|
591
|
+
const resumeWalkSubscriptions = [
|
|
592
|
+
sprite._canMove,
|
|
593
|
+
sprite._animationFixed,
|
|
594
|
+
sprite.animationIsPlaying
|
|
595
|
+
].filter((signal) => signal?.observable).map((signal) => signal.observable.subscribe(() => {
|
|
596
|
+
resumeHeldDirectionWalkAnimation();
|
|
597
|
+
}));
|
|
455
598
|
const waitForTemporaryAnimationEnd = (maxDuration = 1200) => {
|
|
456
599
|
if (!sprite.animationIsPlaying || !sprite.animationIsPlaying()) return Promise.resolve();
|
|
457
600
|
return new Promise((resolve) => {
|
|
@@ -475,22 +618,38 @@ function component($$props) {
|
|
|
475
618
|
const onBeforeDestroy = async () => {
|
|
476
619
|
await runBeforeRemove();
|
|
477
620
|
await waitForTemporaryAnimationEnd();
|
|
621
|
+
if (typeof document !== "undefined") {
|
|
622
|
+
document.removeEventListener("keydown", handleNativeActionWhileMoving);
|
|
623
|
+
document.removeEventListener("keyup", handleNativeActionWhileMoving);
|
|
624
|
+
}
|
|
478
625
|
removeTransitionSubscription?.unsubscribe();
|
|
479
626
|
animationMovementSubscription.unsubscribe();
|
|
627
|
+
resumeWalkSubscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
480
628
|
xSubscription.unsubscribe();
|
|
481
629
|
ySubscription.unsubscribe();
|
|
482
630
|
await lastValueFrom(hooks.callHooks("client-sprite-onDestroy", sprite));
|
|
483
631
|
await lastValueFrom(hooks.callHooks("client-sceneMap-onRemoveSprite", client.sceneMap, sprite));
|
|
484
632
|
};
|
|
485
633
|
mount((element) => {
|
|
634
|
+
if (typeof document !== "undefined") {
|
|
635
|
+
document.addEventListener("keydown", handleNativeActionWhileMoving);
|
|
636
|
+
document.addEventListener("keyup", handleNativeActionWhileMoving);
|
|
637
|
+
}
|
|
486
638
|
hooks.callHooks("client-sprite-onAdd", sprite).subscribe();
|
|
487
639
|
hooks.callHooks("client-sceneMap-onAddSprite", client.sceneMap, sprite).subscribe();
|
|
488
640
|
effect(() => {
|
|
489
641
|
if (isCurrentPlayer()) client.setKeyboardControls(element.directives.controls);
|
|
490
642
|
});
|
|
491
643
|
});
|
|
492
|
-
const
|
|
493
|
-
|
|
644
|
+
const normalizeOpenId = (value) => {
|
|
645
|
+
const resolved = typeof value === "function" ? value() : value;
|
|
646
|
+
return typeof resolved === "string" && resolved.length > 0 ? resolved : void 0;
|
|
647
|
+
};
|
|
648
|
+
const onAttachedGuiFinish = (gui, data, guiOpenId) => {
|
|
649
|
+
const completedOpenId = normalizeOpenId(guiOpenId);
|
|
650
|
+
const currentOpenId = normalizeOpenId(gui.openId);
|
|
651
|
+
if (completedOpenId && currentOpenId && completedOpenId !== currentOpenId) return;
|
|
652
|
+
guiService.guiClose(gui.name, data, completedOpenId ?? currentOpenId);
|
|
494
653
|
};
|
|
495
654
|
const onAttachedGuiInteraction = (gui, name, data) => {
|
|
496
655
|
guiService.guiInteraction(gui.name, name, data);
|
|
@@ -505,7 +664,14 @@ function component($$props) {
|
|
|
505
664
|
viewportFollow: shouldFollowCamera,
|
|
506
665
|
controls,
|
|
507
666
|
onBeforeDestroy,
|
|
508
|
-
visible
|
|
667
|
+
visible,
|
|
668
|
+
cursor: interactionCursor,
|
|
669
|
+
pointerover: interactionPointerOver,
|
|
670
|
+
pointerout: interactionPointerOut,
|
|
671
|
+
pointerdown: interactionPointerDown,
|
|
672
|
+
pointerup: interactionPointerUp,
|
|
673
|
+
pointermove: interactionPointerMove,
|
|
674
|
+
click: interactionClick
|
|
509
675
|
}, [
|
|
510
676
|
loop(normalizedComponentsBehind, (compConfig) => h(Container, null, h(compConfig.component, {
|
|
511
677
|
object: sprite,
|
|
@@ -527,14 +693,14 @@ function component($$props) {
|
|
|
527
693
|
zIndex: 1e3,
|
|
528
694
|
name: particleName
|
|
529
695
|
}),
|
|
530
|
-
h(Container, null, loop(
|
|
696
|
+
h(Container, null, [loop(renderedGraphics, (graphicObj) => h(Container, { scale: computed(() => graphicScale(graphicObj)) }, h(Sprite, {
|
|
531
697
|
sheet: computed(() => sheet(graphicObj)),
|
|
532
698
|
direction,
|
|
533
699
|
tint,
|
|
534
700
|
hitbox,
|
|
535
701
|
shadowCaster: computed(() => shadowCaster(graphicObj)),
|
|
536
702
|
flash: flashConfig
|
|
537
|
-
})))),
|
|
703
|
+
}))), loop(resolvedEventComponents, (eventComponent) => h(Container, { dependencies: eventComponent.dependencies }, h(eventComponent.component, eventComponent.props)))]),
|
|
538
704
|
h(__ce_component$1, {
|
|
539
705
|
object: sprite,
|
|
540
706
|
position: "center",
|
|
@@ -554,12 +720,19 @@ function component($$props) {
|
|
|
554
720
|
object: sprite,
|
|
555
721
|
...compConfig.props
|
|
556
722
|
}))),
|
|
723
|
+
h(__ce_component$2, {
|
|
724
|
+
object: sprite,
|
|
725
|
+
bounds: graphicBounds,
|
|
726
|
+
hitboxBounds,
|
|
727
|
+
graphicBounds
|
|
728
|
+
}),
|
|
557
729
|
loop(attachedGuis, (attachedGui) => cond(shouldDisplayAttachedGui, () => h(Container, null, h(attachedGui.component, {
|
|
558
730
|
...attachedGui.data(),
|
|
559
731
|
dependencies: attachedGui.dependencies,
|
|
560
732
|
object: sprite,
|
|
561
|
-
|
|
562
|
-
|
|
733
|
+
guiOpenId: attachedGui.openId,
|
|
734
|
+
onFinish: (data, guiOpenId) => {
|
|
735
|
+
onAttachedGuiFinish(attachedGui, data, guiOpenId);
|
|
563
736
|
},
|
|
564
737
|
onInteraction: (name, data) => {
|
|
565
738
|
onAttachedGuiInteraction(attachedGui, name, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character.ce.js","names":[],"sources":["../../src/components/character.ce"],"sourcesContent":["<Container x={smoothX} y={smoothY} zIndex={z} viewportFollow={shouldFollowCamera} controls onBeforeDestroy visible>\n @for (compConfig of normalizedComponentsBehind) {\n <Container>\n <compConfig.component object={sprite} ...compConfig.props />\n </Container>\n } \n <PlayerComponents object={sprite} position=\"bottom\" graphicBounds />\n <PlayerComponents object={sprite} position=\"left\" graphicBounds />\n <Particle emit={emitParticleTrigger} settings={particleSettings} zIndex={1000} name={particleName} />\n <Container>\n @for (graphicObj of graphicsSignals) {\n <Container scale={graphicScale(graphicObj)}>\n <Sprite \n sheet={sheet(graphicObj)} \n direction \n tint \n hitbox\n shadowCaster={shadowCaster(graphicObj)}\n flash={flashConfig}\n />\n </Container>\n }\n </Container>\n <PlayerComponents object={sprite} position=\"center\" graphicBounds />\n <PlayerComponents object={sprite} position=\"right\" graphicBounds />\n <PlayerComponents object={sprite} position=\"top\" graphicBounds />\n @for (compConfig of normalizedComponentsInFront) {\n <Container dependencies={compConfig.dependencies}>\n <compConfig.component object={sprite} ...compConfig.props />\n </Container>\n }\n @for (attachedGui of attachedGuis) {\n @if (shouldDisplayAttachedGui) {\n <Container>\n <attachedGui.component ...attachedGui.data() dependencies={attachedGui.dependencies} object={sprite} onFinish={(data) => {\n onAttachedGuiFinish(attachedGui, data)\n }} onInteraction={(name, data) => {\n onAttachedGuiInteraction(attachedGui, name, data)\n }} />\n </Container>\n }\n }\n</Container>\n\n<script>\n import { signal, effect, mount, computed, tick, animatedSignal, on } from \"canvasengine\";\n import { Assets } from \"pixi.js\";\n\n import { lastValueFrom, combineLatest, pairwise, filter, map, startWith } from \"rxjs\";\n import { Particle } from \"@canvasengine/presets\";\n import { GameEngineToken, ModulesToken } from \"@rpgjs/common\";\n import { RpgClientEngine } from \"../RpgClientEngine\";\n import { inject } from \"../core/inject\"; \n import { Direction, Animation } from \"@rpgjs/common\";\n import Hit from \"./effects/hit.ce\";\n import PlayerComponents from \"./player-components.ce\";\n import { RpgGui } from \"../Gui/Gui\";\n import { getCanMoveValue } from \"../utils/readPropValue\";\n import { getKeyboardControlBind, resolveKeyboardActionInput } from \"../services/actionInput\";\n\n const { object, id } = defineProps();\n const sprite = object();\n\n const client = inject(RpgClientEngine);\n const hooks = inject(ModulesToken);\n const guiService = inject(RpgGui);\n\n const spritesheets = client.spritesheets;\n const componentsBehind = client.spriteComponentsBehind;\n const componentsInFront = client.spriteComponentsInFront;\n const readProp = (value) => typeof value === 'function' ? value() : value;\n const isCurrentPlayer = () => {\n const playerId = client.playerIdSignal();\n const currentPlayer = playerId ? client.sceneMap?.players?.()?.[playerId] : undefined;\n return readProp(id) === playerId\n || readProp(sprite?.id) === playerId\n || sprite === currentPlayer\n || sprite === client.sceneMap?.getCurrentPlayer?.();\n };\n const isMe = computed(isCurrentPlayer);\n const shadowsEnabled = computed(() => {\n const lighting = client.sceneMap?.lighting?.();\n return Boolean(lighting?.shadows?.enabled || (lighting?.spots?.length ?? 0) > 0);\n });\n\n /**\n * Normalize a single sprite component configuration\n * \n * Handles both direct component references and configuration objects with optional props and dependencies.\n * Extracts the component reference and creates a computed function that returns the props.\n * \n * ## Design\n * \n * Supports two formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...}, dependencies: (object) => [...] }`\n * \n * The normalization process:\n * - Extracts the actual component from either format\n * - Extracts dependencies function if provided\n * - Creates a computed function that returns props (static object or dynamic function result)\n * - Returns a normalized object with `component`, `props`, and `dependencies`\n * \n * @param comp - Component reference or configuration object\n * @returns Normalized component configuration with component, props, and dependencies\n * \n * @example\n * ```ts\n * // Direct component\n * normalizeComponent(ShadowComponent)\n * // => { component: ShadowComponent, props: {}, dependencies: undefined }\n * \n * // With static props\n * normalizeComponent({ component: LightHalo, props: { radius: 30 } })\n * // => { component: LightHalo, props: { radius: 30 }, dependencies: undefined }\n * \n * // With dynamic props and dependencies\n * normalizeComponent({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * })\n * // => { component: HealthBar, props: {...}, dependencies: (object) => [...] }\n * ```\n */\n const normalizeComponent = (comp) => {\n let componentRef;\n let propsValue;\n let dependenciesFn;\n \n // If it's a direct component reference\n if (typeof comp === 'function' || (comp && typeof comp === 'object' && !comp.component)) {\n componentRef = comp;\n propsValue = undefined;\n dependenciesFn = undefined;\n }\n // If it's a configuration object with component and props\n else if (comp && typeof comp === 'object' && comp.component) {\n componentRef = comp.component;\n // Support both \"data\" (legacy) and \"props\" (new) for backward compatibility\n propsValue = comp.props !== undefined ? comp.props : comp.data;\n dependenciesFn = comp.dependencies;\n }\n // Fallback: treat as direct component\n else {\n componentRef = comp;\n propsValue = undefined;\n dependenciesFn = undefined;\n }\n \n // Return props directly (object or function), not as computed\n // The computed will be created in the template when needed\n return {\n component: componentRef,\n props: typeof propsValue === 'function' ? propsValue(sprite) : propsValue || {},\n dependencies: dependenciesFn ? dependenciesFn(sprite) : []\n };\n };\n\n /**\n * Normalize an array of sprite components\n * \n * Applies normalization to each component in the array using `normalizeComponent`.\n * \n * @param components - Array of component references or configuration objects\n * @returns Array of normalized component configurations\n */\n const normalizeComponents = (components) => {\n return components.map((comp) => normalizeComponent(comp));\n };\n\n\n /**\n * Normalized components to render behind sprites\n * Handles both direct component references and configuration objects with optional props and dependencies\n * \n * Supports multiple formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...} }`\n * 3. With dynamic props: `{ component: LightHalo, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @example\n * ```ts\n * // Direct component\n * componentsBehind: [ShadowComponent]\n * \n * // With static props\n * componentsBehind: [{ component: LightHalo, props: { radius: 30 } }]\n * \n * // With dynamic props and dependencies\n * componentsBehind: [{ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * }]\n * ```\n */\n const normalizedComponentsBehind = computed(() => {\n return normalizeComponents(componentsBehind());\n });\n\n /**\n * Normalized components to render in front of sprites\n * Handles both direct component references and configuration objects with optional props and dependencies\n * \n * See `normalizedComponentsBehind` for format details.\n * Components with dependencies will only be displayed when all dependencies are resolved.\n */\n const normalizedComponentsInFront = computed(() => {\n return normalizeComponents(componentsInFront());\n });\n \n /**\n * Determine if the camera should follow this sprite\n * \n * The camera follows this sprite if:\n * - It's explicitly set as the camera follow target, OR\n * - It's the current player and no explicit target is set (default behavior)\n */\n const shouldFollowCamera = computed(() => {\n const cameraTargetId = client.cameraFollowTargetId();\n // If a target is explicitly set, only follow if this sprite is the target\n if (cameraTargetId !== null) {\n return id() === cameraTargetId;\n }\n // Otherwise, follow the current player (default behavior)\n return isMe();\n });\n\n /**\n * Get all attached GUI components that should be rendered on sprites\n * These are GUIs with attachToSprite: true\n */\n const attachedGuis = computed(() => {\n return guiService.getAttachedGuis();\n });\n\n /**\n * Check if attached GUIs should be displayed for this sprite\n * This is controlled by showAttachedGui/hideAttachedGui on the server\n */\n const shouldDisplayAttachedGui = computed(() => {\n return guiService.shouldDisplayAttachedGui(id());\n });\n\n const { \n x, \n y, \n tint, \n direction, \n animationName, \n animationCurrentIndex,\n emitParticleTrigger, \n particleName, \n graphics, \n hitbox,\n isConnected,\n graphicsSignals,\n flashTrigger\n } = sprite;\n\n /**\n * Flash configuration signals for dynamic options\n * These signals are updated when the flash trigger is activated with options\n */\n const flashType = signal<'alpha' | 'tint' | 'both'>('alpha');\n const flashDuration = signal(300);\n const flashCycles = signal(1);\n const flashAlpha = signal(0.3);\n const flashTint = signal(0xffffff);\n\n /**\n * Listen to flash trigger to update configuration dynamically\n * When flash is triggered with options, update the signals\n */\n on(flashTrigger, (data) => {\n if (data && typeof data === 'object') {\n if (data.type !== undefined) flashType.set(data.type);\n if (data.duration !== undefined) flashDuration.set(data.duration);\n if (data.cycles !== undefined) flashCycles.set(data.cycles);\n if (data.alpha !== undefined) flashAlpha.set(data.alpha);\n if (data.tint !== undefined) flashTint.set(data.tint);\n }\n });\n\n /**\n * Flash configuration for the sprite\n * \n * This configuration is used by the flash directive to create visual feedback effects.\n * The flash trigger is exposed through the object, allowing both server events and\n * client-side code to trigger flash animations. Options can be passed dynamically\n * through the trigger, which updates the reactive signals.\n */\n const flashConfig = computed(() => ({\n trigger: flashTrigger,\n type: flashType(),\n duration: flashDuration(),\n cycles: flashCycles(),\n alpha: flashAlpha(),\n tint: flashTint(),\n }));\n\n const particleSettings = client.particleSettings;\n\n const canControls = () => isMe() && getCanMoveValue(sprite)\n const keyboardControls = client.globalConfig.keyboardControls;\n\n const visible = computed(() => {\n if (sprite.isEvent()) {\n return true\n }\n return isConnected()\n });\n\n const controls = {\n down: {\n repeat: true,\n bind: keyboardControls.down,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Down })\n },\n },\n up: {\n repeat: true,\n bind: keyboardControls.up,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Up })\n },\n },\n left: {\n repeat: true,\n bind: keyboardControls.left,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Left })\n },\n },\n right: {\n repeat: true,\n bind: keyboardControls.right,\n keyDown() {\n if (canControls()) client.processInput({ input: Direction.Right })\n },\n },\n action: {\n bind: getKeyboardControlBind(keyboardControls.action),\n keyDown() {\n if (canControls()) {\n client.processAction(resolveKeyboardActionInput(keyboardControls.action, client, sprite))\n }\n },\n },\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (canControls()) {\n client.processAction({ action: 'escape' })\n }\n },\n },\n gamepad: {\n enabled: true\n }\n };\n\n const smoothX = animatedSignal(x(), {\n duration: isMe() ? 0 : 0\n });\n\n const smoothY = animatedSignal(y(), {\n duration: isMe() ? 0 : 0,\n });\n\n const z = computed(() => {\n return sprite.y() + sprite.z()\n });\n\n const realAnimationName = signal(animationName());\n\n const xSubscription = x.observable.subscribe((value) => {\n smoothX.set(value);\n });\n\n const ySubscription = y.observable.subscribe((value) => {\n smoothY.set(value);\n });\n \n const sheet = (graphicObject) => {\n return {\n definition: graphicObject,\n playing: realAnimationName(),\n params: {\n direction: direction()\n },\n onFinish() {\n animationCurrentIndex.update(index => index + 1)\n }\n };\n }\n\n const graphicScale = (graphicObject) => {\n const scale = graphicObject?.scale;\n if (Array.isArray(scale)) return scale;\n if (typeof scale === 'number') return [scale, scale];\n if (scale && typeof scale === 'object') {\n const x = typeof scale.x === 'number' ? scale.x : 1;\n const y = typeof scale.y === 'number' ? scale.y : x;\n return [x, y];\n }\n return undefined;\n }\n\n const shadowCaster = (graphicObject) => {\n const box = hitbox();\n const bounds = graphicBounds();\n const scale = graphicScale(graphicObject);\n const scaleY = Array.isArray(scale) && typeof scale[1] === 'number' ? Math.abs(scale[1]) : 1;\n const height = Math.max(bounds?.height ?? box?.h ?? 32, box?.h ?? 32) * scaleY;\n\n return {\n enabled: shadowsEnabled,\n height,\n footAnchor: { x: 0.5, y: 1 },\n footOffset: { x: 0, y: 2 },\n alpha: 0.5,\n blur: 3.5,\n gradientPower: 2,\n hardness: 0.42,\n minLength: Math.max(6, (box?.h ?? 32) * 0.25),\n maxLength: Math.max(90, height * 1.8),\n contactAlpha: 0.3,\n contactScale: 0.3,\n };\n }\n\n const imageDimensions = signal({});\n const loadingImageDimensions = new Set();\n\n const toPositiveNumber = (value) => {\n const number = typeof value === 'number' ? value : parseFloat(value);\n return Number.isFinite(number) && number > 0 ? number : undefined;\n };\n\n const toFiniteNumber = (value, fallback = 0) => {\n const number = typeof value === 'number' ? value : parseFloat(value);\n return Number.isFinite(number) ? number : fallback;\n };\n\n const clampRatio = (value) => Math.min(1, Math.max(0, value));\n\n const normalizePair = (value, fallback = [1, 1]) => {\n if (Array.isArray(value)) {\n const x = toFiniteNumber(value[0], fallback[0]);\n const y = toFiniteNumber(value[1] ?? value[0], x);\n return [x, y];\n }\n if (typeof value === 'number') {\n return [value, value];\n }\n if (value && typeof value === 'object') {\n const x = toFiniteNumber(value.x, fallback[0]);\n const y = toFiniteNumber(value.y ?? value.x, x);\n return [x, y];\n }\n return fallback;\n };\n\n const normalizeAnchor = (value) => {\n if (!Array.isArray(value)) return undefined;\n const [x, y] = normalizePair(value, [0, 0]);\n return [clampRatio(x), clampRatio(y)];\n };\n\n const resolveImageSource = (image) => {\n if (typeof image === 'string') return image;\n if (typeof image?.default === 'string') return image.default;\n return undefined;\n };\n\n const parentTextureOptions = (graphicObject) => {\n const props = [\n 'width',\n 'height',\n 'framesHeight',\n 'framesWidth',\n 'rectWidth',\n 'rectHeight',\n 'offset',\n 'image',\n 'sound',\n 'spriteRealSize',\n 'scale',\n 'anchor',\n 'pivot',\n 'x',\n 'y',\n 'opacity'\n ];\n\n return props.reduce((options, prop) => {\n if (graphicObject?.[prop] !== undefined) {\n options[prop] = graphicObject[prop];\n }\n return options;\n }, {});\n };\n\n const resolveTextureOptions = (graphicObject) => {\n const textures = graphicObject?.textures ?? {};\n const texture =\n textures[realAnimationName()] ??\n textures[Animation.Stand] ??\n Object.values(textures)[0] ??\n {};\n\n return {\n ...parentTextureOptions(graphicObject),\n ...texture\n };\n };\n\n const resolveFirstAnimationFrame = (textureOptions) => {\n const animations = textureOptions?.animations;\n if (!animations) return {};\n\n try {\n const frames = typeof animations === 'function'\n ? animations({ direction: direction() })\n : animations;\n if (!Array.isArray(frames)) return {};\n const firstGroup = frames[0];\n return Array.isArray(firstGroup) ? firstGroup[0] ?? {} : firstGroup ?? {};\n }\n catch {\n return {};\n }\n };\n\n const optionValue = (prop, frame, textureOptions, graphicObject) => {\n return frame?.[prop] ?? textureOptions?.[prop] ?? graphicObject?.[prop];\n };\n\n const resolveFrameSize = (textureOptions, dimensions) => {\n const framesWidth = toPositiveNumber(textureOptions?.framesWidth) ?? 1;\n const framesHeight = toPositiveNumber(textureOptions?.framesHeight) ?? 1;\n const imageSource = resolveImageSource(textureOptions?.image);\n const loadedSize = imageSource ? dimensions[imageSource] : undefined;\n const fullWidth = toPositiveNumber(textureOptions?.width) ?? loadedSize?.width;\n const fullHeight = toPositiveNumber(textureOptions?.height) ?? loadedSize?.height;\n const width = toPositiveNumber(textureOptions?.rectWidth) ??\n toPositiveNumber(textureOptions?.spriteWidth) ??\n (fullWidth ? fullWidth / framesWidth : undefined);\n const height = toPositiveNumber(textureOptions?.rectHeight) ??\n toPositiveNumber(textureOptions?.spriteHeight) ??\n (fullHeight ? fullHeight / framesHeight : undefined);\n\n return {\n width,\n height\n };\n };\n\n const resolveHitboxAnchor = (spriteWidth, spriteHeight, realSize, box) => {\n if (!spriteWidth || !spriteHeight || !box) {\n return [0, 0];\n }\n\n const heightOfSprite = typeof realSize === 'number' ? realSize : realSize?.height;\n const resolvedHeight = toPositiveNumber(heightOfSprite) ?? spriteHeight;\n const gap = Math.max(0, (spriteHeight - resolvedHeight) / 2);\n const hitboxTopLeftX = clampRatio((spriteWidth - box.w) / 2 / spriteWidth);\n const hitboxTopLeftY = clampRatio((spriteHeight - box.h - gap) / spriteHeight);\n const hitboxCenterX = clampRatio(hitboxTopLeftX + box.w / 2 / spriteWidth);\n const hitboxCenterY = clampRatio(hitboxTopLeftY + box.h / 2 / spriteHeight);\n const footY = clampRatio((spriteHeight - gap) / spriteHeight);\n\n switch (box.anchorMode ?? 'top-left') {\n case 'center':\n return [hitboxCenterX, hitboxCenterY];\n case 'foot':\n return [hitboxCenterX, footY];\n case 'top-left':\n default:\n return [hitboxTopLeftX, hitboxTopLeftY];\n }\n };\n\n const loadImageDimensions = (image) => {\n const source = resolveImageSource(image);\n if (!source || imageDimensions()[source] || loadingImageDimensions.has(source)) {\n return;\n }\n\n loadingImageDimensions.add(source);\n Assets.load(source)\n .then((texture) => {\n const width = toPositiveNumber(texture?.width);\n const height = toPositiveNumber(texture?.height);\n if (!width || !height) return;\n\n imageDimensions.update((dimensions) => ({\n ...dimensions,\n [source]: { width, height }\n }));\n })\n .catch(() => {})\n .finally(() => {\n loadingImageDimensions.delete(source);\n });\n };\n\n effect(() => {\n const sources = new Set();\n\n graphicsSignals().forEach((graphicObject) => {\n const baseImage = resolveImageSource(graphicObject?.image);\n if (baseImage) sources.add(baseImage);\n\n Object.values(graphicObject?.textures ?? {}).forEach((textureOptions) => {\n const image = resolveImageSource(textureOptions?.image ?? graphicObject?.image);\n if (image) sources.add(image);\n });\n });\n\n sources.forEach((source) => loadImageDimensions(source));\n });\n\n const hitboxBounds = computed(() => {\n const box = hitbox();\n const width = box?.w ?? 0;\n const height = box?.h ?? 0;\n\n return {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height,\n centerX: width / 2,\n centerY: height / 2\n };\n });\n\n const graphicBounds = computed(() => {\n const box = hitbox();\n const fallback = hitboxBounds();\n const dimensions = imageDimensions();\n const graphics = graphicsSignals();\n let bounds = null;\n\n graphics.forEach((graphicObject) => {\n const textureOptions = resolveTextureOptions(graphicObject);\n const frame = resolveFirstAnimationFrame(textureOptions);\n const size = resolveFrameSize(textureOptions, dimensions);\n const spriteWidth = size.width ?? box?.w;\n const spriteHeight = size.height ?? box?.h;\n\n if (!spriteWidth || !spriteHeight) {\n return;\n }\n\n const explicitAnchor = normalizeAnchor(optionValue('anchor', frame, textureOptions, graphicObject));\n const anchor = explicitAnchor ?? resolveHitboxAnchor(\n spriteWidth,\n spriteHeight,\n optionValue('spriteRealSize', frame, textureOptions, graphicObject),\n box\n );\n const scale = normalizePair(optionValue('scale', frame, textureOptions, graphicObject) ?? graphicScale(graphicObject));\n const x = toFiniteNumber(optionValue('x', frame, textureOptions, graphicObject), 0);\n const y = toFiniteNumber(optionValue('y', frame, textureOptions, graphicObject), 0);\n const leftEdge = -anchor[0] * spriteWidth * scale[0];\n const rightEdge = (1 - anchor[0]) * spriteWidth * scale[0];\n const topEdge = -anchor[1] * spriteHeight * scale[1];\n const bottomEdge = (1 - anchor[1]) * spriteHeight * scale[1];\n const graphic = {\n left: x + Math.min(leftEdge, rightEdge),\n top: y + Math.min(topEdge, bottomEdge),\n right: x + Math.max(leftEdge, rightEdge),\n bottom: y + Math.max(topEdge, bottomEdge)\n };\n\n bounds = bounds\n ? {\n left: Math.min(bounds.left, graphic.left),\n top: Math.min(bounds.top, graphic.top),\n right: Math.max(bounds.right, graphic.right),\n bottom: Math.max(bounds.bottom, graphic.bottom)\n }\n : graphic;\n });\n\n if (!bounds) {\n return fallback;\n }\n\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n\n return {\n ...bounds,\n width,\n height,\n centerX: bounds.left + width / 2,\n centerY: bounds.top + height / 2\n };\n });\n\n // Combine animation change detection with movement state from smoothX/smoothY\n const movementAnimations = ['walk', 'stand'];\n const epsilon = 0; // movement threshold to consider the easing still running\n\n const stateX$ = smoothX.animatedState.observable;\n const stateY$ = smoothY.animatedState.observable;\n const animationName$ = animationName.observable;\n\n const moving$ = combineLatest([stateX$, stateY$]).pipe(\n map(([sx, sy]) => {\n const xFinished = Math.abs(sx.value.current - sx.value.end) <= epsilon;\n const yFinished = Math.abs(sy.value.current - sy.value.end) <= epsilon;\n return !xFinished || !yFinished; // moving if X or Y is not finished\n }),\n startWith(false)\n );\n\n const animationChange$ = animationName$.pipe(\n startWith(animationName()),\n pairwise(),\n filter(([prev, curr]) => prev !== curr)\n );\n\n let beforeRemovePromise = null;\n let beforeRemoveTransitionValue = null;\n const resolveRemoveContext = () => {\n if (!sprite._removeTransition) return null;\n const value = sprite._removeTransition();\n if (!value || typeof value !== 'string') return null;\n try {\n const context = JSON.parse(value);\n if (!context || typeof context !== 'object' || !context.active) return null;\n context.__transitionValue = value;\n return context;\n }\n catch {\n return null;\n }\n };\n\n const withTimeout = (promise, timeoutMs = 0) => {\n if (!timeoutMs || timeoutMs <= 0) return promise;\n return Promise.race([\n promise,\n new Promise((resolve) => setTimeout(resolve, timeoutMs)),\n ]);\n };\n\n const runBeforeRemove = () => {\n const context = resolveRemoveContext();\n if (!context) return Promise.resolve();\n if (beforeRemovePromise && beforeRemoveTransitionValue === context.__transitionValue) {\n return beforeRemovePromise;\n }\n beforeRemoveTransitionValue = context.__transitionValue;\n beforeRemovePromise = withTimeout(\n lastValueFrom(hooks.callHooks(\"client-sprite-onBeforeRemove\", sprite, context)),\n context.timeoutMs\n );\n return beforeRemovePromise;\n };\n\n const removeTransitionSubscription = sprite._removeTransition?.observable?.subscribe(() => {\n if (resolveRemoveContext()) {\n runBeforeRemove();\n }\n });\n\n const animationMovementSubscription = combineLatest([animationChange$, moving$]).subscribe(([[prev, curr], isMoving]) => {\n if (curr == 'stand' && !isMoving) {\n realAnimationName.set(curr);\n }\n else if (curr == 'walk' && isMoving) {\n realAnimationName.set(curr);\n }\n else if (!movementAnimations.includes(curr)) {\n realAnimationName.set(curr);\n }\n if (!isMoving && sprite.animationIsPlaying && sprite.animationIsPlaying()) {\n if (movementAnimations.includes(curr)) {\n if (typeof sprite.resetAnimationState === 'function') {\n sprite.resetAnimationState();\n }\n }\n }\n });\n\n /**\n * Cleanup subscriptions and call hooks before sprite destruction.\n *\n * # Design\n * - Prevent memory leaks by unsubscribing from all local subscriptions created in this component.\n * - Execute destruction hooks to notify modules and scene map of sprite removal.\n *\n * @example\n * await onBeforeDestroy();\n */\n const waitForTemporaryAnimationEnd = (maxDuration = 1200) => {\n if (!sprite.animationIsPlaying || !sprite.animationIsPlaying()) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n let finished = false;\n let timeout;\n let subscription;\n const finish = () => {\n if (finished) return;\n finished = true;\n clearTimeout(timeout);\n subscription?.unsubscribe();\n resolve();\n };\n timeout = setTimeout(finish, maxDuration);\n subscription = sprite.animationIsPlaying.observable.subscribe((isPlaying) => {\n if (!isPlaying) finish();\n });\n if (finished) subscription.unsubscribe();\n });\n };\n\n const onBeforeDestroy = async () => {\n await runBeforeRemove();\n await waitForTemporaryAnimationEnd();\n removeTransitionSubscription?.unsubscribe();\n animationMovementSubscription.unsubscribe();\n xSubscription.unsubscribe();\n ySubscription.unsubscribe();\n await lastValueFrom(hooks.callHooks(\"client-sprite-onDestroy\", sprite)) \n await lastValueFrom(hooks.callHooks(\"client-sceneMap-onRemoveSprite\", client.sceneMap, sprite))\n }\n\n mount((element) => {\n hooks.callHooks(\"client-sprite-onAdd\", sprite).subscribe()\n hooks.callHooks(\"client-sceneMap-onAddSprite\", client.sceneMap, sprite).subscribe()\n effect(() => {\n if (isCurrentPlayer()) {\n client.setKeyboardControls(element.directives.controls)\n }\n })\n })\n\n /**\n * Handle attached GUI finish event\n * \n * @param gui - The GUI instance\n * @param data - Data passed from the GUI component\n */\n const onAttachedGuiFinish = (gui, data) => {\n guiService.guiClose(gui.name, data);\n };\n\n /**\n * Handle attached GUI interaction event\n * \n * @param gui - The GUI instance\n * @param name - Interaction name\n * @param data - Interaction data\n */\n const onAttachedGuiInteraction = (gui, name, data) => {\n guiService.guiInteraction(gui.name, name, data);\n };\n\n tick(() => {\n hooks.callHooks(\"client-sprite-onUpdate\").subscribe()\n })\n</script>\n"],"mappings":";;;;;;;;;;;;AAkBM,SAAS,UAAE,SAAW;CACnB,SAAA,OAAA;CAEL,MAAA,EAAA,QAAA,OADa,eAAA,OACb,EAAA;CACJ,MAAI,SAAS,OAAA;CACb,MAAG,SAAA,OAAiB,eAAgB;CACpC,MAAG,QAAA,OAAiB,YAAQ;CAC5B,MAAG,aAAgB,OAAO,MAAE;CACP,OAAC;CACtB,MAAK,mBAAU,OAAc;CAC7B,MAAM,oBAAY,OAAU;CAC5B,MAAM,YAAS,UAAA,OAAA,UAAA,aAAA,MAAA,IAAA;CACf,MAAE,wBAAA;EACC,MAAK,WAAY,OAAG,eAAc;EACjC,MAAK,gBAAA,WAA0B,OAAA,UAAA,UAAA,IAAA,YAAA,KAAA;EAC/B,OAAG,SAAS,EAAA,MAAA,YACP,SAAW,QAAC,EAAS,MAAI,YACxB,WAAA,iBACC,WAAA,OAAgB,UAAY,mBAAG;CAC1C;CACA,MAAM,OAAM,SAAA,eAAA;CACZ,MAAM,iBAAW,eAAA;EACb,MAAA,WAAA,OAAA,UAAA,WAAA;EACF,OAAA,QAAA,UAAA,SAAA,YAAA,UAAA,OAAA,UAAA,KAAA,CAAA;CACF,CAAC;;EAEA,IAAM;EACL,IAAM;EACN,IAAM;EAEN,IAAM,OAAG,SAAa,cAAe,QAAE,OAAU,SAAY,YAAY,CAAC,KAAK,WAAM;GAC/E,eAAc;GACd,aAAG,KAAA;GACH,iBAAG,KAAA;EACT,OAEO,IAAI,QAAQ,OAAO,SAAQ,YAAA,KAAA,WAAA;GAC5B,eAAC,KAAiB;GAElB,aAAG,KAAe,UAAU,KAAA,IAAQ,KAAA,QAAc,KAAA;GAClD,iBAAG,KAAA;SAGH;;GAEA,aAAS,KAAA;GACT,iBAAe,KAAA;EACrB;EAGA,OAAM;G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EAAA,WAAA,MAAA,KAAA,kBAAA,eAAA,EAAA,WAAA,EAAA,OAAA,eAAA,aAAA,UAAA,CAAA,EAAA,GAAA,EAAA,QAAA;GAAA,OAAA,eAAA,MAAA,UAAA,CAAA;GAAA;GAAA;GAAA;GAAA,cAAA,eAAA,aAAA,UAAA,CAAA;GAAA,OAAA;EAAA,CAAA,CAAA,CAAA,CAAA;EAAA,EAAA,kBAAA;GAAA,QAAA;GAAA,UAAA;GAAA;EAAA,CAAA;EAAA,EAAA,kBAAA;GAAA,QAAA;GAAA,UAAA;GAAA;EAAA,CAAA;EAAA,EAAA,kBAAA;GAAA,QAAA;GAAA,UAAA;GAAA;EAAA,CAAA;EAAA,KAAA,8BAAA,eAAA,EAAA,WAAA,EAAA,cAAA,WAAA,aAAA,GAAA,EAAA,WAAA,WAAA;GAAA,QAAA;GAAA,GAAA,WAAA;EAAA,CAAA,CAAA,CAAA;EAAA,KAAA,eAAA,gBAAA,KAAA,gCAAA,EAAA,WAAA,MAAA,EAAA,YAAA,WAAA;GAAA,GAAA,YAAA,KAAA;GAAA,cAAA,YAAA;GAAA,QAAA;GAAA,WAAA,SAAA;;GAEzB;GAAA,gBAAkB,MAAS,SAAA;IACzB,yBAAkB,aAAmB,MAAA,IAAe;GAClD;EAAE,CAAA,CAAA,CAAA,CAAA;CAAA,CAAA;AAEJ;AAEA,IAAM,iBAAe"}
|
|
1
|
+
{"version":3,"file":"character.ce.js","names":[],"sources":["../../src/components/character.ce"],"sourcesContent":["<Container\n x={smoothX}\n y={smoothY}\n zIndex={z}\n viewportFollow={shouldFollowCamera}\n controls\n onBeforeDestroy\n visible\n cursor={interactionCursor}\n pointerover={interactionPointerOver}\n pointerout={interactionPointerOut}\n pointerdown={interactionPointerDown}\n pointerup={interactionPointerUp}\n pointermove={interactionPointerMove}\n click={interactionClick}\n>\n @for (compConfig of normalizedComponentsBehind) {\n <Container>\n <compConfig.component object={sprite} ...compConfig.props />\n </Container>\n } \n <PlayerComponents object={sprite} position=\"bottom\" graphicBounds />\n <PlayerComponents object={sprite} position=\"left\" graphicBounds />\n <Particle emit={emitParticleTrigger} settings={particleSettings} zIndex={1000} name={particleName} />\n <Container>\n @for (graphicObj of renderedGraphics) {\n <Container scale={graphicScale(graphicObj)}>\n <Sprite \n sheet={sheet(graphicObj)} \n direction \n tint \n hitbox\n shadowCaster={shadowCaster(graphicObj)}\n flash={flashConfig}\n />\n </Container>\n }\n @for (eventComponent of resolvedEventComponents) {\n <Container dependencies={eventComponent.dependencies}>\n <eventComponent.component ...eventComponent.props />\n </Container>\n }\n </Container>\n <PlayerComponents object={sprite} position=\"center\" graphicBounds />\n <PlayerComponents object={sprite} position=\"right\" graphicBounds />\n <PlayerComponents object={sprite} position=\"top\" graphicBounds />\n @for (compConfig of normalizedComponentsInFront) {\n <Container dependencies={compConfig.dependencies}>\n <compConfig.component object={sprite} ...compConfig.props />\n </Container>\n }\n <InteractionComponents\n object={sprite}\n bounds={graphicBounds}\n hitboxBounds={hitboxBounds}\n graphicBounds={graphicBounds}\n />\n @for (attachedGui of attachedGuis) {\n @if (shouldDisplayAttachedGui) {\n <Container>\n <attachedGui.component ...attachedGui.data() dependencies={attachedGui.dependencies} object={sprite} guiOpenId={attachedGui.openId} onFinish={(data, guiOpenId) => {\n onAttachedGuiFinish(attachedGui, data, guiOpenId)\n }} onInteraction={(name, data) => {\n onAttachedGuiInteraction(attachedGui, name, data)\n }} />\n </Container>\n }\n }\n</Container>\n\n<script>\n import { signal, effect, mount, computed, tick, animatedSignal, on } from \"canvasengine\";\n import { Assets } from \"pixi.js\";\n\n import { lastValueFrom, combineLatest, pairwise, filter, map, startWith } from \"rxjs\";\n import { Particle } from \"@canvasengine/presets\";\n import { GameEngineToken, ModulesToken } from \"@rpgjs/common\";\n import { RpgClientEngine } from \"../RpgClientEngine\";\n import { inject } from \"../core/inject\"; \n import { Direction, Animation } from \"@rpgjs/common\";\n import { normalizeEventComponent } from \"../Game/EventComponentResolver\";\n import Hit from \"./effects/hit.ce\";\n import PlayerComponents from \"./player-components.ce\";\n import InteractionComponents from \"./interaction-components.ce\";\n import { RpgGui } from \"../Gui/Gui\";\n import { getCanMoveValue } from \"../utils/readPropValue\";\n import {\n getKeyboardControlBind,\n keyboardEventMatchesBind,\n resolveKeyboardActionInput,\n resolveKeyboardDirectionInput,\n } from \"../services/actionInput\";\n\n const { object, id } = defineProps();\n const sprite = object();\n\n const client = inject(RpgClientEngine);\n const hooks = inject(ModulesToken);\n const guiService = inject(RpgGui);\n\n const spritesheets = client.spritesheets;\n const componentsBehind = client.spriteComponentsBehind;\n const componentsInFront = client.spriteComponentsInFront;\n const readProp = (value) => typeof value === 'function' ? value() : value;\n const isCurrentPlayer = () => {\n const playerId = client.playerIdSignal();\n const currentPlayer = playerId ? client.sceneMap?.players?.()?.[playerId] : undefined;\n return readProp(id) === playerId\n || readProp(sprite?.id) === playerId\n || sprite === currentPlayer\n || sprite === client.sceneMap?.getCurrentPlayer?.();\n };\n const isMe = computed(isCurrentPlayer);\n const shadowsEnabled = computed(() => {\n const lighting = client.sceneMap?.lighting?.();\n return Boolean(lighting?.shadows?.enabled || (lighting?.spots?.length ?? 0) > 0);\n });\n\n /**\n * Normalize a single sprite component configuration\n * \n * Handles both direct component references and configuration objects with optional props and dependencies.\n * Extracts the component reference and creates a computed function that returns the props.\n * \n * ## Design\n * \n * Supports two formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...}, dependencies: (object) => [...] }`\n * \n * The normalization process:\n * - Extracts the actual component from either format\n * - Extracts dependencies function if provided\n * - Creates a computed function that returns props (static object or dynamic function result)\n * - Returns a normalized object with `component`, `props`, and `dependencies`\n * \n * @param comp - Component reference or configuration object\n * @returns Normalized component configuration with component, props, and dependencies\n * \n * @example\n * ```ts\n * // Direct component\n * normalizeComponent(ShadowComponent)\n * // => { component: ShadowComponent, props: {}, dependencies: undefined }\n * \n * // With static props\n * normalizeComponent({ component: LightHalo, props: { radius: 30 } })\n * // => { component: LightHalo, props: { radius: 30 }, dependencies: undefined }\n * \n * // With dynamic props and dependencies\n * normalizeComponent({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * })\n * // => { component: HealthBar, props: {...}, dependencies: (object) => [...] }\n * ```\n */\n const normalizeComponent = (comp) => {\n let componentRef;\n let propsValue;\n let dependenciesFn;\n \n // If it's a direct component reference\n if (typeof comp === 'function' || (comp && typeof comp === 'object' && !comp.component)) {\n componentRef = comp;\n propsValue = undefined;\n dependenciesFn = undefined;\n }\n // If it's a configuration object with component and props\n else if (comp && typeof comp === 'object' && comp.component) {\n componentRef = comp.component;\n // Support both \"data\" (legacy) and \"props\" (new) for backward compatibility\n propsValue = comp.props !== undefined ? comp.props : comp.data;\n dependenciesFn = comp.dependencies;\n }\n // Fallback: treat as direct component\n else {\n componentRef = comp;\n propsValue = undefined;\n dependenciesFn = undefined;\n }\n \n // Return props directly (object or function), not as computed\n // The computed will be created in the template when needed\n return {\n component: componentRef,\n props: typeof propsValue === 'function' ? propsValue(sprite) : propsValue || {},\n dependencies: dependenciesFn ? dependenciesFn(sprite) : []\n };\n };\n\n /**\n * Normalize an array of sprite components\n * \n * Applies normalization to each component in the array using `normalizeComponent`.\n * \n * @param components - Array of component references or configuration objects\n * @returns Array of normalized component configurations\n */\n const normalizeComponents = (components) => {\n return components.map((comp) => normalizeComponent(comp));\n };\n\n\n /**\n * Normalized components to render behind sprites\n * Handles both direct component references and configuration objects with optional props and dependencies\n * \n * Supports multiple formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...} }`\n * 3. With dynamic props: `{ component: LightHalo, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @example\n * ```ts\n * // Direct component\n * componentsBehind: [ShadowComponent]\n * \n * // With static props\n * componentsBehind: [{ component: LightHalo, props: { radius: 30 } }]\n * \n * // With dynamic props and dependencies\n * componentsBehind: [{ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * }]\n * ```\n */\n const normalizedComponentsBehind = computed(() => {\n return normalizeComponents(componentsBehind());\n });\n\n /**\n * Normalized components to render in front of sprites\n * Handles both direct component references and configuration objects with optional props and dependencies\n * \n * See `normalizedComponentsBehind` for format details.\n * Components with dependencies will only be displayed when all dependencies are resolved.\n */\n const normalizedComponentsInFront = computed(() => {\n return normalizeComponents(componentsInFront());\n });\n\n const isEventSprite = () => {\n return typeof sprite?.isEvent === 'function'\n ? sprite.isEvent()\n : sprite?._type === 'event';\n };\n\n const resolvedEventComponents = computed(() => {\n if (!isEventSprite()) return [];\n const eventComponent = normalizeEventComponent(client.resolveEventComponent(sprite), sprite);\n return eventComponent ? [eventComponent] : [];\n });\n \n /**\n * Determine if the camera should follow this sprite\n * \n * The camera follows this sprite if:\n * - It's explicitly set as the camera follow target, OR\n * - It's the current player and no explicit target is set (default behavior)\n */\n const shouldFollowCamera = computed(() => {\n const cameraTargetId = client.cameraFollowTargetId();\n // If a target is explicitly set, only follow if this sprite is the target\n if (cameraTargetId !== null) {\n return id() === cameraTargetId;\n }\n // Otherwise, follow the current player (default behavior)\n return isMe();\n });\n\n /**\n * Get all attached GUI components that should be rendered on sprites\n * These are GUIs with attachToSprite: true\n */\n const attachedGuis = computed(() => {\n return guiService.getAttachedGuis();\n });\n\n /**\n * Check if attached GUIs should be displayed for this sprite\n * This is controlled by showAttachedGui/hideAttachedGui on the server\n */\n const shouldDisplayAttachedGui = computed(() => {\n return guiService.shouldDisplayAttachedGui(id());\n });\n\n const { \n x, \n y, \n tint, \n direction, \n animationName, \n animationCurrentIndex,\n emitParticleTrigger, \n particleName, \n graphics, \n hitbox,\n isConnected,\n graphicsSignals,\n flashTrigger\n } = sprite;\n\n const renderedGraphics = computed(() => {\n const eventComponent = resolvedEventComponents()[0];\n if (eventComponent && !eventComponent.renderGraphic) return [];\n return graphicsSignals();\n });\n\n /**\n * Flash configuration signals for dynamic options\n * These signals are updated when the flash trigger is activated with options\n */\n const flashType = signal<'alpha' | 'tint' | 'both'>('alpha');\n const flashDuration = signal(300);\n const flashCycles = signal(1);\n const flashAlpha = signal(0.3);\n const flashTint = signal(0xffffff);\n\n /**\n * Listen to flash trigger to update configuration dynamically\n * When flash is triggered with options, update the signals\n */\n on(flashTrigger, (data) => {\n if (data && typeof data === 'object') {\n if (data.type !== undefined) flashType.set(data.type);\n if (data.duration !== undefined) flashDuration.set(data.duration);\n if (data.cycles !== undefined) flashCycles.set(data.cycles);\n if (data.alpha !== undefined) flashAlpha.set(data.alpha);\n if (data.tint !== undefined) flashTint.set(data.tint);\n }\n });\n\n /**\n * Flash configuration for the sprite\n * \n * This configuration is used by the flash directive to create visual feedback effects.\n * The flash trigger is exposed through the object, allowing both server events and\n * client-side code to trigger flash animations. Options can be passed dynamically\n * through the trigger, which updates the reactive signals.\n */\n const flashConfig = computed(() => ({\n trigger: flashTrigger,\n type: flashType(),\n duration: flashDuration(),\n cycles: flashCycles(),\n alpha: flashAlpha(),\n tint: flashTint(),\n }));\n\n const particleSettings = client.particleSettings;\n\n const canControls = () => isMe() && getCanMoveValue(sprite)\n const keyboardControls = client.globalConfig.keyboardControls;\n const activeDirectionKeys = new Map();\n\n const resolveHeldDirection = () => {\n const directions = Array.from(activeDirectionKeys.values());\n return directions[directions.length - 1];\n };\n\n const resolveSpriteDirection = () => {\n const heldDirection = resolveHeldDirection();\n if (heldDirection) return heldDirection;\n if (typeof sprite.getDirection === 'function') return sprite.getDirection();\n if (typeof sprite.direction === 'function') return sprite.direction();\n return direction();\n };\n\n const directionToDashVector = (currentDirection) => {\n switch (currentDirection) {\n case Direction.Left:\n return { x: -1, y: 0 };\n case Direction.Right:\n return { x: 1, y: 0 };\n case Direction.Up:\n return { x: 0, y: -1 };\n case Direction.Down:\n default:\n return { x: 0, y: 1 };\n }\n };\n\n const withCurrentDirection = (payload) => {\n if (payload.action !== 'action') return payload;\n const data = payload.data && typeof payload.data === 'object'\n ? { ...payload.data }\n : {};\n return {\n ...payload,\n data: {\n ...data,\n direction: data.direction ?? resolveSpriteDirection(),\n },\n };\n };\n\n const resolveCurrentActionInput = () =>\n withCurrentDirection(\n resolveKeyboardActionInput(keyboardControls.action, client, sprite)\n );\n\n const playPredictedWalkAnimation = () => {\n if (sprite.animationFixed) return;\n if (sprite.animationIsPlaying && sprite.animationIsPlaying()) return;\n realAnimationName.set('walk');\n };\n\n const resumeHeldDirectionWalkAnimation = () => {\n if (!isCurrentPlayer()) return false;\n if (activeDirectionKeys.size === 0) return false;\n if (!canControls()) return false;\n if (sprite.animationFixed) return false;\n if (sprite.animationIsPlaying && sprite.animationIsPlaying()) return false;\n realAnimationName.set('walk');\n return true;\n };\n\n const processMovementInput = (input) => {\n if (!canControls()) return;\n client.processInput({ input });\n playPredictedWalkAnimation();\n };\n\n const processDashInput = () => {\n if (!canControls()) return;\n client.processDash({\n direction: directionToDashVector(resolveSpriteDirection()),\n });\n };\n\n const actionBind = () => getKeyboardControlBind(keyboardControls.action);\n const keyboardEventId = (event) => `${event.keyCode}:${event.code}:${event.key}`;\n\n const handleNativeActionWhileMoving = (event) => {\n const inputDirection = resolveKeyboardDirectionInput(event, keyboardControls);\n if (inputDirection) {\n const keyId = keyboardEventId(event);\n if (event.type === 'keydown') {\n activeDirectionKeys.delete(keyId);\n activeDirectionKeys.set(keyId, inputDirection);\n resumeHeldDirectionWalkAnimation();\n }\n else {\n activeDirectionKeys.delete(keyId);\n }\n }\n\n if (!isCurrentPlayer()) return;\n if (event.type !== 'keydown' || event.repeat) return;\n if (activeDirectionKeys.size === 0) return;\n if (!keyboardEventMatchesBind(event, actionBind())) return;\n if (!canControls()) return;\n\n client.processAction(resolveCurrentActionInput());\n };\n\n const visible = computed(() => {\n if (sprite.isEvent()) {\n return true\n }\n return isConnected()\n });\n\n const controls = {\n down: {\n repeat: true,\n bind: keyboardControls.down,\n keyDown() {\n processMovementInput(Direction.Down)\n },\n },\n up: {\n repeat: true,\n bind: keyboardControls.up,\n keyDown() {\n processMovementInput(Direction.Up)\n },\n },\n left: {\n repeat: true,\n bind: keyboardControls.left,\n keyDown() {\n processMovementInput(Direction.Left)\n },\n },\n right: {\n repeat: true,\n bind: keyboardControls.right,\n keyDown() {\n processMovementInput(Direction.Right)\n },\n },\n action: {\n bind: getKeyboardControlBind(keyboardControls.action),\n keyDown() {\n if (canControls()) {\n client.processAction(resolveCurrentActionInput())\n }\n },\n },\n dash: {\n bind: keyboardControls.dash,\n keyDown() {\n processDashInput()\n },\n },\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (canControls()) {\n client.processAction({ action: 'escape' })\n }\n },\n },\n gamepad: {\n enabled: true\n }\n };\n\n const smoothX = animatedSignal(x(), {\n duration: isMe() ? 0 : 0\n });\n\n const smoothY = animatedSignal(y(), {\n duration: isMe() ? 0 : 0,\n });\n\n const z = computed(() => {\n return sprite.y() + sprite.z()\n });\n\n const realAnimationName = signal(animationName());\n\n const xSubscription = x.observable.subscribe((value) => {\n smoothX.set(value);\n });\n\n const ySubscription = y.observable.subscribe((value) => {\n smoothY.set(value);\n });\n \n const sheet = (graphicObject) => {\n return {\n definition: graphicObject,\n playing: realAnimationName(),\n params: {\n direction: direction()\n },\n onFinish() {\n animationCurrentIndex.update(index => index + 1)\n }\n };\n }\n\n const graphicScale = (graphicObject) => {\n const scale = graphicObject?.displayScale ?? graphicObject?.scale;\n if (Array.isArray(scale)) return scale;\n if (typeof scale === 'number') return [scale, scale];\n if (scale && typeof scale === 'object') {\n const x = typeof scale.x === 'number' ? scale.x : 1;\n const y = typeof scale.y === 'number' ? scale.y : x;\n return [x, y];\n }\n return undefined;\n }\n\n const shadowCaster = (graphicObject) => {\n const box = hitbox();\n const bounds = graphicBounds();\n const scale = graphicScale(graphicObject);\n const scaleY = Array.isArray(scale) && typeof scale[1] === 'number' ? Math.abs(scale[1]) : 1;\n const height = Math.max(bounds?.height ?? box?.h ?? 32, box?.h ?? 32) * scaleY;\n\n return {\n enabled: shadowsEnabled,\n height,\n footAnchor: { x: 0.5, y: 1 },\n footOffset: { x: 0, y: 2 },\n alpha: 0.5,\n blur: 3.5,\n gradientPower: 2,\n hardness: 0.42,\n minLength: Math.max(6, (box?.h ?? 32) * 0.25),\n maxLength: Math.max(90, height * 1.8),\n contactAlpha: 0.3,\n contactScale: 0.3,\n };\n }\n\n const imageDimensions = signal({});\n const loadingImageDimensions = new Set();\n\n const toPositiveNumber = (value) => {\n const number = typeof value === 'number' ? value : parseFloat(value);\n return Number.isFinite(number) && number > 0 ? number : undefined;\n };\n\n const toFiniteNumber = (value, fallback = 0) => {\n const number = typeof value === 'number' ? value : parseFloat(value);\n return Number.isFinite(number) ? number : fallback;\n };\n\n const clampRatio = (value) => Math.min(1, Math.max(0, value));\n\n const normalizePair = (value, fallback = [1, 1]) => {\n if (Array.isArray(value)) {\n const x = toFiniteNumber(value[0], fallback[0]);\n const y = toFiniteNumber(value[1] ?? value[0], x);\n return [x, y];\n }\n if (typeof value === 'number') {\n return [value, value];\n }\n if (value && typeof value === 'object') {\n const x = toFiniteNumber(value.x, fallback[0]);\n const y = toFiniteNumber(value.y ?? value.x, x);\n return [x, y];\n }\n return fallback;\n };\n\n const normalizeAnchor = (value) => {\n if (!Array.isArray(value)) return undefined;\n const [x, y] = normalizePair(value, [0, 0]);\n return [clampRatio(x), clampRatio(y)];\n };\n\n const resolveImageSource = (image) => {\n if (typeof image === 'string') return image;\n if (typeof image?.default === 'string') return image.default;\n return undefined;\n };\n\n const parentTextureOptions = (graphicObject) => {\n const props = [\n 'width',\n 'height',\n 'framesHeight',\n 'framesWidth',\n 'rectWidth',\n 'rectHeight',\n 'offset',\n 'image',\n 'sound',\n 'spriteRealSize',\n 'scale',\n 'anchor',\n 'pivot',\n 'x',\n 'y',\n 'opacity'\n ];\n\n return props.reduce((options, prop) => {\n if (graphicObject?.[prop] !== undefined) {\n options[prop] = graphicObject[prop];\n }\n return options;\n }, {});\n };\n\n const resolveTextureOptions = (graphicObject) => {\n const textures = graphicObject?.textures ?? {};\n const texture =\n textures[realAnimationName()] ??\n textures[Animation.Stand] ??\n Object.values(textures)[0] ??\n {};\n\n return {\n ...parentTextureOptions(graphicObject),\n ...texture\n };\n };\n\n const resolveFirstAnimationFrame = (textureOptions) => {\n const animations = textureOptions?.animations;\n if (!animations) return {};\n\n try {\n const frames = typeof animations === 'function'\n ? animations({ direction: direction() })\n : animations;\n if (!Array.isArray(frames)) return {};\n const firstGroup = frames[0];\n return Array.isArray(firstGroup) ? firstGroup[0] ?? {} : firstGroup ?? {};\n }\n catch {\n return {};\n }\n };\n\n const optionValue = (prop, frame, textureOptions, graphicObject) => {\n return frame?.[prop] ?? textureOptions?.[prop] ?? graphicObject?.[prop];\n };\n\n const resolveFrameSize = (textureOptions, dimensions) => {\n const framesWidth = toPositiveNumber(textureOptions?.framesWidth) ?? 1;\n const framesHeight = toPositiveNumber(textureOptions?.framesHeight) ?? 1;\n const imageSource = resolveImageSource(textureOptions?.image);\n const loadedSize = imageSource ? dimensions[imageSource] : undefined;\n const fullWidth = toPositiveNumber(textureOptions?.width) ?? loadedSize?.width;\n const fullHeight = toPositiveNumber(textureOptions?.height) ?? loadedSize?.height;\n const width = toPositiveNumber(textureOptions?.rectWidth) ??\n toPositiveNumber(textureOptions?.spriteWidth) ??\n (fullWidth ? fullWidth / framesWidth : undefined);\n const height = toPositiveNumber(textureOptions?.rectHeight) ??\n toPositiveNumber(textureOptions?.spriteHeight) ??\n (fullHeight ? fullHeight / framesHeight : undefined);\n\n return {\n width,\n height\n };\n };\n\n const resolveHitboxAnchor = (spriteWidth, spriteHeight, realSize, box) => {\n if (!spriteWidth || !spriteHeight || !box) {\n return [0, 0];\n }\n\n const heightOfSprite = typeof realSize === 'number' ? realSize : realSize?.height;\n const resolvedHeight = toPositiveNumber(heightOfSprite) ?? spriteHeight;\n const gap = Math.max(0, (spriteHeight - resolvedHeight) / 2);\n const hitboxTopLeftX = clampRatio((spriteWidth - box.w) / 2 / spriteWidth);\n const hitboxTopLeftY = clampRatio((spriteHeight - box.h - gap) / spriteHeight);\n const hitboxCenterX = clampRatio(hitboxTopLeftX + box.w / 2 / spriteWidth);\n const hitboxCenterY = clampRatio(hitboxTopLeftY + box.h / 2 / spriteHeight);\n const footY = clampRatio((spriteHeight - gap) / spriteHeight);\n\n switch (box.anchorMode ?? 'top-left') {\n case 'center':\n return [hitboxCenterX, hitboxCenterY];\n case 'foot':\n return [hitboxCenterX, footY];\n case 'top-left':\n default:\n return [hitboxTopLeftX, hitboxTopLeftY];\n }\n };\n\n const loadImageDimensions = (image) => {\n const source = resolveImageSource(image);\n if (!source || imageDimensions()[source] || loadingImageDimensions.has(source)) {\n return;\n }\n\n loadingImageDimensions.add(source);\n Assets.load(source)\n .then((texture) => {\n const width = toPositiveNumber(texture?.width);\n const height = toPositiveNumber(texture?.height);\n if (!width || !height) return;\n\n imageDimensions.update((dimensions) => ({\n ...dimensions,\n [source]: { width, height }\n }));\n })\n .catch(() => {})\n .finally(() => {\n loadingImageDimensions.delete(source);\n });\n };\n\n effect(() => {\n const sources = new Set();\n\n graphicsSignals().forEach((graphicObject) => {\n const baseImage = resolveImageSource(graphicObject?.image);\n if (baseImage) sources.add(baseImage);\n\n Object.values(graphicObject?.textures ?? {}).forEach((textureOptions) => {\n const image = resolveImageSource(textureOptions?.image ?? graphicObject?.image);\n if (image) sources.add(image);\n });\n });\n\n sources.forEach((source) => loadImageDimensions(source));\n });\n\n const hitboxBounds = computed(() => {\n const box = hitbox();\n const width = box?.w ?? 0;\n const height = box?.h ?? 0;\n\n return {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height,\n centerX: width / 2,\n centerY: height / 2\n };\n });\n\n const graphicBounds = computed(() => {\n const box = hitbox();\n const fallback = hitboxBounds();\n const customEventComponent = resolvedEventComponents()[0];\n if (customEventComponent && !customEventComponent.renderGraphic) {\n return fallback;\n }\n const dimensions = imageDimensions();\n const graphics = graphicsSignals();\n let bounds = null;\n\n graphics.forEach((graphicObject) => {\n const textureOptions = resolveTextureOptions(graphicObject);\n const frame = resolveFirstAnimationFrame(textureOptions);\n const size = resolveFrameSize(textureOptions, dimensions);\n const spriteWidth = size.width ?? box?.w;\n const spriteHeight = size.height ?? box?.h;\n\n if (!spriteWidth || !spriteHeight) {\n return;\n }\n\n const explicitAnchor = normalizeAnchor(optionValue('anchor', frame, textureOptions, graphicObject));\n const anchor = explicitAnchor ?? resolveHitboxAnchor(\n spriteWidth,\n spriteHeight,\n optionValue('spriteRealSize', frame, textureOptions, graphicObject),\n box\n );\n const scale = normalizePair(optionValue('scale', frame, textureOptions, graphicObject) ?? graphicScale(graphicObject));\n const x = toFiniteNumber(optionValue('x', frame, textureOptions, graphicObject), 0);\n const y = toFiniteNumber(optionValue('y', frame, textureOptions, graphicObject), 0);\n const leftEdge = -anchor[0] * spriteWidth * scale[0];\n const rightEdge = (1 - anchor[0]) * spriteWidth * scale[0];\n const topEdge = -anchor[1] * spriteHeight * scale[1];\n const bottomEdge = (1 - anchor[1]) * spriteHeight * scale[1];\n const graphic = {\n left: x + Math.min(leftEdge, rightEdge),\n top: y + Math.min(topEdge, bottomEdge),\n right: x + Math.max(leftEdge, rightEdge),\n bottom: y + Math.max(topEdge, bottomEdge)\n };\n\n bounds = bounds\n ? {\n left: Math.min(bounds.left, graphic.left),\n top: Math.min(bounds.top, graphic.top),\n right: Math.max(bounds.right, graphic.right),\n bottom: Math.max(bounds.bottom, graphic.bottom)\n }\n : graphic;\n });\n\n if (!bounds) {\n return fallback;\n }\n\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n\n return {\n ...bounds,\n width,\n height,\n centerX: bounds.left + width / 2,\n centerY: bounds.top + height / 2\n };\n });\n\n const interactionBounds = () => ({\n bounds: graphicBounds(),\n hitbox: hitboxBounds(),\n graphic: graphicBounds()\n });\n\n const interactionCursor = computed(() =>\n client.interactions.cursorFor(sprite, interactionBounds())\n );\n\n const handleInteraction = (type) => (event) => {\n client.updatePointerFromInteractionEvent(event);\n client.interactions.handle(sprite, type, {\n event,\n bounds: interactionBounds()\n });\n };\n\n const interactionPointerOver = handleInteraction('pointerover');\n const interactionPointerOut = handleInteraction('pointerout');\n const interactionPointerDown = handleInteraction('pointerdown');\n const interactionPointerUp = handleInteraction('pointerup');\n const interactionPointerMove = handleInteraction('pointermove');\n const interactionClick = handleInteraction('click');\n\n // Combine animation change detection with movement state from smoothX/smoothY\n const movementAnimations = ['walk', 'stand'];\n const epsilon = 0; // movement threshold to consider the easing still running\n\n const stateX$ = smoothX.animatedState.observable;\n const stateY$ = smoothY.animatedState.observable;\n const animationName$ = animationName.observable;\n\n const moving$ = combineLatest([stateX$, stateY$]).pipe(\n map(([sx, sy]) => {\n const xFinished = Math.abs(sx.value.current - sx.value.end) <= epsilon;\n const yFinished = Math.abs(sy.value.current - sy.value.end) <= epsilon;\n return !xFinished || !yFinished; // moving if X or Y is not finished\n }),\n startWith(false)\n );\n\n const animationChange$ = animationName$.pipe(\n startWith(animationName()),\n pairwise(),\n filter(([prev, curr]) => prev !== curr)\n );\n\n let beforeRemovePromise = null;\n let beforeRemoveTransitionValue = null;\n const resolveRemoveContext = () => {\n if (!sprite._removeTransition) return null;\n const value = sprite._removeTransition();\n if (!value || typeof value !== 'string') return null;\n try {\n const context = JSON.parse(value);\n if (!context || typeof context !== 'object' || !context.active) return null;\n context.__transitionValue = value;\n return context;\n }\n catch {\n return null;\n }\n };\n\n const withTimeout = (promise, timeoutMs = 0) => {\n if (!timeoutMs || timeoutMs <= 0) return promise;\n return Promise.race([\n promise,\n new Promise((resolve) => setTimeout(resolve, timeoutMs)),\n ]);\n };\n\n const runBeforeRemove = () => {\n const context = resolveRemoveContext();\n if (!context) return Promise.resolve();\n if (beforeRemovePromise && beforeRemoveTransitionValue === context.__transitionValue) {\n return beforeRemovePromise;\n }\n beforeRemoveTransitionValue = context.__transitionValue;\n beforeRemovePromise = withTimeout(\n lastValueFrom(hooks.callHooks(\"client-sprite-onBeforeRemove\", sprite, context)),\n context.timeoutMs\n );\n return beforeRemovePromise;\n };\n\n const removeTransitionSubscription = sprite._removeTransition?.observable?.subscribe(() => {\n if (resolveRemoveContext()) {\n runBeforeRemove();\n }\n });\n\n const animationMovementSubscription = combineLatest([animationChange$, moving$]).subscribe(([[prev, curr], isMoving]) => {\n const isMovementAnimation = movementAnimations.includes(curr);\n const isTemporaryAnimationPlaying =\n sprite.animationIsPlaying && sprite.animationIsPlaying();\n\n if (sprite.animationFixed && isMovementAnimation) {\n realAnimationName.set(curr);\n return;\n }\n\n if (curr == 'stand' && !isMoving) {\n if (!resumeHeldDirectionWalkAnimation()) {\n realAnimationName.set(curr);\n }\n }\n else if (curr == 'walk' && isMoving) {\n realAnimationName.set(curr);\n }\n else if (!isMovementAnimation) {\n realAnimationName.set(curr);\n }\n if (!isMoving && isTemporaryAnimationPlaying) {\n if (isMovementAnimation) {\n if (typeof sprite.resetAnimationState === 'function') {\n sprite.resetAnimationState();\n }\n }\n }\n });\n\n const resumeWalkSubscriptions = [\n sprite._canMove,\n sprite._animationFixed,\n sprite.animationIsPlaying,\n ]\n .filter(signal => signal?.observable)\n .map(signal => signal.observable.subscribe(() => {\n resumeHeldDirectionWalkAnimation();\n }));\n\n /**\n * Cleanup subscriptions and call hooks before sprite destruction.\n *\n * # Design\n * - Prevent memory leaks by unsubscribing from all local subscriptions created in this component.\n * - Execute destruction hooks to notify modules and scene map of sprite removal.\n *\n * @example\n * await onBeforeDestroy();\n */\n const waitForTemporaryAnimationEnd = (maxDuration = 1200) => {\n if (!sprite.animationIsPlaying || !sprite.animationIsPlaying()) {\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n let finished = false;\n let timeout;\n let subscription;\n const finish = () => {\n if (finished) return;\n finished = true;\n clearTimeout(timeout);\n subscription?.unsubscribe();\n resolve();\n };\n timeout = setTimeout(finish, maxDuration);\n subscription = sprite.animationIsPlaying.observable.subscribe((isPlaying) => {\n if (!isPlaying) finish();\n });\n if (finished) subscription.unsubscribe();\n });\n };\n\n const onBeforeDestroy = async () => {\n await runBeforeRemove();\n await waitForTemporaryAnimationEnd();\n if (typeof document !== 'undefined') {\n document.removeEventListener('keydown', handleNativeActionWhileMoving);\n document.removeEventListener('keyup', handleNativeActionWhileMoving);\n }\n removeTransitionSubscription?.unsubscribe();\n animationMovementSubscription.unsubscribe();\n resumeWalkSubscriptions.forEach(subscription => subscription.unsubscribe());\n xSubscription.unsubscribe();\n ySubscription.unsubscribe();\n await lastValueFrom(hooks.callHooks(\"client-sprite-onDestroy\", sprite)) \n await lastValueFrom(hooks.callHooks(\"client-sceneMap-onRemoveSprite\", client.sceneMap, sprite))\n }\n\n mount((element) => {\n if (typeof document !== 'undefined') {\n document.addEventListener('keydown', handleNativeActionWhileMoving);\n document.addEventListener('keyup', handleNativeActionWhileMoving);\n }\n hooks.callHooks(\"client-sprite-onAdd\", sprite).subscribe()\n hooks.callHooks(\"client-sceneMap-onAddSprite\", client.sceneMap, sprite).subscribe()\n effect(() => {\n if (isCurrentPlayer()) {\n client.setKeyboardControls(element.directives.controls)\n }\n })\n })\n\n /**\n * Handle attached GUI finish event\n * \n * @param gui - The GUI instance\n * @param data - Data passed from the GUI component\n */\n const normalizeOpenId = (value) => {\n const resolved = typeof value === \"function\" ? value() : value;\n return typeof resolved === \"string\" && resolved.length > 0 ? resolved : undefined;\n };\n\n const onAttachedGuiFinish = (gui, data, guiOpenId) => {\n const completedOpenId = normalizeOpenId(guiOpenId);\n const currentOpenId = normalizeOpenId(gui.openId);\n if (completedOpenId && currentOpenId && completedOpenId !== currentOpenId) return;\n guiService.guiClose(gui.name, data, completedOpenId ?? currentOpenId);\n };\n\n /**\n * Handle attached GUI interaction event\n * \n * @param gui - The GUI instance\n * @param name - Interaction name\n * @param data - Interaction data\n */\n const onAttachedGuiInteraction = (gui, name, data) => {\n guiService.guiInteraction(gui.name, name, data);\n };\n\n tick(() => {\n hooks.callHooks(\"client-sprite-onUpdate\").subscribe()\n })\n</script>\n"],"mappings":";;;;;;;;;;;;;;AAoBG,SAAA,UAAA,SAAA;CACiB,SAAQ,OAAQ;CAEjC,MAAS,EAAI,QAAE,OADU,eAAQ,OACG,EAAA;CACvC,MAAG,SAAS,OAAA;CACZ,MAAK,SAAK,OAAW,eAAG;CACxB,MAAM,QAAC,OAAU,YAAO;CACxB,MAAM,aAAS,OAAA,MAAA;CACE,OAAM;CACvB,MAAM,mBAAa,OAAA;CACnB,MAAM,oBAAQ,OAAA;CACd,MAAM,YAAI,UAAA,OAAA,UAAA,aAAA,MAAA,IAAA;CACV,MAAM,wBAAkB;EACpB,MAAM,WAAO,OAAW,eAAA;EACxB,MAAK,gBAAA,WAAA,OAAA,UAAA,UAAA,IAAA,YAAA,KAAA;EACL,OAAI,SAAS,EAAA,MAAA,YACb,SAAA,QAAA,EAAA,MAAA,YACM,WAAA,iBACH,WAAU,OAAY,UAAE,mBAA2B;CAC1D;CACA,MAAM,OAAE,SAAS,eAAA;CACjB,MAAI,iBAAA,eAAA;EACA,MAAA,WAAS,OAAA,UAAA,WAAA;EACV,OAAA,QAAgB,UAAS,SAAQ,YAAU,UAAQ,OAAa,UAAE,KAAA,CAAA;CACrE,CAAC;CACD,MAAG,sBAAyB,SAAQ;EACjC,IAAK;EACJ,IAAC;EACD,IAAG;EAEL,IAAA,OAAA,SAAA,cAAA,QAAA,OAAA,SAAA,YAAA,CAAA,KAAA,WAAA;GACC,eAAA;GACC,aAAc,KAAA;GACd,iBAAqB,KAAA;EACrB,OAED,IAAA,QAAA,OAAA,SAAA,YAAA,KAAA,WAAA;GACK,eAAe,KAAA;GAEhB,aAAS,KAAA,UAAA,KAAA,IAAA,KAAA,QAAA,KAAA;GACR,iBAAa,KAAS;EAC1B,OAEK;GACD,eAAI;G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