@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.
Files changed (325) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/Game/AnimationManager.d.ts +2 -1
  3. package/dist/Game/AnimationManager.js +21 -9
  4. package/dist/Game/AnimationManager.js.map +1 -1
  5. package/dist/Game/AnimationManager.spec.d.ts +1 -0
  6. package/dist/Game/ClientVisuals.d.ts +61 -0
  7. package/dist/Game/ClientVisuals.js +96 -0
  8. package/dist/Game/ClientVisuals.js.map +1 -0
  9. package/dist/Game/ClientVisuals.spec.d.ts +1 -0
  10. package/dist/Game/Event.js.map +1 -1
  11. package/dist/Game/EventComponentResolver.d.ts +16 -0
  12. package/dist/Game/EventComponentResolver.js +52 -0
  13. package/dist/Game/EventComponentResolver.js.map +1 -0
  14. package/dist/Game/EventComponentResolver.spec.d.ts +1 -0
  15. package/dist/Game/Map.d.ts +9 -1
  16. package/dist/Game/Map.js +83 -5
  17. package/dist/Game/Map.js.map +1 -1
  18. package/dist/Game/Object.d.ts +49 -15
  19. package/dist/Game/Object.js +101 -42
  20. package/dist/Game/Object.js.map +1 -1
  21. package/dist/Game/Object.spec.d.ts +1 -0
  22. package/dist/Game/Player.js.map +1 -1
  23. package/dist/Game/ProjectileManager.d.ts +98 -0
  24. package/dist/Game/ProjectileManager.js +196 -0
  25. package/dist/Game/ProjectileManager.js.map +1 -0
  26. package/dist/Game/ProjectileManager.spec.d.ts +1 -0
  27. package/dist/Gui/Gui.d.ts +20 -6
  28. package/dist/Gui/Gui.js +132 -57
  29. package/dist/Gui/Gui.js.map +1 -1
  30. package/dist/Gui/Gui.spec.d.ts +1 -0
  31. package/dist/Gui/NotificationManager.js.map +1 -1
  32. package/dist/Resource.js +1 -1
  33. package/dist/Resource.js.map +1 -1
  34. package/dist/RpgClient.d.ts +194 -15
  35. package/dist/RpgClientEngine.d.ts +191 -19
  36. package/dist/RpgClientEngine.js +693 -74
  37. package/dist/RpgClientEngine.js.map +1 -1
  38. package/dist/Sound.js.map +1 -1
  39. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
  40. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorateMetadata.js +1 -1
  41. package/dist/_virtual/_rolldown/runtime.js +13 -0
  42. package/dist/components/animations/animation.ce.js +6 -5
  43. package/dist/components/animations/animation.ce.js.map +1 -1
  44. package/dist/components/animations/fx.ce.js +60 -0
  45. package/dist/components/animations/fx.ce.js.map +1 -0
  46. package/dist/components/animations/hit.ce.js +24 -28
  47. package/dist/components/animations/hit.ce.js.map +1 -1
  48. package/dist/components/animations/index.d.ts +1 -0
  49. package/dist/components/animations/index.js +6 -4
  50. package/dist/components/animations/index.js.map +1 -1
  51. package/dist/components/character.ce.js +748 -249
  52. package/dist/components/character.ce.js.map +1 -1
  53. package/dist/components/dynamics/bar.ce.js +99 -0
  54. package/dist/components/dynamics/bar.ce.js.map +1 -0
  55. package/dist/components/dynamics/image.ce.js +26 -0
  56. package/dist/components/dynamics/image.ce.js.map +1 -0
  57. package/dist/components/dynamics/parse-value.d.ts +3 -0
  58. package/dist/components/dynamics/parse-value.js +54 -35
  59. package/dist/components/dynamics/parse-value.js.map +1 -1
  60. package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
  61. package/dist/components/dynamics/shape-utils.d.ts +16 -0
  62. package/dist/components/dynamics/shape-utils.js +73 -0
  63. package/dist/components/dynamics/shape-utils.js.map +1 -0
  64. package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
  65. package/dist/components/dynamics/shape.ce.js +86 -0
  66. package/dist/components/dynamics/shape.ce.js.map +1 -0
  67. package/dist/components/dynamics/text.ce.js +36 -56
  68. package/dist/components/dynamics/text.ce.js.map +1 -1
  69. package/dist/components/gui/box.ce.js +9 -9
  70. package/dist/components/gui/box.ce.js.map +1 -1
  71. package/dist/components/gui/dialogbox/index.ce.js +75 -65
  72. package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
  73. package/dist/components/gui/gameover.ce.js +47 -68
  74. package/dist/components/gui/gameover.ce.js.map +1 -1
  75. package/dist/components/gui/hud/hud.ce.js +23 -31
  76. package/dist/components/gui/hud/hud.ce.js.map +1 -1
  77. package/dist/components/gui/menu/equip-menu.ce.js +121 -172
  78. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
  79. package/dist/components/gui/menu/exit-menu.ce.js +15 -10
  80. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
  81. package/dist/components/gui/menu/items-menu.ce.js +62 -77
  82. package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
  83. package/dist/components/gui/menu/main-menu.ce.js +89 -104
  84. package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
  85. package/dist/components/gui/menu/options-menu.ce.js +12 -8
  86. package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
  87. package/dist/components/gui/menu/skills-menu.ce.js +17 -19
  88. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
  89. package/dist/components/gui/mobile/index.d.ts +51 -2
  90. package/dist/components/gui/mobile/index.js +14 -6
  91. package/dist/components/gui/mobile/index.js.map +1 -1
  92. package/dist/components/gui/mobile/index.spec.d.ts +1 -0
  93. package/dist/components/gui/mobile/mobile.ce.js +309 -59
  94. package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
  95. package/dist/components/gui/notification/notification.ce.js +28 -26
  96. package/dist/components/gui/notification/notification.ce.js.map +1 -1
  97. package/dist/components/gui/save-load.ce.js +81 -256
  98. package/dist/components/gui/save-load.ce.js.map +1 -1
  99. package/dist/components/gui/shop/shop.ce.js +107 -142
  100. package/dist/components/gui/shop/shop.ce.js.map +1 -1
  101. package/dist/components/gui/title-screen.ce.js +50 -73
  102. package/dist/components/gui/title-screen.ce.js.map +1 -1
  103. package/dist/components/index.d.ts +2 -1
  104. package/dist/components/index.js +1 -0
  105. package/dist/components/interaction-components.ce.js +22 -0
  106. package/dist/components/interaction-components.ce.js.map +1 -0
  107. package/dist/components/player-components-utils.d.ts +67 -0
  108. package/dist/components/player-components-utils.js +162 -0
  109. package/dist/components/player-components-utils.js.map +1 -0
  110. package/dist/components/player-components-utils.spec.d.ts +1 -0
  111. package/dist/components/player-components.ce.js +191 -0
  112. package/dist/components/player-components.ce.js.map +1 -0
  113. package/dist/components/prebuilt/hp-bar.ce.js +45 -45
  114. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
  115. package/dist/components/prebuilt/light-halo.ce.js +39 -60
  116. package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
  117. package/dist/components/scenes/canvas.ce.js +205 -27
  118. package/dist/components/scenes/canvas.ce.js.map +1 -1
  119. package/dist/components/scenes/draw-map.ce.js +39 -39
  120. package/dist/components/scenes/draw-map.ce.js.map +1 -1
  121. package/dist/components/scenes/event-layer.ce.js +51 -10
  122. package/dist/components/scenes/event-layer.ce.js.map +1 -1
  123. package/dist/core/inject.js +1 -1
  124. package/dist/core/inject.js.map +1 -1
  125. package/dist/core/setup.js +1 -1
  126. package/dist/core/setup.js.map +1 -1
  127. package/dist/decorators/spritesheet.d.ts +1 -0
  128. package/dist/decorators/spritesheet.js +11 -0
  129. package/dist/decorators/spritesheet.js.map +1 -0
  130. package/dist/i18n.d.ts +55 -0
  131. package/dist/i18n.js +60 -0
  132. package/dist/i18n.js.map +1 -0
  133. package/dist/i18n.spec.d.ts +1 -0
  134. package/dist/index.d.ts +8 -0
  135. package/dist/index.js +29 -21
  136. package/dist/module.js +45 -4
  137. package/dist/module.js.map +1 -1
  138. package/dist/node_modules/.pnpm/{@signe_di@2.9.0 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +7 -117
  139. package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js.map +1 -0
  140. package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +239 -0
  141. package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
  142. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
  143. 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
  144. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +698 -0
  145. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -0
  146. package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +43 -0
  147. 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
  148. 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
  149. package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -0
  150. 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
  151. package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -0
  152. 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
  153. package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -0
  154. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +13 -0
  155. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js.map +1 -0
  156. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +106 -0
  157. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
  158. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +13 -0
  159. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
  160. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +121 -0
  161. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js.map +1 -0
  162. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
  163. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
  164. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
  165. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
  166. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
  167. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
  168. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +82 -0
  169. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
  170. 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
  171. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
  172. package/dist/presets/animation.js.map +1 -1
  173. package/dist/presets/faceset.js.map +1 -1
  174. package/dist/presets/icon.js.map +1 -1
  175. package/dist/presets/index.js.map +1 -1
  176. package/dist/presets/lpc.js.map +1 -1
  177. package/dist/presets/rmspritesheet.js.map +1 -1
  178. package/dist/services/AbstractSocket.d.ts +2 -0
  179. package/dist/services/AbstractSocket.js.map +1 -1
  180. package/dist/services/actionInput.d.ts +14 -0
  181. package/dist/services/actionInput.js +59 -0
  182. package/dist/services/actionInput.js.map +1 -0
  183. package/dist/services/actionInput.spec.d.ts +1 -0
  184. package/dist/services/cameraFollow.d.ts +51 -0
  185. package/dist/services/cameraFollow.js +134 -0
  186. package/dist/services/cameraFollow.js.map +1 -0
  187. package/dist/services/cameraFollow.spec.d.ts +1 -0
  188. package/dist/services/interactions.d.ts +159 -0
  189. package/dist/services/interactions.js +460 -0
  190. package/dist/services/interactions.js.map +1 -0
  191. package/dist/services/interactions.spec.d.ts +1 -0
  192. package/dist/services/keyboardControls.d.ts +1 -0
  193. package/dist/services/keyboardControls.js +1 -0
  194. package/dist/services/keyboardControls.js.map +1 -1
  195. package/dist/services/loadMap.d.ts +9 -0
  196. package/dist/services/loadMap.js +1 -1
  197. package/dist/services/loadMap.js.map +1 -1
  198. package/dist/services/mmorpg-connection.d.ts +5 -0
  199. package/dist/services/mmorpg-connection.js +50 -0
  200. package/dist/services/mmorpg-connection.js.map +1 -0
  201. package/dist/services/mmorpg-connection.spec.d.ts +1 -0
  202. package/dist/services/mmorpg.d.ts +11 -4
  203. package/dist/services/mmorpg.js +57 -33
  204. package/dist/services/mmorpg.js.map +1 -1
  205. package/dist/services/pointerContext.d.ts +11 -0
  206. package/dist/services/pointerContext.js +48 -0
  207. package/dist/services/pointerContext.js.map +1 -0
  208. package/dist/services/pointerContext.spec.d.ts +1 -0
  209. package/dist/services/save.js.map +1 -1
  210. package/dist/services/save.spec.d.ts +1 -0
  211. package/dist/services/standalone-message.d.ts +1 -0
  212. package/dist/services/standalone-message.js +9 -0
  213. package/dist/services/standalone-message.js.map +1 -0
  214. package/dist/services/standalone.d.ts +4 -1
  215. package/dist/services/standalone.js +36 -16
  216. package/dist/services/standalone.js.map +1 -1
  217. package/dist/services/standalone.spec.d.ts +1 -0
  218. package/dist/utils/getEntityProp.js +4 -3
  219. package/dist/utils/getEntityProp.js.map +1 -1
  220. package/dist/utils/getEntityProp.spec.d.ts +1 -0
  221. package/dist/utils/mapId.d.ts +1 -0
  222. package/dist/utils/mapId.js +6 -0
  223. package/dist/utils/mapId.js.map +1 -0
  224. package/dist/utils/readPropValue.d.ts +2 -0
  225. package/dist/utils/readPropValue.js +13 -0
  226. package/dist/utils/readPropValue.js.map +1 -0
  227. package/package.json +13 -13
  228. package/src/Game/AnimationManager.spec.ts +30 -0
  229. package/src/Game/AnimationManager.ts +26 -10
  230. package/src/Game/ClientVisuals.spec.ts +56 -0
  231. package/src/Game/ClientVisuals.ts +184 -0
  232. package/src/Game/EventComponentResolver.spec.ts +84 -0
  233. package/src/Game/EventComponentResolver.ts +74 -0
  234. package/src/Game/Map.ts +134 -2
  235. package/src/Game/Object.spec.ts +59 -0
  236. package/src/Game/Object.ts +181 -77
  237. package/src/Game/ProjectileManager.spec.ts +449 -0
  238. package/src/Game/ProjectileManager.ts +346 -0
  239. package/src/Gui/Gui.spec.ts +359 -0
  240. package/src/Gui/Gui.ts +178 -67
  241. package/src/Resource.ts +1 -2
  242. package/src/RpgClient.ts +220 -17
  243. package/src/RpgClientEngine.ts +995 -133
  244. package/src/components/animations/fx.ce +101 -0
  245. package/src/components/animations/index.ts +4 -2
  246. package/src/components/character.ce +839 -45
  247. package/src/components/dynamics/bar.ce +88 -0
  248. package/src/components/dynamics/image.ce +21 -0
  249. package/src/components/dynamics/parse-value.spec.ts +83 -0
  250. package/src/components/dynamics/parse-value.ts +111 -37
  251. package/src/components/dynamics/shape-utils.spec.ts +46 -0
  252. package/src/components/dynamics/shape-utils.ts +61 -0
  253. package/src/components/dynamics/shape.ce +90 -0
  254. package/src/components/dynamics/text.ce +35 -149
  255. package/src/components/gui/dialogbox/index.ce +52 -21
  256. package/src/components/gui/gameover.ce +6 -4
  257. package/src/components/gui/menu/equip-menu.ce +11 -9
  258. package/src/components/gui/menu/exit-menu.ce +6 -4
  259. package/src/components/gui/menu/items-menu.ce +11 -9
  260. package/src/components/gui/menu/main-menu.ce +14 -12
  261. package/src/components/gui/menu/options-menu.ce +4 -3
  262. package/src/components/gui/menu/skills-menu.ce +2 -1
  263. package/src/components/gui/mobile/index.spec.ts +94 -0
  264. package/src/components/gui/mobile/index.ts +74 -6
  265. package/src/components/gui/mobile/mobile.ce +347 -65
  266. package/src/components/gui/notification/notification.ce +7 -1
  267. package/src/components/gui/save-load.ce +13 -11
  268. package/src/components/gui/shop/shop.ce +20 -18
  269. package/src/components/gui/title-screen.ce +6 -4
  270. package/src/components/index.ts +2 -1
  271. package/src/components/interaction-components.ce +23 -0
  272. package/src/components/player-components-utils.spec.ts +109 -0
  273. package/src/components/player-components-utils.ts +205 -0
  274. package/src/components/player-components.ce +222 -0
  275. package/src/components/prebuilt/hp-bar.ce +4 -3
  276. package/src/components/prebuilt/light-halo.ce +2 -2
  277. package/src/components/scenes/canvas.ce +219 -15
  278. package/src/components/scenes/draw-map.ce +34 -22
  279. package/src/components/scenes/event-layer.ce +55 -4
  280. package/src/core/setup.ts +2 -2
  281. package/src/decorators/spritesheet.ts +8 -0
  282. package/src/i18n.spec.ts +39 -0
  283. package/src/i18n.ts +59 -0
  284. package/src/index.ts +19 -0
  285. package/src/module.ts +61 -11
  286. package/src/services/AbstractSocket.ts +3 -0
  287. package/src/services/actionInput.spec.ts +155 -0
  288. package/src/services/actionInput.ts +120 -0
  289. package/src/services/cameraFollow.spec.ts +220 -0
  290. package/src/services/cameraFollow.ts +222 -0
  291. package/src/services/interactions.spec.ts +175 -0
  292. package/src/services/interactions.ts +722 -0
  293. package/src/services/keyboardControls.ts +2 -1
  294. package/src/services/loadMap.ts +5 -1
  295. package/src/services/mmorpg-connection.spec.ts +99 -0
  296. package/src/services/mmorpg-connection.ts +69 -0
  297. package/src/services/mmorpg.ts +70 -36
  298. package/src/services/pointerContext.spec.ts +36 -0
  299. package/src/services/pointerContext.ts +84 -0
  300. package/src/services/save.spec.ts +127 -0
  301. package/src/services/standalone-message.ts +7 -0
  302. package/src/services/standalone.spec.ts +54 -0
  303. package/src/services/standalone.ts +44 -12
  304. package/src/utils/getEntityProp.spec.ts +96 -0
  305. package/src/utils/getEntityProp.ts +4 -3
  306. package/src/utils/mapId.ts +2 -0
  307. package/src/utils/readPropValue.ts +16 -0
  308. package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +0 -1
  309. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
  310. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +0 -1
  311. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +0 -463
  312. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +0 -1
  313. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +0 -2191
  314. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +0 -1
  315. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -10
  316. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +0 -1
  317. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +0 -91
  318. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +0 -1
  319. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +0 -1
  320. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +0 -14
  321. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +0 -1
  322. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +0 -1
  323. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +0 -1
  324. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +0 -2
  325. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +0 -1
package/src/module.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { findModules, provideModules } from "@rpgjs/common";
1
+ import { findModules, provideModules, registerI18nMessages } from "@rpgjs/common";
2
2
  import { FactoryProvider } from "@signe/di";
3
3
  import { RpgClientEngine } from "./RpgClientEngine";
4
4
  import { RpgClient } from "./RpgClient";
@@ -67,6 +67,9 @@ export function provideClientModules(modules: RpgClientModule[]): FactoryProvide
67
67
  if ('client' in module) {
68
68
  module = module.client as any;
69
69
  }
70
+ if (module.i18n) {
71
+ registerI18nMessages(context, module.i18n, "client-module", 10);
72
+ }
70
73
  if (module.spritesheets) {
71
74
  const spritesheets = [...module.spritesheets];
72
75
  module.spritesheets = {
@@ -155,6 +158,46 @@ export function provideClientModules(modules: RpgClientModule[]): FactoryProvide
155
158
  },
156
159
  };
157
160
  }
161
+ if (module.clientVisuals) {
162
+ const clientVisuals = { ...module.clientVisuals };
163
+ module.clientVisuals = {
164
+ load: (engine: RpgClientEngine) => {
165
+ engine.registerClientVisuals(clientVisuals);
166
+ },
167
+ };
168
+ }
169
+ if (module.projectiles) {
170
+ const projectiles = { ...module.projectiles };
171
+ module.projectiles = {
172
+ ...projectiles,
173
+ load: (engine: RpgClientEngine) => {
174
+ if (projectiles.components) {
175
+ Object.entries(projectiles.components).forEach(([type, component]) => {
176
+ engine.registerProjectileComponent(type, component);
177
+ });
178
+ }
179
+ },
180
+ };
181
+ }
182
+ if (module.interactions) {
183
+ const interactions = module.interactions;
184
+ module.interactions = {
185
+ ...interactions,
186
+ load: (engine: RpgClientEngine) => {
187
+ if (typeof interactions === "function") {
188
+ interactions(engine);
189
+ return;
190
+ }
191
+ interactions.load?.(engine);
192
+ interactions.setup?.(engine);
193
+ if (Array.isArray(interactions.use)) {
194
+ interactions.use.forEach(([matcher, behavior]) => {
195
+ engine.interactions.use(matcher, behavior);
196
+ });
197
+ }
198
+ },
199
+ };
200
+ }
158
201
  if (module.transitions) {
159
202
  const transitions = [...module.transitions];
160
203
  module.transitions = {
@@ -195,6 +238,14 @@ export function provideClientModules(modules: RpgClientModule[]): FactoryProvide
195
238
  engine.addSpriteComponentInFront(component);
196
239
  });
197
240
  }
241
+ if (sprite.components) {
242
+ Object.entries(sprite.components).forEach(([id, component]) => {
243
+ engine.registerSpriteComponent(id, component);
244
+ });
245
+ }
246
+ if (sprite.eventComponent) {
247
+ engine.addEventComponentResolver(sprite.eventComponent);
248
+ }
198
249
  },
199
250
  };
200
251
  }
@@ -214,16 +265,15 @@ export function provideGlobalConfig(config: any) {
214
265
  }
215
266
 
216
267
  export function provideClientGlobalConfig(config: any = {}) {
217
- if (!config.keyboardControls) {
218
- config.keyboardControls = {
219
- up: 'up',
220
- down: 'down',
221
- left: 'left',
222
- right: 'right',
223
- action: 'space',
224
- escape: 'escape'
225
- }
268
+ config.keyboardControls = {
269
+ up: 'up',
270
+ down: 'down',
271
+ left: 'left',
272
+ right: 'right',
273
+ action: 'space',
274
+ dash: 'shift',
275
+ escape: 'escape',
276
+ ...(config.keyboardControls ?? {}),
226
277
  }
227
278
  return provideGlobalConfig(config)
228
279
  }
229
-
@@ -9,8 +9,11 @@ export type SocketUpdateProperties = {
9
9
  host?: string;
10
10
  query?: SocketQuery;
11
11
  };
12
+ export type WebSocketMode = "standalone" | "mmorpg";
12
13
 
13
14
  export abstract class AbstractWebsocket {
15
+ readonly mode?: WebSocketMode;
16
+
14
17
  constructor(protected context: Context) {}
15
18
 
16
19
  abstract connection(listeners?: (data: any) => void): Promise<void>;
@@ -0,0 +1,155 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import {
3
+ getKeyboardControlBind,
4
+ keyboardEventMatchesBind,
5
+ normalizeActionInput,
6
+ resolveKeyboardActionInput,
7
+ resolveKeyboardDirectionInput,
8
+ } from "./actionInput";
9
+
10
+ const keyboardEvent = (values: Partial<KeyboardEvent>) =>
11
+ values as KeyboardEvent;
12
+
13
+ describe("normalizeActionInput", () => {
14
+ test("keeps simple actions compatible", () => {
15
+ expect(normalizeActionInput("action")).toEqual({
16
+ action: "action",
17
+ });
18
+ });
19
+
20
+ test("adds custom data to action payloads", () => {
21
+ expect(normalizeActionInput("projectile:shoot", {
22
+ target: { x: 320, y: 180 },
23
+ source: "map-click",
24
+ })).toEqual({
25
+ action: "projectile:shoot",
26
+ data: {
27
+ target: { x: 320, y: 180 },
28
+ source: "map-click",
29
+ },
30
+ });
31
+ });
32
+
33
+ test("keeps object-form action payloads intact", () => {
34
+ const payload = {
35
+ action: "projectile:shoot",
36
+ data: { target: { x: 64, y: 96 } },
37
+ };
38
+
39
+ expect(normalizeActionInput(payload)).toBe(payload);
40
+ });
41
+ });
42
+
43
+ describe("keyboard action controls", () => {
44
+ test("keeps string controls compatible", () => {
45
+ expect(getKeyboardControlBind("space")).toBe("space");
46
+ expect(resolveKeyboardActionInput("space", {}, {})).toEqual({
47
+ action: "action",
48
+ });
49
+ });
50
+
51
+ test("resolves object controls with static data", () => {
52
+ const control = {
53
+ bind: "space",
54
+ action: "projectile:shoot",
55
+ data: {
56
+ source: "keyboard",
57
+ target: { x: 10, y: 20 },
58
+ },
59
+ };
60
+
61
+ expect(getKeyboardControlBind(control)).toBe("space");
62
+ expect(resolveKeyboardActionInput(control, {}, {})).toEqual({
63
+ action: "projectile:shoot",
64
+ data: {
65
+ source: "keyboard",
66
+ target: { x: 10, y: 20 },
67
+ },
68
+ });
69
+ });
70
+
71
+ test("resolves object controls with functional data", () => {
72
+ const client = {
73
+ pointer: {
74
+ world: () => ({ x: 64, y: 96 }),
75
+ },
76
+ };
77
+ const sprite = { id: "player-1" };
78
+ const control = {
79
+ bind: "space",
80
+ action: "projectile:shoot",
81
+ data: (resolvedClient: typeof client, resolvedSprite: typeof sprite) => ({
82
+ source: "keyboard",
83
+ target: resolvedClient.pointer.world(),
84
+ playerId: resolvedSprite.id,
85
+ }),
86
+ };
87
+
88
+ expect(resolveKeyboardActionInput(control, client, sprite)).toEqual({
89
+ action: "projectile:shoot",
90
+ data: {
91
+ source: "keyboard",
92
+ target: { x: 64, y: 96 },
93
+ playerId: "player-1",
94
+ },
95
+ });
96
+ });
97
+
98
+ test("omits data when object controls do not provide it", () => {
99
+ expect(resolveKeyboardActionInput({
100
+ bind: "space",
101
+ action: "projectile:shoot",
102
+ }, {}, {})).toEqual({
103
+ action: "projectile:shoot",
104
+ });
105
+ });
106
+
107
+ test("matches keyboard events against string, numeric, and array binds", () => {
108
+ expect(
109
+ keyboardEventMatchesBind(
110
+ keyboardEvent({ key: " ", code: "Space", keyCode: 32 }),
111
+ "space"
112
+ )
113
+ ).toBe(true);
114
+ expect(
115
+ keyboardEventMatchesBind(
116
+ keyboardEvent({ key: "ArrowUp", code: "ArrowUp", keyCode: 38 }),
117
+ "up"
118
+ )
119
+ ).toBe(true);
120
+ expect(
121
+ keyboardEventMatchesBind(
122
+ keyboardEvent({ key: "x", code: "KeyX", keyCode: 88 }),
123
+ ["space", "x"]
124
+ )
125
+ ).toBe(true);
126
+ expect(
127
+ keyboardEventMatchesBind(
128
+ keyboardEvent({ key: "Escape", code: "Escape", keyCode: 27 }),
129
+ 27
130
+ )
131
+ ).toBe(true);
132
+ expect(
133
+ keyboardEventMatchesBind(
134
+ keyboardEvent({ key: "a", code: "KeyA", keyCode: 65 }),
135
+ "space"
136
+ )
137
+ ).toBe(false);
138
+ });
139
+
140
+ test("resolves directional keyboard controls from a native keyboard event", () => {
141
+ const controls = {
142
+ up: "up",
143
+ down: "down",
144
+ left: "left",
145
+ right: "right",
146
+ };
147
+
148
+ expect(
149
+ resolveKeyboardDirectionInput(
150
+ keyboardEvent({ key: "ArrowRight", code: "ArrowRight", keyCode: 39 }),
151
+ controls
152
+ )
153
+ ).toBe("right");
154
+ });
155
+ });
@@ -0,0 +1,120 @@
1
+ import { Direction, type RpgActionInput, type RpgActionName } from "@rpgjs/common";
2
+
3
+ export type KeyboardActionDataResolver<TClient = any, TSprite = any> = (
4
+ client: TClient,
5
+ sprite: TSprite,
6
+ ) => any;
7
+
8
+ export interface KeyboardActionConfig<TClient = any, TSprite = any> {
9
+ bind: any;
10
+ action?: RpgActionName;
11
+ data?: any | KeyboardActionDataResolver<TClient, TSprite>;
12
+ }
13
+
14
+ export function normalizeActionInput(action: RpgActionName, data?: any): RpgActionInput;
15
+ export function normalizeActionInput(action: RpgActionInput): RpgActionInput;
16
+ export function normalizeActionInput(action: RpgActionName | RpgActionInput, data?: any): RpgActionInput {
17
+ if (typeof action === "object") {
18
+ return action;
19
+ }
20
+ return data === undefined
21
+ ? { action }
22
+ : { action, data };
23
+ }
24
+
25
+ export function isKeyboardActionConfig(value: any): value is KeyboardActionConfig {
26
+ return value !== null
27
+ && typeof value === "object"
28
+ && Object.prototype.hasOwnProperty.call(value, "bind");
29
+ }
30
+
31
+ export function getKeyboardControlBind(control: any): any {
32
+ return isKeyboardActionConfig(control) ? control.bind : control;
33
+ }
34
+
35
+ const KEY_CODE_NAMES: Record<number, string> = {
36
+ 32: "space",
37
+ 27: "escape",
38
+ 37: "left",
39
+ 38: "up",
40
+ 39: "right",
41
+ 40: "down",
42
+ };
43
+
44
+ const normalizeKeyboardName = (value: unknown): string | undefined => {
45
+ if (typeof value !== "string") return undefined;
46
+ const normalized = value.toLowerCase();
47
+ if (
48
+ normalized === " " ||
49
+ normalized === "spacebar" ||
50
+ normalized === "space"
51
+ ) {
52
+ return "space";
53
+ }
54
+ if (normalized.startsWith("arrow")) {
55
+ return normalized.slice("arrow".length);
56
+ }
57
+ return normalized;
58
+ };
59
+
60
+ export function keyboardEventMatchesBind(
61
+ event: KeyboardEvent,
62
+ bind: any
63
+ ): boolean {
64
+ if (Array.isArray(bind)) {
65
+ return bind.some(item => keyboardEventMatchesBind(event, item));
66
+ }
67
+
68
+ if (typeof bind === "number") {
69
+ return event.keyCode === bind;
70
+ }
71
+
72
+ const expected = normalizeKeyboardName(bind);
73
+ if (!expected) return false;
74
+
75
+ return (
76
+ normalizeKeyboardName(event.key) === expected ||
77
+ normalizeKeyboardName(event.code) === expected ||
78
+ KEY_CODE_NAMES[event.keyCode] === expected
79
+ );
80
+ }
81
+
82
+ export function resolveKeyboardActionInput(
83
+ control: any,
84
+ client: any,
85
+ sprite: any,
86
+ defaultAction: RpgActionName = "action",
87
+ ): RpgActionInput {
88
+ if (!isKeyboardActionConfig(control)) {
89
+ return { action: defaultAction };
90
+ }
91
+
92
+ const action = control.action ?? defaultAction;
93
+ const data = typeof control.data === "function"
94
+ ? control.data(client, sprite)
95
+ : control.data;
96
+
97
+ return data === undefined
98
+ ? { action }
99
+ : { action, data };
100
+ }
101
+
102
+ export function resolveKeyboardDirectionInput(
103
+ event: KeyboardEvent,
104
+ keyboardControls: any
105
+ ): Direction | undefined {
106
+ const directions: Array<[any, Direction]> = [
107
+ [keyboardControls?.up, Direction.Up],
108
+ [keyboardControls?.down, Direction.Down],
109
+ [keyboardControls?.left, Direction.Left],
110
+ [keyboardControls?.right, Direction.Right],
111
+ ];
112
+
113
+ for (const [control, direction] of directions) {
114
+ if (keyboardEventMatchesBind(event, getKeyboardControlBind(control))) {
115
+ return direction;
116
+ }
117
+ }
118
+
119
+ return undefined;
120
+ }
@@ -0,0 +1,220 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import {
3
+ applyCameraFollow,
4
+ cameraFollowAnimationOptions,
5
+ cameraFollowOptions,
6
+ ownsCameraFollowRevision,
7
+ } from "./cameraFollow";
8
+
9
+ const createViewport = () => ({
10
+ animate: vi.fn(),
11
+ follow: vi.fn(),
12
+ plugins: {
13
+ remove: vi.fn(),
14
+ },
15
+ });
16
+
17
+ describe("camera follow", () => {
18
+ it("normalizes transition options from smoothMove", () => {
19
+ expect(cameraFollowAnimationOptions(true)).toEqual({
20
+ time: 1000,
21
+ ease: "easeInOutSine",
22
+ });
23
+ expect(cameraFollowAnimationOptions({ time: 450, ease: "easeInOutQuad" })).toEqual({
24
+ time: 450,
25
+ ease: "easeInOutQuad",
26
+ });
27
+ expect(cameraFollowAnimationOptions({ time: 450, ease: "easeInOutQuadd" } as any)).toEqual({
28
+ time: 450,
29
+ ease: "easeInOutSine",
30
+ });
31
+ expect(cameraFollowAnimationOptions(false)).toBeNull();
32
+ });
33
+
34
+ it("normalizes continuous follow options", () => {
35
+ expect(cameraFollowOptions({ speed: 12, acceleration: 0.2, radius: 80 })).toEqual({
36
+ speed: 12,
37
+ acceleration: 0.2,
38
+ radius: 80,
39
+ });
40
+ expect(cameraFollowOptions({ speed: -4, acceleration: null, radius: null })).toEqual({
41
+ speed: 0,
42
+ acceleration: null,
43
+ radius: null,
44
+ });
45
+ expect(cameraFollowOptions(true)).toBeUndefined();
46
+ });
47
+
48
+ it("animates to the target then follows it", () => {
49
+ const viewport = createViewport();
50
+ const target = { x: 120, y: 240 };
51
+
52
+ applyCameraFollow({
53
+ viewport,
54
+ target,
55
+ smoothMove: { time: 800, ease: "easeInOutQuad", speed: 10, radius: 32 },
56
+ followRevision: 2,
57
+ isCurrentRevision: (revision) => revision === 2,
58
+ shouldFollowCamera: () => true,
59
+ });
60
+
61
+ expect(viewport.plugins.remove).toHaveBeenCalledWith("animate");
62
+ expect(viewport.plugins.remove).toHaveBeenCalledWith("follow");
63
+ expect(viewport.animate).toHaveBeenCalledWith(
64
+ expect.objectContaining({
65
+ position: { x: 120, y: 240 },
66
+ time: 800,
67
+ ease: "easeInOutQuad",
68
+ })
69
+ );
70
+ expect(viewport.follow).not.toHaveBeenCalled();
71
+
72
+ const animateOptions = viewport.animate.mock.calls[0][0];
73
+ animateOptions.callbackOnComplete();
74
+
75
+ const [followTarget, followOptions] = viewport.follow.mock.calls[0];
76
+ expect(followTarget).not.toBe(target);
77
+ expect(followTarget.x).toBe(120);
78
+ expect(followTarget.y).toBe(240);
79
+ expect(followOptions).toEqual({
80
+ speed: 10,
81
+ radius: 32,
82
+ });
83
+ });
84
+
85
+ it("follows instantly when smoothMove is disabled", () => {
86
+ const viewport = createViewport();
87
+ const target = { x: 120, y: 240 };
88
+
89
+ applyCameraFollow({
90
+ viewport,
91
+ target,
92
+ smoothMove: false,
93
+ followRevision: 1,
94
+ isCurrentRevision: () => true,
95
+ shouldFollowCamera: () => true,
96
+ });
97
+
98
+ expect(viewport.animate).not.toHaveBeenCalled();
99
+ const [followTarget] = viewport.follow.mock.calls[0];
100
+ expect(followTarget).not.toBe(target);
101
+ expect(followTarget.x).toBe(120);
102
+ expect(followTarget.y).toBe(240);
103
+ });
104
+
105
+ it("does not follow after animation if another camera command superseded it", () => {
106
+ const viewport = createViewport();
107
+
108
+ applyCameraFollow({
109
+ viewport,
110
+ target: { x: 120, y: 240 },
111
+ smoothMove: { time: 800, ease: "easeInOutQuad" },
112
+ followRevision: 2,
113
+ isCurrentRevision: (revision) => revision === 3,
114
+ shouldFollowCamera: () => true,
115
+ });
116
+
117
+ const animateOptions = viewport.animate.mock.calls[0][0];
118
+ animateOptions.callbackOnComplete();
119
+
120
+ expect(viewport.follow).not.toHaveBeenCalled();
121
+ });
122
+
123
+ it("does not follow a target whose position cannot be read", () => {
124
+ const viewport = createViewport();
125
+ const target = {
126
+ get x(): number {
127
+ throw new Error("target destroyed");
128
+ },
129
+ get y() {
130
+ return 240;
131
+ },
132
+ };
133
+
134
+ applyCameraFollow({
135
+ viewport,
136
+ target,
137
+ smoothMove: false,
138
+ followRevision: 1,
139
+ isCurrentRevision: () => true,
140
+ shouldFollowCamera: () => true,
141
+ });
142
+
143
+ expect(viewport.plugins.remove).toHaveBeenCalledWith("animate");
144
+ expect(viewport.plugins.remove).toHaveBeenCalledWith("follow");
145
+ expect(viewport.animate).not.toHaveBeenCalled();
146
+ expect(viewport.follow).not.toHaveBeenCalled();
147
+ });
148
+
149
+ it("keeps the follow target readable when the source target is destroyed", () => {
150
+ const viewport = createViewport();
151
+ let position: { x: number; y: number } | null = { x: 120, y: 240 };
152
+ const target = {
153
+ get destroyed() {
154
+ return position === null;
155
+ },
156
+ get x() {
157
+ if (!position) throw new Error("target destroyed");
158
+ return position.x;
159
+ },
160
+ get y() {
161
+ if (!position) throw new Error("target destroyed");
162
+ return position.y;
163
+ },
164
+ };
165
+
166
+ applyCameraFollow({
167
+ viewport,
168
+ target,
169
+ smoothMove: false,
170
+ followRevision: 1,
171
+ isCurrentRevision: () => true,
172
+ shouldFollowCamera: () => true,
173
+ });
174
+
175
+ const [followTarget] = viewport.follow.mock.calls[0];
176
+ expect(followTarget.x).toBe(120);
177
+ expect(followTarget.y).toBe(240);
178
+
179
+ position = { x: 160, y: 280 };
180
+ expect(followTarget.x).toBe(160);
181
+ expect(followTarget.y).toBe(280);
182
+
183
+ position = null;
184
+ expect(followTarget.x).toBe(160);
185
+ expect(followTarget.y).toBe(280);
186
+ });
187
+
188
+ it("does not follow after animation if the target was destroyed", () => {
189
+ const viewport = createViewport();
190
+ let destroyed = false;
191
+ const target = {
192
+ get destroyed() {
193
+ return destroyed;
194
+ },
195
+ x: 120,
196
+ y: 240,
197
+ };
198
+
199
+ applyCameraFollow({
200
+ viewport,
201
+ target,
202
+ smoothMove: { time: 800, ease: "easeInOutQuad" },
203
+ followRevision: 2,
204
+ isCurrentRevision: (revision) => revision === 2,
205
+ shouldFollowCamera: () => true,
206
+ });
207
+
208
+ destroyed = true;
209
+ const animateOptions = viewport.animate.mock.calls[0][0];
210
+ animateOptions.callbackOnComplete();
211
+
212
+ expect(viewport.follow).not.toHaveBeenCalled();
213
+ });
214
+
215
+ it("only lets the sprite that owns the active follow revision clear plugins", () => {
216
+ expect(ownsCameraFollowRevision(2, 2)).toBe(true);
217
+ expect(ownsCameraFollowRevision(2, 3)).toBe(false);
218
+ expect(ownsCameraFollowRevision(null, 2)).toBe(false);
219
+ });
220
+ });