@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
@@ -31,8 +31,10 @@
31
31
  import { inject } from "../../core/inject";
32
32
  import { RpgClientEngine } from "../../RpgClientEngine";
33
33
  import { RpgGui } from "../../Gui/Gui";
34
+ import { getKeyboardControlBind } from "../../services/actionInput";
34
35
 
35
36
  const engine = inject(RpgClientEngine);
37
+ const { t } = engine.i18n();
36
38
  const guiService = inject(RpgGui);
37
39
  const keyboardControls = engine.globalConfig.keyboardControls;
38
40
 
@@ -51,12 +53,12 @@
51
53
  const { entries, title, subtitle, version, saveLoad, localActions } = data();
52
54
 
53
55
  const defaultEntries = [
54
- { id: "start", label: "Start" },
55
- { id: "load", label: "Load" }
56
+ { id: "start", label: t("rpg.title.start") },
57
+ { id: "load", label: t("rpg.title.load") }
56
58
  ];
57
59
 
58
60
  const resolveProp = (value) => typeof value === "function" ? value() : value;
59
- const titleText = computed(() => resolveProp(title) || "RPG");
61
+ const titleText = computed(() => resolveProp(title) || t("rpg.title.default"));
60
62
  const subtitleText = computed(() => resolveProp(subtitle) || "");
61
63
  const versionText = computed(() => resolveProp(version) || "");
62
64
  const localActionsEnabled = computed(() => resolveProp(localActions) === true);
@@ -150,7 +152,7 @@
150
152
  }
151
153
  },
152
154
  action: {
153
- bind: keyboardControls.action,
155
+ bind: getKeyboardControlBind(keyboardControls.action),
154
156
  keyDown() {
155
157
  if (guiService.isDisplaying(PrebuiltGui.Save)) return;
156
158
  triggerSelect(selectedEntry());
@@ -1,7 +1,8 @@
1
1
  import EventLayerComponent from "./scenes/event-layer.ce";
2
+ import SceneMap from "./scenes/draw-map.ce";
2
3
  import CharacterComponent from "./character.ce";
3
4
 
4
5
  // Prebuilt sprite components
5
6
  export { HpBar } from "./prebuilt";
6
7
 
7
- export { EventLayerComponent, CharacterComponent }
8
+ export { EventLayerComponent, SceneMap, CharacterComponent }
@@ -0,0 +1,23 @@
1
+ <Container>
2
+ @for (entry of renderedComponents) {
3
+ <Container dependencies={entry.dependencies}>
4
+ <entry.component ...entry.props />
5
+ </Container>
6
+ }
7
+ </Container>
8
+
9
+ <script>
10
+ import { computed } from "canvasengine";
11
+ import { RpgClientEngine } from "../RpgClientEngine";
12
+ import { inject } from "../core/inject";
13
+
14
+ const { object, bounds, hitboxBounds, graphicBounds } = defineProps();
15
+ const client = inject(RpgClientEngine);
16
+ const sprite = object();
17
+
18
+ const renderedComponents = computed(() => client.interactions.getRenderedComponents(sprite, {
19
+ bounds: typeof bounds === "function" ? bounds() : undefined,
20
+ hitbox: typeof hitboxBounds === "function" ? hitboxBounds() : undefined,
21
+ graphic: typeof graphicBounds === "function" ? graphicBounds() : undefined,
22
+ }));
23
+ </script>
@@ -0,0 +1,109 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import {
3
+ computeBlockPosition,
4
+ computeBlockSize,
5
+ estimateComponentSize,
6
+ getComponentProps
7
+ } from "./player-components-utils";
8
+
9
+ const graphic = {
10
+ left: -8,
11
+ top: -24,
12
+ right: 40,
13
+ bottom: 48,
14
+ width: 48,
15
+ height: 72,
16
+ centerX: 16,
17
+ centerY: 12
18
+ };
19
+
20
+ describe("player component layout utilities", () => {
21
+ test("bottom layout uses the hitbox as positioning rectangle", () => {
22
+ const rowMetrics = [
23
+ {
24
+ cells: [{ width: 32, height: 32 }],
25
+ width: 32,
26
+ height: 32
27
+ }
28
+ ];
29
+
30
+ const size = computeBlockSize({
31
+ position: "bottom",
32
+ rowMetrics,
33
+ graphic,
34
+ hitbox: { w: 32, h: 32 }
35
+ });
36
+
37
+ expect(size).toEqual({ width: 32, height: 32 });
38
+ expect(
39
+ computeBlockPosition({
40
+ position: "bottom",
41
+ size,
42
+ graphic,
43
+ hitbox: { w: 32, h: 32 }
44
+ })
45
+ ).toEqual({ x: 0, y: 0 });
46
+ });
47
+
48
+ test("bottom layout centers smaller content in the hitbox rectangle", () => {
49
+ const size = computeBlockSize({
50
+ position: "bottom",
51
+ rowMetrics: [
52
+ {
53
+ cells: [{ width: 16, height: 8 }],
54
+ width: 16,
55
+ height: 8
56
+ }
57
+ ],
58
+ graphic,
59
+ hitbox: { w: 32, h: 32 }
60
+ });
61
+
62
+ expect(size).toEqual({ width: 32, height: 32 });
63
+ expect(
64
+ computeBlockPosition({
65
+ position: "bottom",
66
+ size,
67
+ graphic,
68
+ hitbox: { w: 32, h: 32 }
69
+ })
70
+ ).toEqual({ x: 0, y: 0 });
71
+ });
72
+
73
+ test("bottom margins move from the hitbox-centered position", () => {
74
+ const position = computeBlockPosition({
75
+ position: "bottom",
76
+ size: { width: 32, height: 32 },
77
+ layout: { marginLeft: 3, marginRight: 1, marginBottom: 16, marginTop: 4 },
78
+ graphic,
79
+ hitbox: { w: 32, h: 32 }
80
+ });
81
+
82
+ expect(position).toEqual({ x: 2, y: 12 });
83
+ });
84
+
85
+ test("top layout remains anchored above graphic bounds", () => {
86
+ const position = computeBlockPosition({
87
+ position: "top",
88
+ size: { width: 50, height: 12 },
89
+ graphic,
90
+ hitbox: { w: 32, h: 32 }
91
+ });
92
+
93
+ expect(position).toEqual({ x: -9, y: -36 });
94
+ });
95
+
96
+ test("estimates bar labels, shape aliases, circles, lines and polygons", () => {
97
+ expect(estimateComponentSize({ type: "hpBar", style: { width: 60, height: 6 }, text: "{$percent}%" })).toEqual({ width: 60, height: 18 });
98
+ expect(estimateComponentSize({ type: "shape", value: { type: "rect", width: 32, height: 24 } })).toEqual({ width: 32, height: 24 });
99
+ expect(estimateComponentSize({ type: "shape", value: { type: "circle", radius: 7 } })).toEqual({ width: 14, height: 14 });
100
+ expect(estimateComponentSize({ type: "shape", value: { type: "line", x1: -4, y1: 2, x2: 6, y2: 2 } })).toEqual({ width: 10, height: 1 });
101
+ expect(estimateComponentSize({ type: "shape", value: { type: "polygon", points: [-5, 2, 15, 2, 5, 12] } })).toEqual({ width: 20, height: 10 });
102
+ });
103
+
104
+ test("legacy hp and sp bars receive default fill colors", () => {
105
+ expect(getComponentProps({ type: "hpBar" }).style.fillColor).toBe("#ef4444");
106
+ expect(getComponentProps({ type: "spBar" }).style.fillColor).toBe("#3b82f6");
107
+ expect(getComponentProps({ type: "hpBar", style: { fillColor: "#111111" } }).style.fillColor).toBe("#111111");
108
+ });
109
+ });
@@ -0,0 +1,205 @@
1
+ export const DEFAULT_HP_BAR_STYLE = { fillColor: '#ef4444' };
2
+ export const DEFAULT_SP_BAR_STYLE = { fillColor: '#3b82f6' };
3
+
4
+ const DEFAULT_CELL_HEIGHT = 16;
5
+ const DEFAULT_CELL_WIDTH = 32;
6
+
7
+ type NumberResolver = (value: any, fallback?: number) => number;
8
+
9
+ const defaultToNumber: NumberResolver = (value, fallback = 0) => {
10
+ const num = typeof value === 'number' ? value : parseFloat(value);
11
+ return Number.isFinite(num) ? num : fallback;
12
+ };
13
+
14
+ export function getPointBounds(points: any[] = [], toNumber: NumberResolver = defaultToNumber) {
15
+ if (!Array.isArray(points) || points.length < 2) {
16
+ return { width: 1, height: 1 };
17
+ }
18
+
19
+ let minX = Infinity;
20
+ let minY = Infinity;
21
+ let maxX = -Infinity;
22
+ let maxY = -Infinity;
23
+
24
+ for (let i = 0; i < points.length; i += 2) {
25
+ const x = toNumber(points[i], 0);
26
+ const y = toNumber(points[i + 1], 0);
27
+ minX = Math.min(minX, x);
28
+ minY = Math.min(minY, y);
29
+ maxX = Math.max(maxX, x);
30
+ maxY = Math.max(maxY, y);
31
+ }
32
+
33
+ return {
34
+ width: Math.max(1, maxX - minX),
35
+ height: Math.max(1, maxY - minY)
36
+ };
37
+ }
38
+
39
+ export function getComponentId(definition: any) {
40
+ if (!definition) return undefined;
41
+ if (definition.id) return definition.id;
42
+ if (definition.type === 'text') return 'rpg:text';
43
+ if (definition.type === 'hpBar') return 'rpg:hpBar';
44
+ if (definition.type === 'spBar') return 'rpg:spBar';
45
+ if (definition.type === 'bar') return 'rpg:bar';
46
+ if (definition.type === 'shape') return 'rpg:shape';
47
+ if (definition.type === 'image') return 'rpg:image';
48
+ if (definition.type === 'tile') return 'rpg:tile';
49
+ return definition.type;
50
+ }
51
+
52
+ export function getComponentProps(definition: any) {
53
+ if (definition.props) return definition.props;
54
+
55
+ if (definition.type === 'text') {
56
+ return { value: definition.value, style: definition.style };
57
+ }
58
+ if (definition.type === 'hpBar') {
59
+ return { current: '{hp}', max: '{param.maxHp}', style: { ...DEFAULT_HP_BAR_STYLE, ...definition.style }, text: definition.text };
60
+ }
61
+ if (definition.type === 'spBar') {
62
+ return { current: '{sp}', max: '{param.maxSp}', style: { ...DEFAULT_SP_BAR_STYLE, ...definition.style }, text: definition.text };
63
+ }
64
+ if (definition.type === 'bar') {
65
+ return { current: `{${definition.current}}`, max: `{${definition.max}}`, style: definition.style, text: definition.text };
66
+ }
67
+ if (definition.type === 'shape') {
68
+ return definition.value;
69
+ }
70
+ if (definition.type === 'image' || definition.type === 'tile') {
71
+ return { value: definition.value };
72
+ }
73
+
74
+ return {};
75
+ }
76
+
77
+ export function estimateComponentSize(
78
+ definition: any,
79
+ {
80
+ toNumber = defaultToNumber,
81
+ estimateTextWidth = (value: any) => String(value ?? '').length * 8
82
+ }: {
83
+ toNumber?: NumberResolver;
84
+ estimateTextWidth?: (value: any, style?: any) => number;
85
+ } = {}
86
+ ) {
87
+ const props = getComponentProps(definition);
88
+ const style = props?.style ?? definition?.style ?? {};
89
+
90
+ if (definition?.type === 'text' || definition?.id === 'rpg:text') {
91
+ return {
92
+ width: estimateTextWidth(props.value ?? definition.value, style),
93
+ height: toNumber(style.fontSize, 12)
94
+ };
95
+ }
96
+
97
+ if (definition?.type === 'hpBar' || definition?.type === 'spBar' || definition?.type === 'bar' || definition?.id === 'rpg:hpBar' || definition?.id === 'rpg:spBar' || definition?.id === 'rpg:bar') {
98
+ const barHeight = toNumber(style.height, 8);
99
+ const labelHeight = props.text != null && props.text !== '' ? toNumber(style.fontSize, 10) + 2 : 0;
100
+ return {
101
+ width: toNumber(style.width, 50),
102
+ height: barHeight + labelHeight
103
+ };
104
+ }
105
+
106
+ if (definition?.type === 'shape' || definition?.id === 'rpg:shape') {
107
+ const shape = props ?? {};
108
+ if (shape.type === 'circle') {
109
+ const radius = toNumber(shape.radius, 8);
110
+ return { width: radius * 2, height: radius * 2 };
111
+ }
112
+ if (shape.type === 'line') {
113
+ return {
114
+ width: Math.max(1, Math.abs(toNumber(shape.x2, 16) - toNumber(shape.x1, 0))),
115
+ height: Math.max(1, Math.abs(toNumber(shape.y2, 0) - toNumber(shape.y1, 0)))
116
+ };
117
+ }
118
+ if (shape.type === 'polygon') {
119
+ return getPointBounds(shape.points, toNumber);
120
+ }
121
+ return {
122
+ width: toNumber(shape.width, 16),
123
+ height: toNumber(shape.height, 16)
124
+ };
125
+ }
126
+
127
+ return {
128
+ width: toNumber(definition?.props?.width, DEFAULT_CELL_WIDTH),
129
+ height: toNumber(definition?.props?.height, DEFAULT_CELL_HEIGHT)
130
+ };
131
+ }
132
+
133
+ export function computeBlockSize({
134
+ position,
135
+ layout = {},
136
+ rowMetrics,
137
+ gap = { row: 0, column: 0 },
138
+ graphic,
139
+ hitbox
140
+ }: {
141
+ position: string;
142
+ layout?: any;
143
+ rowMetrics: Array<{ width: number; height: number; cells: any[] }>;
144
+ gap?: { row: number; column: number };
145
+ graphic: { width: number; height: number };
146
+ hitbox: { w: number; h: number };
147
+ }) {
148
+ const rowGapTotal = Math.max(0, rowMetrics.length - 1) * gap.row;
149
+ const maxColumns = rowMetrics.reduce((max, row) => Math.max(max, row.cells.length), 0);
150
+ const columnGapTotal = Math.max(0, maxColumns - 1) * gap.column;
151
+ const contentWidth = rowMetrics.reduce((max, row) => Math.max(max, row.width), 0) + columnGapTotal;
152
+ const contentHeight = rowMetrics.reduce((sum, row) => sum + row.height, 0) + rowGapTotal;
153
+ const width = layout.width ?? Math.max(contentWidth, position === 'bottom' ? hitbox.w : position === 'top' || position === 'center' ? graphic.width : contentWidth);
154
+ const height = layout.height ?? Math.max(contentHeight, position === 'bottom' ? hitbox.h : position === 'left' || position === 'right' || position === 'center' ? graphic.height : contentHeight);
155
+
156
+ return { width, height };
157
+ }
158
+
159
+ export function computeBlockPosition({
160
+ position,
161
+ size,
162
+ layout = {},
163
+ graphic,
164
+ hitbox
165
+ }: {
166
+ position: string;
167
+ size: { width: number; height: number };
168
+ layout?: any;
169
+ graphic: { left: number; top: number; right: number; centerX: number; centerY: number };
170
+ hitbox: { w: number; h: number };
171
+ }) {
172
+ const marginLeft = layout.marginLeft ?? 0;
173
+ const marginRight = layout.marginRight ?? 0;
174
+ const marginTop = layout.marginTop ?? 0;
175
+ const marginBottom = layout.marginBottom ?? 0;
176
+
177
+ switch (position) {
178
+ case 'bottom':
179
+ return {
180
+ x: (hitbox.w / 2) - (size.width / 2) + marginLeft - marginRight,
181
+ y: (hitbox.h / 2) - (size.height / 2) + marginBottom - marginTop
182
+ };
183
+ case 'center':
184
+ return {
185
+ x: graphic.centerX - (size.width / 2) + marginLeft - marginRight,
186
+ y: graphic.centerY - (size.height / 2) + marginTop - marginBottom
187
+ };
188
+ case 'left':
189
+ return {
190
+ x: graphic.left - size.width + marginLeft - marginRight,
191
+ y: graphic.centerY - (size.height / 2) + marginTop - marginBottom
192
+ };
193
+ case 'right':
194
+ return {
195
+ x: graphic.right + marginLeft - marginRight,
196
+ y: graphic.centerY - (size.height / 2) + marginTop - marginBottom
197
+ };
198
+ case 'top':
199
+ default:
200
+ return {
201
+ x: graphic.centerX - (size.width / 2) + marginLeft - marginRight,
202
+ y: graphic.top - size.height + marginTop - marginBottom
203
+ };
204
+ }
205
+ }
@@ -0,0 +1,222 @@
1
+ <Container
2
+ x={blockPosition().x}
3
+ y={blockPosition().y}
4
+ width={blockSize().width}
5
+ height={blockSize().height}
6
+ minWidth={blockSize().width}
7
+ minHeight={blockSize().height}
8
+ display="flex"
9
+ flexDirection="column"
10
+ justifyContent="center"
11
+ alignItems="center"
12
+ rowGap={gap().row}
13
+ >
14
+ @for (row of renderedRows) {
15
+ <Container
16
+ width="100%"
17
+ height={row.height}
18
+ display="flex"
19
+ flexDirection="row"
20
+ justifyContent="center"
21
+ alignItems="center"
22
+ columnGap={gap().column}
23
+ >
24
+ @for (entry of row.entries) {
25
+ <Container
26
+ width={entry.width}
27
+ height={entry.height}
28
+ display="flex"
29
+ justifyContent="center"
30
+ alignItems="center"
31
+ >
32
+ <entry.component object={sprite} ...entry.props />
33
+ </Container>
34
+ }
35
+ </Container>
36
+ }
37
+ </Container>
38
+
39
+ <script>
40
+ import { computed } from "canvasengine";
41
+ import { RpgClientEngine } from "../RpgClientEngine";
42
+ import { inject } from "../core/inject";
43
+ import { resolveDynamicProps, resolveDynamicValue } from "./dynamics/parse-value";
44
+ import {
45
+ computeBlockPosition,
46
+ computeBlockSize,
47
+ estimateComponentSize,
48
+ getComponentId,
49
+ getComponentProps
50
+ } from "./player-components-utils";
51
+
52
+ const { object, position, graphicBounds } = defineProps({
53
+ position: {
54
+ default: 'top'
55
+ }
56
+ });
57
+ const sprite = object();
58
+
59
+ const client = inject(RpgClientEngine);
60
+ const warnedComponents = new Set();
61
+
62
+ const readPosition = computed(() => position?.() ?? 'top');
63
+
64
+ const componentSource = computed(() => {
65
+ switch (readPosition()) {
66
+ case 'bottom':
67
+ return sprite.componentsBottom?.();
68
+ case 'center':
69
+ return sprite.componentsCenter?.();
70
+ case 'left':
71
+ return sprite.componentsLeft?.();
72
+ case 'right':
73
+ return sprite.componentsRight?.();
74
+ case 'top':
75
+ default:
76
+ return sprite.componentsTop?.();
77
+ }
78
+ });
79
+
80
+ const componentData = computed(() => {
81
+ const value = componentSource();
82
+ if (!value) {
83
+ return { components: [], layout: {} };
84
+ }
85
+
86
+ if (typeof value !== 'string') {
87
+ return value;
88
+ }
89
+
90
+ try {
91
+ return JSON.parse(value);
92
+ } catch (error) {
93
+ if (typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') {
94
+ console.warn('[RPGJS] Invalid server sprite component payload', error);
95
+ }
96
+ return { components: [], layout: {} };
97
+ }
98
+ });
99
+
100
+ const layout = computed(() => componentData()?.layout ?? {});
101
+ const rows = computed(() => componentData()?.components ?? []);
102
+ const hitbox = sprite.hitbox;
103
+
104
+ const toNumber = (value, fallback = 0) => {
105
+ const resolved = resolveDynamicValue(value, sprite);
106
+ const num = typeof resolved === 'number' ? resolved : parseFloat(resolved);
107
+ return Number.isFinite(num) ? num : fallback;
108
+ };
109
+
110
+ const estimateTextWidth = (value, style = {}) => {
111
+ const text = String(resolveDynamicValue(value ?? '', sprite) ?? '');
112
+ const fontSize = toNumber(style.fontSize, 12);
113
+ return Math.max(1, Math.ceil(text.length * fontSize * 0.6));
114
+ };
115
+
116
+ const rowMetrics = computed(() => {
117
+ return rows().map((row) => {
118
+ const cells = row.map((definition) => {
119
+ const intrinsic = estimateComponentSize(definition, { toNumber, estimateTextWidth });
120
+ return {
121
+ definition,
122
+ width: intrinsic.width,
123
+ height: intrinsic.height
124
+ };
125
+ });
126
+
127
+ return {
128
+ cells,
129
+ width: cells.reduce((sum, cell) => sum + cell.width, 0),
130
+ height: cells.reduce((max, cell) => Math.max(max, cell.height), 0)
131
+ };
132
+ });
133
+ });
134
+
135
+ const gap = computed(() => ({
136
+ row: toNumber(layout().rowGap ?? layout().gap, 0),
137
+ column: toNumber(layout().columnGap ?? layout().gap, 0)
138
+ }));
139
+
140
+ const fallbackBounds = computed(() => {
141
+ const box = hitbox();
142
+ const width = box?.w ?? 0;
143
+ const height = box?.h ?? 0;
144
+
145
+ return {
146
+ left: 0,
147
+ top: 0,
148
+ right: width,
149
+ bottom: height,
150
+ width,
151
+ height,
152
+ centerX: width / 2,
153
+ centerY: height / 2
154
+ };
155
+ });
156
+
157
+ const bounds = computed(() => {
158
+ const resolvedBounds = typeof graphicBounds === 'function' ? graphicBounds() : undefined;
159
+ return resolvedBounds ?? fallbackBounds();
160
+ });
161
+
162
+ const blockSize = computed(() => {
163
+ const box = hitbox() ?? { w: 0, h: 0 };
164
+ const graphic = bounds();
165
+ return computeBlockSize({
166
+ position: readPosition(),
167
+ layout: layout(),
168
+ rowMetrics: rowMetrics(),
169
+ gap: gap(),
170
+ graphic,
171
+ hitbox: box
172
+ });
173
+ });
174
+
175
+ const blockPosition = computed(() => {
176
+ const box = hitbox() ?? { w: 0, h: 0 };
177
+ const graphic = bounds();
178
+ return computeBlockPosition({
179
+ position: readPosition(),
180
+ size: blockSize(),
181
+ layout: layout(),
182
+ graphic,
183
+ hitbox: box
184
+ });
185
+ });
186
+
187
+ const warnMissingComponent = (id) => {
188
+ if (!id || warnedComponents.has(id)) return;
189
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') return;
190
+ warnedComponents.add(id);
191
+ console.warn(`[RPGJS] Server sprite component "${id}" is not registered on the client.`);
192
+ };
193
+
194
+ const renderedRows = computed(() => {
195
+ return rowMetrics().map((row) => {
196
+ const entries = [];
197
+
198
+ row.cells.forEach((cell) => {
199
+ const definition = cell.definition;
200
+ const id = getComponentId(definition);
201
+ const component = client.getSpriteComponent(id);
202
+
203
+ if (!component) {
204
+ warnMissingComponent(id);
205
+ return;
206
+ }
207
+
208
+ entries.push({
209
+ component,
210
+ props: resolveDynamicProps(getComponentProps(definition), sprite),
211
+ width: cell.width,
212
+ height: cell.height
213
+ });
214
+ });
215
+
216
+ return {
217
+ height: row.height,
218
+ entries
219
+ };
220
+ });
221
+ });
222
+ </script>
@@ -46,6 +46,7 @@
46
46
  import { computed, animatedSignal, effect } from "canvasengine";
47
47
 
48
48
  const { object } = defineProps();
49
+ const sprite = object();
49
50
 
50
51
  // ====================
51
52
  // Configuration
@@ -93,14 +94,14 @@ const highlightHeight = Math.floor(fillHeight / 2);
93
94
  // ====================
94
95
 
95
96
  /** Gets hitbox dimensions for positioning */
96
- const hitbox = object.hitbox;
97
+ const hitbox = sprite.hitbox;
97
98
 
98
99
  /**
99
100
  * Gets the current HP value from the player object
100
101
  * Uses hpSignal which is synchronized from the server
101
102
  */
102
103
  const currentHp = computed(() => {
103
- return object.hpSignal?.() ?? 0;
104
+ return sprite.hpSignal?.() ?? 0;
104
105
  });
105
106
 
106
107
  /**
@@ -108,7 +109,7 @@ const currentHp = computed(() => {
108
109
  * Reads from _param.maxHp which contains calculated stats
109
110
  */
110
111
  const maxHp = computed(() => {
111
- const params = object._param?.() ?? {};
112
+ const params = sprite._param?.() ?? {};
112
113
  return params.maxHp ?? 100;
113
114
  });
114
115
 
@@ -31,6 +31,7 @@ const {
31
31
  opacitySpeed,
32
32
  lightColor
33
33
  } = defineProps();
34
+ const sprite = object();
34
35
 
35
36
  // ====================
36
37
  // Props with default values
@@ -92,7 +93,7 @@ const currentOpacity = computed(() => {
92
93
  // Position calculations
93
94
  // ====================
94
95
 
95
- const hitbox = object.hitbox;
96
+ const hitbox = sprite.hitbox;
96
97
 
97
98
  const position = computed(() => ({
98
99
  x: hitbox().w / 2,
@@ -145,4 +146,3 @@ tick(() => {
145
146
  time.update(t => t + 1);
146
147
  });
147
148
  </script>
148
-