@rpgjs/client 5.0.0-alpha.42 → 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 +2 -2
- package/src/components/scenes/draw-map.ce +3 -1
- package/dist/index.js.map +0 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
import { signal } from "canvasengine";
|
|
2
|
+
import { generateUID } from "@rpgjs/common";
|
|
3
|
+
//#region src/Game/AnimationManager.ts
|
|
4
|
+
var AnimationManager = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.current = signal([]);
|
|
7
|
+
}
|
|
8
|
+
displayEffect(params, player) {
|
|
9
|
+
const id = generateUID();
|
|
10
|
+
this.current().push({
|
|
11
|
+
...params,
|
|
12
|
+
id,
|
|
13
|
+
x: player.x,
|
|
14
|
+
y: player.y,
|
|
15
|
+
object: player,
|
|
16
|
+
onFinish: () => {
|
|
17
|
+
const index = this.current().findIndex((value) => value.id === id);
|
|
18
|
+
this.current().splice(index, 1);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
24
|
export { AnimationManager };
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=AnimationManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationManager.js","sources":["../../src/Game/AnimationManager.ts"],"sourcesContent":["import { generateUID, RpgCommonPlayer } from \"@rpgjs/common\";\nimport { signal } from \"canvasengine\";\n\nexport class AnimationManager {\n current = signal<any[]>([]);\n\n displayEffect(params: any, player: RpgCommonPlayer | { x: number, y: number }) {\n const id = generateUID();\n this.current().push({\n ...params,\n id,\n x: player.x,\n y: player.y,\n object: player,\n onFinish: () => {\n const index = this.current().findIndex((value) => value.id === id);\n this.current().splice(index, 1);\n },\n });\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"AnimationManager.js","names":[],"sources":["../../src/Game/AnimationManager.ts"],"sourcesContent":["import { generateUID, RpgCommonPlayer } from \"@rpgjs/common\";\nimport { signal } from \"canvasengine\";\n\nexport class AnimationManager {\n current = signal<any[]>([]);\n\n displayEffect(params: any, player: RpgCommonPlayer | { x: number, y: number }) {\n const id = generateUID();\n this.current().push({\n ...params,\n id,\n x: player.x,\n y: player.y,\n object: player,\n onFinish: () => {\n const index = this.current().findIndex((value) => value.id === id);\n this.current().splice(index, 1);\n },\n });\n }\n}\n"],"mappings":";;;AAGA,IAAa,mBAAb,MAA8B;;iBAClB,OAAc,EAAE,CAAC;;CAE3B,cAAc,QAAa,QAAoD;EAC7E,MAAM,KAAK,aAAa;AACxB,OAAK,SAAS,CAAC,KAAK;GAClB,GAAG;GACH;GACA,GAAG,OAAO;GACV,GAAG,OAAO;GACV,QAAQ;GACR,gBAAgB;IACd,MAAM,QAAQ,KAAK,SAAS,CAAC,WAAW,UAAU,MAAM,OAAO,GAAG;AAClE,SAAK,SAAS,CAAC,OAAO,OAAO,EAAE;;GAElC,CAAC"}
|
package/dist/Game/Event.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { RpgClientObject } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
1
|
+
import { RpgClientObject } from "./Object.js";
|
|
2
|
+
//#region src/Game/Event.ts
|
|
3
|
+
var RpgClientEvent = class extends RpgClientObject {
|
|
4
|
+
constructor(..._args) {
|
|
5
|
+
super(..._args);
|
|
6
|
+
this.type = "event";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
10
|
export { RpgClientEvent };
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=Event.js.map
|
package/dist/Game/Event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Event.js","sources":["../../src/Game/Event.ts"],"sourcesContent":["import { RpgClientObject } from \"./Object\"; \n\nexport class RpgClientEvent extends RpgClientObject {\n type = 'event'\n} "],"
|
|
1
|
+
{"version":3,"file":"Event.js","names":[],"sources":["../../src/Game/Event.ts"],"sourcesContent":["import { RpgClientObject } from \"./Object\"; \n\nexport class RpgClientEvent extends RpgClientObject {\n type = 'event'\n} "],"mappings":";;AAEA,IAAa,iBAAb,cAAoC,gBAAgB;;;cACzC"}
|
package/dist/Game/Map.js
CHANGED
|
@@ -1,96 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { sync, users } from
|
|
3
|
-
import { RpgClientPlayer } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { inject } from "../core/inject.js";
|
|
2
|
+
import { sync, users } from "../node_modules/.pnpm/@signe_sync@2.8.3/node_modules/@signe/sync/dist/index.js";
|
|
3
|
+
import { RpgClientPlayer } from "./Player.js";
|
|
4
|
+
import { RpgClientEvent } from "./Event.js";
|
|
5
|
+
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.js";
|
|
6
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js";
|
|
7
|
+
import { RpgClientEngine } from "../RpgClientEngine.js";
|
|
8
|
+
import { computed, signal } from "canvasengine";
|
|
9
|
+
import { RpgCommonMap } from "@rpgjs/common";
|
|
10
|
+
//#region src/Game/Map.ts
|
|
11
|
+
var RpgClientMap = class extends RpgCommonMap {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.engine = inject(RpgClientEngine);
|
|
15
|
+
this.players = signal({});
|
|
16
|
+
this.events = signal({});
|
|
17
|
+
this.currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()]);
|
|
18
|
+
this.weatherState = signal(null);
|
|
19
|
+
this.localWeatherOverride = signal(null);
|
|
20
|
+
this.weather = computed(() => {
|
|
21
|
+
const local = this.localWeatherOverride();
|
|
22
|
+
const state = this.weatherState();
|
|
23
|
+
return local ?? state;
|
|
24
|
+
});
|
|
25
|
+
this.manualClientPhysicsTick = false;
|
|
26
|
+
const isTest = typeof process !== "undefined" && process.env?.TEST === "true" || typeof window !== "undefined" && window.__RPGJS_TEST__ === true;
|
|
27
|
+
this.isTestEnvironment = isTest;
|
|
28
|
+
if (isTest) this.autoTickEnabled = false;
|
|
29
|
+
}
|
|
30
|
+
configureClientPrediction(enabled) {
|
|
31
|
+
this.manualClientPhysicsTick = enabled;
|
|
32
|
+
this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;
|
|
33
|
+
}
|
|
34
|
+
getCurrentPlayer() {
|
|
35
|
+
return this.currentPlayer();
|
|
36
|
+
}
|
|
37
|
+
reset(force = false) {
|
|
38
|
+
const currentPlayerId = this.engine.playerIdSignal();
|
|
39
|
+
const currentPlayer = !force && currentPlayerId ? this.players()[currentPlayerId] : void 0;
|
|
40
|
+
this.players.set(currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {});
|
|
41
|
+
this.events.set({});
|
|
42
|
+
this.weatherState.set(null);
|
|
43
|
+
this.localWeatherOverride.set(null);
|
|
44
|
+
this.clearPhysic();
|
|
45
|
+
}
|
|
46
|
+
getWeather() {
|
|
47
|
+
return this.weather();
|
|
48
|
+
}
|
|
49
|
+
setLocalWeather(next) {
|
|
50
|
+
this.localWeatherOverride.set(next);
|
|
51
|
+
}
|
|
52
|
+
clearLocalWeather() {
|
|
53
|
+
this.localWeatherOverride.set(null);
|
|
54
|
+
}
|
|
55
|
+
stepClientPhysics(deltaMs) {
|
|
56
|
+
if (!this.manualClientPhysicsTick) return 0;
|
|
57
|
+
return this.nextTick(deltaMs);
|
|
58
|
+
}
|
|
59
|
+
stepPredictionTick() {
|
|
60
|
+
this.forceSingleTick();
|
|
61
|
+
}
|
|
62
|
+
emitPhysicsInit(context) {
|
|
63
|
+
this.engine?.emitSceneMapHook?.("onPhysicsInit", this, context);
|
|
64
|
+
}
|
|
65
|
+
emitPhysicsEntityAdd(context) {
|
|
66
|
+
this.engine?.emitSceneMapHook?.("onPhysicsEntityAdd", this, context);
|
|
67
|
+
}
|
|
68
|
+
emitPhysicsEntityRemove(context) {
|
|
69
|
+
this.engine?.emitSceneMapHook?.("onPhysicsEntityRemove", this, context);
|
|
70
|
+
}
|
|
71
|
+
emitPhysicsReset() {
|
|
72
|
+
this.engine?.emitSceneMapHook?.("onPhysicsReset", this);
|
|
73
|
+
}
|
|
17
74
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.engine = inject(RpgClientEngine);
|
|
22
|
-
this.players = signal({});
|
|
23
|
-
this.events = signal({});
|
|
24
|
-
this.currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()]);
|
|
25
|
-
this.weatherState = signal(null);
|
|
26
|
-
this.localWeatherOverride = signal(null);
|
|
27
|
-
this.weather = computed(() => {
|
|
28
|
-
const local = this.localWeatherOverride();
|
|
29
|
-
const state = this.weatherState();
|
|
30
|
-
return local ?? state;
|
|
31
|
-
});
|
|
32
|
-
this.manualClientPhysicsTick = false;
|
|
33
|
-
const isTest = typeof process !== "undefined" && process.env?.TEST === "true" || typeof window !== "undefined" && window.__RPGJS_TEST__ === true;
|
|
34
|
-
this.isTestEnvironment = isTest;
|
|
35
|
-
if (isTest) {
|
|
36
|
-
this.autoTickEnabled = false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
configureClientPrediction(enabled) {
|
|
40
|
-
this.manualClientPhysicsTick = enabled;
|
|
41
|
-
this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;
|
|
42
|
-
}
|
|
43
|
-
getCurrentPlayer() {
|
|
44
|
-
return this.currentPlayer();
|
|
45
|
-
}
|
|
46
|
-
reset(force = false) {
|
|
47
|
-
const currentPlayerId = this.engine.playerIdSignal();
|
|
48
|
-
const currentPlayer = !force && currentPlayerId ? this.players()[currentPlayerId] : void 0;
|
|
49
|
-
this.players.set(
|
|
50
|
-
currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {}
|
|
51
|
-
);
|
|
52
|
-
this.events.set({});
|
|
53
|
-
this.weatherState.set(null);
|
|
54
|
-
this.localWeatherOverride.set(null);
|
|
55
|
-
this.clearPhysic();
|
|
56
|
-
}
|
|
57
|
-
getWeather() {
|
|
58
|
-
return this.weather();
|
|
59
|
-
}
|
|
60
|
-
setLocalWeather(next) {
|
|
61
|
-
this.localWeatherOverride.set(next);
|
|
62
|
-
}
|
|
63
|
-
clearLocalWeather() {
|
|
64
|
-
this.localWeatherOverride.set(null);
|
|
65
|
-
}
|
|
66
|
-
stepClientPhysics(deltaMs) {
|
|
67
|
-
if (!this.manualClientPhysicsTick) {
|
|
68
|
-
return 0;
|
|
69
|
-
}
|
|
70
|
-
return this.nextTick(deltaMs);
|
|
71
|
-
}
|
|
72
|
-
stepPredictionTick() {
|
|
73
|
-
this.forceSingleTick();
|
|
74
|
-
}
|
|
75
|
-
emitPhysicsInit(context) {
|
|
76
|
-
this.engine?.emitSceneMapHook?.("onPhysicsInit", this, context);
|
|
77
|
-
}
|
|
78
|
-
emitPhysicsEntityAdd(context) {
|
|
79
|
-
this.engine?.emitSceneMapHook?.("onPhysicsEntityAdd", this, context);
|
|
80
|
-
}
|
|
81
|
-
emitPhysicsEntityRemove(context) {
|
|
82
|
-
this.engine?.emitSceneMapHook?.("onPhysicsEntityRemove", this, context);
|
|
83
|
-
}
|
|
84
|
-
emitPhysicsReset() {
|
|
85
|
-
this.engine?.emitSceneMapHook?.("onPhysicsReset", this);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
__decorateClass([
|
|
89
|
-
users(RpgClientPlayer)
|
|
90
|
-
], RpgClientMap.prototype, "players");
|
|
91
|
-
__decorateClass([
|
|
92
|
-
sync(RpgClientEvent)
|
|
93
|
-
], RpgClientMap.prototype, "events");
|
|
94
|
-
|
|
75
|
+
__decorate([users(RpgClientPlayer), __decorateMetadata("design:type", Object)], RpgClientMap.prototype, "players", void 0);
|
|
76
|
+
__decorate([sync(RpgClientEvent), __decorateMetadata("design:type", Object)], RpgClientMap.prototype, "events", void 0);
|
|
77
|
+
//#endregion
|
|
95
78
|
export { RpgClientMap };
|
|
96
|
-
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=Map.js.map
|
package/dist/Game/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../src/Game/Map.ts"],"sourcesContent":["import {\n RpgCommonMap,\n type WeatherState,\n type MapPhysicsInitContext,\n type MapPhysicsEntityContext,\n} from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed, effect } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n weatherState = signal<WeatherState | null>(null);\n localWeatherOverride = signal<WeatherState | null>(null);\n weather = computed<WeatherState | null>(() => {\n const local = this.localWeatherOverride() \n const state = this.weatherState()\n return local ?? state\n });\n private manualClientPhysicsTick = false;\n private readonly isTestEnvironment: boolean;\n\n constructor() {\n super();\n // Détecter l'environnement de test\n const isTest = (typeof process !== 'undefined' && process.env?.TEST === 'true')\n || (typeof window !== 'undefined' && (window as any).__RPGJS_TEST__ === true);\n this.isTestEnvironment = isTest;\n if (isTest) {\n this.autoTickEnabled = false;\n }\n }\n\n configureClientPrediction(enabled: boolean): void {\n this.manualClientPhysicsTick = enabled;\n this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;\n }\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset(force = false) {\n const currentPlayerId = this.engine.playerIdSignal();\n const currentPlayer = !force && currentPlayerId\n ? this.players()[currentPlayerId]\n : undefined;\n\n this.players.set(\n currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {}\n );\n this.events.set({})\n this.weatherState.set(null);\n this.localWeatherOverride.set(null);\n this.clearPhysic()\n }\n\n getWeather(): WeatherState | null {\n return this.weather();\n }\n\n setLocalWeather(next: WeatherState | null): void {\n this.localWeatherOverride.set(next);\n }\n\n clearLocalWeather(): void {\n this.localWeatherOverride.set(null);\n }\n\n stepClientPhysics(deltaMs: number): number {\n if (!this.manualClientPhysicsTick) {\n return 0;\n }\n return this.nextTick(deltaMs);\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n\n protected emitPhysicsInit(context: MapPhysicsInitContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsInit\", this, context);\n }\n\n protected emitPhysicsEntityAdd(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityAdd\", this, context);\n }\n\n protected emitPhysicsEntityRemove(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityRemove\", this, context);\n }\n\n protected emitPhysicsReset(): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsReset\", this);\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"Map.js","names":[],"sources":["../../src/Game/Map.ts"],"sourcesContent":["import {\n RpgCommonMap,\n type WeatherState,\n type MapPhysicsInitContext,\n type MapPhysicsEntityContext,\n} from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed, effect } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n weatherState = signal<WeatherState | null>(null);\n localWeatherOverride = signal<WeatherState | null>(null);\n weather = computed<WeatherState | null>(() => {\n const local = this.localWeatherOverride() \n const state = this.weatherState()\n return local ?? state\n });\n private manualClientPhysicsTick = false;\n private readonly isTestEnvironment: boolean;\n\n constructor() {\n super();\n // Détecter l'environnement de test\n const isTest = (typeof process !== 'undefined' && process.env?.TEST === 'true')\n || (typeof window !== 'undefined' && (window as any).__RPGJS_TEST__ === true);\n this.isTestEnvironment = isTest;\n if (isTest) {\n this.autoTickEnabled = false;\n }\n }\n\n configureClientPrediction(enabled: boolean): void {\n this.manualClientPhysicsTick = enabled;\n this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;\n }\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset(force = false) {\n const currentPlayerId = this.engine.playerIdSignal();\n const currentPlayer = !force && currentPlayerId\n ? this.players()[currentPlayerId]\n : undefined;\n\n this.players.set(\n currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {}\n );\n this.events.set({})\n this.weatherState.set(null);\n this.localWeatherOverride.set(null);\n this.clearPhysic()\n }\n\n getWeather(): WeatherState | null {\n return this.weather();\n }\n\n setLocalWeather(next: WeatherState | null): void {\n this.localWeatherOverride.set(next);\n }\n\n clearLocalWeather(): void {\n this.localWeatherOverride.set(null);\n }\n\n stepClientPhysics(deltaMs: number): number {\n if (!this.manualClientPhysicsTick) {\n return 0;\n }\n return this.nextTick(deltaMs);\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n\n protected emitPhysicsInit(context: MapPhysicsInitContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsInit\", this, context);\n }\n\n protected emitPhysicsEntityAdd(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityAdd\", this, context);\n }\n\n protected emitPhysicsEntityRemove(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityRemove\", this, context);\n }\n\n protected emitPhysicsReset(): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsReset\", this);\n }\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAa,eAAb,cAAkC,aAAkB;CAelD,cAAc;AACZ,SAAO;gBAfiB,OAAO,gBAAgB;iBACf,OAAwC,EAAE,CAAC;gBAC9C,OAAuC,EAAE,CAAC;uBACzD,eAAe,KAAK,SAAS,CAAC,KAAK,OAAO,gBAAgB,EAAG;sBAC9D,OAA4B,KAAK;8BACzB,OAA4B,KAAK;iBAC9C,eAAoC;GAC5C,MAAM,QAAQ,KAAK,sBAAsB;GACzC,MAAM,QAAQ,KAAK,cAAc;AACjC,UAAO,SAAS;IAChB;iCACgC;EAMhC,MAAM,SAAU,OAAO,YAAY,eAAe,QAAQ,KAAK,SAAS,UAClE,OAAO,WAAW,eAAgB,OAAe,mBAAmB;AAC1E,OAAK,oBAAoB;AACzB,MAAI,OACF,MAAK,kBAAkB;;CAI3B,0BAA0B,SAAwB;AAChD,OAAK,0BAA0B;AAC/B,OAAK,kBAAkB,UAAU,QAAQ,CAAC,KAAK;;CAGjD,mBAAmB;AACjB,SAAO,KAAK,eAAe;;CAG7B,MAAM,QAAQ,OAAO;EACnB,MAAM,kBAAkB,KAAK,OAAO,gBAAgB;EACpD,MAAM,gBAAgB,CAAC,SAAS,kBAC5B,KAAK,SAAS,CAAC,mBACf,KAAA;AAEJ,OAAK,QAAQ,IACX,mBAAmB,gBAAgB,GAAG,kBAAkB,eAAe,GAAG,EAAE,CAC7E;AACD,OAAK,OAAO,IAAI,EAAE,CAAC;AACnB,OAAK,aAAa,IAAI,KAAK;AAC3B,OAAK,qBAAqB,IAAI,KAAK;AACnC,OAAK,aAAa;;CAGpB,aAAkC;AAChC,SAAO,KAAK,SAAS;;CAGvB,gBAAgB,MAAiC;AAC/C,OAAK,qBAAqB,IAAI,KAAK;;CAGrC,oBAA0B;AACxB,OAAK,qBAAqB,IAAI,KAAK;;CAGrC,kBAAkB,SAAyB;AACzC,MAAI,CAAC,KAAK,wBACR,QAAO;AAET,SAAO,KAAK,SAAS,QAAQ;;CAG/B,qBAA2B;AACzB,OAAK,iBAAiB;;CAGxB,gBAA0B,SAAsC;AAC9D,OAAK,QAAQ,mBAAmB,iBAAiB,MAAM,QAAQ;;CAGjE,qBAA+B,SAAwC;AACrE,OAAK,QAAQ,mBAAmB,sBAAsB,MAAM,QAAQ;;CAGtE,wBAAkC,SAAwC;AACxE,OAAK,QAAQ,mBAAmB,yBAAyB,MAAM,QAAQ;;CAGzE,mBAAmC;AACjC,OAAK,QAAQ,mBAAmB,kBAAkB,KAAK;;;YApFxD,MAAM,gBAAgB,EAAA,mBAAA,eAAA,OAAA,CAAA,EAAA,aAAA,WAAA,WAAA,KAAA,EAAA;YACtB,KAAK,eAAe,EAAA,mBAAA,eAAA,OAAA,CAAA,EAAA,aAAA,WAAA,UAAA,KAAA,EAAA"}
|