@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.
- package/CHANGELOG.md +214 -2
- package/README.md +2 -0
- package/dist/ai/crowd.d.ts +36 -0
- package/dist/ai/crowd.js +213 -0
- package/dist/ai/jobBoard.d.ts +49 -0
- package/dist/ai/jobBoard.js +155 -0
- package/dist/ai/spawnDirector.d.ts +61 -0
- package/dist/ai/spawnDirector.js +162 -0
- package/dist/ai/threat.d.ts +25 -0
- package/dist/ai/threat.js +67 -0
- package/dist/anim/easing.d.ts +14 -0
- package/dist/anim/easing.js +55 -0
- package/dist/audio/audioFalloff.d.ts +38 -0
- package/dist/audio/audioFalloff.js +32 -0
- package/dist/behaviour/behaviour.d.ts +136 -0
- package/dist/behaviour/behaviour.js +388 -0
- package/dist/board/laneBoard.d.ts +63 -0
- package/dist/board/laneBoard.js +114 -0
- package/dist/board/timelineBoard.d.ts +36 -0
- package/dist/board/timelineBoard.js +70 -0
- package/dist/cards/cardPile.d.ts +64 -0
- package/dist/cards/cardPile.js +175 -0
- package/dist/cards/modifierPipeline.d.ts +33 -0
- package/dist/cards/modifierPipeline.js +48 -0
- package/dist/combat/abilityKit.d.ts +47 -0
- package/dist/combat/abilityKit.js +139 -0
- package/dist/combat/animationState.d.ts +47 -0
- package/dist/combat/animationState.js +101 -0
- package/dist/combat/attackTags.d.ts +14 -0
- package/dist/combat/attackTags.js +26 -0
- package/dist/combat/breakMeters.d.ts +32 -0
- package/dist/combat/breakMeters.js +51 -0
- package/dist/combat/comboString.d.ts +35 -0
- package/dist/combat/comboString.js +59 -0
- package/dist/combat/death.d.ts +8 -0
- package/dist/combat/death.js +5 -2
- package/dist/combat/defensiveWindow.d.ts +34 -0
- package/dist/combat/defensiveWindow.js +66 -0
- package/dist/combat/downed.d.ts +35 -0
- package/dist/combat/downed.js +104 -0
- package/dist/combat/effects.d.ts +12 -1
- package/dist/combat/effects.js +31 -19
- package/dist/combat/hitReaction.d.ts +23 -0
- package/dist/combat/hitReaction.js +20 -0
- package/dist/combat/projectiles.d.ts +42 -5
- package/dist/combat/projectiles.js +98 -12
- package/dist/combat/resistance.d.ts +13 -0
- package/dist/combat/resistance.js +46 -0
- package/dist/combat/telegraph.d.ts +31 -0
- package/dist/combat/telegraph.js +51 -0
- package/dist/commands/commandRegistry.d.ts +1 -1
- package/dist/commands/commandRegistry.js +2 -1
- package/dist/crafting/crop.d.ts +59 -0
- package/dist/crafting/crop.js +181 -0
- package/dist/crafting/production.d.ts +64 -0
- package/dist/crafting/production.js +130 -0
- package/dist/crafting/recipe.d.ts +62 -0
- package/dist/crafting/recipe.js +101 -0
- package/dist/data/dataSource.d.ts +26 -0
- package/dist/data/dataSource.js +93 -0
- package/dist/data/devProxy.d.ts +11 -0
- package/dist/data/devProxy.js +38 -0
- package/dist/data/fetchJson.d.ts +20 -0
- package/dist/data/fetchJson.js +43 -0
- package/dist/data/jsonDataSource.d.ts +4 -0
- package/dist/data/jsonDataSource.js +6 -0
- package/dist/devtools/devtools.d.ts +157 -0
- package/dist/devtools/devtools.js +484 -0
- package/dist/devtools/transformTunables.d.ts +14 -0
- package/dist/devtools/transformTunables.js +38 -0
- package/dist/economy/sharedWallet.d.ts +28 -0
- package/dist/economy/sharedWallet.js +62 -0
- package/dist/economy/techTree.d.ts +40 -0
- package/dist/economy/techTree.js +66 -0
- package/dist/game/chat.d.ts +66 -0
- package/dist/game/chat.js +165 -0
- package/dist/game/cosmetics.d.ts +25 -0
- package/dist/game/cosmetics.js +51 -0
- package/dist/game/defineGame.d.ts +10 -2
- package/dist/game/defineGame.js +2 -1
- package/dist/game/events.d.ts +87 -0
- package/dist/game/levelSequence.d.ts +44 -0
- package/dist/game/levelSequence.js +78 -0
- package/dist/game/lootFilter.d.ts +33 -0
- package/dist/game/lootFilter.js +48 -0
- package/dist/game/ping.d.ts +67 -0
- package/dist/game/ping.js +86 -0
- package/dist/game/playableGame.d.ts +516 -8
- package/dist/game/playableGame.js +6 -1
- package/dist/game/progression.d.ts +1 -0
- package/dist/game/progression.js +23 -2
- package/dist/game/race.d.ts +100 -0
- package/dist/game/race.js +236 -0
- package/dist/game/runDraft.d.ts +34 -0
- package/dist/game/runDraft.js +97 -0
- package/dist/game/social.d.ts +69 -0
- package/dist/game/social.js +138 -0
- package/dist/game/spawnPoints.d.ts +19 -0
- package/dist/game/spawnPoints.js +23 -0
- package/dist/game/worldItem.d.ts +95 -0
- package/dist/game/worldItem.js +138 -0
- package/dist/input/actionBindings.d.ts +10 -0
- package/dist/input/actionBindings.js +14 -0
- package/dist/input/axisInput.d.ts +43 -0
- package/dist/input/axisInput.js +70 -0
- package/dist/input/gestureSurface.d.ts +31 -0
- package/dist/input/gestureSurface.js +120 -0
- package/dist/input/pointer.d.ts +69 -0
- package/dist/input/pointer.js +65 -0
- package/dist/input/touchScheme.d.ts +83 -0
- package/dist/input/touchScheme.js +115 -0
- package/dist/interaction/contextMenu.d.ts +30 -0
- package/dist/interaction/contextMenu.js +22 -0
- package/dist/interaction/qte.d.ts +20 -0
- package/dist/interaction/qte.js +24 -0
- package/dist/interaction/skillCheck.d.ts +20 -0
- package/dist/interaction/skillCheck.js +26 -0
- package/dist/inventory/shapedGrid.d.ts +56 -0
- package/dist/inventory/shapedGrid.js +176 -0
- package/dist/inventory/storageTier.d.ts +52 -0
- package/dist/inventory/storageTier.js +77 -0
- package/dist/item/affix.d.ts +54 -0
- package/dist/item/affix.js +115 -0
- package/dist/item/durability.d.ts +51 -0
- package/dist/item/durability.js +78 -0
- package/dist/item/modularItem.d.ts +46 -0
- package/dist/item/modularItem.js +75 -0
- package/dist/meta/changelog.d.ts +1 -1
- package/dist/meta/changelog.js +71 -1
- package/dist/movement/dash.d.ts +37 -0
- package/dist/movement/dash.js +65 -0
- package/dist/movement/movementModel.d.ts +36 -3
- package/dist/movement/movementModel.js +81 -5
- package/dist/movement/voxelController.d.ts +61 -0
- package/dist/movement/voxelController.js +229 -0
- package/dist/multiplayer/chatContract.d.ts +42 -0
- package/dist/multiplayer/chatContract.js +57 -0
- package/dist/multiplayer/combatSnapshot.d.ts +45 -0
- package/dist/multiplayer/combatSnapshot.js +89 -0
- package/dist/multiplayer/identity.d.ts +13 -0
- package/dist/multiplayer/identity.js +20 -0
- package/dist/multiplayer/lagCompensation.d.ts +43 -0
- package/dist/multiplayer/lagCompensation.js +154 -0
- package/dist/multiplayer/matchmaking.d.ts +33 -0
- package/dist/multiplayer/matchmaking.js +60 -0
- package/dist/multiplayer/poseSyncGate.d.ts +1 -0
- package/dist/multiplayer/poseSyncGate.js +13 -1
- package/dist/multiplayer/presenceModel.d.ts +3 -0
- package/dist/multiplayer/presenceModel.js +15 -1
- package/dist/multiplayer/simultaneousCommit.d.ts +34 -0
- package/dist/multiplayer/simultaneousCommit.js +53 -0
- package/dist/multiplayer/voiceContract.d.ts +44 -0
- package/dist/multiplayer/voiceContract.js +108 -0
- package/dist/nav/navConstrain.d.ts +14 -0
- package/dist/nav/navConstrain.js +26 -0
- package/dist/nav/navFromEnvironment.d.ts +11 -0
- package/dist/nav/navFromEnvironment.js +16 -0
- package/dist/nav/navGrid.d.ts +56 -0
- package/dist/nav/navGrid.js +265 -0
- package/dist/nav/pathFollow.d.ts +31 -0
- package/dist/nav/pathFollow.js +69 -0
- package/dist/physics/ballisticSweep.d.ts +18 -0
- package/dist/physics/ballisticSweep.js +49 -0
- package/dist/physics/buoyancy.d.ts +49 -0
- package/dist/physics/buoyancy.js +112 -0
- package/dist/physics/carryable.d.ts +46 -0
- package/dist/physics/carryable.js +110 -0
- package/dist/physics/damageZones.d.ts +56 -0
- package/dist/physics/damageZones.js +107 -0
- package/dist/physics/forceVolume.d.ts +48 -0
- package/dist/physics/forceVolume.js +119 -0
- package/dist/physics/physicsWorld.d.ts +124 -2
- package/dist/physics/physicsWorld.js +493 -41
- package/dist/physics/ragdoll.d.ts +49 -0
- package/dist/physics/ragdoll.js +103 -0
- package/dist/physics/spatialGrid.d.ts +41 -0
- package/dist/physics/spatialGrid.js +143 -0
- package/dist/physics/structure.d.ts +83 -0
- package/dist/physics/structure.js +0 -0
- package/dist/physics/traversal.d.ts +75 -0
- package/dist/physics/traversal.js +138 -0
- package/dist/physics/vehicleBody.d.ts +99 -0
- package/dist/physics/vehicleBody.js +233 -0
- package/dist/puzzle/cellGrid.d.ts +26 -0
- package/dist/puzzle/cellGrid.js +110 -0
- package/dist/puzzle/fallingPiece.d.ts +24 -0
- package/dist/puzzle/fallingPiece.js +51 -0
- package/dist/random/nameGen.d.ts +18 -0
- package/dist/random/nameGen.js +35 -0
- package/dist/random/rng.d.ts +2 -0
- package/dist/random/rng.js +23 -0
- package/dist/runtime/adapter.d.ts +35 -0
- package/dist/runtime/adapter.js +37 -1
- package/dist/runtime/cameraDirector.d.ts +10 -0
- package/dist/runtime/cameraDirector.js +25 -0
- package/dist/runtime/gameContext.d.ts +107 -3
- package/dist/runtime/gameContext.js +253 -7
- package/dist/runtime/hostPersistence.d.ts +39 -0
- package/dist/runtime/hostPersistence.js +54 -0
- package/dist/runtime/inputSnapshot.d.ts +7 -0
- package/dist/runtime/inputSnapshot.js +12 -0
- package/dist/runtime/motionIntents.d.ts +25 -0
- package/dist/runtime/motionIntents.js +25 -0
- package/dist/runtime/persistenceScope.d.ts +32 -0
- package/dist/runtime/persistenceScope.js +64 -0
- package/dist/runtime/transport.d.ts +32 -0
- package/dist/scene/autoTarget.d.ts +15 -0
- package/dist/scene/autoTarget.js +54 -0
- package/dist/scene/behaviors.d.ts +13 -1
- package/dist/scene/behaviors.js +3 -0
- package/dist/scene/captureCheck.d.ts +7 -0
- package/dist/scene/captureCheck.js +11 -0
- package/dist/scene/entityStore.d.ts +9 -1
- package/dist/scene/entityStore.js +25 -2
- package/dist/scene/form.d.ts +40 -0
- package/dist/scene/form.js +56 -0
- package/dist/scene/mount.d.ts +62 -0
- package/dist/scene/mount.js +107 -0
- package/dist/scene/movementSpeed.d.ts +35 -0
- package/dist/scene/movementSpeed.js +20 -0
- package/dist/scene/objectQuery.d.ts +18 -0
- package/dist/scene/objectQuery.js +108 -0
- package/dist/scene/objectStore.d.ts +11 -0
- package/dist/scene/objectStore.js +109 -4
- package/dist/scene/paintLayer.d.ts +15 -0
- package/dist/scene/paintLayer.js +53 -0
- package/dist/scene/possession.d.ts +30 -0
- package/dist/scene/possession.js +51 -0
- package/dist/scene/roster.d.ts +25 -0
- package/dist/scene/roster.js +57 -0
- package/dist/scene/selection.d.ts +30 -0
- package/dist/scene/selection.js +38 -0
- package/dist/scene/spatial.d.ts +21 -0
- package/dist/scene/spatial.js +63 -1
- package/dist/scene/stationClaim.d.ts +43 -0
- package/dist/scene/stationClaim.js +109 -0
- package/dist/sensor/concealment.d.ts +21 -0
- package/dist/sensor/concealment.js +63 -0
- package/dist/sensor/freezeMonitor.d.ts +17 -0
- package/dist/sensor/freezeMonitor.js +35 -0
- package/dist/sensor/frustumSensor.d.ts +60 -0
- package/dist/sensor/frustumSensor.js +104 -0
- package/dist/sensor/hiddenStateProbe.d.ts +31 -0
- package/dist/sensor/hiddenStateProbe.js +40 -0
- package/dist/sensor/recordingBuffer.d.ts +29 -0
- package/dist/sensor/recordingBuffer.js +61 -0
- package/dist/sensor/revealQuery.d.ts +22 -0
- package/dist/sensor/revealQuery.js +36 -0
- package/dist/session/contestedChannel.d.ts +36 -0
- package/dist/session/contestedChannel.js +100 -0
- package/dist/session/extraction.d.ts +54 -0
- package/dist/session/extraction.js +108 -0
- package/dist/session/ring.d.ts +36 -0
- package/dist/session/ring.js +88 -0
- package/dist/session/roles.d.ts +6 -0
- package/dist/session/roles.js +32 -0
- package/dist/session/roundState.d.ts +79 -0
- package/dist/session/roundState.js +158 -0
- package/dist/stats/accumulatorMeter.d.ts +31 -0
- package/dist/stats/accumulatorMeter.js +81 -0
- package/dist/stats/eventMeter.d.ts +34 -0
- package/dist/stats/eventMeter.js +76 -0
- package/dist/stats/rollCheck.d.ts +15 -0
- package/dist/stats/rollCheck.js +15 -0
- package/dist/survival/decayMeter.d.ts +59 -0
- package/dist/survival/decayMeter.js +95 -0
- package/dist/survival/moodle.d.ts +48 -0
- package/dist/survival/moodle.js +91 -0
- package/dist/survival/regionHealth.d.ts +72 -0
- package/dist/survival/regionHealth.js +129 -0
- package/dist/tactics/fallingGrid.d.ts +62 -0
- package/dist/tactics/fallingGrid.js +158 -0
- package/dist/tactics/predictiveQuery.d.ts +34 -0
- package/dist/tactics/predictiveQuery.js +44 -0
- package/dist/tactics/snapshot.d.ts +18 -0
- package/dist/tactics/snapshot.js +65 -0
- package/dist/tactics/surface.d.ts +52 -0
- package/dist/tactics/surface.js +135 -0
- package/dist/tactics/tacticalGrid.d.ts +68 -0
- package/dist/tactics/tacticalGrid.js +261 -0
- package/dist/time/beatClock.d.ts +40 -0
- package/dist/time/beatClock.js +73 -0
- package/dist/time/simClock.d.ts +25 -1
- package/dist/time/simClock.js +28 -3
- package/dist/turn/commit.d.ts +27 -0
- package/dist/turn/commit.js +72 -0
- package/dist/turn/intent.d.ts +14 -0
- package/dist/turn/intent.js +29 -0
- package/dist/turn/turnLoop.d.ts +60 -0
- package/dist/turn/turnLoop.js +223 -0
- package/dist/world/buildPermissions.d.ts +47 -0
- package/dist/world/buildPermissions.js +134 -0
- package/dist/world/carve.d.ts +105 -0
- package/dist/world/carve.js +175 -0
- package/dist/world/connectors.d.ts +40 -0
- package/dist/world/connectors.js +67 -0
- package/dist/world/envField.d.ts +71 -0
- package/dist/world/envField.js +96 -0
- package/dist/world/environmentSummary.d.ts +53 -0
- package/dist/world/environmentSummary.js +129 -0
- package/dist/world/features.d.ts +87 -6
- package/dist/world/features.js +52 -2
- package/dist/world/fog.d.ts +40 -0
- package/dist/world/fog.js +137 -0
- package/dist/world/gridInstances.d.ts +13 -0
- package/dist/world/gridInstances.js +22 -0
- package/dist/world/markers.d.ts +52 -0
- package/dist/world/markers.js +96 -0
- package/dist/world/minimap.d.ts +42 -0
- package/dist/world/minimap.js +72 -0
- package/dist/world/placedStructureStore.d.ts +39 -0
- package/dist/world/placedStructureStore.js +95 -0
- package/dist/world/placementController.d.ts +69 -0
- package/dist/world/placementController.js +153 -0
- package/dist/world/realm.d.ts +61 -0
- package/dist/world/realm.js +66 -0
- package/dist/world/support.d.ts +27 -0
- package/dist/world/support.js +75 -0
- package/dist/world/terraform.d.ts +54 -0
- package/dist/world/terraform.js +186 -0
- package/dist/world/terrain.d.ts +23 -1
- package/dist/world/terrain.js +64 -1
- package/dist/world/voxelField.d.ts +54 -0
- package/dist/world/voxelField.js +241 -0
- package/dist/world/walls.d.ts +61 -0
- package/dist/world/walls.js +221 -0
- package/dist/world/weather.d.ts +92 -0
- package/dist/world/weather.js +169 -0
- package/llms.txt +4102 -0
- package/package.json +3 -2
package/dist/runtime/adapter.js
CHANGED
|
@@ -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
|
}
|