@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.22
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 +130 -0
- package/dist/Game/AnimationManager.d.ts +2 -1
- package/dist/Game/AnimationManager.js +21 -9
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/AnimationManager.spec.d.ts +1 -0
- 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/Event.js.map +1 -1
- 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.d.ts +9 -1
- package/dist/Game/Map.js +83 -5
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.d.ts +49 -15
- package/dist/Game/Object.js +101 -42
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Object.spec.d.ts +1 -0
- package/dist/Game/Player.js.map +1 -1
- package/dist/Game/ProjectileManager.d.ts +98 -0
- package/dist/Game/ProjectileManager.js +196 -0
- package/dist/Game/ProjectileManager.js.map +1 -0
- package/dist/Game/ProjectileManager.spec.d.ts +1 -0
- package/dist/Gui/Gui.d.ts +20 -6
- package/dist/Gui/Gui.js +132 -57
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/Gui.spec.d.ts +1 -0
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/Resource.js +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/RpgClient.d.ts +194 -15
- package/dist/RpgClientEngine.d.ts +191 -19
- package/dist/RpgClientEngine.js +693 -74
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorateMetadata.js +1 -1
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/animations/animation.ce.js +6 -5
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/fx.ce.js +60 -0
- package/dist/components/animations/fx.ce.js.map +1 -0
- package/dist/components/animations/hit.ce.js +24 -28
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/animations/index.d.ts +1 -0
- package/dist/components/animations/index.js +6 -4
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +748 -249
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/bar.ce.js +99 -0
- package/dist/components/dynamics/bar.ce.js.map +1 -0
- package/dist/components/dynamics/image.ce.js +26 -0
- package/dist/components/dynamics/image.ce.js.map +1 -0
- package/dist/components/dynamics/parse-value.d.ts +3 -0
- package/dist/components/dynamics/parse-value.js +54 -35
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
- package/dist/components/dynamics/shape-utils.d.ts +16 -0
- package/dist/components/dynamics/shape-utils.js +73 -0
- package/dist/components/dynamics/shape-utils.js.map +1 -0
- package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
- package/dist/components/dynamics/shape.ce.js +86 -0
- package/dist/components/dynamics/shape.ce.js.map +1 -0
- package/dist/components/dynamics/text.ce.js +36 -56
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +9 -9
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +75 -65
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +47 -68
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +23 -31
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +121 -172
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +15 -10
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +62 -77
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +89 -104
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +12 -8
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +17 -19
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/index.d.ts +51 -2
- package/dist/components/gui/mobile/index.js +14 -6
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/index.spec.d.ts +1 -0
- package/dist/components/gui/mobile/mobile.ce.js +309 -59
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +28 -26
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +81 -256
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +107 -142
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +50 -73
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1 -0
- package/dist/components/interaction-components.ce.js +22 -0
- package/dist/components/interaction-components.ce.js.map +1 -0
- package/dist/components/player-components-utils.d.ts +67 -0
- package/dist/components/player-components-utils.js +162 -0
- package/dist/components/player-components-utils.js.map +1 -0
- package/dist/components/player-components-utils.spec.d.ts +1 -0
- package/dist/components/player-components.ce.js +191 -0
- package/dist/components/player-components.ce.js.map +1 -0
- package/dist/components/prebuilt/hp-bar.ce.js +45 -45
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/light-halo.ce.js +39 -60
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +205 -27
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +39 -39
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +51 -10
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +1 -1
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/decorators/spritesheet.d.ts +1 -0
- package/dist/decorators/spritesheet.js +11 -0
- package/dist/decorators/spritesheet.js.map +1 -0
- 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 +8 -0
- package/dist/index.js +29 -21
- package/dist/module.js +45 -4
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/{@signe_di@2.9.0 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +7 -117
- package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +239 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +698 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +43 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{@signe_sync@2.9.0 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/index.js +57 -141
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js} +30 -17
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js} +65 -34
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +106 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +121 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +82 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/.pnpm/{zod@3.24.2/node_modules/zod/lib/index.js → zod@3.25.76/node_modules/zod/v3/types.js} +74 -611
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
- package/dist/presets/animation.js.map +1 -1
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/icon.js.map +1 -1
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/lpc.js.map +1 -1
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/services/AbstractSocket.d.ts +2 -0
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/actionInput.d.ts +14 -0
- package/dist/services/actionInput.js +59 -0
- package/dist/services/actionInput.js.map +1 -0
- package/dist/services/actionInput.spec.d.ts +1 -0
- package/dist/services/cameraFollow.d.ts +51 -0
- package/dist/services/cameraFollow.js +134 -0
- package/dist/services/cameraFollow.js.map +1 -0
- package/dist/services/cameraFollow.spec.d.ts +1 -0
- 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/loadMap.d.ts +9 -0
- package/dist/services/loadMap.js +1 -1
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mmorpg-connection.d.ts +5 -0
- package/dist/services/mmorpg-connection.js +50 -0
- package/dist/services/mmorpg-connection.js.map +1 -0
- package/dist/services/mmorpg-connection.spec.d.ts +1 -0
- package/dist/services/mmorpg.d.ts +11 -4
- package/dist/services/mmorpg.js +57 -33
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/pointerContext.d.ts +11 -0
- package/dist/services/pointerContext.js +48 -0
- package/dist/services/pointerContext.js.map +1 -0
- package/dist/services/pointerContext.spec.d.ts +1 -0
- package/dist/services/save.js.map +1 -1
- package/dist/services/save.spec.d.ts +1 -0
- package/dist/services/standalone-message.d.ts +1 -0
- package/dist/services/standalone-message.js +9 -0
- package/dist/services/standalone-message.js.map +1 -0
- package/dist/services/standalone.d.ts +4 -1
- package/dist/services/standalone.js +36 -16
- package/dist/services/standalone.js.map +1 -1
- package/dist/services/standalone.spec.d.ts +1 -0
- package/dist/utils/getEntityProp.js +4 -3
- package/dist/utils/getEntityProp.js.map +1 -1
- package/dist/utils/getEntityProp.spec.d.ts +1 -0
- package/dist/utils/mapId.d.ts +1 -0
- package/dist/utils/mapId.js +6 -0
- package/dist/utils/mapId.js.map +1 -0
- package/dist/utils/readPropValue.d.ts +2 -0
- package/dist/utils/readPropValue.js +13 -0
- package/dist/utils/readPropValue.js.map +1 -0
- package/package.json +13 -13
- package/src/Game/AnimationManager.spec.ts +30 -0
- package/src/Game/AnimationManager.ts +26 -10
- 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 +134 -2
- package/src/Game/Object.spec.ts +59 -0
- package/src/Game/Object.ts +181 -77
- package/src/Game/ProjectileManager.spec.ts +449 -0
- package/src/Game/ProjectileManager.ts +346 -0
- package/src/Gui/Gui.spec.ts +359 -0
- package/src/Gui/Gui.ts +178 -67
- package/src/Resource.ts +1 -2
- package/src/RpgClient.ts +220 -17
- package/src/RpgClientEngine.ts +995 -133
- package/src/components/animations/fx.ce +101 -0
- package/src/components/animations/index.ts +4 -2
- package/src/components/character.ce +839 -45
- package/src/components/dynamics/bar.ce +88 -0
- package/src/components/dynamics/image.ce +21 -0
- package/src/components/dynamics/parse-value.spec.ts +83 -0
- package/src/components/dynamics/parse-value.ts +111 -37
- package/src/components/dynamics/shape-utils.spec.ts +46 -0
- package/src/components/dynamics/shape-utils.ts +61 -0
- package/src/components/dynamics/shape.ce +90 -0
- package/src/components/dynamics/text.ce +35 -149
- package/src/components/gui/dialogbox/index.ce +52 -21
- package/src/components/gui/gameover.ce +6 -4
- package/src/components/gui/menu/equip-menu.ce +11 -9
- package/src/components/gui/menu/exit-menu.ce +6 -4
- package/src/components/gui/menu/items-menu.ce +11 -9
- package/src/components/gui/menu/main-menu.ce +14 -12
- package/src/components/gui/menu/options-menu.ce +4 -3
- package/src/components/gui/menu/skills-menu.ce +2 -1
- package/src/components/gui/mobile/index.spec.ts +94 -0
- package/src/components/gui/mobile/index.ts +74 -6
- package/src/components/gui/mobile/mobile.ce +347 -65
- package/src/components/gui/notification/notification.ce +7 -1
- package/src/components/gui/save-load.ce +13 -11
- package/src/components/gui/shop/shop.ce +20 -18
- package/src/components/gui/title-screen.ce +6 -4
- package/src/components/index.ts +2 -1
- package/src/components/interaction-components.ce +23 -0
- package/src/components/player-components-utils.spec.ts +109 -0
- package/src/components/player-components-utils.ts +205 -0
- package/src/components/player-components.ce +222 -0
- package/src/components/prebuilt/hp-bar.ce +4 -3
- package/src/components/prebuilt/light-halo.ce +2 -2
- package/src/components/scenes/canvas.ce +219 -15
- package/src/components/scenes/draw-map.ce +34 -22
- package/src/components/scenes/event-layer.ce +55 -4
- package/src/core/setup.ts +2 -2
- package/src/decorators/spritesheet.ts +8 -0
- package/src/i18n.spec.ts +39 -0
- package/src/i18n.ts +59 -0
- package/src/index.ts +19 -0
- package/src/module.ts +61 -11
- package/src/services/AbstractSocket.ts +3 -0
- package/src/services/actionInput.spec.ts +155 -0
- package/src/services/actionInput.ts +120 -0
- package/src/services/cameraFollow.spec.ts +220 -0
- package/src/services/cameraFollow.ts +222 -0
- 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/loadMap.ts +5 -1
- package/src/services/mmorpg-connection.spec.ts +99 -0
- package/src/services/mmorpg-connection.ts +69 -0
- package/src/services/mmorpg.ts +70 -36
- package/src/services/pointerContext.spec.ts +36 -0
- package/src/services/pointerContext.ts +84 -0
- package/src/services/save.spec.ts +127 -0
- package/src/services/standalone-message.ts +7 -0
- package/src/services/standalone.spec.ts +54 -0
- package/src/services/standalone.ts +44 -12
- package/src/utils/getEntityProp.spec.ts +96 -0
- package/src/utils/getEntityProp.ts +4 -3
- package/src/utils/mapId.ts +2 -0
- package/src/utils/readPropValue.ts +16 -0
- package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +0 -463
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +0 -2191
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -10
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +0 -91
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +0 -14
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +0 -2
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +0 -1
package/src/RpgClient.ts
CHANGED
|
@@ -2,11 +2,49 @@ import { ComponentFunction, Signal } from 'canvasengine'
|
|
|
2
2
|
import { RpgClientEngine } from './RpgClientEngine'
|
|
3
3
|
import { Loader, Container } from 'pixi.js'
|
|
4
4
|
import { RpgClientObject } from './Game/Object'
|
|
5
|
-
import
|
|
5
|
+
import type { RpgClientEvent } from './Game/Event'
|
|
6
|
+
import { type I18nMessages, type MapPhysicsEntityContext, type MapPhysicsInitContext, type RpgActionName } from '@rpgjs/common'
|
|
7
|
+
import type {
|
|
8
|
+
ClientProjectileSpawn,
|
|
9
|
+
RenderedProjectileProps,
|
|
10
|
+
} from './Game/ProjectileManager'
|
|
11
|
+
import type { ClientVisualMap } from './Game/ClientVisuals'
|
|
12
|
+
import type {
|
|
13
|
+
RpgInteractionBehavior,
|
|
14
|
+
RpgInteractionMatcher,
|
|
15
|
+
} from './services/interactions'
|
|
6
16
|
|
|
7
17
|
type RpgClass<T = any> = new (...args: any[]) => T
|
|
8
18
|
type RpgComponent = RpgClientObject
|
|
9
19
|
type SceneMap = Container
|
|
20
|
+
export type SpriteComponentConfig = ComponentFunction | {
|
|
21
|
+
component: ComponentFunction
|
|
22
|
+
props?: Record<string, any> | ((object: RpgClientObject) => Record<string, any>)
|
|
23
|
+
data?: Record<string, any> | ((object: RpgClientObject) => Record<string, any>)
|
|
24
|
+
dependencies?: (object: RpgClientObject) => any[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type EventComponentSprite = RpgClientEvent & Record<string, any>
|
|
28
|
+
|
|
29
|
+
export type EventComponentConfig = ComponentFunction | {
|
|
30
|
+
component: ComponentFunction
|
|
31
|
+
props?: Record<string, any> | ((event: EventComponentSprite) => Record<string, any>)
|
|
32
|
+
data?: Record<string, any> | ((event: EventComponentSprite) => Record<string, any>)
|
|
33
|
+
dependencies?: (event: EventComponentSprite) => any[]
|
|
34
|
+
renderGraphic?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface RpgSpriteBeforeRemoveContext {
|
|
38
|
+
reason?: string
|
|
39
|
+
data?: any
|
|
40
|
+
transition?: {
|
|
41
|
+
animation?: string
|
|
42
|
+
graphic?: string | string[]
|
|
43
|
+
duration?: number
|
|
44
|
+
effect?: string
|
|
45
|
+
}
|
|
46
|
+
timeoutMs?: number
|
|
47
|
+
}
|
|
10
48
|
|
|
11
49
|
export interface RpgClientEngineHooks {
|
|
12
50
|
/**
|
|
@@ -28,13 +66,14 @@ export interface RpgClientEngineHooks {
|
|
|
28
66
|
/**
|
|
29
67
|
* Recover keys from the pressed keyboard
|
|
30
68
|
*
|
|
31
|
-
* @prop { (engine: RpgClientEngine, obj: { input: string, playerId: number }) => any } [onInput]
|
|
69
|
+
* @prop { (engine: RpgClientEngine, obj: { input: string | number, action?: string | number, data?: any, playerId: number }) => any } [onInput]
|
|
32
70
|
* @memberof RpgEngineHooks
|
|
33
71
|
*/
|
|
34
|
-
onInput?: (engine: RpgClientEngine, obj: { input:
|
|
72
|
+
onInput?: (engine: RpgClientEngine, obj: { input: RpgActionName, action?: RpgActionName, data?: any, playerId: number }) => any
|
|
35
73
|
|
|
36
74
|
/**
|
|
37
|
-
* Called when the user is connected to the server
|
|
75
|
+
* Called when the user is connected to the server. In MMORPG mode, this
|
|
76
|
+
* runs after the server sends the RPGJS connection acceptance packet.
|
|
38
77
|
*
|
|
39
78
|
* @prop { (engine: RpgClientEngine, socket: any) => any } [onConnected]
|
|
40
79
|
* @memberof RpgEngineHooks
|
|
@@ -50,7 +89,8 @@ export interface RpgClientEngineHooks {
|
|
|
50
89
|
onDisconnect?: (engine: RpgClientEngine, reason: any, socket: any) => any
|
|
51
90
|
|
|
52
91
|
/**
|
|
53
|
-
* Called when there was a connection error
|
|
92
|
+
* Called when there was a connection error. In MMORPG mode, this also runs
|
|
93
|
+
* when server-side auth refuses the connection.
|
|
54
94
|
*
|
|
55
95
|
* @prop { (engine: RpgClientEngine, err: any, socket: any) => any } [onConnectError]
|
|
56
96
|
* @memberof RpgEngineHooks
|
|
@@ -81,7 +121,7 @@ export interface RpgSpriteHooks {
|
|
|
81
121
|
* }
|
|
82
122
|
* ```
|
|
83
123
|
*/
|
|
84
|
-
componentsBehind?:
|
|
124
|
+
componentsBehind?: SpriteComponentConfig[]
|
|
85
125
|
|
|
86
126
|
/**
|
|
87
127
|
* Array of components to render in front of the sprite
|
|
@@ -96,7 +136,53 @@ export interface RpgSpriteHooks {
|
|
|
96
136
|
* }
|
|
97
137
|
* ```
|
|
98
138
|
*/
|
|
99
|
-
componentsInFront?:
|
|
139
|
+
componentsInFront?: SpriteComponentConfig[]
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Reusable sprite components addressable by server-side component definitions.
|
|
143
|
+
*
|
|
144
|
+
* The server sends only the component id and serializable props. The client
|
|
145
|
+
* registry maps that id to the CanvasEngine component that renders it.
|
|
146
|
+
*
|
|
147
|
+
* @prop {Record<string, ComponentFunction>} [components]
|
|
148
|
+
* @memberof RpgSpriteHooks
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import GuildBadge from './components/guild-badge.ce'
|
|
152
|
+
*
|
|
153
|
+
* const sprite: RpgSpriteHooks = {
|
|
154
|
+
* components: {
|
|
155
|
+
* guildBadge: GuildBadge
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
components?: Record<string, ComponentFunction>
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Resolve a custom CanvasEngine component for a specific event.
|
|
164
|
+
*
|
|
165
|
+
* The component always receives the synced event object as the `sprite` prop.
|
|
166
|
+
* Custom props are merged in addition to `sprite`, but cannot replace it.
|
|
167
|
+
* Return `null` or `undefined` to keep the default graphic renderer.
|
|
168
|
+
*
|
|
169
|
+
* @prop { (event: EventComponentSprite) => EventComponentConfig | null | undefined } [eventComponent]
|
|
170
|
+
* @memberof RpgSpriteHooks
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* import ChestEvent from './components/chest-event.ce'
|
|
174
|
+
*
|
|
175
|
+
* const sprite: RpgSpriteHooks = {
|
|
176
|
+
* eventComponent(sprite) {
|
|
177
|
+
* if (sprite.name === 'CHEST') {
|
|
178
|
+
* return ChestEvent
|
|
179
|
+
* }
|
|
180
|
+
* return null
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
eventComponent?: (event: EventComponentSprite) => EventComponentConfig | null | undefined
|
|
100
186
|
|
|
101
187
|
/**
|
|
102
188
|
* As soon as the sprite is initialized
|
|
@@ -114,6 +200,21 @@ export interface RpgSpriteHooks {
|
|
|
114
200
|
*/
|
|
115
201
|
onDestroy?: (sprite: RpgComponent) => any
|
|
116
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Called when a sprite removal is requested, before it disappears from the scene.
|
|
205
|
+
*
|
|
206
|
+
* Return a promise to keep the sprite visible while an animation, effect, or
|
|
207
|
+
* sound transition is running. The server still owns gameplay removal and
|
|
208
|
+
* uses the timeout carried by the remove request as a safety limit.
|
|
209
|
+
*
|
|
210
|
+
* @prop { (sprite: RpgSprite, context: RpgSpriteBeforeRemoveContext) => any } [onBeforeRemove]
|
|
211
|
+
* @memberof RpgSpriteHooks
|
|
212
|
+
*/
|
|
213
|
+
onBeforeRemove?: (
|
|
214
|
+
sprite: RpgComponent,
|
|
215
|
+
context: RpgSpriteBeforeRemoveContext
|
|
216
|
+
) => any
|
|
217
|
+
|
|
117
218
|
/**
|
|
118
219
|
* As soon as a data is changed on the server side (the name for example), you are able to know the new data but also the old data.
|
|
119
220
|
*
|
|
@@ -191,6 +292,14 @@ export interface RpgSceneHooks<Scene> {
|
|
|
191
292
|
}
|
|
192
293
|
|
|
193
294
|
export interface RpgSceneMapHooks extends RpgSceneHooks<SceneMap> {
|
|
295
|
+
/**
|
|
296
|
+
* Root CanvasEngine component used to render the RPG scene map.
|
|
297
|
+
*
|
|
298
|
+
* Use the exported `SceneMap` component inside your custom component to
|
|
299
|
+
* keep the default map rendering and compose additional scene children.
|
|
300
|
+
*/
|
|
301
|
+
component?: ComponentFunction
|
|
302
|
+
|
|
194
303
|
/**
|
|
195
304
|
* The map and resources are being loaded
|
|
196
305
|
*
|
|
@@ -235,7 +344,37 @@ export interface RpgSceneMapHooks extends RpgSceneHooks<SceneMap> {
|
|
|
235
344
|
onPhysicsReset?: (scene: SceneMap) => any
|
|
236
345
|
}
|
|
237
346
|
|
|
347
|
+
export interface RpgProjectileHooks {
|
|
348
|
+
/**
|
|
349
|
+
* CanvasEngine components used to render server-authoritative projectiles.
|
|
350
|
+
*/
|
|
351
|
+
components?: Record<string, ComponentFunction>
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Called when a projectile spawn batch is received from the server.
|
|
355
|
+
*/
|
|
356
|
+
onSpawn?: (projectile: ClientProjectileSpawn) => any
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Called when the server confirms a projectile impact.
|
|
360
|
+
*/
|
|
361
|
+
onImpact?: (projectile: RenderedProjectileProps | null) => any
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Called when the server destroys a projectile.
|
|
365
|
+
*/
|
|
366
|
+
onDestroy?: (projectile: RenderedProjectileProps | null) => any
|
|
367
|
+
}
|
|
368
|
+
|
|
238
369
|
export interface RpgClient {
|
|
370
|
+
/**
|
|
371
|
+
* Default translations owned by this client module.
|
|
372
|
+
*
|
|
373
|
+
* Game-level translations provided with `provideI18n()` override module
|
|
374
|
+
* translations when they share the same locale and key.
|
|
375
|
+
*/
|
|
376
|
+
i18n?: I18nMessages
|
|
377
|
+
|
|
239
378
|
/**
|
|
240
379
|
* Add hooks to the player or engine. All modules can listen to the hook
|
|
241
380
|
*
|
|
@@ -485,6 +624,13 @@ export interface RpgClient {
|
|
|
485
624
|
* ```
|
|
486
625
|
*/
|
|
487
626
|
attachToSprite?: boolean
|
|
627
|
+
/**
|
|
628
|
+
* Vue v4 compatibility alias for `attachToSprite`.
|
|
629
|
+
*
|
|
630
|
+
* Prefer `attachToSprite` in v5 projects. This is read by `@rpgjs/vue`
|
|
631
|
+
* for Vue GUI components migrated from the v4 GUI API.
|
|
632
|
+
*/
|
|
633
|
+
rpgAttachToSprite?: boolean
|
|
488
634
|
} | any)[],
|
|
489
635
|
|
|
490
636
|
/**
|
|
@@ -563,33 +709,36 @@ export interface RpgClient {
|
|
|
563
709
|
* */
|
|
564
710
|
sprite?: RpgSpriteHooks
|
|
565
711
|
|
|
566
|
-
/**
|
|
567
|
-
* Reference the scenes of the game.
|
|
712
|
+
/**
|
|
713
|
+
* Reference the scenes of the game.
|
|
568
714
|
*
|
|
569
715
|
* ```ts
|
|
570
716
|
* import { RpgSceneMapHooks, RpgClient, defineModule } from '@rpgjs/client'
|
|
717
|
+
* import MyScene from './my-scene.ce'
|
|
571
718
|
*
|
|
572
719
|
* export const sceneMap: RpgSceneMapHooks = {
|
|
573
|
-
*
|
|
720
|
+
* component: MyScene
|
|
574
721
|
* }
|
|
575
722
|
*
|
|
576
723
|
* defineModule<RpgClient>({
|
|
577
|
-
*
|
|
578
|
-
* // If you put the RpgSceneMap scene, Thhe key is called mandatory `map`
|
|
579
|
-
* map: sceneMap
|
|
580
|
-
* }
|
|
724
|
+
* sceneMap
|
|
581
725
|
* })
|
|
582
726
|
* ```
|
|
583
727
|
*
|
|
584
|
-
* @prop {
|
|
728
|
+
* @prop {RpgSceneMapHooks} [sceneMap]
|
|
585
729
|
* @memberof RpgClient
|
|
586
730
|
* */
|
|
731
|
+
sceneMap?: RpgSceneMapHooks
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Legacy scene map hook container.
|
|
735
|
+
*
|
|
736
|
+
* Prefer `sceneMap` for new code.
|
|
737
|
+
*/
|
|
587
738
|
scenes?: {
|
|
588
739
|
map: RpgSceneMapHooks
|
|
589
740
|
}
|
|
590
741
|
|
|
591
|
-
sceneMap?: RpgSceneMapHooks
|
|
592
|
-
|
|
593
742
|
/**
|
|
594
743
|
* Array containing the list of component animations
|
|
595
744
|
* Each element defines a temporary component to display for animations like hits, effects, etc.
|
|
@@ -620,4 +769,58 @@ export interface RpgClient {
|
|
|
620
769
|
id: string,
|
|
621
770
|
component: ComponentFunction
|
|
622
771
|
}[]
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Named client-side visual macros.
|
|
775
|
+
*
|
|
776
|
+
* Use client visuals when the server needs to trigger a group of existing
|
|
777
|
+
* client visual primitives at once, such as a flash, damage text, sound,
|
|
778
|
+
* component animation, and camera shake. The server sends only the visual
|
|
779
|
+
* name and a serializable payload; the rendering details live on the client.
|
|
780
|
+
*
|
|
781
|
+
* For a single sound, flash, or component animation, prefer the direct
|
|
782
|
+
* server APIs (`playSound`, `flash`, `showComponentAnimation`). Client
|
|
783
|
+
* visuals are meant to group several visual operations and reduce bandwidth.
|
|
784
|
+
*
|
|
785
|
+
* ```ts
|
|
786
|
+
* import { defineModule, RpgClient } from '@rpgjs/client'
|
|
787
|
+
*
|
|
788
|
+
* export default defineModule<RpgClient>({
|
|
789
|
+
* clientVisuals: {
|
|
790
|
+
* hit({ target, data }, helpers) {
|
|
791
|
+
* helpers.flash(target, { type: 'tint', tint: 'red' })
|
|
792
|
+
* helpers.showHit(target, `-${data.damage}`)
|
|
793
|
+
* helpers.sound('hit')
|
|
794
|
+
* }
|
|
795
|
+
* }
|
|
796
|
+
* })
|
|
797
|
+
* ```
|
|
798
|
+
*
|
|
799
|
+
* @prop {Record<string, ClientVisualHandler>} [clientVisuals]
|
|
800
|
+
* @memberof RpgClient
|
|
801
|
+
*/
|
|
802
|
+
clientVisuals?: ClientVisualMap
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Client-side projectile rendering configuration.
|
|
806
|
+
*
|
|
807
|
+
* Register a CanvasEngine component per projectile type. The server sends
|
|
808
|
+
* compact spawn/impact/destroy events and the client predicts x/y locally.
|
|
809
|
+
*/
|
|
810
|
+
projectiles?: RpgProjectileHooks
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Client-only pointer interactions attached to sprites.
|
|
814
|
+
*
|
|
815
|
+
* Use this for hover popovers, selection, drag previews, cursor changes, and
|
|
816
|
+
* explicit mouse-driven gameplay actions. Pointer feedback stays local unless
|
|
817
|
+
* the behavior calls `ctx.action(...)`.
|
|
818
|
+
*/
|
|
819
|
+
interactions?:
|
|
820
|
+
| ((engine: RpgClientEngine) => void)
|
|
821
|
+
| {
|
|
822
|
+
setup?: (engine: RpgClientEngine) => void
|
|
823
|
+
load?: (engine: RpgClientEngine) => void
|
|
824
|
+
use?: Array<[RpgInteractionMatcher, RpgInteractionBehavior | ComponentFunction]>
|
|
825
|
+
}
|
|
623
826
|
}
|