@jgengine/core 0.6.0 → 0.8.0

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 (330) hide show
  1. package/CHANGELOG.md +214 -2
  2. package/README.md +2 -0
  3. package/dist/ai/crowd.d.ts +36 -0
  4. package/dist/ai/crowd.js +213 -0
  5. package/dist/ai/jobBoard.d.ts +49 -0
  6. package/dist/ai/jobBoard.js +155 -0
  7. package/dist/ai/spawnDirector.d.ts +61 -0
  8. package/dist/ai/spawnDirector.js +162 -0
  9. package/dist/ai/threat.d.ts +25 -0
  10. package/dist/ai/threat.js +67 -0
  11. package/dist/anim/easing.d.ts +14 -0
  12. package/dist/anim/easing.js +55 -0
  13. package/dist/audio/audioFalloff.d.ts +38 -0
  14. package/dist/audio/audioFalloff.js +32 -0
  15. package/dist/behaviour/behaviour.d.ts +136 -0
  16. package/dist/behaviour/behaviour.js +388 -0
  17. package/dist/board/laneBoard.d.ts +63 -0
  18. package/dist/board/laneBoard.js +114 -0
  19. package/dist/board/timelineBoard.d.ts +36 -0
  20. package/dist/board/timelineBoard.js +70 -0
  21. package/dist/cards/cardPile.d.ts +64 -0
  22. package/dist/cards/cardPile.js +175 -0
  23. package/dist/cards/modifierPipeline.d.ts +33 -0
  24. package/dist/cards/modifierPipeline.js +48 -0
  25. package/dist/combat/abilityKit.d.ts +47 -0
  26. package/dist/combat/abilityKit.js +139 -0
  27. package/dist/combat/animationState.d.ts +47 -0
  28. package/dist/combat/animationState.js +101 -0
  29. package/dist/combat/attackTags.d.ts +14 -0
  30. package/dist/combat/attackTags.js +26 -0
  31. package/dist/combat/breakMeters.d.ts +32 -0
  32. package/dist/combat/breakMeters.js +51 -0
  33. package/dist/combat/comboString.d.ts +35 -0
  34. package/dist/combat/comboString.js +59 -0
  35. package/dist/combat/death.d.ts +8 -0
  36. package/dist/combat/death.js +5 -2
  37. package/dist/combat/defensiveWindow.d.ts +34 -0
  38. package/dist/combat/defensiveWindow.js +66 -0
  39. package/dist/combat/downed.d.ts +35 -0
  40. package/dist/combat/downed.js +104 -0
  41. package/dist/combat/effects.d.ts +12 -1
  42. package/dist/combat/effects.js +31 -19
  43. package/dist/combat/hitReaction.d.ts +23 -0
  44. package/dist/combat/hitReaction.js +20 -0
  45. package/dist/combat/projectiles.d.ts +42 -5
  46. package/dist/combat/projectiles.js +98 -12
  47. package/dist/combat/resistance.d.ts +13 -0
  48. package/dist/combat/resistance.js +46 -0
  49. package/dist/combat/telegraph.d.ts +31 -0
  50. package/dist/combat/telegraph.js +51 -0
  51. package/dist/commands/commandRegistry.d.ts +1 -1
  52. package/dist/commands/commandRegistry.js +2 -1
  53. package/dist/crafting/crop.d.ts +59 -0
  54. package/dist/crafting/crop.js +181 -0
  55. package/dist/crafting/production.d.ts +64 -0
  56. package/dist/crafting/production.js +130 -0
  57. package/dist/crafting/recipe.d.ts +62 -0
  58. package/dist/crafting/recipe.js +101 -0
  59. package/dist/data/dataSource.d.ts +26 -0
  60. package/dist/data/dataSource.js +93 -0
  61. package/dist/data/devProxy.d.ts +11 -0
  62. package/dist/data/devProxy.js +38 -0
  63. package/dist/data/fetchJson.d.ts +20 -0
  64. package/dist/data/fetchJson.js +43 -0
  65. package/dist/data/jsonDataSource.d.ts +4 -0
  66. package/dist/data/jsonDataSource.js +6 -0
  67. package/dist/devtools/devtools.d.ts +157 -0
  68. package/dist/devtools/devtools.js +484 -0
  69. package/dist/devtools/transformTunables.d.ts +14 -0
  70. package/dist/devtools/transformTunables.js +38 -0
  71. package/dist/economy/sharedWallet.d.ts +28 -0
  72. package/dist/economy/sharedWallet.js +62 -0
  73. package/dist/economy/techTree.d.ts +40 -0
  74. package/dist/economy/techTree.js +66 -0
  75. package/dist/game/chat.d.ts +66 -0
  76. package/dist/game/chat.js +165 -0
  77. package/dist/game/cosmetics.d.ts +25 -0
  78. package/dist/game/cosmetics.js +51 -0
  79. package/dist/game/defineGame.d.ts +10 -2
  80. package/dist/game/defineGame.js +2 -1
  81. package/dist/game/events.d.ts +87 -0
  82. package/dist/game/levelSequence.d.ts +44 -0
  83. package/dist/game/levelSequence.js +78 -0
  84. package/dist/game/lootFilter.d.ts +33 -0
  85. package/dist/game/lootFilter.js +48 -0
  86. package/dist/game/ping.d.ts +67 -0
  87. package/dist/game/ping.js +86 -0
  88. package/dist/game/playableGame.d.ts +516 -8
  89. package/dist/game/playableGame.js +6 -1
  90. package/dist/game/progression.d.ts +1 -0
  91. package/dist/game/progression.js +23 -2
  92. package/dist/game/race.d.ts +100 -0
  93. package/dist/game/race.js +236 -0
  94. package/dist/game/runDraft.d.ts +34 -0
  95. package/dist/game/runDraft.js +97 -0
  96. package/dist/game/social.d.ts +69 -0
  97. package/dist/game/social.js +138 -0
  98. package/dist/game/spawnPoints.d.ts +19 -0
  99. package/dist/game/spawnPoints.js +23 -0
  100. package/dist/game/worldItem.d.ts +95 -0
  101. package/dist/game/worldItem.js +138 -0
  102. package/dist/input/actionBindings.d.ts +10 -0
  103. package/dist/input/actionBindings.js +14 -0
  104. package/dist/input/axisInput.d.ts +43 -0
  105. package/dist/input/axisInput.js +70 -0
  106. package/dist/input/gestureSurface.d.ts +31 -0
  107. package/dist/input/gestureSurface.js +120 -0
  108. package/dist/input/pointer.d.ts +69 -0
  109. package/dist/input/pointer.js +65 -0
  110. package/dist/input/touchScheme.d.ts +83 -0
  111. package/dist/input/touchScheme.js +115 -0
  112. package/dist/interaction/contextMenu.d.ts +30 -0
  113. package/dist/interaction/contextMenu.js +22 -0
  114. package/dist/interaction/qte.d.ts +20 -0
  115. package/dist/interaction/qte.js +24 -0
  116. package/dist/interaction/skillCheck.d.ts +20 -0
  117. package/dist/interaction/skillCheck.js +26 -0
  118. package/dist/inventory/shapedGrid.d.ts +56 -0
  119. package/dist/inventory/shapedGrid.js +176 -0
  120. package/dist/inventory/storageTier.d.ts +52 -0
  121. package/dist/inventory/storageTier.js +77 -0
  122. package/dist/item/affix.d.ts +54 -0
  123. package/dist/item/affix.js +115 -0
  124. package/dist/item/durability.d.ts +51 -0
  125. package/dist/item/durability.js +78 -0
  126. package/dist/item/modularItem.d.ts +46 -0
  127. package/dist/item/modularItem.js +75 -0
  128. package/dist/meta/changelog.d.ts +1 -1
  129. package/dist/meta/changelog.js +71 -1
  130. package/dist/movement/dash.d.ts +37 -0
  131. package/dist/movement/dash.js +65 -0
  132. package/dist/movement/movementModel.d.ts +36 -3
  133. package/dist/movement/movementModel.js +81 -5
  134. package/dist/movement/voxelController.d.ts +61 -0
  135. package/dist/movement/voxelController.js +229 -0
  136. package/dist/multiplayer/chatContract.d.ts +42 -0
  137. package/dist/multiplayer/chatContract.js +57 -0
  138. package/dist/multiplayer/combatSnapshot.d.ts +45 -0
  139. package/dist/multiplayer/combatSnapshot.js +89 -0
  140. package/dist/multiplayer/identity.d.ts +13 -0
  141. package/dist/multiplayer/identity.js +20 -0
  142. package/dist/multiplayer/lagCompensation.d.ts +43 -0
  143. package/dist/multiplayer/lagCompensation.js +154 -0
  144. package/dist/multiplayer/matchmaking.d.ts +33 -0
  145. package/dist/multiplayer/matchmaking.js +60 -0
  146. package/dist/multiplayer/poseSyncGate.d.ts +1 -0
  147. package/dist/multiplayer/poseSyncGate.js +13 -1
  148. package/dist/multiplayer/presenceModel.d.ts +3 -0
  149. package/dist/multiplayer/presenceModel.js +15 -1
  150. package/dist/multiplayer/simultaneousCommit.d.ts +34 -0
  151. package/dist/multiplayer/simultaneousCommit.js +53 -0
  152. package/dist/multiplayer/voiceContract.d.ts +44 -0
  153. package/dist/multiplayer/voiceContract.js +108 -0
  154. package/dist/nav/navConstrain.d.ts +14 -0
  155. package/dist/nav/navConstrain.js +26 -0
  156. package/dist/nav/navFromEnvironment.d.ts +11 -0
  157. package/dist/nav/navFromEnvironment.js +16 -0
  158. package/dist/nav/navGrid.d.ts +56 -0
  159. package/dist/nav/navGrid.js +265 -0
  160. package/dist/nav/pathFollow.d.ts +31 -0
  161. package/dist/nav/pathFollow.js +69 -0
  162. package/dist/physics/ballisticSweep.d.ts +18 -0
  163. package/dist/physics/ballisticSweep.js +49 -0
  164. package/dist/physics/buoyancy.d.ts +49 -0
  165. package/dist/physics/buoyancy.js +112 -0
  166. package/dist/physics/carryable.d.ts +46 -0
  167. package/dist/physics/carryable.js +110 -0
  168. package/dist/physics/damageZones.d.ts +56 -0
  169. package/dist/physics/damageZones.js +107 -0
  170. package/dist/physics/forceVolume.d.ts +48 -0
  171. package/dist/physics/forceVolume.js +119 -0
  172. package/dist/physics/physicsWorld.d.ts +124 -2
  173. package/dist/physics/physicsWorld.js +493 -41
  174. package/dist/physics/ragdoll.d.ts +49 -0
  175. package/dist/physics/ragdoll.js +103 -0
  176. package/dist/physics/spatialGrid.d.ts +41 -0
  177. package/dist/physics/spatialGrid.js +143 -0
  178. package/dist/physics/structure.d.ts +83 -0
  179. package/dist/physics/structure.js +0 -0
  180. package/dist/physics/traversal.d.ts +75 -0
  181. package/dist/physics/traversal.js +138 -0
  182. package/dist/physics/vehicleBody.d.ts +99 -0
  183. package/dist/physics/vehicleBody.js +233 -0
  184. package/dist/puzzle/cellGrid.d.ts +26 -0
  185. package/dist/puzzle/cellGrid.js +110 -0
  186. package/dist/puzzle/fallingPiece.d.ts +24 -0
  187. package/dist/puzzle/fallingPiece.js +51 -0
  188. package/dist/random/nameGen.d.ts +18 -0
  189. package/dist/random/nameGen.js +35 -0
  190. package/dist/random/rng.d.ts +2 -0
  191. package/dist/random/rng.js +23 -0
  192. package/dist/runtime/adapter.d.ts +35 -0
  193. package/dist/runtime/adapter.js +37 -1
  194. package/dist/runtime/cameraDirector.d.ts +10 -0
  195. package/dist/runtime/cameraDirector.js +25 -0
  196. package/dist/runtime/gameContext.d.ts +107 -3
  197. package/dist/runtime/gameContext.js +253 -7
  198. package/dist/runtime/hostPersistence.d.ts +39 -0
  199. package/dist/runtime/hostPersistence.js +54 -0
  200. package/dist/runtime/inputSnapshot.d.ts +7 -0
  201. package/dist/runtime/inputSnapshot.js +12 -0
  202. package/dist/runtime/motionIntents.d.ts +25 -0
  203. package/dist/runtime/motionIntents.js +25 -0
  204. package/dist/runtime/persistenceScope.d.ts +32 -0
  205. package/dist/runtime/persistenceScope.js +64 -0
  206. package/dist/runtime/transport.d.ts +32 -0
  207. package/dist/scene/autoTarget.d.ts +15 -0
  208. package/dist/scene/autoTarget.js +54 -0
  209. package/dist/scene/behaviors.d.ts +13 -1
  210. package/dist/scene/behaviors.js +3 -0
  211. package/dist/scene/captureCheck.d.ts +7 -0
  212. package/dist/scene/captureCheck.js +11 -0
  213. package/dist/scene/entityStore.d.ts +9 -1
  214. package/dist/scene/entityStore.js +25 -2
  215. package/dist/scene/form.d.ts +40 -0
  216. package/dist/scene/form.js +56 -0
  217. package/dist/scene/mount.d.ts +62 -0
  218. package/dist/scene/mount.js +107 -0
  219. package/dist/scene/movementSpeed.d.ts +35 -0
  220. package/dist/scene/movementSpeed.js +20 -0
  221. package/dist/scene/objectQuery.d.ts +18 -0
  222. package/dist/scene/objectQuery.js +108 -0
  223. package/dist/scene/objectStore.d.ts +11 -0
  224. package/dist/scene/objectStore.js +109 -4
  225. package/dist/scene/paintLayer.d.ts +15 -0
  226. package/dist/scene/paintLayer.js +53 -0
  227. package/dist/scene/possession.d.ts +30 -0
  228. package/dist/scene/possession.js +51 -0
  229. package/dist/scene/roster.d.ts +25 -0
  230. package/dist/scene/roster.js +57 -0
  231. package/dist/scene/selection.d.ts +30 -0
  232. package/dist/scene/selection.js +38 -0
  233. package/dist/scene/spatial.d.ts +21 -0
  234. package/dist/scene/spatial.js +63 -1
  235. package/dist/scene/stationClaim.d.ts +43 -0
  236. package/dist/scene/stationClaim.js +109 -0
  237. package/dist/sensor/concealment.d.ts +21 -0
  238. package/dist/sensor/concealment.js +63 -0
  239. package/dist/sensor/freezeMonitor.d.ts +17 -0
  240. package/dist/sensor/freezeMonitor.js +35 -0
  241. package/dist/sensor/frustumSensor.d.ts +60 -0
  242. package/dist/sensor/frustumSensor.js +104 -0
  243. package/dist/sensor/hiddenStateProbe.d.ts +31 -0
  244. package/dist/sensor/hiddenStateProbe.js +40 -0
  245. package/dist/sensor/recordingBuffer.d.ts +29 -0
  246. package/dist/sensor/recordingBuffer.js +61 -0
  247. package/dist/sensor/revealQuery.d.ts +22 -0
  248. package/dist/sensor/revealQuery.js +36 -0
  249. package/dist/session/contestedChannel.d.ts +36 -0
  250. package/dist/session/contestedChannel.js +100 -0
  251. package/dist/session/extraction.d.ts +54 -0
  252. package/dist/session/extraction.js +108 -0
  253. package/dist/session/ring.d.ts +36 -0
  254. package/dist/session/ring.js +88 -0
  255. package/dist/session/roles.d.ts +6 -0
  256. package/dist/session/roles.js +32 -0
  257. package/dist/session/roundState.d.ts +79 -0
  258. package/dist/session/roundState.js +158 -0
  259. package/dist/stats/accumulatorMeter.d.ts +31 -0
  260. package/dist/stats/accumulatorMeter.js +81 -0
  261. package/dist/stats/eventMeter.d.ts +34 -0
  262. package/dist/stats/eventMeter.js +76 -0
  263. package/dist/stats/rollCheck.d.ts +15 -0
  264. package/dist/stats/rollCheck.js +15 -0
  265. package/dist/survival/decayMeter.d.ts +59 -0
  266. package/dist/survival/decayMeter.js +95 -0
  267. package/dist/survival/moodle.d.ts +48 -0
  268. package/dist/survival/moodle.js +91 -0
  269. package/dist/survival/regionHealth.d.ts +72 -0
  270. package/dist/survival/regionHealth.js +129 -0
  271. package/dist/tactics/fallingGrid.d.ts +62 -0
  272. package/dist/tactics/fallingGrid.js +158 -0
  273. package/dist/tactics/predictiveQuery.d.ts +34 -0
  274. package/dist/tactics/predictiveQuery.js +44 -0
  275. package/dist/tactics/snapshot.d.ts +18 -0
  276. package/dist/tactics/snapshot.js +65 -0
  277. package/dist/tactics/surface.d.ts +52 -0
  278. package/dist/tactics/surface.js +135 -0
  279. package/dist/tactics/tacticalGrid.d.ts +68 -0
  280. package/dist/tactics/tacticalGrid.js +261 -0
  281. package/dist/time/beatClock.d.ts +40 -0
  282. package/dist/time/beatClock.js +73 -0
  283. package/dist/time/simClock.d.ts +25 -1
  284. package/dist/time/simClock.js +28 -3
  285. package/dist/turn/commit.d.ts +27 -0
  286. package/dist/turn/commit.js +72 -0
  287. package/dist/turn/intent.d.ts +14 -0
  288. package/dist/turn/intent.js +29 -0
  289. package/dist/turn/turnLoop.d.ts +60 -0
  290. package/dist/turn/turnLoop.js +223 -0
  291. package/dist/world/buildPermissions.d.ts +47 -0
  292. package/dist/world/buildPermissions.js +134 -0
  293. package/dist/world/carve.d.ts +105 -0
  294. package/dist/world/carve.js +175 -0
  295. package/dist/world/connectors.d.ts +40 -0
  296. package/dist/world/connectors.js +67 -0
  297. package/dist/world/envField.d.ts +71 -0
  298. package/dist/world/envField.js +96 -0
  299. package/dist/world/environmentSummary.d.ts +53 -0
  300. package/dist/world/environmentSummary.js +129 -0
  301. package/dist/world/features.d.ts +87 -6
  302. package/dist/world/features.js +52 -2
  303. package/dist/world/fog.d.ts +40 -0
  304. package/dist/world/fog.js +137 -0
  305. package/dist/world/gridInstances.d.ts +13 -0
  306. package/dist/world/gridInstances.js +22 -0
  307. package/dist/world/markers.d.ts +52 -0
  308. package/dist/world/markers.js +96 -0
  309. package/dist/world/minimap.d.ts +42 -0
  310. package/dist/world/minimap.js +72 -0
  311. package/dist/world/placedStructureStore.d.ts +39 -0
  312. package/dist/world/placedStructureStore.js +95 -0
  313. package/dist/world/placementController.d.ts +69 -0
  314. package/dist/world/placementController.js +153 -0
  315. package/dist/world/realm.d.ts +61 -0
  316. package/dist/world/realm.js +66 -0
  317. package/dist/world/support.d.ts +27 -0
  318. package/dist/world/support.js +75 -0
  319. package/dist/world/terraform.d.ts +54 -0
  320. package/dist/world/terraform.js +186 -0
  321. package/dist/world/terrain.d.ts +23 -1
  322. package/dist/world/terrain.js +64 -1
  323. package/dist/world/voxelField.d.ts +54 -0
  324. package/dist/world/voxelField.js +241 -0
  325. package/dist/world/walls.d.ts +61 -0
  326. package/dist/world/walls.js +221 -0
  327. package/dist/world/weather.d.ts +92 -0
  328. package/dist/world/weather.js +169 -0
  329. package/llms.txt +4102 -0
  330. package/package.json +3 -2
@@ -2,11 +2,47 @@ export function convex(config) {
2
2
  return { kind: "convex", topology: config?.topology ?? "shared" };
3
3
  }
4
4
  export function ws(config) {
5
- return { kind: "ws", topology: config?.topology ?? "shared" };
5
+ return { kind: "ws", topology: config?.topology ?? "shared", url: config?.url };
6
+ }
7
+ export function fly(config) {
8
+ return {
9
+ kind: "ws",
10
+ topology: config.topology ?? "shared",
11
+ url: `wss://${config.app}.fly.dev${config.path ?? "/ws"}`,
12
+ };
13
+ }
14
+ export function socketIo(config) {
15
+ return { kind: "socketio", topology: config?.topology ?? "shared", url: config?.url };
16
+ }
17
+ export function p2p(config) {
18
+ return { kind: "p2p", topology: config?.topology ?? "private", room: config?.room };
19
+ }
20
+ export function lan(config) {
21
+ return { kind: "lan", topology: config?.topology ?? "shared", port: config?.port, path: config?.path };
6
22
  }
7
23
  export function offline() {
8
24
  return { kind: "offline" };
9
25
  }
26
+ const ADAPTER_KINDS = new Set(["convex", "ws", "socketio", "p2p", "lan", "offline"]);
27
+ function isAdapterConfig(value) {
28
+ if (typeof value !== "object" || value === null)
29
+ return false;
30
+ const kind = value.kind;
31
+ return typeof kind === "string" && ADAPTER_KINDS.has(kind);
32
+ }
33
+ export function adapterOf(multiplayer) {
34
+ if (isAdapterConfig(multiplayer))
35
+ return multiplayer;
36
+ if (typeof multiplayer === "object" && multiplayer !== null) {
37
+ const nested = multiplayer.adapter;
38
+ if (isAdapterConfig(nested))
39
+ return nested;
40
+ }
41
+ return null;
42
+ }
43
+ export function multiplayerAdapterKind(multiplayer) {
44
+ return adapterOf(multiplayer)?.kind ?? null;
45
+ }
10
46
  export function servers(config) {
11
47
  return config;
12
48
  }
@@ -0,0 +1,10 @@
1
+ import type { CinematicCameraConfig } from "../game/playableGame.js";
2
+ export interface CameraDirector {
3
+ follow(entityId: string | null): void;
4
+ /** `undefined` means no runtime override — the shell falls back to the static `playable.camera.followEntityId`. `null` means explicitly follow nothing. */
5
+ followedEntityId(): string | null | undefined;
6
+ setCinematic(config: CinematicCameraConfig | null): void;
7
+ cinematic(): CinematicCameraConfig | null;
8
+ subscribe(listener: () => void): () => void;
9
+ }
10
+ export declare function createCameraDirector(): CameraDirector;
@@ -0,0 +1,25 @@
1
+ export function createCameraDirector() {
2
+ const listeners = new Set();
3
+ let followEntity = undefined;
4
+ let cinematicConfig = null;
5
+ function notify() {
6
+ for (const listener of listeners)
7
+ listener();
8
+ }
9
+ return {
10
+ follow(entityId) {
11
+ followEntity = entityId;
12
+ notify();
13
+ },
14
+ followedEntityId: () => followEntity,
15
+ setCinematic(config) {
16
+ cinematicConfig = config;
17
+ notify();
18
+ },
19
+ cinematic: () => cinematicConfig,
20
+ subscribe(listener) {
21
+ listeners.add(listener);
22
+ return () => listeners.delete(listener);
23
+ },
24
+ };
25
+ }
@@ -1,34 +1,56 @@
1
+ import { type CardPile, type CardPileConfig } from "../cards/cardPile.js";
1
2
  import { type OnDeathSpec } from "../combat/death.js";
2
- import { type EffectInput, type EffectResult, type ReceiveMap, type SingleTargetEffectInput } from "../combat/effects.js";
3
+ import { type EffectInput, type EffectResult, type EffectVia, type ReceiveMap, type SingleTargetEffectInput } from "../combat/effects.js";
3
4
  import { type ProjectileSystem } from "../combat/projectiles.js";
5
+ import { type HitReaction, type HitReactionConfig } from "../combat/hitReaction.js";
6
+ import { type TelegraphShape } from "../combat/telegraph.js";
4
7
  import { type CommandDefinition, type CommandResult } from "../commands/commandRegistry.js";
8
+ import { type Cosmetics } from "../game/cosmetics.js";
5
9
  import type { GameDefinition } from "../game/defineGame.js";
10
+ import { type TerrainField } from "../world/terrain.js";
6
11
  import { type GameEventMap, type GameEvents } from "../game/events.js";
7
12
  import { type GameFeed } from "../game/feed.js";
8
13
  import { type Leaderboard } from "../game/leaderboard.js";
9
14
  import { type Loadouts } from "../game/loadout.js";
10
15
  import { type Drop, type LootTableDef } from "../game/lootTable.js";
11
16
  import { type QuestJournal } from "../game/quest.js";
17
+ import { type WorldItemRecord, type WorldItemSpawnInput } from "../game/worldItem.js";
18
+ import { type Chat } from "../game/chat.js";
12
19
  import { type Social } from "../game/social.js";
13
20
  import { type TradeField, type TradeSystem } from "../game/trade.js";
14
21
  import { type Unlocks } from "../game/unlocks.js";
15
22
  import { type InventoryLayout, type InventorySet } from "../inventory/inventoryModel.js";
23
+ import type { ContextVerb } from "../interaction/contextMenu.js";
16
24
  import type { ProximityPrompt } from "../interaction/proximityPrompt.js";
17
25
  import { type ItemUseHandler, type ItemUseInput, type ItemUseRejection, type ItemUseResult } from "../item/use.js";
18
26
  import { type WeaponStats } from "../item/weapon.js";
19
27
  import { type PoseAllowedStates, type PoseState } from "../movement/poseState.js";
20
28
  import type { ModelAssetRef } from "../scene/assetCatalog.js";
29
+ import { type PaintLayer } from "../scene/paintLayer.js";
21
30
  import { type EntityStatsApi, type StatCatalog } from "../scene/entityStats.js";
22
- import type { EntityPose, SceneEntity, SpawnOptions } from "../scene/entityStore.js";
31
+ import type { EntityPose, EntityPosition, EntityStore, SceneEntity, SpawnOptions, SpawnPose } from "../scene/entityStore.js";
32
+ import { type Forms } from "../scene/form.js";
33
+ import { type ObjectRaycastHit, type ObjectRaycastInput } from "../scene/objectQuery.js";
23
34
  import { type ObjectStore } from "../scene/objectStore.js";
35
+ import { type Roster } from "../scene/roster.js";
36
+ import { type Possession } from "../scene/possession.js";
24
37
  import { type SpatialApi } from "../scene/spatial.js";
25
38
  import { type CycleTargetOptions } from "../scene/targeting.js";
26
39
  import { type Stats } from "../stats/statModifiers.js";
40
+ import { type ObservableKeyedStore } from "../store/observableKeyedStore.js";
27
41
  import { type SimClock } from "../time/simClock.js";
42
+ import { type TurnLoop, type TurnLoopConfig } from "../turn/turnLoop.js";
43
+ import { type CameraDirector } from "./cameraDirector.js";
44
+ import { type InputSnapshot } from "./inputSnapshot.js";
45
+ import { type MotionIntents } from "./motionIntents.js";
28
46
  export interface GameContextItemEntry {
29
47
  use?: string;
30
48
  weapon?: Record<string, unknown>;
31
49
  trade?: TradeField;
50
+ /** Rarity id read by the `worldItem` loot-filter/render binding when this item drops to the ground (#32/#33). */
51
+ rarity?: string;
52
+ /** Base item type read by the loot-filter rule evaluator (#33); defaults to the item id when absent. */
53
+ baseType?: string;
32
54
  }
33
55
  export type CatalogEntityRole = "player" | "enemy" | "hostile" | "npc" | "vehicle";
34
56
  export interface GameContextEntityEntry {
@@ -39,6 +61,8 @@ export interface GameContextEntityEntry {
39
61
  walkSpeed?: number;
40
62
  };
41
63
  role?: CatalogEntityRole;
64
+ /** Right-click context-menu verbs for this entity (#31). */
65
+ verbs?: readonly ContextVerb[];
42
66
  }
43
67
  export interface GameContextObjectEntry {
44
68
  proximityPrompt?: ProximityPrompt;
@@ -46,6 +70,8 @@ export interface GameContextObjectEntry {
46
70
  baseBreakTime: number;
47
71
  };
48
72
  slotInventory?: InventoryLayout;
73
+ /** Right-click context-menu verbs for this object (#31). */
74
+ verbs?: readonly ContextVerb[];
49
75
  }
50
76
  export interface GameContextContent {
51
77
  itemById?(itemId: string): GameContextItemEntry | null | undefined;
@@ -63,6 +89,8 @@ export interface GameContextOptions<TAssetRef extends ModelAssetRef = ModelAsset
63
89
  }
64
90
  export interface SceneObjectContext extends ObjectStore {
65
91
  catalog(instanceId: string): GameContextObjectEntry | null;
92
+ raycast(input: ObjectRaycastInput): ObjectRaycastHit | null;
93
+ raycastAll(input: ObjectRaycastInput): readonly ObjectRaycastHit[];
66
94
  }
67
95
  export interface FloatTextInput {
68
96
  instanceId?: string;
@@ -70,19 +98,50 @@ export interface FloatTextInput {
70
98
  text?: string;
71
99
  kind?: string;
72
100
  amount?: number;
101
+ hitType?: string;
102
+ element?: string;
103
+ crit?: boolean;
104
+ scale?: number;
105
+ }
106
+ export interface TelegraphInput {
107
+ from: string;
108
+ shape: TelegraphShape;
109
+ at: [number, number, number];
110
+ dir?: number;
111
+ windupMs: number;
112
+ kind?: string;
113
+ effect?: {
114
+ effect: string;
115
+ via?: EffectVia;
116
+ radius?: number;
117
+ falloff?: "linear" | "none";
118
+ los?: boolean;
119
+ };
120
+ }
121
+ export interface HitReactionInput {
122
+ from: string;
123
+ to: string;
124
+ config: HitReactionConfig;
125
+ power?: number;
73
126
  }
74
127
  export interface SceneEntityContext {
75
128
  spawn(name: string, options?: SpawnOptions): string;
76
129
  despawn(instanceId: string): boolean;
130
+ update: EntityStore["update"];
77
131
  setPose(instanceId: string, pose: EntityPose): boolean;
78
132
  get(instanceId: string): SceneEntity | null;
79
133
  list(): readonly SceneEntity[];
134
+ spawnPoseOf(instanceId: string): SpawnPose | null;
135
+ resetToSpawn(instanceId: string): boolean;
136
+ resetAllToSpawn(filter?: (entity: SceneEntity) => boolean): number;
80
137
  stats: EntityStatsApi;
81
138
  floatText(input: FloatTextInput): void;
139
+ telegraph(input: TelegraphInput): () => void;
140
+ hitReaction(input: HitReactionInput): HitReaction | null;
82
141
  setTarget(fromId: string, toId: string | null): void;
83
142
  getTarget(fromId: string): string | null;
84
143
  cycleTarget(fromId: string, options?: CycleTargetOptions): string | null;
85
- canReceive(instanceId: string, effect: string): string | null;
144
+ canReceive(instanceId: string, effect: string, magnitude?: number): string | null;
86
145
  preview(input: SingleTargetEffectInput): number;
87
146
  effect(input: EffectInput): EffectResult[];
88
147
  willHitProjectile: ProjectileSystem["willHitProjectile"];
@@ -93,6 +152,23 @@ export interface SceneEntityContext {
93
152
  hasLineOfSight: SpatialApi["hasLineOfSight"];
94
153
  queryArc: SpatialApi["queryArc"];
95
154
  moveToward: SpatialApi["moveToward"];
155
+ form: Forms;
156
+ paint: PaintLayer;
157
+ }
158
+ export type WorldItemPickupResult = {
159
+ status: "ok";
160
+ record: WorldItemRecord;
161
+ } | {
162
+ status: "rejected";
163
+ reason: string;
164
+ };
165
+ export interface SceneWorldItemContext {
166
+ spawn(input: WorldItemSpawnInput): WorldItemRecord;
167
+ get(instanceId: string): WorldItemRecord | null;
168
+ list(): readonly WorldItemRecord[];
169
+ nearestInRadius(from: EntityPosition, radius: number, filter?: (record: WorldItemRecord) => boolean): string | null;
170
+ pickup(instanceId: string, userId: string): WorldItemPickupResult;
171
+ consume(instanceId: string): WorldItemRecord | null;
96
172
  }
97
173
  export interface GameContextCommands {
98
174
  define<TInput>(name: string, definition: CommandDefinition<GameContext, TInput>): void;
@@ -122,11 +198,25 @@ export interface GameContextItemUse {
122
198
  can(input: ItemUseInput): ItemUseRejection | null;
123
199
  use(input: ItemUseInput): ItemUseResult<GameContext>;
124
200
  }
201
+ export interface GameContextWorld {
202
+ ground: TerrainField;
203
+ groundHeightAt(x: number, z: number): number;
204
+ }
205
+ export interface GameContextCards {
206
+ /** Lazily creates (on first call, `config` required) or returns the existing notify-wrapped pile for `id`. */
207
+ pile(id: string, config?: CardPileConfig): CardPile;
208
+ }
209
+ export interface GameContextTurn {
210
+ /** Lazily creates (on first call, `config` required) or returns the existing notify-wrapped turn loop for `id`. */
211
+ loop(id: string, config?: TurnLoopConfig): TurnLoop;
212
+ }
125
213
  export interface GameContext {
126
214
  scene: {
127
215
  object: SceneObjectContext;
128
216
  entity: SceneEntityContext;
217
+ worldItem: SceneWorldItemContext;
129
218
  };
219
+ world: GameContextWorld;
130
220
  game: {
131
221
  commands: GameContextCommands;
132
222
  events: GameEvents;
@@ -135,9 +225,15 @@ export interface GameContext {
135
225
  trade: TradeSystem;
136
226
  quest: QuestJournal;
137
227
  social: Social;
228
+ chat: Chat;
138
229
  unlocks: Unlocks;
139
230
  economy: GameContextEconomy;
140
231
  leaderboard: Leaderboard;
232
+ roster: Roster;
233
+ /** Game-defined keyed reactive store slot (#163.1); mutations bump `ctx.version()`/notify `ctx.subscribe`. */
234
+ store: ObservableKeyedStore<unknown>;
235
+ cards: GameContextCards;
236
+ turn: GameContextTurn;
141
237
  };
142
238
  player: {
143
239
  userId: string;
@@ -149,12 +245,20 @@ export interface GameContext {
149
245
  reason: string;
150
246
  } | null;
151
247
  movement: PoseState;
248
+ possession: Possession;
249
+ cosmetics: Cosmetics;
250
+ /** Vertical-motion seam into the shell-owned FrameDriver (#162.4); see `MotionIntents`. */
251
+ motion: MotionIntents;
152
252
  };
153
253
  item: {
154
254
  use: GameContextItemUse;
155
255
  weapon: WeaponStats;
156
256
  };
157
257
  time: SimClock;
258
+ /** Runtime camera-follow/cinematic override (#196.2); the shell reads `followedEntityId()` each frame. */
259
+ camera: CameraDirector;
260
+ /** Held-input snapshot published by the shell each frame before `onTick` (#164.1). */
261
+ input: InputSnapshot;
158
262
  subscribe(listener: () => void): () => void;
159
263
  version(): number;
160
264
  }