@jgengine/core 0.11.0 → 0.13.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 +52 -0
- package/dist/ai/populationDirector.d.ts +103 -0
- package/dist/ai/populationDirector.js +190 -0
- package/dist/ai/pursuit.d.ts +56 -0
- package/dist/ai/pursuit.js +53 -0
- package/dist/authoring.d.ts +1 -1
- package/dist/authoring.js +1 -1
- package/dist/combat/effects.d.ts +11 -4
- package/dist/combat/effects.js +24 -17
- package/dist/combat/magazine.d.ts +13 -0
- package/dist/combat/magazine.js +27 -0
- package/dist/combat/vfxPresets.d.ts +176 -0
- package/dist/combat/vfxPresets.js +74 -0
- package/dist/combat/weaponFire.d.ts +114 -0
- package/dist/combat/weaponFire.js +96 -0
- package/dist/combat.d.ts +5 -2
- package/dist/combat.js +4 -1
- package/dist/devtools/controls.d.ts +38 -0
- package/dist/devtools/controls.js +181 -0
- package/dist/devtools/devtools.d.ts +5 -197
- package/dist/devtools/devtools.js +38 -774
- package/dist/devtools/discover.d.ts +32 -0
- package/dist/devtools/discover.js +240 -0
- package/dist/devtools/fallbackSeams.d.ts +50 -0
- package/dist/devtools/fallbackSeams.js +111 -0
- package/dist/devtools/frame.d.ts +15 -0
- package/dist/devtools/frame.js +247 -0
- package/dist/devtools/logs.d.ts +15 -0
- package/dist/devtools/logs.js +86 -0
- package/dist/devtools/overrides.d.ts +16 -0
- package/dist/devtools/overrides.js +66 -0
- package/dist/devtools/types.d.ts +212 -0
- package/dist/devtools/types.js +1 -0
- package/dist/devtools/urlFlags.d.ts +22 -0
- package/dist/devtools/urlFlags.js +62 -0
- package/dist/economy/auctionBook.d.ts +122 -0
- package/dist/economy/auctionBook.js +213 -0
- package/dist/economy/priceHistory.d.ts +44 -0
- package/dist/economy/priceHistory.js +89 -0
- package/dist/economy/unlockPoints.d.ts +92 -0
- package/dist/economy/unlockPoints.js +103 -0
- package/dist/editor/commandApply.d.ts +5 -0
- package/dist/editor/commandApply.js +755 -0
- package/dist/editor/commands.d.ts +48 -3
- package/dist/editor/commands.js +40 -754
- package/dist/editor/directives.d.ts +94 -0
- package/dist/editor/directives.js +206 -0
- package/dist/editor/document.d.ts +37 -2
- package/dist/editor/document.js +422 -6
- package/dist/editor/entityCatalog.d.ts +42 -0
- package/dist/editor/entityCatalog.js +101 -0
- package/dist/editor/environment.d.ts +74 -0
- package/dist/editor/environment.js +169 -0
- package/dist/editor/index.d.ts +26 -1
- package/dist/editor/index.js +8 -1
- package/dist/editor/minimap.d.ts +31 -0
- package/dist/editor/minimap.js +73 -0
- package/dist/editor/streamer.d.ts +66 -0
- package/dist/editor/streamer.js +68 -0
- package/dist/editor/types.d.ts +143 -0
- package/dist/editor/world.d.ts +136 -0
- package/dist/editor/world.js +303 -0
- package/dist/game/breeding.d.ts +161 -0
- package/dist/game/breeding.js +181 -0
- package/dist/game/cameraConfig.d.ts +451 -0
- package/dist/game/cameraConfig.js +1 -0
- package/dist/game/clipRoles.d.ts +51 -0
- package/dist/game/clipRoles.js +142 -0
- package/dist/game/defineGame.d.ts +16 -9
- package/dist/game/defineGame.js +14 -6
- package/dist/game/defineSystem.d.ts +2 -0
- package/dist/game/defineSystem.js +2 -0
- package/dist/game/events.d.ts +28 -0
- package/dist/game/partAnimation.d.ts +78 -0
- package/dist/game/partAnimation.js +147 -0
- package/dist/game/playableGame.d.ts +72 -440
- package/dist/game/playableGame.js +1 -1
- package/dist/game/progression.d.ts +35 -0
- package/dist/game/progression.js +22 -1
- package/dist/game/quest.js +1 -3
- package/dist/game/tribe.d.ts +184 -0
- package/dist/game/tribe.js +432 -0
- package/dist/gameplay.d.ts +3 -1
- package/dist/gameplay.js +3 -1
- package/dist/inventory/encumbrance.d.ts +69 -0
- package/dist/inventory/encumbrance.js +68 -0
- package/dist/inventory/inventoryModel.d.ts +24 -8
- package/dist/inventory/inventoryModel.js +47 -8
- package/dist/item/durability.js +1 -3
- package/dist/meta/changelog.d.ts +1 -1
- package/dist/meta/changelog.js +48 -1
- package/dist/movement/movementModel.d.ts +15 -1
- package/dist/movement/movementModel.js +33 -15
- package/dist/movement/playerMovement.js +102 -2
- package/dist/multiplayer/combatSnapshot.js +13 -8
- package/dist/multiplayer/presenceModel.d.ts +2 -0
- package/dist/multiplayer/presenceModel.js +8 -0
- package/dist/physics/drivableVehicle.d.ts +2 -0
- package/dist/physics/drivableVehicle.js +1 -1
- package/dist/physics/flightDynamics.d.ts +82 -0
- package/dist/physics/flightDynamics.js +165 -0
- package/dist/physics/gravityField.d.ts +25 -0
- package/dist/physics/gravityField.js +41 -0
- package/dist/physics/kinematicVehicle.d.ts +87 -0
- package/dist/physics/kinematicVehicle.js +193 -11
- package/dist/physics/physicsWorld.d.ts +26 -0
- package/dist/physics/physicsWorld.js +109 -117
- package/dist/physics/vehicleObstacles.d.ts +44 -0
- package/dist/physics/vehicleObstacles.js +115 -0
- package/dist/random/rng.d.ts +4 -1
- package/dist/random/rng.js +4 -1
- package/dist/runtime/adapter.d.ts +13 -0
- package/dist/runtime/adapter.js +13 -0
- package/dist/runtime/context/combat.d.ts +51 -0
- package/dist/runtime/context/combat.js +131 -0
- package/dist/runtime/context/combatFx.js +15 -5
- package/dist/runtime/context/deathLoot.d.ts +30 -0
- package/dist/runtime/context/deathLoot.js +39 -0
- package/dist/runtime/context/player.d.ts +48 -0
- package/dist/runtime/context/player.js +125 -0
- package/dist/runtime/context/scene.d.ts +60 -0
- package/dist/runtime/context/scene.js +329 -0
- package/dist/runtime/context/snapshotCodecs.d.ts +12 -0
- package/dist/runtime/context/snapshotCodecs.js +26 -0
- package/dist/runtime/descriptors/baseline.js +26 -3
- package/dist/runtime/descriptors/features.d.ts +5 -0
- package/dist/runtime/descriptors/features.js +20 -2
- package/dist/runtime/gameContext.d.ts +2 -428
- package/dist/runtime/gameContext.js +133 -500
- package/dist/runtime/gameContextTypes.d.ts +500 -0
- package/dist/runtime/gameContextTypes.js +1 -0
- package/dist/runtime/headlessRunner.d.ts +17 -2
- package/dist/runtime/headlessRunner.js +15 -0
- package/dist/runtime/hostPolicy.d.ts +51 -0
- package/dist/runtime/hostPolicy.js +68 -0
- package/dist/runtime/hostedGameRunner.d.ts +3 -1
- package/dist/runtime/hostedGameRunner.js +1 -0
- package/dist/runtime/hostedWorldSession.d.ts +3 -1
- package/dist/runtime/hostedWorldSession.js +1 -0
- package/dist/runtime/worldSnapshot.d.ts +13 -1
- package/dist/runtime/worldSnapshot.js +15 -3
- package/dist/scene/assetCatalog.d.ts +7 -0
- package/dist/scene/assetSpace.js +1 -3
- package/dist/scene/authoredTriggers.d.ts +50 -0
- package/dist/scene/authoredTriggers.js +114 -0
- package/dist/scene/builtinSceneKinds.js +8 -3
- package/dist/scene/colliders.d.ts +79 -0
- package/dist/scene/colliders.js +170 -0
- package/dist/scene/collisionMesh.d.ts +94 -0
- package/dist/scene/collisionMesh.js +699 -0
- package/dist/scene/companion.d.ts +147 -0
- package/dist/scene/companion.js +193 -0
- package/dist/scene/entityStats.d.ts +7 -9
- package/dist/scene/entityStats.js +19 -15
- package/dist/scene/sceneKinds.d.ts +16 -0
- package/dist/scene/sceneKinds.js +4 -0
- package/dist/scene/sceneRaycast.js +15 -0
- package/dist/stats/spawnLevelStats.d.ts +110 -0
- package/dist/stats/spawnLevelStats.js +140 -0
- package/dist/stats/statModifiers.d.ts +16 -0
- package/dist/stats/statModifiers.js +30 -1
- package/dist/stats/statPool.d.ts +70 -0
- package/dist/stats/statPool.js +62 -0
- package/dist/store/changeSignal.d.ts +3 -0
- package/dist/store/changeSignal.js +2 -0
- package/dist/store/observableKeyedStore.d.ts +2 -0
- package/dist/store/observableKeyedStore.js +1 -0
- package/dist/survival/decayMeter.js +1 -3
- package/dist/survival/regionHealth.js +1 -3
- package/dist/ui/hudLayout.d.ts +5 -0
- package/dist/ui/hudLayout.js +17 -1
- package/dist/ui/panelModel.d.ts +120 -0
- package/dist/ui/panelModel.js +168 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +1 -0
- package/dist/world/authoredEntities.d.ts +29 -0
- package/dist/world/authoredEntities.js +29 -0
- package/dist/world/authoredObjects.d.ts +15 -1
- package/dist/world/authoredObjects.js +13 -1
- package/dist/world/authoredSpawn.d.ts +39 -0
- package/dist/world/authoredSpawn.js +37 -0
- package/dist/world/buildSockets.d.ts +152 -0
- package/dist/world/buildSockets.js +188 -0
- package/dist/world/buildingLots.d.ts +84 -0
- package/dist/world/buildingLots.js +119 -0
- package/dist/world/buildings.d.ts +6 -0
- package/dist/world/cityBlocks.d.ts +152 -0
- package/dist/world/cityBlocks.js +670 -0
- package/dist/world/cityContent.d.ts +77 -0
- package/dist/world/cityContent.js +261 -0
- package/dist/world/cityGenerator.d.ts +41 -0
- package/dist/world/cityGenerator.js +58 -0
- package/dist/world/cityGeometry.d.ts +114 -0
- package/dist/world/cityGeometry.js +573 -0
- package/dist/world/cityKind.d.ts +314 -0
- package/dist/world/cityKind.js +1578 -0
- package/dist/world/environmentSummary.js +57 -1
- package/dist/world/features.d.ts +53 -5
- package/dist/world/features.js +15 -3
- package/dist/world/grassKind.js +2 -2
- package/dist/world/markers.d.ts +50 -4
- package/dist/world/markers.js +49 -0
- package/dist/world/massing.js +1 -1
- package/dist/world/minimapBake.d.ts +78 -0
- package/dist/world/minimapBake.js +208 -0
- package/dist/world/minimapTrack.d.ts +17 -0
- package/dist/world/minimapTrack.js +22 -0
- package/dist/world/place.d.ts +166 -0
- package/dist/world/place.js +96 -0
- package/dist/world/placeAsset.js +3 -1
- package/dist/world/poleLineKind.d.ts +40 -0
- package/dist/world/poleLineKind.js +97 -0
- package/dist/world/polyline.js +9 -2
- package/dist/world/resourceNode.d.ts +109 -0
- package/dist/world/resourceNode.js +140 -0
- package/dist/world/roads.d.ts +19 -2
- package/dist/world/roads.js +60 -3
- package/dist/world/scatter.js +2 -20
- package/dist/world/streetGenerator.d.ts +159 -0
- package/dist/world/streetGenerator.js +684 -0
- package/dist/world/streets.d.ts +103 -1
- package/dist/world/streets.js +273 -0
- package/dist/world/terraform.js +58 -88
- package/dist/world/terrain.d.ts +65 -1
- package/dist/world/terrain.js +119 -2
- package/dist/world.d.ts +14 -5
- package/dist/world.js +12 -3
- package/package.json +1 -1
- package/skills/game-design/SKILL.md +28 -0
- package/skills/game-design/agents/openai.yaml +4 -0
- package/skills/game-design/references/application-playbook.md +170 -0
- package/skills/game-design/references/field-guide.md +288 -0
- package/skills/jgengine/SKILL.md +8 -4
- package/skills/jgengine/api.md +182 -81
- package/skills/jgengine/capabilities.md +104 -2
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-combat/SKILL.md +19 -1
- package/skills/jgengine-combat/api.md +75 -2
- package/skills/jgengine-combat/capabilities.md +61 -1
- package/skills/jgengine-combat/recipes/portable-damage-effects.md +197 -0
- package/skills/jgengine-combat/recipes/portable-runtime-state.md +154 -0
- package/skills/jgengine-combat/recipes/portable-stat-pools.md +122 -0
- package/skills/jgengine-combat/recipes/portable-weapon-plumbing.md +156 -0
- package/skills/jgengine-combat/recipes/visible-attacks.md +81 -0
- package/skills/jgengine-combat/reference.md +33 -4
- package/skills/jgengine-gameplay/SKILL.md +8 -0
- package/skills/jgengine-gameplay/api.md +182 -26
- package/skills/jgengine-gameplay/capabilities.md +96 -2
- package/skills/jgengine-gameplay/recipes/portable-xp-leveling.md +168 -0
- package/skills/jgengine-gameplay/reference-systems.md +10 -5
- package/skills/jgengine-world/SKILL.md +13 -0
- package/skills/jgengine-world/api.md +453 -21
- package/skills/jgengine-world/capabilities.md +112 -2
- package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
- package/skills/jgengine-world/reference.md +43 -4
- package/skills/jgengine/reference-cartridge.md +0 -72
|
@@ -10,6 +10,7 @@ import { createUnlocks } from "../../game/unlocks.js";
|
|
|
10
10
|
import { createRoster } from "../../scene/roster.js";
|
|
11
11
|
import { createConnectedPlayers } from "../../game/connectedPlayers.js";
|
|
12
12
|
import { notifyAfter } from "../../store/changeSignal.js";
|
|
13
|
+
import { decodeArray, decodeRecord } from "../context/snapshotCodecs.js";
|
|
13
14
|
/** @internal */
|
|
14
15
|
export const featureDescriptors = [
|
|
15
16
|
{
|
|
@@ -22,6 +23,7 @@ export const featureDescriptors = [
|
|
|
22
23
|
save: {
|
|
23
24
|
key: "unlocks",
|
|
24
25
|
snapshot: () => unlocks.snapshotAll(),
|
|
26
|
+
decode: (raw) => decodeRecord(raw),
|
|
25
27
|
hydrate: (data) => unlocks.hydrateAll(data),
|
|
26
28
|
},
|
|
27
29
|
};
|
|
@@ -49,6 +51,10 @@ export const featureDescriptors = [
|
|
|
49
51
|
replicate: {
|
|
50
52
|
key: "social",
|
|
51
53
|
snapshot: () => social.snapshot(),
|
|
54
|
+
decode: (rawVal) => {
|
|
55
|
+
const rec = decodeRecord(rawVal);
|
|
56
|
+
return rec === null ? null : rec;
|
|
57
|
+
},
|
|
52
58
|
hydrate: (data) => social.hydrate(data),
|
|
53
59
|
},
|
|
54
60
|
};
|
|
@@ -74,6 +80,10 @@ export const featureDescriptors = [
|
|
|
74
80
|
replicate: {
|
|
75
81
|
key: "chat",
|
|
76
82
|
snapshot: () => chat.snapshot(),
|
|
83
|
+
decode: (rawVal) => {
|
|
84
|
+
const rec = decodeRecord(rawVal);
|
|
85
|
+
return rec === null ? null : rec;
|
|
86
|
+
},
|
|
77
87
|
hydrate: (data) => chat.hydrate(data),
|
|
78
88
|
},
|
|
79
89
|
};
|
|
@@ -89,6 +99,7 @@ export const featureDescriptors = [
|
|
|
89
99
|
replicate: {
|
|
90
100
|
key: "leaderboard",
|
|
91
101
|
snapshot: () => leaderboard.snapshot(),
|
|
102
|
+
decode: (raw) => decodeArray(raw),
|
|
92
103
|
hydrate: (data) => leaderboard.hydrate(data),
|
|
93
104
|
},
|
|
94
105
|
};
|
|
@@ -104,6 +115,7 @@ export const featureDescriptors = [
|
|
|
104
115
|
save: {
|
|
105
116
|
key: "roster",
|
|
106
117
|
snapshot: () => roster.snapshotAll(),
|
|
118
|
+
decode: (raw) => decodeRecord(raw),
|
|
107
119
|
hydrate: (data) => roster.hydrateAll(data),
|
|
108
120
|
},
|
|
109
121
|
};
|
|
@@ -119,6 +131,7 @@ export const featureDescriptors = [
|
|
|
119
131
|
save: {
|
|
120
132
|
key: "cosmetics",
|
|
121
133
|
snapshot: () => cosmetics.snapshotAll(),
|
|
134
|
+
decode: (raw) => decodeRecord(raw),
|
|
122
135
|
hydrate: (data) => cosmetics.hydrateAll(data),
|
|
123
136
|
},
|
|
124
137
|
};
|
|
@@ -193,6 +206,7 @@ export const featureDescriptors = [
|
|
|
193
206
|
save: {
|
|
194
207
|
key: "quest",
|
|
195
208
|
snapshot: () => quest.snapshotAll(),
|
|
209
|
+
decode: (raw) => decodeRecord(raw),
|
|
196
210
|
hydrate: (data) => quest.hydrateAll(data),
|
|
197
211
|
},
|
|
198
212
|
};
|
|
@@ -239,8 +253,10 @@ export const featureDescriptors = [
|
|
|
239
253
|
out[id] = cardPile.state();
|
|
240
254
|
return out;
|
|
241
255
|
},
|
|
256
|
+
decode: (raw) => decodeRecord(raw),
|
|
242
257
|
hydrate: (data) => {
|
|
243
|
-
|
|
258
|
+
const piles = data;
|
|
259
|
+
for (const [id, state] of Object.entries(piles)) {
|
|
244
260
|
d.cardPiles.get(id)?.reset(state);
|
|
245
261
|
}
|
|
246
262
|
},
|
|
@@ -262,8 +278,10 @@ export const featureDescriptors = [
|
|
|
262
278
|
out[id] = turnLoop.capture();
|
|
263
279
|
return out;
|
|
264
280
|
},
|
|
281
|
+
decode: (raw) => decodeRecord(raw),
|
|
265
282
|
hydrate: (data) => {
|
|
266
|
-
|
|
283
|
+
const loops = data;
|
|
284
|
+
for (const [id, state] of Object.entries(loops)) {
|
|
267
285
|
d.turnLoops.get(id)?.restore(state);
|
|
268
286
|
}
|
|
269
287
|
},
|
|
@@ -1,430 +1,4 @@
|
|
|
1
|
-
import { type CardPile, type CardPileConfig } from "../cards/cardPile.js";
|
|
2
|
-
import { type OnDeathSpec } from "../combat/death.js";
|
|
3
|
-
import { type EffectInput, type EffectResult, type EffectVia, type ReceiveMap, type SingleTargetEffectInput } from "../combat/effects.js";
|
|
4
|
-
import { type ProjectileSystem } from "../combat/projectiles.js";
|
|
5
|
-
import { type HitReaction, type HitReactionConfig, type ImpactPresetName } from "../combat/hitReaction.js";
|
|
6
|
-
import { type TelegraphShape } from "../combat/telegraph.js";
|
|
7
|
-
import { type CommandDefinition, type CommandResult } from "../commands/commandRegistry.js";
|
|
8
|
-
import { type ChargeOptions as WalletChargeOptions } from "../economy/wallet.js";
|
|
9
|
-
import { type Cosmetics } from "../game/cosmetics.js";
|
|
10
|
-
import type { GameDefinition } from "../game/defineGame.js";
|
|
11
|
-
import { type TerrainField } from "../world/terrain.js";
|
|
12
|
-
import { type GameEventMap, type GameEvents, type VfxKind } from "../game/events.js";
|
|
13
|
-
import { type VfxInstanceStore } from "../game/vfxInstance.js";
|
|
14
|
-
import { type GameFeed } from "../game/feed.js";
|
|
15
|
-
import { type Leaderboard } from "../game/leaderboard.js";
|
|
16
|
-
import { type Loadouts } from "../game/loadout.js";
|
|
17
|
-
import { type Drop, type LootTableDef } from "../game/lootTable.js";
|
|
18
|
-
import { type GameDialogue } from "../game/dialogue.js";
|
|
19
|
-
import { type QuestJournal } from "../game/quest.js";
|
|
20
|
-
import { type WorldItemRecord, type WorldItemSpawnInput } from "../game/worldItem.js";
|
|
21
|
-
import { type Chat } from "../game/chat.js";
|
|
22
|
-
import { type Social } from "../game/social.js";
|
|
23
|
-
import { type TradeField, type TradeSystem } from "../game/trade.js";
|
|
24
|
-
import { type Unlocks } from "../game/unlocks.js";
|
|
25
|
-
import { type InventoryLayout, type InventorySet } from "../inventory/inventoryModel.js";
|
|
26
|
-
import type { ContextVerb } from "../interaction/contextMenu.js";
|
|
27
|
-
import type { ProximityPrompt } from "../interaction/proximityPrompt.js";
|
|
28
|
-
import { type ItemUseHandler, type ItemUseInput, type ItemUseRejection, type ItemUseResult } from "../item/use.js";
|
|
29
|
-
import { type WeaponStats } from "../item/weapon.js";
|
|
30
|
-
import { type PoseAllowedStates, type PoseState } from "../movement/poseState.js";
|
|
31
1
|
import type { ModelAssetRef } from "../scene/assetCatalog.js";
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
import { type EntityStatsApi, type StatCatalog } from "../scene/entityStats.js";
|
|
35
|
-
import { type EntityBlackboard, type EntityPose, type EntityPosition, type EntityStore, type SceneEntity, type SpawnOptions, type SpawnPose } from "../scene/entityStore.js";
|
|
36
|
-
import { type Forms } from "../scene/form.js";
|
|
37
|
-
import { type EntityColliderSet } from "../scene/colliders.js";
|
|
38
|
-
import { type ObjectRaycastHit, type ObjectRaycastInput } from "../scene/objectQuery.js";
|
|
39
|
-
import { type ObjectStore } from "../scene/objectStore.js";
|
|
40
|
-
import { type Roster } from "../scene/roster.js";
|
|
41
|
-
import { type SelectionSet } from "../scene/selection.js";
|
|
42
|
-
import { type ConnectedPlayers } from "../game/connectedPlayers.js";
|
|
43
|
-
import { type Possession } from "../scene/possession.js";
|
|
44
|
-
import { type SceneRaycastHit, type SceneRaycastInput } from "../scene/sceneRaycast.js";
|
|
45
|
-
import { type MoveTowardOptions, type SpatialApi } from "../scene/spatial.js";
|
|
46
|
-
import { type CycleTargetOptions } from "../scene/targeting.js";
|
|
47
|
-
import { type Stats } from "../stats/statModifiers.js";
|
|
48
|
-
import { type ObservableKeyedStore } from "../store/observableKeyedStore.js";
|
|
49
|
-
import { type SnapshotModule, type SnapshotViewer, type WorldSnapshot } from "./worldSnapshot.js";
|
|
50
|
-
import { type ReplicationPolicy } from "./worldProjection.js";
|
|
51
|
-
import { type RuntimeSave, type RuntimeSaveOptions } from "./runtimeSave.js";
|
|
52
|
-
import { type SimClock } from "../time/simClock.js";
|
|
53
|
-
import { type TurnLoop, type TurnLoopConfig } from "../turn/turnLoop.js";
|
|
54
|
-
import { RaceState, type RaceStateConfig } from "../game/race.js";
|
|
55
|
-
import { type CameraDirector } from "./cameraDirector.js";
|
|
56
|
-
import { type InputSnapshot } from "./inputSnapshot.js";
|
|
57
|
-
import { type MotionIntents } from "./motionIntents.js";
|
|
58
|
-
export interface GameContextItemEntry {
|
|
59
|
-
use?: string;
|
|
60
|
-
weapon?: Record<string, unknown>;
|
|
61
|
-
trade?: TradeField;
|
|
62
|
-
/** Rarity id read by the `worldItem` loot-filter/render binding when this item drops to the ground (#32/#33). */
|
|
63
|
-
rarity?: string;
|
|
64
|
-
/** Base item type read by the loot-filter rule evaluator (#33); defaults to the item id when absent. */
|
|
65
|
-
baseType?: string;
|
|
66
|
-
}
|
|
67
|
-
export type CatalogEntityRole = "player" | "enemy" | "hostile" | "npc" | "vehicle";
|
|
68
|
-
export interface GameContextEntityEntry {
|
|
69
|
-
stats?: StatCatalog;
|
|
70
|
-
receive?: ReceiveMap;
|
|
71
|
-
onDeath?: OnDeathSpec;
|
|
72
|
-
movement?: PoseAllowedStates & {
|
|
73
|
-
walkSpeed?: number;
|
|
74
|
-
};
|
|
75
|
-
role?: CatalogEntityRole;
|
|
76
|
-
/** Right-click context-menu verbs for this entity (#31). */
|
|
77
|
-
verbs?: readonly ContextVerb[];
|
|
78
|
-
/** Purpose-specific colliders (physical body + named damage hitboxes). */
|
|
79
|
-
colliders?: EntityColliderSet;
|
|
80
|
-
/** Uniform visual scale of the rendered mesh; derives a matching hitbox (and eye-height) when no explicit `colliders` are set. */
|
|
81
|
-
scale?: number;
|
|
82
|
-
}
|
|
83
|
-
export interface GameContextObjectEntry {
|
|
84
|
-
proximityPrompt?: ProximityPrompt;
|
|
85
|
-
breakable?: false | {
|
|
86
|
-
baseBreakTime: number;
|
|
87
|
-
};
|
|
88
|
-
slotInventory?: InventoryLayout;
|
|
89
|
-
/** Right-click context-menu verbs for this object (#31). */
|
|
90
|
-
verbs?: readonly ContextVerb[];
|
|
91
|
-
colliders?: EntityColliderSet;
|
|
92
|
-
halfExtents?: readonly [number, number, number];
|
|
93
|
-
}
|
|
94
|
-
export interface GameContextContent {
|
|
95
|
-
itemById?(itemId: string): GameContextItemEntry | null | undefined;
|
|
96
|
-
entityById?(catalogId: string): GameContextEntityEntry | null | undefined;
|
|
97
|
-
objectById?(catalogId: string): GameContextObjectEntry | null | undefined;
|
|
98
|
-
}
|
|
99
|
-
export interface GameContextOptions<TAssetRef extends ModelAssetRef = ModelAssetRef, TMultiplayer = unknown> {
|
|
100
|
-
definition: GameDefinition<TAssetRef, TMultiplayer>;
|
|
101
|
-
content: GameContextContent;
|
|
102
|
-
player: {
|
|
103
|
-
userId: string;
|
|
104
|
-
isNew: boolean;
|
|
105
|
-
};
|
|
106
|
-
now?: () => number;
|
|
107
|
-
occluder?: (from: EntityPosition, to: EntityPosition) => boolean;
|
|
108
|
-
/** Bind `ctx.game.save` to a pluggable backend (offline/single-player whole-world save). The shell resolves this from `defineGame({ save })`; multiplayer leaves it off (the host persists). */
|
|
109
|
-
save?: RuntimeSaveOptions;
|
|
110
|
-
/**
|
|
111
|
-
* Host-side per-viewer replication policy — private-state and area-of-interest projection over the
|
|
112
|
-
* wire. Bound on the authoritative host only. Unset (the default) replicates the whole world to every
|
|
113
|
-
* client, exactly as before; the simulation is identical either way, so a game plays the same.
|
|
114
|
-
*/
|
|
115
|
-
replication?: ReplicationPolicy;
|
|
116
|
-
}
|
|
117
|
-
export interface SceneObjectContext extends ObjectStore {
|
|
118
|
-
catalog(instanceId: string): GameContextObjectEntry | null;
|
|
119
|
-
raycast(input: ObjectRaycastInput): ObjectRaycastHit | null;
|
|
120
|
-
raycastAll(input: ObjectRaycastInput): readonly ObjectRaycastHit[];
|
|
121
|
-
setColliders(instanceId: string, colliders: EntityColliderSet | null): void;
|
|
122
|
-
collidersOf(instanceId: string): EntityColliderSet | null;
|
|
123
|
-
/**
|
|
124
|
-
* Per-instance selection/highlight state for placed objects — the reactive counterpart to
|
|
125
|
-
* `worldHealthBars`/`nameplates` (entities), so a build-mode or RTS selection ring reads
|
|
126
|
-
* `ctx.scene.object.selection` instead of hand-rolling one through `WorldOverlay` against external
|
|
127
|
-
* state. Mutations (`add`/`remove`/`toggle`/`replace`/`clear`) bump `ctx.version()`/notify
|
|
128
|
-
* `ctx.subscribe` like every other `ctx` surface. Render it with `WorldObjectHighlights`
|
|
129
|
-
* (`@jgengine/shell/world/WorldHud`).
|
|
130
|
-
*/
|
|
131
|
-
selection: SelectionSet;
|
|
132
|
-
}
|
|
133
|
-
export interface FloatTextInput {
|
|
134
|
-
instanceId?: string;
|
|
135
|
-
position?: [number, number, number];
|
|
136
|
-
text?: string;
|
|
137
|
-
kind?: string;
|
|
138
|
-
amount?: number;
|
|
139
|
-
hitType?: string;
|
|
140
|
-
element?: string;
|
|
141
|
-
crit?: boolean;
|
|
142
|
-
scale?: number;
|
|
143
|
-
}
|
|
144
|
-
/** Request a transient spell/ability VFX burst; `from`/`to` accept an instance id or a world point, `color` is a `0xRRGGBB` tint, and `durationMs` defaults per `kind`. */
|
|
145
|
-
export interface VfxInput {
|
|
146
|
-
kind: VfxKind;
|
|
147
|
-
color: number;
|
|
148
|
-
from?: string | readonly [number, number, number];
|
|
149
|
-
to?: string | readonly [number, number, number];
|
|
150
|
-
radius?: number;
|
|
151
|
-
durationMs?: number;
|
|
152
|
-
}
|
|
153
|
-
export interface TelegraphInput {
|
|
154
|
-
from: string;
|
|
155
|
-
shape: TelegraphShape;
|
|
156
|
-
at: [number, number, number];
|
|
157
|
-
dir?: number;
|
|
158
|
-
windupMs: number;
|
|
159
|
-
kind?: string;
|
|
160
|
-
effect?: {
|
|
161
|
-
effect: string;
|
|
162
|
-
via?: EffectVia;
|
|
163
|
-
radius?: number;
|
|
164
|
-
falloff?: "linear" | "none";
|
|
165
|
-
los?: boolean;
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
export interface HitReactionInput {
|
|
169
|
-
from: string;
|
|
170
|
-
to: string;
|
|
171
|
-
config: HitReactionConfig | ImpactPresetName;
|
|
172
|
-
power?: number;
|
|
173
|
-
}
|
|
174
|
-
/** Options for {@link SceneEntityContext.moveTowardCommit}: {@link MoveTowardOptions} plus an optional facing turn. */
|
|
175
|
-
export interface MoveTowardCommitOptions extends MoveTowardOptions {
|
|
176
|
-
/** Rotate the entity to face its direction of travel instead of preserving its current `rotationY`. Default false. */
|
|
177
|
-
face?: boolean;
|
|
178
|
-
}
|
|
179
|
-
export interface SceneEntityContext {
|
|
180
|
-
spawn(name: string, options?: SpawnOptions): string;
|
|
181
|
-
despawn(instanceId: string): boolean;
|
|
182
|
-
update: EntityStore["update"];
|
|
183
|
-
setPose(instanceId: string, pose: EntityPose): boolean;
|
|
184
|
-
setPoseConstraint: EntityStore["setPoseConstraint"];
|
|
185
|
-
get(instanceId: string): SceneEntity | null;
|
|
186
|
-
list(): readonly SceneEntity[];
|
|
187
|
-
ids: EntityStore["ids"];
|
|
188
|
-
subscribeMembership: EntityStore["subscribeMembership"];
|
|
189
|
-
spawnPoseOf(instanceId: string): SpawnPose | null;
|
|
190
|
-
resetToSpawn(instanceId: string): boolean;
|
|
191
|
-
resetAllToSpawn(filter?: (entity: SceneEntity) => boolean): number;
|
|
192
|
-
blackboard: EntityBlackboard;
|
|
193
|
-
stats: EntityStatsApi;
|
|
194
|
-
floatText(input: FloatTextInput): void;
|
|
195
|
-
vfx(input: VfxInput): void;
|
|
196
|
-
/**
|
|
197
|
-
* Retained VFX registry for long-lived, updatable effects (held beams, tethers, zones, target lines) whose
|
|
198
|
-
* endpoints and params change over time — the persistent complement to the one-shot {@link SceneEntityContext.vfx}
|
|
199
|
-
* burst. `upsert` creates/replaces by stable id, `update` nudges dynamic params, `stop` disposes with an optional
|
|
200
|
-
* fade; endpoints given as an entity instance id are followed live by the renderer without per-frame commands.
|
|
201
|
-
*/
|
|
202
|
-
vfxInstance: VfxInstanceStore;
|
|
203
|
-
telegraph(input: TelegraphInput): () => void;
|
|
204
|
-
hitReaction(input: HitReactionInput): HitReaction | null;
|
|
205
|
-
setTarget(fromId: string, toId: string | null): void;
|
|
206
|
-
getTarget(fromId: string): string | null;
|
|
207
|
-
cycleTarget(fromId: string, options?: CycleTargetOptions): string | null;
|
|
208
|
-
canReceive(instanceId: string, effect: string, magnitude?: number): string | null;
|
|
209
|
-
preview(input: SingleTargetEffectInput): number;
|
|
210
|
-
effect(input: EffectInput): EffectResult[];
|
|
211
|
-
willHitProjectile: ProjectileSystem["willHitProjectile"];
|
|
212
|
-
fireProjectile: ProjectileSystem["fireProjectile"];
|
|
213
|
-
settleProjectile: ProjectileSystem["settleProjectile"];
|
|
214
|
-
distance: SpatialApi["distance"];
|
|
215
|
-
inRadius: SpatialApi["inRadius"];
|
|
216
|
-
hasLineOfSight: SpatialApi["hasLineOfSight"];
|
|
217
|
-
queryArc: SpatialApi["queryArc"];
|
|
218
|
-
moveToward: SpatialApi["moveToward"];
|
|
219
|
-
/**
|
|
220
|
-
* `moveToward` plus commit: steps `instanceId` toward `target` and immediately `setPose`s the
|
|
221
|
-
* result, so a per-tick mover no longer pairs `moveToward` with a hand-written `setPose`.
|
|
222
|
-
* `options.face` turns the entity to its direction of travel; omitted preserves the current
|
|
223
|
-
* `rotationY`. Returns the committed position (`null`, committing nothing, when `moveToward` would
|
|
224
|
-
* — unknown instance/target).
|
|
225
|
-
*/
|
|
226
|
-
moveTowardCommit(instanceId: string, target: EntityPosition | string, options: MoveTowardCommitOptions): EntityPosition | null;
|
|
227
|
-
invalidateSpatial: SpatialApi["invalidate"];
|
|
228
|
-
setColliders(instanceId: string, colliders: EntityColliderSet | null): void;
|
|
229
|
-
collidersOf(instanceId: string): EntityColliderSet | null;
|
|
230
|
-
/** Uniform visual scale from the entity's catalog entry (1 when unscaled). */
|
|
231
|
-
visualScaleOf(instanceId: string): number;
|
|
232
|
-
form: Forms;
|
|
233
|
-
paint: PaintLayer;
|
|
234
|
-
/**
|
|
235
|
-
* Lazily creates (on first call) or returns the existing declarative bind for `key` — the sim-snapshot →
|
|
236
|
-
* scene-entity pose mirror (#673). Call `bind(key).sync(bodies, dt)` once per tick with every sim body's
|
|
237
|
-
* current snapshot instead of hand-writing `setPose` per body: an id seen for the first time is spawned
|
|
238
|
-
* from its `kind`, an id already bound is posed, and a previously-bound id absent from this tick's
|
|
239
|
-
* `bodies` is despawned — no per-game spawn/despawn dance.
|
|
240
|
-
*/
|
|
241
|
-
bind(key: string): BodyBind;
|
|
242
|
-
}
|
|
243
|
-
export type WorldItemPickupResult = {
|
|
244
|
-
status: "ok";
|
|
245
|
-
record: WorldItemRecord;
|
|
246
|
-
} | {
|
|
247
|
-
status: "rejected";
|
|
248
|
-
reason: string;
|
|
249
|
-
};
|
|
250
|
-
export interface SceneWorldItemContext {
|
|
251
|
-
spawn(input: WorldItemSpawnInput): WorldItemRecord;
|
|
252
|
-
get(instanceId: string): WorldItemRecord | null;
|
|
253
|
-
list(): readonly WorldItemRecord[];
|
|
254
|
-
nearestInRadius(from: EntityPosition, radius: number, filter?: (record: WorldItemRecord) => boolean): string | null;
|
|
255
|
-
pickup(instanceId: string, userId: string): WorldItemPickupResult;
|
|
256
|
-
consume(instanceId: string): WorldItemRecord | null;
|
|
257
|
-
}
|
|
258
|
-
export interface GameContextCommands {
|
|
259
|
-
define<TInput>(name: string, definition: CommandDefinition<GameContext, TInput>): void;
|
|
260
|
-
has(name: string): boolean;
|
|
261
|
-
names(): string[];
|
|
262
|
-
run(name: string, input: unknown): CommandResult<GameContext>;
|
|
263
|
-
/** Run a command attributed to `actorUserId` — a shared-world host routes each client's command through this so the handler can read {@link actor}. */
|
|
264
|
-
runAs(actorUserId: string, name: string, input: unknown): CommandResult<GameContext>;
|
|
265
|
-
/** The user a command is running on behalf of, or `null` outside a {@link runAs} call — commands default to `ctx.player.userId` when this is `null`. */
|
|
266
|
-
actor(): string | null;
|
|
267
|
-
}
|
|
268
|
-
export interface GameContextFeed extends Omit<GameFeed, "bind"> {
|
|
269
|
-
bind(action: keyof GameEventMap): () => void;
|
|
270
|
-
}
|
|
271
|
-
export interface GameContextLoot {
|
|
272
|
-
register(def: LootTableDef): void;
|
|
273
|
-
has(id: string): boolean;
|
|
274
|
-
roll(id: string, rng?: () => number): Drop[];
|
|
275
|
-
grantToPlayer(userId: string, drops: Drop[], source?: string): void;
|
|
276
|
-
}
|
|
277
|
-
export interface GameContextEconomy {
|
|
278
|
-
balance(userId: string, currencyId: string): number;
|
|
279
|
-
grant(userId: string, currencyId: string, amount: number): void;
|
|
280
|
-
/** `options.overdraft` opts this charge into carrying a negative balance (`true` unlimited, `{ max }` capped) — omitted keeps the strict no-debt default. */
|
|
281
|
-
charge(userId: string, currencyId: string, amount: number, options?: WalletChargeOptions): {
|
|
282
|
-
reason: string;
|
|
283
|
-
} | null;
|
|
284
|
-
/** True once `balance(userId, currencyId)` has gone negative under an overdraft-enabled charge. */
|
|
285
|
-
isOverdrawn(userId: string, currencyId: string): boolean;
|
|
286
|
-
}
|
|
287
|
-
export interface GameContextItemUse {
|
|
288
|
-
register(handlers: Record<string, ItemUseHandler<GameContext>>): void;
|
|
289
|
-
registered(): string[];
|
|
290
|
-
can(input: ItemUseInput): ItemUseRejection | null;
|
|
291
|
-
use(input: ItemUseInput): ItemUseResult<GameContext>;
|
|
292
|
-
}
|
|
293
|
-
export interface GameContextWorld {
|
|
294
|
-
ground: TerrainField;
|
|
295
|
-
groundHeightAt(x: number, z: number): number;
|
|
296
|
-
}
|
|
297
|
-
export interface GameContextCards {
|
|
298
|
-
/** Lazily creates (on first call, `config` required) or returns the existing notify-wrapped pile for `id`. */
|
|
299
|
-
pile(id: string, config?: CardPileConfig): CardPile;
|
|
300
|
-
}
|
|
301
|
-
export interface GameContextTurn {
|
|
302
|
-
/** Lazily creates (on first call, `config` required) or returns the existing notify-wrapped turn loop for `id`. */
|
|
303
|
-
loop(id: string, config?: TurnLoopConfig): TurnLoop;
|
|
304
|
-
}
|
|
305
|
-
export interface GameContextRace {
|
|
306
|
-
/** Lazily creates (on first call, `config` required) or returns the existing reactive race for `id` — discrete mutations and eventful `update` calls bump `ctx.version()`, so HUDs stop hand-managing `store.set` (#286.2). */
|
|
307
|
-
state(id: string, config?: RaceStateConfig): RaceState;
|
|
308
|
-
}
|
|
309
|
-
/** Reachable audio seam on `ctx.game`: `play`, `music`, and `resume` route through the `audio.play`/`audio.music`/`audio.resume` events the shell's audio engine listens on, so game code triggers sound without importing the shell. */
|
|
310
|
-
export interface GameAudio {
|
|
311
|
-
play(sound: string, at?: readonly [number, number, number]): void;
|
|
312
|
-
/** Crossfade the procedural soundtrack to `theme` (null fades out); `transpose` shifts the incoming theme's key in semitones. */
|
|
313
|
-
music(theme: string | null, transpose?: number): void;
|
|
314
|
-
resume(): void;
|
|
315
|
-
}
|
|
316
|
-
export interface GameContext {
|
|
317
|
-
scene: {
|
|
318
|
-
object: SceneObjectContext;
|
|
319
|
-
entity: SceneEntityContext;
|
|
320
|
-
worldItem: SceneWorldItemContext;
|
|
321
|
-
raycast(input: SceneRaycastInput): SceneRaycastHit | null;
|
|
322
|
-
raycastAll(input: SceneRaycastInput): readonly SceneRaycastHit[];
|
|
323
|
-
};
|
|
324
|
-
world: GameContextWorld;
|
|
325
|
-
game: {
|
|
326
|
-
commands: GameContextCommands;
|
|
327
|
-
events: GameEvents;
|
|
328
|
-
audio: GameAudio;
|
|
329
|
-
/** Play a model's one-shot animation clip bound to `event` in its `animation.oneShots` (e.g. an attack swing) — emits `entity.animation` for the shell to pick up. */
|
|
330
|
-
playEntityAnimation(instanceId: string, event: string): void;
|
|
331
|
-
feed: GameContextFeed;
|
|
332
|
-
loot: GameContextLoot;
|
|
333
|
-
/** Shop/vendor barter — present only when `features.trade` is set. */
|
|
334
|
-
trade?: TradeSystem;
|
|
335
|
-
/** Quest/mission journal — present only when `features.quest` is set. */
|
|
336
|
-
quest?: QuestJournal;
|
|
337
|
-
/** Talkable-NPC dialogue open/close bridge — present only when `features.dialogue` is set. */
|
|
338
|
-
dialogue?: GameDialogue;
|
|
339
|
-
/** Friends/party/presence/emotes/world-invites — present only when `features.social` is set. */
|
|
340
|
-
social?: Social;
|
|
341
|
-
/** Channels + messages — present only when `features.chat` is set (implies `social`). */
|
|
342
|
-
chat?: Chat;
|
|
343
|
-
/** Earned unlockable content — present only when `features.unlocks` is set. */
|
|
344
|
-
unlocks?: Unlocks;
|
|
345
|
-
economy: GameContextEconomy;
|
|
346
|
-
/** Competitive score tracking — present only when `features.leaderboard` is set. */
|
|
347
|
-
leaderboard?: Leaderboard;
|
|
348
|
-
/** Owned-entity roster — present only when `features.roster` is set. */
|
|
349
|
-
roster?: Roster;
|
|
350
|
-
/** Game-defined keyed reactive store slot (#163.1); mutations bump `ctx.version()`/notify `ctx.subscribe`. */
|
|
351
|
-
store: ObservableKeyedStore<unknown>;
|
|
352
|
-
/** Card pile zones — present only when `features.cards` is set. */
|
|
353
|
-
cards?: GameContextCards;
|
|
354
|
-
/** Turn/phase loop — present only when `features.turn` is set. */
|
|
355
|
-
turn?: GameContextTurn;
|
|
356
|
-
/** Lap/checkpoint race state — present only when `features.race` is set. */
|
|
357
|
-
race?: GameContextRace;
|
|
358
|
-
/** Connected-player set for a shared world — present only when `features.players` is set. */
|
|
359
|
-
players?: ConnectedPlayers;
|
|
360
|
-
/** Whole-world save/load bound to a pluggable backend — present only when `defineGame({ save })` is set (offline/single-player). Drive save points and quest/area checkpoints with `checkpoint()`, restore on boot with `load()`. */
|
|
361
|
-
save?: RuntimeSave;
|
|
362
|
-
/**
|
|
363
|
-
* Register a save-only snapshot module after boot (system-owned persistence).
|
|
364
|
-
* Used by `composeGameLoop` / `installSystems` when a system declares `save`.
|
|
365
|
-
*/
|
|
366
|
-
registerSave?(module: SnapshotModule): void;
|
|
367
|
-
/**
|
|
368
|
-
* Register a host→client replication module after boot (system-owned replication).
|
|
369
|
-
* Used by `composeGameLoop` / `installSystems` when a system declares `replicate`.
|
|
370
|
-
*/
|
|
371
|
-
registerReplicate?(module: SnapshotModule): void;
|
|
372
|
-
};
|
|
373
|
-
player: {
|
|
374
|
-
/** The acting player's id — the command actor inside `runAs`, the local player everywhere else. */
|
|
375
|
-
userId: string;
|
|
376
|
-
isNew: boolean;
|
|
377
|
-
/** The acting player's inventory set — the command actor's bags inside `runAs`, the local player's everywhere else. */
|
|
378
|
-
inventory: InventorySet<string>;
|
|
379
|
-
/** A specific player's inventory set — how a host reads or grants into any connected player's bags. */
|
|
380
|
-
inventoryFor(userId: string): InventorySet<string>;
|
|
381
|
-
/** The acting player's stat modifiers — the command actor's inside `runAs`, the local player's everywhere else. */
|
|
382
|
-
stats: Stats<string>;
|
|
383
|
-
/** A specific player's stat modifiers — how a host reads or buffs any connected player's stats. */
|
|
384
|
-
statsFor(userId: string): Stats<string>;
|
|
385
|
-
loadout: Loadouts;
|
|
386
|
-
applyLoadout(userId: string, loadoutId: string): {
|
|
387
|
-
reason: string;
|
|
388
|
-
} | null;
|
|
389
|
-
movement: PoseState;
|
|
390
|
-
possession: Possession;
|
|
391
|
-
/** Cosmetic skins/customization — present only when `features.cosmetics` is set. */
|
|
392
|
-
cosmetics?: Cosmetics;
|
|
393
|
-
/** Motion seam into the movement integrator (#162.4); routes to the command actor's queue (or the local player outside a command), so a command's impulse lands on whoever ran it. See `MotionIntents`. */
|
|
394
|
-
motion: MotionIntents;
|
|
395
|
-
/** A specific player's motion queue — how the host-side per-player movement integrator drains each connected player's impulses. */
|
|
396
|
-
motionFor(userId: string): MotionIntents;
|
|
397
|
-
};
|
|
398
|
-
item: {
|
|
399
|
-
use: GameContextItemUse;
|
|
400
|
-
weapon: WeaponStats;
|
|
401
|
-
};
|
|
402
|
-
time: SimClock;
|
|
403
|
-
/** Runtime camera-follow/cinematic override (#196.2); the shell reads `followedEntityId()` each frame. */
|
|
404
|
-
camera: CameraDirector;
|
|
405
|
-
/** Held-input snapshot published by the shell each frame before `onTick` (#164.1). */
|
|
406
|
-
input: InputSnapshot;
|
|
407
|
-
subscribe(listener: () => void): () => void;
|
|
408
|
-
version(): number;
|
|
409
|
-
/**
|
|
410
|
-
* Bump {@link version}/notify {@link subscribe} directly — the escape hatch for a command that only
|
|
411
|
-
* mutates game-owned state outside the entity/object/economy/store layers (an external session map,
|
|
412
|
-
* a plain closure variable) and needs to force a reactive HUD refresh without faking a `ctx.game.store.set`.
|
|
413
|
-
*/
|
|
414
|
-
touch(): void;
|
|
415
|
-
/**
|
|
416
|
-
* Gather every opted-in live subsystem into one {@link WorldSnapshot} — entities, entity stats, the
|
|
417
|
-
* keyed store, the action feed, plus leaderboard/chat when those features are on. The full-world
|
|
418
|
-
* baseline a host sends a joining client; {@link hydrate} is its inverse. Pass a `viewer` and the host
|
|
419
|
-
* projects the snapshot to only what that viewer may see (private state, area of interest) when a
|
|
420
|
-
* {@link GameContextOptions.replication} policy is set; without one the viewer argument is a no-op.
|
|
421
|
-
*/
|
|
422
|
-
snapshot(viewer?: SnapshotViewer): WorldSnapshot;
|
|
423
|
-
/** Apply a {@link WorldSnapshot} from an authoritative host, hydrating each subsystem key present in it. */
|
|
424
|
-
hydrate(snapshot: WorldSnapshot): void;
|
|
425
|
-
/** Aggregate world-dirty version summed across replicated modules; the host replicator skips an unchanged commit. @internal */
|
|
426
|
-
replicationVersion(): number;
|
|
427
|
-
/** True when a {@link GameContextOptions.replication} policy makes {@link snapshot} viewer-dependent (private/AOI projection is active). @internal */
|
|
428
|
-
replicatesPerViewer(): boolean;
|
|
429
|
-
}
|
|
2
|
+
import type { GameContext, GameContextOptions } from "./gameContextTypes.js";
|
|
3
|
+
export type { CatalogEntityRole, FloatTextInput, GameAudio, GameContext, GameContextCards, GameContextCommands, GameContextContent, GameContextEconomy, GameContextEntityEntry, GameContextFeed, GameContextItemEntry, GameContextItemUse, GameContextLoot, GameContextModels, GameContextObjectEntry, GameContextOptions, GameContextRace, GameContextTurn, GameContextWorld, HitReactionInput, MoveTowardCommitOptions, SceneEntityContext, SceneObjectContext, SceneWorldItemContext, TelegraphInput, VfxInput, WorldItemPickupResult, } from "./gameContextTypes.js";
|
|
430
4
|
export declare function createGameContext<TAssetRef extends ModelAssetRef, TMultiplayer>(options: GameContextOptions<TAssetRef, TMultiplayer>): GameContext;
|