@jgengine/core 0.9.0 → 0.11.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 +34 -3
- package/LICENSE +203 -661
- package/README.md +1 -1
- package/dist/ai/crowd.d.ts +55 -0
- package/dist/ai/crowd.js +114 -0
- package/dist/ai/flock.d.ts +5 -2
- package/dist/ai/flock.js +5 -2
- package/dist/ai/groupAssist.d.ts +1 -0
- package/dist/ai/groupAssist.js +1 -0
- package/dist/ai/heatSystem.d.ts +76 -0
- package/dist/ai/heatSystem.js +97 -0
- package/dist/ai/interestScheduler.d.ts +107 -0
- package/dist/ai/interestScheduler.js +118 -0
- package/dist/ai/jobBoard.d.ts +1 -0
- package/dist/ai/jobBoard.js +1 -0
- package/dist/ai/laneSelect.d.ts +5 -2
- package/dist/ai/laneSelect.js +5 -2
- package/dist/ai/mobBrain.d.ts +1 -0
- package/dist/ai/mobBrain.js +1 -0
- package/dist/ai/spawnDirector.d.ts +19 -1
- package/dist/ai/spawnDirector.js +53 -26
- package/dist/ai/spawnPoint.d.ts +7 -0
- package/dist/ai/spawnPoint.js +7 -0
- package/dist/ai/targetAcquisition.d.ts +84 -0
- package/dist/ai/targetAcquisition.js +92 -0
- package/dist/anim/easing.d.ts +19 -0
- package/dist/anim/easing.js +19 -0
- package/dist/anim/oscillator.d.ts +12 -0
- package/dist/anim/oscillator.js +25 -0
- package/dist/area/areaEffectField.d.ts +127 -0
- package/dist/area/areaEffectField.js +175 -0
- package/dist/area/stackPolicy.d.ts +47 -0
- package/dist/area/stackPolicy.js +99 -0
- package/dist/audio/audioFalloff.d.ts +5 -2
- package/dist/audio/music.d.ts +53 -0
- package/dist/audio/music.js +34 -0
- package/dist/audio/synth.d.ts +60 -0
- package/dist/audio/synth.js +8 -0
- package/dist/authoring.d.ts +15 -0
- package/dist/authoring.js +15 -0
- package/dist/board/laneBoard.d.ts +13 -0
- package/dist/board/laneBoard.js +13 -0
- package/dist/board/timelineBoard.d.ts +10 -0
- package/dist/board/timelineBoard.js +10 -0
- package/dist/combat/abilityKit.d.ts +18 -0
- package/dist/combat/abilityKit.js +24 -9
- package/dist/combat/animationState.d.ts +5 -0
- package/dist/combat/animationState.js +5 -0
- package/dist/combat/breakMeters.d.ts +10 -0
- package/dist/combat/breakMeters.js +10 -0
- package/dist/combat/castRunner.d.ts +5 -0
- package/dist/combat/castRunner.js +5 -0
- package/dist/combat/comboPoints.d.ts +5 -0
- package/dist/combat/comboPoints.js +5 -0
- package/dist/combat/comboString.d.ts +5 -0
- package/dist/combat/comboString.js +5 -0
- package/dist/combat/damageInterceptors.d.ts +192 -0
- package/dist/combat/damageInterceptors.js +251 -0
- package/dist/combat/damageMatchup.d.ts +68 -0
- package/dist/combat/damageMatchup.js +42 -0
- package/dist/combat/damageResolution.d.ts +63 -0
- package/dist/combat/damageResolution.js +50 -0
- package/dist/combat/death.d.ts +7 -1
- package/dist/combat/death.js +5 -0
- package/dist/combat/deathReason.d.ts +14 -0
- package/dist/combat/deathReason.js +1 -0
- package/dist/combat/defensiveWindow.d.ts +5 -0
- package/dist/combat/defensiveWindow.js +5 -0
- package/dist/combat/dotField.d.ts +47 -0
- package/dist/combat/dotField.js +52 -0
- package/dist/combat/downed.d.ts +5 -0
- package/dist/combat/downed.js +5 -0
- package/dist/combat/effects.d.ts +5 -0
- package/dist/combat/effects.js +5 -0
- package/dist/combat/encounterSequence.d.ts +258 -0
- package/dist/combat/encounterSequence.js +426 -0
- package/dist/combat/hitReaction.d.ts +57 -1
- package/dist/combat/hitReaction.js +45 -5
- package/dist/combat/magazine.d.ts +54 -0
- package/dist/combat/magazine.js +96 -0
- package/dist/combat/projectiles.d.ts +7 -2
- package/dist/combat/projectiles.js +48 -17
- package/dist/combat/receivedDamage.d.ts +117 -0
- package/dist/combat/receivedDamage.js +92 -0
- package/dist/combat/regenShield.d.ts +39 -0
- package/dist/combat/regenShield.js +49 -0
- package/dist/combat/renderCues.d.ts +51 -0
- package/dist/combat/renderCues.js +44 -0
- package/dist/combat/resourcePool.d.ts +5 -0
- package/dist/combat/resourcePool.js +5 -0
- package/dist/combat/rewardAllocation.d.ts +121 -0
- package/dist/combat/rewardAllocation.js +251 -0
- package/dist/combat/shotOrigin.d.ts +30 -1
- package/dist/combat/shotOrigin.js +70 -2
- package/dist/combat/statusApplication.d.ts +96 -0
- package/dist/combat/statusApplication.js +81 -0
- package/dist/combat/telegraph.d.ts +11 -2
- package/dist/combat/telegraph.js +11 -2
- package/dist/combat/thresholdCrossings.d.ts +85 -0
- package/dist/combat/thresholdCrossings.js +116 -0
- package/dist/combat.d.ts +34 -0
- package/dist/combat.js +34 -0
- package/dist/commands/commandRegistry.d.ts +11 -0
- package/dist/commands/commandRegistry.js +9 -2
- package/dist/crafting/crop.d.ts +18 -0
- package/dist/crafting/crop.js +18 -0
- package/dist/crafting/production.d.ts +5 -0
- package/dist/crafting/production.js +5 -0
- package/dist/devtools/rewriteTunables.d.ts +17 -0
- package/dist/devtools/rewriteTunables.js +276 -0
- package/dist/devtools/saveEndpoint.d.ts +46 -0
- package/dist/devtools/saveEndpoint.js +48 -0
- package/dist/devtools/transformTunables.d.ts +3 -0
- package/dist/devtools/transformTunables.js +3 -0
- package/dist/devtools/tunableSchema.d.ts +31 -0
- package/dist/devtools/tunableSchema.js +31 -0
- package/dist/economy/currency.d.ts +12 -1
- package/dist/economy/currency.js +12 -1
- package/dist/economy/listingBook.d.ts +91 -0
- package/dist/economy/listingBook.js +144 -0
- package/dist/economy/resourceLedger.d.ts +222 -0
- package/dist/economy/resourceLedger.js +353 -0
- package/dist/economy/sharedWallet.d.ts +14 -0
- package/dist/economy/sharedWallet.js +14 -0
- package/dist/economy/techTree.d.ts +12 -0
- package/dist/economy/techTree.js +12 -0
- package/dist/economy/wallet.d.ts +26 -2
- package/dist/economy/wallet.js +35 -6
- package/dist/editor/commands.d.ts +248 -0
- package/dist/editor/commands.js +865 -0
- package/dist/editor/document.d.ts +186 -0
- package/dist/editor/document.js +884 -0
- package/dist/editor/grid.d.ts +229 -0
- package/dist/editor/grid.js +366 -0
- package/dist/editor/gridAdapters.d.ts +80 -0
- package/dist/editor/gridAdapters.js +134 -0
- package/dist/editor/index.d.ts +97 -0
- package/dist/editor/index.js +10 -0
- package/dist/editor/liveSync.d.ts +127 -0
- package/dist/editor/liveSync.js +249 -0
- package/dist/editor/runtimeInspector.d.ts +88 -0
- package/dist/editor/runtimeInspector.js +239 -0
- package/dist/editor/types.d.ts +175 -0
- package/dist/editor/types.js +29 -0
- package/dist/faction/reputation.d.ts +5 -0
- package/dist/faction/reputation.js +5 -0
- package/dist/format/distance.d.ts +17 -0
- package/dist/format/distance.js +18 -0
- package/dist/format/duration.d.ts +27 -0
- package/dist/format/duration.js +45 -0
- package/dist/format/speed.d.ts +17 -0
- package/dist/format/speed.js +25 -0
- package/dist/game/connectedPlayers.d.ts +30 -0
- package/dist/game/connectedPlayers.js +21 -0
- package/dist/game/cosmetics.d.ts +9 -0
- package/dist/game/cosmetics.js +16 -0
- package/dist/game/defineGame.d.ts +141 -2
- package/dist/game/defineGame.js +39 -1
- package/dist/game/defineSystem.d.ts +88 -0
- package/dist/game/defineSystem.js +45 -0
- package/dist/game/dialogue.d.ts +33 -0
- package/dist/game/dialogue.js +21 -0
- package/dist/game/events.d.ts +50 -13
- package/dist/game/events.js +5 -0
- package/dist/game/feed.d.ts +33 -0
- package/dist/game/feed.js +35 -2
- package/dist/game/gamePhase.d.ts +11 -0
- package/dist/game/gamePhase.js +16 -0
- package/dist/game/keyValueStore.d.ts +25 -0
- package/dist/game/keyValueStore.js +61 -0
- package/dist/game/leaderboard.d.ts +5 -0
- package/dist/game/leaderboard.js +5 -0
- package/dist/game/levelSequence.d.ts +24 -2
- package/dist/game/levelSequence.js +51 -2
- package/dist/game/loadout.d.ts +5 -0
- package/dist/game/loadout.js +5 -0
- package/dist/game/lootFilter.d.ts +2 -0
- package/dist/game/lootFilter.js +2 -0
- package/dist/game/lootPipeline.d.ts +164 -0
- package/dist/game/lootPipeline.js +216 -0
- package/dist/game/lootTable.d.ts +21 -0
- package/dist/game/lootTable.js +15 -4
- package/dist/game/modelAnimation.d.ts +8 -0
- package/dist/game/modelAnimation.js +18 -0
- package/dist/game/objectives.d.ts +43 -0
- package/dist/game/objectives.js +36 -0
- package/dist/game/paramLayers.d.ts +148 -0
- package/dist/game/paramLayers.js +185 -0
- package/dist/game/ping.d.ts +5 -0
- package/dist/game/ping.js +5 -0
- package/dist/game/playableGame.d.ts +160 -12
- package/dist/game/quest.d.ts +8 -0
- package/dist/game/quest.js +29 -0
- package/dist/game/race.d.ts +141 -0
- package/dist/game/race.js +169 -0
- package/dist/game/recordBook.d.ts +5 -5
- package/dist/game/recordBook.js +4 -1
- package/dist/game/ruleSelection.d.ts +75 -0
- package/dist/game/ruleSelection.js +127 -0
- package/dist/game/runDraft.d.ts +5 -0
- package/dist/game/runDraft.js +5 -0
- package/dist/game/saveStore.d.ts +111 -0
- package/dist/game/saveStore.js +312 -0
- package/dist/game/snapshotHistory.d.ts +67 -0
- package/dist/game/snapshotHistory.js +95 -0
- package/dist/game/social.d.ts +38 -1
- package/dist/game/social.js +71 -0
- package/dist/game/spawnPoints.d.ts +5 -0
- package/dist/game/spawnPoints.js +5 -0
- package/dist/game/systemRuntime.d.ts +50 -0
- package/dist/game/systemRuntime.js +157 -0
- package/dist/game/systemSchedule.d.ts +72 -0
- package/dist/game/systemSchedule.js +242 -0
- package/dist/game/toasts.d.ts +43 -0
- package/dist/game/toasts.js +44 -0
- package/dist/game/trade.d.ts +10 -0
- package/dist/game/trade.js +10 -0
- package/dist/game/unlocks.d.ts +8 -0
- package/dist/game/unlocks.js +16 -0
- package/dist/game/vfxInstance.d.ts +138 -0
- package/dist/game/vfxInstance.js +96 -0
- package/dist/game/worldItem.d.ts +17 -4
- package/dist/game/worldItem.js +17 -4
- package/dist/gameplay.d.ts +91 -0
- package/dist/gameplay.js +91 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +5 -7
- package/dist/input/actionBindings.d.ts +24 -5
- package/dist/input/actionBindings.js +23 -5
- package/dist/input/axisInput.d.ts +13 -1
- package/dist/input/axisInput.js +22 -1
- package/dist/input/controlGroups.d.ts +67 -0
- package/dist/input/controlGroups.js +41 -0
- package/dist/input/touchScheme.d.ts +82 -6
- package/dist/input/touchScheme.js +123 -10
- package/dist/interaction/contextMenu.d.ts +1 -0
- package/dist/interaction/contextMenu.js +1 -0
- package/dist/interaction/lockpick.d.ts +61 -0
- package/dist/interaction/lockpick.js +168 -0
- package/dist/interaction/proximityPrompt.d.ts +5 -1
- package/dist/interaction/proximityPrompt.js +5 -3
- package/dist/interaction/qte.d.ts +5 -0
- package/dist/interaction/qte.js +5 -0
- package/dist/interaction/skillCheck.d.ts +5 -0
- package/dist/interaction/skillCheck.js +5 -0
- package/dist/inventory/inventoryModel.d.ts +12 -0
- package/dist/inventory/inventoryModel.js +12 -0
- package/dist/inventory/shapedGrid.d.ts +16 -0
- package/dist/inventory/shapedGrid.js +16 -0
- package/dist/inventory/slotModel.d.ts +10 -0
- package/dist/inventory/slotModel.js +10 -0
- package/dist/item/durability.d.ts +5 -0
- package/dist/item/durability.js +5 -0
- package/dist/item/itemIdentity.d.ts +171 -0
- package/dist/item/itemIdentity.js +138 -0
- package/dist/item/itemInstanceRegistry.d.ts +32 -0
- package/dist/item/itemInstanceRegistry.js +34 -0
- package/dist/item/itemgen.d.ts +163 -0
- package/dist/item/itemgen.js +151 -0
- package/dist/item/modularItem.d.ts +5 -0
- package/dist/item/modularItem.js +5 -0
- package/dist/item/use.d.ts +5 -0
- package/dist/item/use.js +5 -0
- package/dist/item/useBehavior.d.ts +142 -0
- package/dist/item/useBehavior.js +105 -0
- package/dist/item/weapon.d.ts +5 -0
- package/dist/item/weapon.js +5 -0
- package/dist/math/scalar.d.ts +25 -0
- package/dist/math/scalar.js +47 -0
- package/dist/meta/changelog.d.ts +4 -1
- package/dist/meta/changelog.js +36 -1
- package/dist/movement/avoidance.d.ts +45 -0
- package/dist/movement/avoidance.js +123 -0
- package/dist/movement/cameraRig.d.ts +8 -0
- package/dist/movement/cameraRig.js +8 -0
- package/dist/movement/dash.d.ts +11 -0
- package/dist/movement/dash.js +11 -0
- package/dist/movement/formation.d.ts +135 -0
- package/dist/movement/formation.js +194 -0
- package/dist/movement/glideModel.d.ts +5 -0
- package/dist/movement/glideModel.js +5 -0
- package/dist/movement/grappleSwing.d.ts +5 -0
- package/dist/movement/grappleSwing.js +5 -0
- package/dist/movement/leaderTrail.d.ts +5 -0
- package/dist/movement/leaderTrail.js +5 -0
- package/dist/movement/movementModel.d.ts +38 -7
- package/dist/movement/movementModel.js +54 -13
- package/dist/movement/playerMovement.d.ts +41 -0
- package/dist/movement/playerMovement.js +236 -0
- package/dist/movement/poseState.d.ts +13 -0
- package/dist/movement/poseState.js +16 -0
- package/dist/movement/steering.d.ts +8 -0
- package/dist/movement/steering.js +18 -0
- package/dist/multiplayer/combatSnapshot.d.ts +3 -0
- package/dist/multiplayer/combatSnapshot.js +3 -0
- package/dist/multiplayer/lagCompensation.d.ts +5 -0
- package/dist/multiplayer/lagCompensation.js +5 -0
- package/dist/multiplayer/presenceModel.d.ts +9 -1
- package/dist/multiplayer/presenceModel.js +9 -1
- package/dist/multiplayer/simultaneousCommit.d.ts +3 -0
- package/dist/multiplayer/simultaneousCommit.js +3 -0
- package/dist/multiplayer.d.ts +11 -0
- package/dist/multiplayer.js +11 -0
- package/dist/nav/pathFollow.d.ts +57 -0
- package/dist/nav/pathFollow.js +109 -0
- package/dist/orders/orderKinds.d.ts +156 -0
- package/dist/orders/orderKinds.js +197 -0
- package/dist/orders/orderQueue.d.ts +208 -0
- package/dist/orders/orderQueue.js +211 -0
- package/dist/physics/drivableVehicle.d.ts +29 -0
- package/dist/physics/drivableVehicle.js +16 -0
- package/dist/physics/kinematicVehicle.d.ts +21 -1
- package/dist/physics/kinematicVehicle.js +23 -8
- package/dist/physics/physicsWorld.d.ts +24 -12
- package/dist/physics/physicsWorld.js +11 -5
- package/dist/physics/radialImpulse.d.ts +25 -0
- package/dist/physics/radialImpulse.js +27 -0
- package/dist/procedural.d.ts +3 -0
- package/dist/procedural.js +3 -0
- package/dist/progression/statGraph.d.ts +116 -0
- package/dist/progression/statGraph.js +318 -0
- package/dist/puzzle/cellGrid.d.ts +9 -0
- package/dist/puzzle/cellGrid.js +9 -0
- package/dist/puzzle/fallingPiece.d.ts +9 -0
- package/dist/puzzle/fallingPiece.js +9 -0
- package/dist/puzzle/nonogram.d.ts +39 -0
- package/dist/puzzle/nonogram.js +136 -0
- package/dist/random/nameGen.d.ts +5 -0
- package/dist/random/nameGen.js +5 -0
- package/dist/random/pick.d.ts +8 -0
- package/dist/random/pick.js +31 -0
- package/dist/random/rng.d.ts +24 -0
- package/dist/random/rng.js +30 -8
- package/dist/random/seedLink.d.ts +4 -0
- package/dist/random/seedLink.js +4 -0
- package/dist/relation/keyedValues.d.ts +54 -0
- package/dist/relation/keyedValues.js +115 -0
- package/dist/relation/thresholds.d.ts +62 -0
- package/dist/relation/thresholds.js +62 -0
- package/dist/render/color.d.ts +12 -0
- package/dist/render/color.js +26 -0
- package/dist/render/lookPreset.d.ts +41 -0
- package/dist/render/lookPreset.js +29 -0
- package/dist/render/postProcessing.d.ts +76 -0
- package/dist/render/postProcessing.js +21 -0
- package/dist/rules/predicate.d.ts +53 -0
- package/dist/rules/predicate.js +64 -0
- package/dist/rules/ruleEffects.d.ts +38 -0
- package/dist/rules/ruleEffects.js +37 -0
- package/dist/rules/triggeredRules.d.ts +160 -0
- package/dist/rules/triggeredRules.js +241 -0
- package/dist/runtime/adapter.d.ts +58 -0
- package/dist/runtime/adapter.js +54 -5
- package/dist/runtime/cameraDirector.d.ts +1 -0
- package/dist/runtime/cameraDirector.js +1 -0
- package/dist/runtime/commandRunner.d.ts +1 -0
- package/dist/runtime/commandRunner.js +1 -0
- package/dist/runtime/context/combatFx.d.ts +23 -0
- package/dist/runtime/context/combatFx.js +161 -0
- package/dist/runtime/context/registries.d.ts +13 -0
- package/dist/runtime/context/registries.js +84 -0
- package/dist/runtime/context/worldItems.d.ts +21 -0
- package/dist/runtime/context/worldItems.js +37 -0
- package/dist/runtime/descriptors/baseline.d.ts +48 -0
- package/dist/runtime/descriptors/baseline.js +134 -0
- package/dist/runtime/descriptors/features.d.ts +74 -0
- package/dist/runtime/descriptors/features.js +281 -0
- package/dist/runtime/gameContext.d.ts +163 -19
- package/dist/runtime/gameContext.js +385 -339
- package/dist/runtime/gameRuntime.d.ts +1 -0
- package/dist/runtime/gameRuntime.js +1 -0
- package/dist/runtime/headlessRunner.d.ts +60 -0
- package/dist/runtime/headlessRunner.js +44 -0
- package/dist/runtime/hostPersistence.d.ts +12 -0
- package/dist/runtime/hostPersistence.js +12 -0
- package/dist/runtime/hostedGameRunner.d.ts +54 -0
- package/dist/runtime/hostedGameRunner.js +85 -0
- package/dist/runtime/hostedWorldSession.d.ts +73 -0
- package/dist/runtime/hostedWorldSession.js +64 -0
- package/dist/runtime/inputSnapshot.d.ts +21 -3
- package/dist/runtime/inputSnapshot.js +8 -2
- package/dist/runtime/motionIntents.d.ts +12 -1
- package/dist/runtime/motionIntents.js +26 -1
- package/dist/runtime/perContext.d.ts +15 -0
- package/dist/runtime/perContext.js +21 -0
- package/dist/runtime/runtimeSave.d.ts +79 -0
- package/dist/runtime/runtimeSave.js +105 -0
- package/dist/runtime/save.d.ts +4 -0
- package/dist/runtime/save.js +4 -0
- package/dist/runtime/snapshot.d.ts +7 -0
- package/dist/runtime/snapshot.js +7 -0
- package/dist/runtime/visibility.d.ts +2 -1
- package/dist/runtime/visibility.js +2 -1
- package/dist/runtime/worldChannel.d.ts +62 -0
- package/dist/runtime/worldChannel.js +114 -0
- package/dist/runtime/worldMirror.d.ts +36 -0
- package/dist/runtime/worldMirror.js +44 -0
- package/dist/runtime/worldProjection.d.ts +47 -0
- package/dist/runtime/worldProjection.js +52 -0
- package/dist/runtime/worldReplication.d.ts +69 -0
- package/dist/runtime/worldReplication.js +217 -0
- package/dist/runtime/worldSnapshot.d.ts +44 -0
- package/dist/runtime/worldSnapshot.js +30 -0
- package/dist/scene/assetCatalog.d.ts +22 -0
- package/dist/scene/assetCatalog.js +4 -0
- package/dist/scene/assetDiagnostics.d.ts +69 -0
- package/dist/scene/assetDiagnostics.js +110 -0
- package/dist/scene/assetGenerator.d.ts +65 -0
- package/dist/scene/assetGenerator.js +64 -0
- package/dist/scene/assetSpace.d.ts +137 -0
- package/dist/scene/assetSpace.js +259 -0
- package/dist/scene/authoredTriggers.d.ts +169 -0
- package/dist/scene/authoredTriggers.js +340 -0
- package/dist/scene/behaviorRuntime.d.ts +75 -0
- package/dist/scene/behaviorRuntime.js +217 -0
- package/dist/scene/behaviors.d.ts +14 -2
- package/dist/scene/behaviors.js +7 -2
- package/dist/scene/bodyBind.d.ts +60 -0
- package/dist/scene/bodyBind.js +51 -0
- package/dist/scene/builtinSceneKinds.d.ts +5 -0
- package/dist/scene/builtinSceneKinds.js +62 -0
- package/dist/scene/colliders.d.ts +18 -0
- package/dist/scene/colliders.js +61 -1
- package/dist/scene/entityStats.d.ts +13 -0
- package/dist/scene/entityStats.js +30 -0
- package/dist/scene/entityStore.d.ts +41 -1
- package/dist/scene/entityStore.js +75 -0
- package/dist/scene/facing.d.ts +18 -0
- package/dist/scene/facing.js +26 -0
- package/dist/scene/modelSockets.d.ts +33 -0
- package/dist/scene/modelSockets.js +29 -0
- package/dist/scene/objectQuery.d.ts +2 -0
- package/dist/scene/objectQuery.js +2 -0
- package/dist/scene/objectStore.d.ts +4 -0
- package/dist/scene/objectStore.js +6 -0
- package/dist/scene/possession.d.ts +8 -0
- package/dist/scene/possession.js +14 -0
- package/dist/scene/roster.d.ts +3 -0
- package/dist/scene/roster.js +12 -0
- package/dist/scene/sceneKinds.d.ts +240 -0
- package/dist/scene/sceneKinds.js +214 -0
- package/dist/scene/sceneOwnership.d.ts +169 -0
- package/dist/scene/sceneOwnership.js +179 -0
- package/dist/scene/selectionBookmarks.d.ts +93 -0
- package/dist/scene/selectionBookmarks.js +122 -0
- package/dist/scene/vehicleSeat.d.ts +68 -0
- package/dist/scene/vehicleSeat.js +59 -0
- package/dist/sensor/concealment.d.ts +3 -0
- package/dist/sensor/concealment.js +3 -0
- package/dist/sensor/freezeMonitor.d.ts +1 -0
- package/dist/sensor/freezeMonitor.js +1 -0
- package/dist/sensor/frustumSensor.d.ts +7 -3
- package/dist/sensor/frustumSensor.js +7 -3
- package/dist/sensor/hiddenStateProbe.d.ts +5 -2
- package/dist/sensor/hiddenStateProbe.js +5 -2
- package/dist/sensor/recordingBuffer.d.ts +2 -1
- package/dist/sensor/recordingBuffer.js +2 -1
- package/dist/sensor/replayLoop.d.ts +6 -2
- package/dist/sensor/replayLoop.js +6 -2
- package/dist/sensor/revealQuery.d.ts +2 -1
- package/dist/sensor/revealQuery.js +2 -1
- package/dist/sensor/visionCone.d.ts +10 -3
- package/dist/sensor/visionCone.js +10 -3
- package/dist/session/contestedChannel.d.ts +1 -0
- package/dist/session/contestedChannel.js +1 -0
- package/dist/session/extraction.d.ts +1 -0
- package/dist/session/extraction.js +1 -0
- package/dist/session/roles.d.ts +6 -0
- package/dist/session/roles.js +6 -0
- package/dist/session/roundState.d.ts +8 -0
- package/dist/session/roundState.js +2 -0
- package/dist/settings/settingsModel.d.ts +1 -0
- package/dist/settings/settingsModel.js +1 -0
- package/dist/stats/accumulatorMeter.d.ts +6 -0
- package/dist/stats/accumulatorMeter.js +6 -0
- package/dist/stats/eventMeter.d.ts +5 -0
- package/dist/stats/eventMeter.js +5 -0
- package/dist/stats/rollCheck.d.ts +5 -0
- package/dist/stats/rollCheck.js +5 -0
- package/dist/stats/statModifiers.d.ts +5 -0
- package/dist/stats/statModifiers.js +5 -0
- package/dist/store/defineKeyedStore.d.ts +38 -0
- package/dist/store/defineKeyedStore.js +42 -0
- package/dist/store/defineStore.d.ts +33 -0
- package/dist/store/defineStore.js +35 -0
- package/dist/store/observableKeyedStore.d.ts +9 -0
- package/dist/store/observableKeyedStore.js +43 -2
- package/dist/survival/decayMeter.d.ts +55 -0
- package/dist/survival/decayMeter.js +130 -55
- package/dist/survival/moodle.d.ts +2 -0
- package/dist/survival/regionHealth.d.ts +6 -0
- package/dist/survival/regionHealth.js +5 -0
- package/dist/tactics/fallingGrid.d.ts +6 -4
- package/dist/tactics/fallingGrid.js +6 -4
- package/dist/tactics/predictiveQuery.d.ts +3 -0
- package/dist/tactics/predictiveQuery.js +3 -0
- package/dist/tactics/snapshot.d.ts +2 -0
- package/dist/tactics/snapshot.js +2 -0
- package/dist/tactics/surface.d.ts +1 -0
- package/dist/tactics/surface.js +1 -0
- package/dist/tactics/tacticalGrid.d.ts +1 -0
- package/dist/tactics/tacticalGrid.js +1 -0
- package/dist/time/beatClock.d.ts +14 -4
- package/dist/time/beatClock.js +14 -4
- package/dist/time/calendarClock.d.ts +3 -0
- package/dist/time/calendarClock.js +3 -0
- package/dist/time/idleProgress.d.ts +4 -0
- package/dist/time/idleProgress.js +4 -0
- package/dist/time/simClock.d.ts +2 -0
- package/dist/time/simClock.js +20 -5
- package/dist/ui/actionModel.d.ts +110 -0
- package/dist/ui/actionModel.js +159 -0
- package/dist/ui/gameLayout.d.ts +144 -0
- package/dist/ui/gameLayout.js +148 -0
- package/dist/ui/hudDocument.d.ts +114 -0
- package/dist/ui/hudDocument.js +220 -0
- package/dist/ui/hudLayout.d.ts +33 -1
- package/dist/ui/hudLayout.js +204 -17
- package/dist/ui/orientation.d.ts +39 -0
- package/dist/ui/orientation.js +49 -0
- package/dist/ui/selectionModel.d.ts +92 -0
- package/dist/ui/selectionModel.js +88 -0
- package/dist/ui/swingTimer.d.ts +42 -0
- package/dist/ui/swingTimer.js +38 -0
- package/dist/ui/tooltipModel.d.ts +63 -0
- package/dist/ui/tooltipModel.js +82 -0
- package/dist/ui.d.ts +15 -0
- package/dist/ui.js +15 -0
- package/dist/visibility/bounds.d.ts +8 -1
- package/dist/visibility/bounds.js +8 -1
- package/dist/visibility/frustum.d.ts +12 -3
- package/dist/visibility/frustum.js +12 -3
- package/dist/visibility/spatialIndex.js +34 -20
- package/dist/work/jobQueue.d.ts +201 -0
- package/dist/work/jobQueue.js +253 -0
- package/dist/work/unitTraining.d.ts +58 -0
- package/dist/work/unitTraining.js +52 -0
- package/dist/world/authoredObjects.d.ts +58 -0
- package/dist/world/authoredObjects.js +69 -0
- package/dist/world/buildingGenerator.d.ts +18 -0
- package/dist/world/buildingGenerator.js +62 -0
- package/dist/world/buildings.d.ts +5 -0
- package/dist/world/buildings.js +5 -0
- package/dist/world/catenary.d.ts +22 -0
- package/dist/world/catenary.js +69 -0
- package/dist/world/environmentSummary.d.ts +11 -2
- package/dist/world/environmentSummary.js +11 -1
- package/dist/world/features.d.ts +244 -7
- package/dist/world/features.js +92 -4
- package/dist/world/footprintGrid.d.ts +59 -0
- package/dist/world/footprintGrid.js +141 -0
- package/dist/world/geometry.d.ts +64 -0
- package/dist/world/geometry.js +94 -0
- package/dist/world/grassKind.d.ts +51 -0
- package/dist/world/grassKind.js +101 -0
- package/dist/world/pathInstances.d.ts +27 -0
- package/dist/world/pathInstances.js +27 -0
- package/dist/world/pathTerrain.d.ts +80 -0
- package/dist/world/pathTerrain.js +142 -0
- package/dist/world/placeAsset.d.ts +81 -0
- package/dist/world/placeAsset.js +77 -0
- package/dist/world/placement.d.ts +4 -0
- package/dist/world/placement.js +4 -0
- package/dist/world/placementController.d.ts +6 -0
- package/dist/world/placementController.js +6 -0
- package/dist/world/polyline.d.ts +34 -0
- package/dist/world/polyline.js +81 -0
- package/dist/world/roads.d.ts +55 -0
- package/dist/world/roads.js +184 -0
- package/dist/world/scatterRegion.d.ts +164 -0
- package/dist/world/scatterRegion.js +409 -0
- package/dist/world/sceneShapes.d.ts +43 -0
- package/dist/world/sceneShapes.js +1 -0
- package/dist/world/segment.d.ts +27 -0
- package/dist/world/segment.js +43 -0
- package/dist/world/soilKind.d.ts +48 -0
- package/dist/world/soilKind.js +92 -0
- package/dist/world/spatialSample.d.ts +241 -0
- package/dist/world/spatialSample.js +465 -0
- package/dist/world/streets.d.ts +80 -0
- package/dist/world/streets.js +144 -0
- package/dist/world/terraform.d.ts +213 -1
- package/dist/world/terraform.js +655 -20
- package/dist/world/terrain.d.ts +138 -12
- package/dist/world/terrain.js +346 -28
- package/dist/world/terrainGuides.d.ts +182 -0
- package/dist/world/terrainGuides.js +343 -0
- package/dist/world/vec2.d.ts +81 -0
- package/dist/world/vec2.js +128 -0
- package/dist/world/vec3.d.ts +49 -0
- package/dist/world/vec3.js +76 -0
- package/dist/world/vegetation.d.ts +71 -0
- package/dist/world/vegetation.js +151 -0
- package/dist/world/visibilityField.d.ts +154 -0
- package/dist/world/visibilityField.js +271 -0
- package/dist/world/volumetricClouds.d.ts +52 -0
- package/dist/world/volumetricClouds.js +43 -0
- package/dist/world/walls.d.ts +9 -0
- package/dist/world/walls.js +9 -0
- package/dist/world/waterKind.d.ts +55 -0
- package/dist/world/waterKind.js +99 -0
- package/dist/world.d.ts +132 -0
- package/dist/world.js +132 -0
- package/package.json +32 -8
- package/skills/jgengine/SKILL.md +51 -0
- package/skills/jgengine/api.md +434 -0
- package/skills/jgengine/capabilities.md +29 -0
- package/skills/jgengine/reference-cartridge.md +72 -0
- package/skills/jgengine-combat/SKILL.md +34 -0
- package/skills/jgengine-combat/api.md +549 -0
- package/skills/jgengine-combat/capabilities.md +169 -0
- package/skills/jgengine-combat/reference.md +98 -0
- package/skills/jgengine-gameplay/SKILL.md +39 -0
- package/skills/jgengine-gameplay/api.md +1794 -0
- package/skills/jgengine-gameplay/capabilities.md +378 -0
- package/skills/jgengine-gameplay/reference-systems.md +60 -0
- package/skills/jgengine-world/SKILL.md +38 -0
- package/skills/jgengine-world/api.md +2652 -0
- package/skills/jgengine-world/capabilities.md +370 -0
- package/skills/jgengine-world/reference.md +222 -0
- package/dist/cartridge/runtime.d.ts +0 -15
- package/dist/cartridge/runtime.js +0 -556
- package/dist/cartridge/spec.d.ts +0 -188
- package/dist/cartridge/spec.js +0 -19
- package/dist/cartridge/validate.d.ts +0 -2
- package/dist/cartridge/validate.js +0 -78
- package/dist/store/engineStore.d.ts +0 -22
- package/dist/store/engineStore.js +0 -50
- package/dist/store/features.d.ts +0 -10
- package/dist/store/features.js +0 -23
- package/llms.txt +0 -4983
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Target unit for {@link formatSpeed}: km/h, mph, knots, or raw m/s. */
|
|
2
|
+
export type SpeedUnit = "kmh" | "mph" | "knots" | "ms";
|
|
3
|
+
/** Options for {@link formatSpeed}. */
|
|
4
|
+
export interface SpeedFormat {
|
|
5
|
+
/** Target unit to convert into from the m/s input. Defaults to `"kmh"`. */
|
|
6
|
+
unit?: SpeedUnit;
|
|
7
|
+
/** Fractional digits to show. Defaults to 0. */
|
|
8
|
+
decimals?: 0 | 1 | 2;
|
|
9
|
+
/** Append the unit label. Defaults to true; set false to compose custom unit styling. */
|
|
10
|
+
showUnit?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Format a speed given in meters/second as a HUD-ready string in km/h, mph, knots, or m/s — the one conversion table every speedometer and telemetry readout should share.
|
|
14
|
+
*
|
|
15
|
+
* @capability speed-format render a m/s speed as km/h, mph, knots, or m/s for speedometers and telemetry HUDs
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatSpeed(metersPerSecond: number, options?: SpeedFormat): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const SPEED_UNIT_FACTOR = {
|
|
2
|
+
kmh: 3.6,
|
|
3
|
+
mph: 2.2369362920544025,
|
|
4
|
+
knots: 1.9438444924406046,
|
|
5
|
+
ms: 1,
|
|
6
|
+
};
|
|
7
|
+
const SPEED_UNIT_LABEL = {
|
|
8
|
+
kmh: "km/h",
|
|
9
|
+
mph: "mph",
|
|
10
|
+
knots: "kn",
|
|
11
|
+
ms: "m/s",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Format a speed given in meters/second as a HUD-ready string in km/h, mph, knots, or m/s — the one conversion table every speedometer and telemetry readout should share.
|
|
15
|
+
*
|
|
16
|
+
* @capability speed-format render a m/s speed as km/h, mph, knots, or m/s for speedometers and telemetry HUDs
|
|
17
|
+
*/
|
|
18
|
+
export function formatSpeed(metersPerSecond, options = {}) {
|
|
19
|
+
const unit = options.unit ?? "kmh";
|
|
20
|
+
const decimals = options.decimals ?? 0;
|
|
21
|
+
const showUnit = options.showUnit ?? true;
|
|
22
|
+
const converted = Math.max(0, metersPerSecond) * SPEED_UNIT_FACTOR[unit];
|
|
23
|
+
const text = converted.toFixed(decimals);
|
|
24
|
+
return showUnit ? `${text} ${SPEED_UNIT_LABEL[unit]}` : text;
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InputFrame } from "../runtime/inputSnapshot.js";
|
|
2
|
+
/** A player currently joined to a hosted world — the unit a shared-world loop iterates instead of `ctx.player`. Frozen by the registry (see {@link ConnectedPlayers.get}); fields are `readonly` so a caller can't edit its own copy and assume the change stuck. */
|
|
3
|
+
export interface ConnectedPlayer {
|
|
4
|
+
readonly userId: string;
|
|
5
|
+
readonly isNew: boolean;
|
|
6
|
+
/** This player's latest {@link InputFrame}, written by the host each time the client sends input; `null` until the first frame arrives. The per-player movement seam reads it in `onTick`. */
|
|
7
|
+
readonly input: InputFrame | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The set of players connected to one hosted world. A single-player game uses `ctx.player`; a shared-world loop
|
|
11
|
+
* reads `ctx.game.players` so `onTick` can advance every connected hero, not just the one local player. The host
|
|
12
|
+
* (`HostedGameRunner`) drives `join`/`leave`/`setInput`; game code reads `list`/`ids`/`has`/`count`/`input`.
|
|
13
|
+
*/
|
|
14
|
+
export interface ConnectedPlayers {
|
|
15
|
+
join(userId: string, isNew: boolean): void;
|
|
16
|
+
leave(userId: string): boolean;
|
|
17
|
+
has(userId: string): boolean;
|
|
18
|
+
/** Returns a frozen `ConnectedPlayer` — mutating it (or reassigning `.input`) throws instead of corrupting the registry. */
|
|
19
|
+
get(userId: string): ConnectedPlayer | null;
|
|
20
|
+
/** Frozen `ConnectedPlayer` entries, same immutability contract as {@link get}. */
|
|
21
|
+
list(): readonly ConnectedPlayer[];
|
|
22
|
+
ids(): readonly string[];
|
|
23
|
+
count(): number;
|
|
24
|
+
/** Record a player's latest input frame (host-driven); a no-op for a player that hasn't joined. */
|
|
25
|
+
setInput(userId: string, frame: InputFrame): void;
|
|
26
|
+
/** This player's latest input frame, or `null` if they haven't joined or no frame has arrived yet. */
|
|
27
|
+
input(userId: string): InputFrame | null;
|
|
28
|
+
}
|
|
29
|
+
/** Build an empty {@link ConnectedPlayers} registry — the host joins/leaves players; the game loop reads them. */
|
|
30
|
+
export declare function createConnectedPlayers(): ConnectedPlayers;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Build an empty {@link ConnectedPlayers} registry — the host joins/leaves players; the game loop reads them. */
|
|
2
|
+
export function createConnectedPlayers() {
|
|
3
|
+
const players = new Map();
|
|
4
|
+
return {
|
|
5
|
+
join(userId, isNew) {
|
|
6
|
+
players.set(userId, Object.freeze({ userId, isNew, input: null }));
|
|
7
|
+
},
|
|
8
|
+
leave: (userId) => players.delete(userId),
|
|
9
|
+
has: (userId) => players.has(userId),
|
|
10
|
+
get: (userId) => players.get(userId) ?? null,
|
|
11
|
+
list: () => Array.from(players.values()),
|
|
12
|
+
ids: () => Array.from(players.keys()),
|
|
13
|
+
count: () => players.size,
|
|
14
|
+
setInput(userId, frame) {
|
|
15
|
+
const player = players.get(userId);
|
|
16
|
+
if (player !== undefined)
|
|
17
|
+
players.set(userId, Object.freeze({ ...player, input: frame }));
|
|
18
|
+
},
|
|
19
|
+
input: (userId) => players.get(userId)?.input ?? null,
|
|
20
|
+
};
|
|
21
|
+
}
|
package/dist/game/cosmetics.d.ts
CHANGED
|
@@ -21,5 +21,14 @@ export interface Cosmetics {
|
|
|
21
21
|
get(userId: string): Readonly<Record<string, string>>;
|
|
22
22
|
snapshot(userId: string): Record<string, string>;
|
|
23
23
|
hydrate(userId: string, state: Record<string, string>): void;
|
|
24
|
+
/** Snapshot every user's equipped slots for a whole-world save. */
|
|
25
|
+
snapshotAll(): Record<string, Record<string, string>>;
|
|
26
|
+
/** Restore every user's equipped slots from a {@link snapshotAll} payload. */
|
|
27
|
+
hydrateAll(state: Record<string, Record<string, string>>): void;
|
|
24
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Equip cosmetic skins and customizations by slot, independent of gameplay stats.
|
|
31
|
+
*
|
|
32
|
+
* @capability cosmetics equip cosmetic skins and customizations by slot
|
|
33
|
+
*/
|
|
25
34
|
export declare function createCosmetics(deps?: CosmeticsDeps): Cosmetics;
|
package/dist/game/cosmetics.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const EMPTY_SLOTS = Object.freeze({});
|
|
2
|
+
/**
|
|
3
|
+
* Equip cosmetic skins and customizations by slot, independent of gameplay stats.
|
|
4
|
+
*
|
|
5
|
+
* @capability cosmetics equip cosmetic skins and customizations by slot
|
|
6
|
+
*/
|
|
2
7
|
export function createCosmetics(deps = {}) {
|
|
3
8
|
const definitions = new Map();
|
|
4
9
|
const equipped = new Map();
|
|
@@ -47,5 +52,16 @@ export function createCosmetics(deps = {}) {
|
|
|
47
52
|
hydrate(userId, state) {
|
|
48
53
|
equipped.set(userId, { ...state });
|
|
49
54
|
},
|
|
55
|
+
snapshotAll() {
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const [userId, slots] of equipped)
|
|
58
|
+
out[userId] = { ...slots };
|
|
59
|
+
return out;
|
|
60
|
+
},
|
|
61
|
+
hydrateAll(state) {
|
|
62
|
+
equipped.clear();
|
|
63
|
+
for (const [userId, slots] of Object.entries(state))
|
|
64
|
+
equipped.set(userId, { ...slots });
|
|
65
|
+
},
|
|
50
66
|
};
|
|
51
67
|
}
|
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import type { ActionCodesMap } from "../input/actionBindings.js";
|
|
2
2
|
import type { GameFeedOptions } from "./feed.js";
|
|
3
|
+
import type { GamePhase } from "./gamePhase.js";
|
|
4
|
+
import type { SystemDefinition } from "./defineSystem.js";
|
|
3
5
|
import type { ItemTraits } from "../inventory/inventoryModel.js";
|
|
4
6
|
import type { StorageTier } from "../inventory/storageTier.js";
|
|
7
|
+
import type { GameContext } from "../runtime/gameContext.js";
|
|
8
|
+
import type { ReplicationPolicy } from "../runtime/worldProjection.js";
|
|
9
|
+
import type { RuntimeSaveMode } from "../runtime/runtimeSave.js";
|
|
5
10
|
import type { SaveConfig } from "../runtime/save.js";
|
|
6
11
|
import { type AssetCatalog, type ModelAssetRef } from "../scene/assetCatalog.js";
|
|
7
12
|
import { type EntityStore } from "../scene/entityStore.js";
|
|
13
|
+
import type { StoreHandle } from "../store/defineStore.js";
|
|
8
14
|
import type { TimeConfig } from "../time/simClock.js";
|
|
9
15
|
import type { WorldFeature } from "../world/features.js";
|
|
16
|
+
/** Tunes offline whole-world save (`defineGame({ persist })`). Defaults: continuous `autosave` to `localStorage`, one slot, no version. */
|
|
17
|
+
export interface PersistConfig {
|
|
18
|
+
/** `"autosave"` (default) writes on a debounce after any change; `"manual"` writes only on `ctx.game.save.checkpoint()` (save points / quest triggers). */
|
|
19
|
+
mode?: RuntimeSaveMode;
|
|
20
|
+
/** `"local"` (default) persists to `localStorage`; `"memory"` keeps saves in-session only (tests, "no persistence" mode). */
|
|
21
|
+
storage?: "local" | "memory";
|
|
22
|
+
/** Save-format version; bump when the world shape changes in a save-breaking way. */
|
|
23
|
+
version?: number;
|
|
24
|
+
/** Autosave debounce in ms (autosave mode). Default 3000. */
|
|
25
|
+
autosaveMs?: number;
|
|
26
|
+
}
|
|
27
|
+
/** World gravity and jump tuning, plus scene-object collision opt-ins, for the game's physics step. */
|
|
10
28
|
export interface PhysicsConfig {
|
|
11
29
|
gravity?: number;
|
|
12
30
|
jumpVelocity?: number;
|
|
13
31
|
/** Opt placed scene objects into projectile raycasts as blocking cover AABBs. Default false — enabling changes where shots land. */
|
|
14
32
|
projectileObstacles?: boolean;
|
|
15
33
|
}
|
|
34
|
+
/** Shape of one named inventory a game declares — slot count, accepted item types, HUD binding. */
|
|
16
35
|
export interface InventoryDeclaration {
|
|
17
36
|
slots: number;
|
|
18
37
|
hud?: string;
|
|
@@ -21,20 +40,122 @@ export interface InventoryDeclaration {
|
|
|
21
40
|
applyModifiers?: boolean;
|
|
22
41
|
tier?: StorageTier;
|
|
23
42
|
}
|
|
43
|
+
/** Hosting mode for a game's multiplayer server: `"persistent"`, or a custom mode with its own options. */
|
|
24
44
|
export type GameServerConfig = "persistent" | {
|
|
25
45
|
mode: string;
|
|
26
46
|
[key: string]: unknown;
|
|
27
47
|
};
|
|
48
|
+
/** Identity of a player joining or leaving a hosted world — passed to the multiplayer loop hooks. */
|
|
49
|
+
export interface LoopPlayer {
|
|
50
|
+
userId: string;
|
|
51
|
+
isNew: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Lifecycle hooks a game implements to drive init, per-tick simulation, and player join/leave. */
|
|
28
54
|
export interface GameLoop<TContext = unknown> {
|
|
29
55
|
onInit?(ctx: TContext): void;
|
|
30
|
-
|
|
56
|
+
/** Once per join. `player` identifies the joiner in a hosted world; single-player callers may omit it. */
|
|
57
|
+
onNewPlayer?(ctx: TContext, player?: LoopPlayer): void;
|
|
31
58
|
onTick?(ctx: TContext, dt: number): void;
|
|
59
|
+
/** Once per leave in a hosted world (never fired single-player). Despawn the player's entities / release their slots here. */
|
|
60
|
+
onPlayerLeave?(ctx: TContext, player: LoopPlayer): void;
|
|
61
|
+
/** Scenario/run reset — clear run-scoped state. Composed system `reset` hooks run here too. */
|
|
62
|
+
onReset?(ctx: TContext): void;
|
|
63
|
+
/** World teardown (mode switch, unmount). Composed system `dispose` hooks run here too. */
|
|
64
|
+
onDispose?(ctx: TContext): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A scope cleanups register onto, run in LIFO order exactly once — the shared shape behind every
|
|
68
|
+
* teardown path in this codebase (a looping audio handle's source/gain nodes, a GPU texture swap on
|
|
69
|
+
* entity/scene replacement). Registering after `dispose()` has already run invokes the cleanup
|
|
70
|
+
* immediately instead of dropping it, so a resource created by a still-in-flight async step (e.g. a
|
|
71
|
+
* decoded audio buffer) never leaks past a `stop()`/unmount that raced ahead of it.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export interface DisposerScope {
|
|
75
|
+
onDispose(cleanup: () => void): void;
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
export interface Disposer extends DisposerScope {
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|
|
81
|
+
/** @internal */
|
|
82
|
+
export declare function createDisposer(): Disposer;
|
|
83
|
+
/**
|
|
84
|
+
* Opt-in `ctx.game.*` subsystems. Absent = off: the game doesn't carry (or expose) it, and `ctx.game.<name>`
|
|
85
|
+
* is `undefined`. Present (`true`) builds it. The universal base — `commands`, `events`, `store`, `feed` — is
|
|
86
|
+
* always on and not listed here. This is what keeps core genre-agnostic: a puzzle game isn't handed an MMO's
|
|
87
|
+
* leaderboard/roster/turn plumbing it never asked for.
|
|
88
|
+
*/
|
|
89
|
+
export interface GameFeatures {
|
|
90
|
+
/** Quest/mission journal (`ctx.game.quest`) — quest-driven games. */
|
|
91
|
+
quest?: boolean;
|
|
92
|
+
/** Shop/vendor barter (`ctx.game.trade`) — games with buy/sell economies. */
|
|
93
|
+
trade?: boolean;
|
|
94
|
+
/** Earned unlockable content (`ctx.game.unlocks`) — progression-gated games. */
|
|
95
|
+
unlocks?: boolean;
|
|
96
|
+
/** Cosmetic skins/customization (`ctx.player.cosmetics`) — appearance-customization games. */
|
|
97
|
+
cosmetics?: boolean;
|
|
98
|
+
/** Owned/captured entity roster (`ctx.game.roster`) — pet/monster collection games. */
|
|
99
|
+
roster?: boolean;
|
|
100
|
+
/** Card pile zones (`ctx.game.cards`) — deckbuilders, card games. */
|
|
101
|
+
cards?: boolean;
|
|
102
|
+
/** Turn/phase loop (`ctx.game.turn`) — turn-based games. */
|
|
103
|
+
turn?: boolean;
|
|
104
|
+
/** Talkable-NPC dialogue bridge (`ctx.game.dialogue`) — auto-registers `dialogue.open`/`dialogue.close`; dialogue-driven games. */
|
|
105
|
+
dialogue?: boolean;
|
|
106
|
+
/** Lap/checkpoint race state (`ctx.game.race`) — racers. */
|
|
107
|
+
race?: boolean;
|
|
108
|
+
/** Competitive score tracking (`ctx.game.leaderboard`) — ranked/arcade games. */
|
|
109
|
+
leaderboard?: boolean;
|
|
110
|
+
/** Friends/party/presence/emotes/world-invites (`ctx.game.social`) — social/MMO games. */
|
|
111
|
+
social?: boolean;
|
|
112
|
+
/** Channels + messages (`ctx.game.chat`) — implies `social`; multiplayer/social games. */
|
|
113
|
+
chat?: boolean;
|
|
114
|
+
/** Connected-player set (`ctx.game.players`) — shared-world hosts whose loop ticks every player, not just `ctx.player`. */
|
|
115
|
+
players?: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Declarative start/restart run lifecycle: the state transitions a game's run phase every genre repeats
|
|
119
|
+
* (title screen → live run → live run → title screen again), expressed as pure functions over one typed
|
|
120
|
+
* {@link StoreHandle} slot instead of hand-rolled `commands.define("start"/"restart")` glue that re-derives
|
|
121
|
+
* phase after every mutation. `start`/`restart` receive the store's own value type — the store's `TState`,
|
|
122
|
+
* never `ctx.game.store.get(key) as T` — and return the next value; the runtime writes it back and derives
|
|
123
|
+
* {@link GamePhase} from it via `phaseOf` in one place, so every adopting game gets identical, correct
|
|
124
|
+
* phase-sync for free.
|
|
125
|
+
*
|
|
126
|
+
* @capability lifecycle declarative start/restart run flow — the engine owns the command glue and phase sync, the game supplies pure state transitions
|
|
127
|
+
*/
|
|
128
|
+
export interface LifecycleConfig<TState = unknown> {
|
|
129
|
+
/** The store slot holding this game's run state; `start`/`restart` transform its current value. */
|
|
130
|
+
store: StoreHandle<TState>;
|
|
131
|
+
/** Pure transition into a live run. `input` is whatever the `start` command was invoked with (e.g. a chosen difficulty/tier). */
|
|
132
|
+
start(state: TState, ctx: GameContext, input?: unknown): TState;
|
|
133
|
+
/** Pure transition back into a fresh live run — same shape as `start` but never re-shows the menu first. */
|
|
134
|
+
restart(state: TState, ctx: GameContext): TState;
|
|
135
|
+
/** Derive the canonical {@link GamePhase} from the run state. The runtime calls this after every loop hook (`onInit`/`onNewPlayer`/`onTick`) as well as after `start`/`restart`, publishing the result only when it changed — so a game never hand-writes a per-tick `setGamePhase` ternary or its own previous-phase diff. */
|
|
136
|
+
phaseOf(state: TState): GamePhase;
|
|
137
|
+
/** Override the registered command names — default `"start"`/`"restart"` — for games whose input bindings already name them differently. */
|
|
138
|
+
commands?: {
|
|
139
|
+
start?: string;
|
|
140
|
+
restart?: string;
|
|
141
|
+
};
|
|
32
142
|
}
|
|
143
|
+
/** Fully-resolved game description produced by {@link defineGame} — assets, scene, and opted-in subsystems. */
|
|
33
144
|
export interface GameDefinition<TAssetRef extends ModelAssetRef = ModelAssetRef, TMultiplayer = unknown> {
|
|
34
145
|
name: string;
|
|
35
146
|
assets: AssetCatalog<TAssetRef>;
|
|
36
147
|
multiplayer: TMultiplayer;
|
|
148
|
+
/** @deprecated No longer the runtime store — `createGameContext` mints a fresh per-context `EntityStore` so one host can serve many worlds without state bleed (#632). Retained only for API compatibility; read `ctx.scene.entity` instead. */
|
|
37
149
|
scene: EntityStore;
|
|
150
|
+
/** Opt-in `ctx.game.*` subsystems beyond the always-on base; omitted systems are `undefined` on `ctx.game`. */
|
|
151
|
+
features?: GameFeatures;
|
|
152
|
+
/**
|
|
153
|
+
* Composable game capabilities — the preferred authoring path for runtime behavior.
|
|
154
|
+
* Each system owns timing, events, and optional save/replication/reset/disposal.
|
|
155
|
+
* Installing a system with `feature` enables that `ctx.game.*` capability without a redundant flag.
|
|
156
|
+
* Classic `loop` hooks still run for incremental migration (systems tick first, then `loop.onTick`).
|
|
157
|
+
*/
|
|
158
|
+
systems?: readonly SystemDefinition[];
|
|
38
159
|
world?: WorldFeature;
|
|
39
160
|
physics?: PhysicsConfig;
|
|
40
161
|
/** Simulation clock: real→game time scale, selectable speeds, calendar. Exposed as `ctx.time`; the shell feeds its scaled dt to `loop.onTick`. */
|
|
@@ -45,10 +166,28 @@ export interface GameDefinition<TAssetRef extends ModelAssetRef = ModelAssetRef,
|
|
|
45
166
|
input?: ActionCodesMap;
|
|
46
167
|
server?: GameServerConfig;
|
|
47
168
|
save?: SaveConfig;
|
|
169
|
+
/** Offline/single-player whole-world save. `true` autosaves the entire game to `localStorage`; a config object tunes the mode/cadence/target. Binds `ctx.game.save` — the game drives save points and restore. Ignored for multiplayer worlds (the host persists). */
|
|
170
|
+
persist?: boolean | PersistConfig;
|
|
48
171
|
ui?: unknown;
|
|
49
|
-
loop?: GameLoop<
|
|
172
|
+
loop?: GameLoop<GameContext>;
|
|
173
|
+
/** Declarative start/restart run lifecycle — see {@link LifecycleConfig}. Omitted games keep hand-rolling their own commands. */
|
|
174
|
+
lifecycle?: LifecycleConfig;
|
|
175
|
+
/**
|
|
176
|
+
* Host-side per-viewer replication policy — private-state and area-of-interest projection over the
|
|
177
|
+
* wire. Applied on every authoritative host (ws, Convex, loopback); clients need not set it. Unset
|
|
178
|
+
* replicates the whole world to every client (today's behavior). Changes only what each client sees,
|
|
179
|
+
* never the simulation, so the game plays identically with or without it.
|
|
180
|
+
*/
|
|
181
|
+
replication?: ReplicationPolicy;
|
|
50
182
|
}
|
|
183
|
+
/** Input to {@link defineGame} — a `GameDefinition` with `scene` derived and `assets` optional. */
|
|
51
184
|
export type GameDefinitionConfig<TAssetRef extends ModelAssetRef = ModelAssetRef, TMultiplayer = unknown> = Omit<GameDefinition<TAssetRef, TMultiplayer>, "scene" | "assets"> & {
|
|
52
185
|
assets?: AssetCatalog<TAssetRef>;
|
|
53
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Task-first entry point for authoring a game: fills in `scene` and default `assets`, validates `name`,
|
|
189
|
+
* OR-merges `features` from installed systems, and composes `loop` from `systems` + any classic hooks.
|
|
190
|
+
*
|
|
191
|
+
* @capability define-game single public game-authoring path — compose systems, world, and loop in one definition
|
|
192
|
+
*/
|
|
54
193
|
export declare function defineGame<TAssetRef extends ModelAssetRef, TMultiplayer>(config: GameDefinitionConfig<TAssetRef, TMultiplayer>): GameDefinition<TAssetRef, TMultiplayer>;
|
package/dist/game/defineGame.js
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
|
+
import { mergeSystemFeatures } from "./defineSystem.js";
|
|
2
|
+
import { composeGameLoop } from "./systemRuntime.js";
|
|
1
3
|
import { createAssetCatalog } from "../scene/assetCatalog.js";
|
|
2
4
|
import { createEntityStore } from "../scene/entityStore.js";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export function createDisposer() {
|
|
7
|
+
const cleanups = [];
|
|
8
|
+
let disposed = false;
|
|
9
|
+
return {
|
|
10
|
+
onDispose(cleanup) {
|
|
11
|
+
if (disposed) {
|
|
12
|
+
cleanup();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
cleanups.push(cleanup);
|
|
16
|
+
},
|
|
17
|
+
dispose() {
|
|
18
|
+
if (disposed)
|
|
19
|
+
return;
|
|
20
|
+
disposed = true;
|
|
21
|
+
while (cleanups.length > 0) {
|
|
22
|
+
cleanups.pop()();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Task-first entry point for authoring a game: fills in `scene` and default `assets`, validates `name`,
|
|
29
|
+
* OR-merges `features` from installed systems, and composes `loop` from `systems` + any classic hooks.
|
|
30
|
+
*
|
|
31
|
+
* @capability define-game single public game-authoring path — compose systems, world, and loop in one definition
|
|
32
|
+
*/
|
|
3
33
|
export function defineGame(config) {
|
|
4
34
|
if (config.name.trim().length === 0) {
|
|
5
35
|
throw new Error("defineGame: name must be non-empty");
|
|
6
36
|
}
|
|
7
|
-
|
|
37
|
+
const features = mergeSystemFeatures(config.features, config.systems);
|
|
38
|
+
const loop = composeGameLoop(config.systems, config.loop);
|
|
39
|
+
return {
|
|
40
|
+
...config,
|
|
41
|
+
features,
|
|
42
|
+
loop,
|
|
43
|
+
scene: createEntityStore(),
|
|
44
|
+
assets: config.assets ?? createAssetCatalog(),
|
|
45
|
+
};
|
|
8
46
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { GameFeatures } from "./defineGame.js";
|
|
2
|
+
import type { GameContext } from "../runtime/gameContext.js";
|
|
3
|
+
import type { SnapshotModule } from "../runtime/worldSnapshot.js";
|
|
4
|
+
/**
|
|
5
|
+
* How a system is scheduled. Omit `tick` (or use only `events`) for event-driven systems.
|
|
6
|
+
* Multiple systems may share the same channel; order within a channel is deterministic by stage
|
|
7
|
+
* then optional `before`/`after` constraints — never import order.
|
|
8
|
+
*/
|
|
9
|
+
export type SystemTick = {
|
|
10
|
+
type: "fixed";
|
|
11
|
+
/** Steps per game-second. Default 60. */
|
|
12
|
+
rate?: number;
|
|
13
|
+
stage?: string;
|
|
14
|
+
after?: string | readonly string[];
|
|
15
|
+
before?: string | readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
type: "frame";
|
|
18
|
+
stage?: string;
|
|
19
|
+
after?: string | readonly string[];
|
|
20
|
+
before?: string | readonly string[];
|
|
21
|
+
} | {
|
|
22
|
+
type: "interval";
|
|
23
|
+
/** Period in game-seconds between runs. */
|
|
24
|
+
every: number;
|
|
25
|
+
stage?: string;
|
|
26
|
+
after?: string | readonly string[];
|
|
27
|
+
before?: string | readonly string[];
|
|
28
|
+
} | {
|
|
29
|
+
type: "manual";
|
|
30
|
+
};
|
|
31
|
+
/** Event name → handler. Payload is the engine event shape for that name. */
|
|
32
|
+
export type SystemEventHandlers = {
|
|
33
|
+
readonly [eventName: string]: (ctx: GameContext, event: unknown) => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A reusable game capability — lifecycle, timing, events, and optional save / replication /
|
|
37
|
+
* reset / disposal. Pass instances via `defineGame({ systems })`. Prefer one system per meaningful
|
|
38
|
+
* capability (`combat`, `quests`), not per micro-tick.
|
|
39
|
+
*
|
|
40
|
+
* @capability game-system declare a composable capability with its own schedule and lifecycle
|
|
41
|
+
*/
|
|
42
|
+
export interface SystemDefinition {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
/**
|
|
45
|
+
* Timing channel. Omit for event-only systems (handlers in {@link events} still run).
|
|
46
|
+
* `manual` systems install but never auto-tick — call them yourself or leave as infrastructure.
|
|
47
|
+
*/
|
|
48
|
+
tick?: SystemTick;
|
|
49
|
+
/** Other system ids that must also be installed; validated when the schedule compiles. */
|
|
50
|
+
dependsOn?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Opt-in `ctx.game.*` feature(s) this system needs. Installing the system enables them — no
|
|
53
|
+
* separate `features: { quest: true }` flag required (you may still set flags for systems-free games).
|
|
54
|
+
*/
|
|
55
|
+
feature?: keyof GameFeatures | readonly (keyof GameFeatures)[];
|
|
56
|
+
/** Once per world boot, before {@link start}. */
|
|
57
|
+
create?(ctx: GameContext): void;
|
|
58
|
+
/** Once per world boot, after every system's `create`. */
|
|
59
|
+
start?(ctx: GameContext): void;
|
|
60
|
+
/** Per schedule fire — `dt` is game-seconds for the step (fixed/frame/interval). */
|
|
61
|
+
update?(ctx: GameContext, dt: number): void;
|
|
62
|
+
events?: SystemEventHandlers;
|
|
63
|
+
/**
|
|
64
|
+
* Whole-world save contribution. A factory form runs after `create` so closures can close over
|
|
65
|
+
* system state. Registered into `ctx.game.save` coverage.
|
|
66
|
+
*/
|
|
67
|
+
save?: SnapshotModule | ((ctx: GameContext) => SnapshotModule | undefined);
|
|
68
|
+
/**
|
|
69
|
+
* Host→client replication contribution. Same factory form as {@link save}; registered into
|
|
70
|
+
* `ctx.snapshot` / `ctx.hydrate`.
|
|
71
|
+
*/
|
|
72
|
+
replicate?: SnapshotModule | ((ctx: GameContext) => SnapshotModule | undefined);
|
|
73
|
+
/** Run on scenario/run reset — clear run-scoped state while meta may survive. */
|
|
74
|
+
reset?(ctx: GameContext): void;
|
|
75
|
+
/** Run when the world is torn down (mode switch, unmount). */
|
|
76
|
+
dispose?(ctx: GameContext): void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Declare a composable game system. Pure data + hooks — the engine compiles the schedule and
|
|
80
|
+
* installs lifecycle when the game boots.
|
|
81
|
+
*/
|
|
82
|
+
export declare function defineSystem(definition: SystemDefinition): SystemDefinition;
|
|
83
|
+
/** Collect feature flags implied by a system list (OR-merge; installing a system activates its capability).
|
|
84
|
+
* @internal */
|
|
85
|
+
export declare function featuresFromSystems(systems: readonly SystemDefinition[] | undefined): GameFeatures;
|
|
86
|
+
/** OR-merge explicit `features` with flags implied by installed systems.
|
|
87
|
+
* @internal */
|
|
88
|
+
export declare function mergeSystemFeatures(explicit: GameFeatures | undefined, systems: readonly SystemDefinition[] | undefined): GameFeatures | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declare a composable game system. Pure data + hooks — the engine compiles the schedule and
|
|
3
|
+
* installs lifecycle when the game boots.
|
|
4
|
+
*/
|
|
5
|
+
export function defineSystem(definition) {
|
|
6
|
+
if (definition.id.trim().length === 0) {
|
|
7
|
+
throw new Error("defineSystem: id must be non-empty");
|
|
8
|
+
}
|
|
9
|
+
if (definition.tick?.type === "interval" && !(definition.tick.every > 0)) {
|
|
10
|
+
throw new Error(`defineSystem "${definition.id}": interval.every must be > 0`);
|
|
11
|
+
}
|
|
12
|
+
if (definition.tick?.type === "fixed" && definition.tick.rate !== undefined && !(definition.tick.rate > 0)) {
|
|
13
|
+
throw new Error(`defineSystem "${definition.id}": fixed.rate must be > 0`);
|
|
14
|
+
}
|
|
15
|
+
return definition;
|
|
16
|
+
}
|
|
17
|
+
/** Collect feature flags implied by a system list (OR-merge; installing a system activates its capability).
|
|
18
|
+
* @internal */
|
|
19
|
+
export function featuresFromSystems(systems) {
|
|
20
|
+
const out = {};
|
|
21
|
+
if (systems === undefined)
|
|
22
|
+
return out;
|
|
23
|
+
for (const system of systems) {
|
|
24
|
+
if (system.feature === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
const keys = typeof system.feature === "string" ? [system.feature] : system.feature;
|
|
27
|
+
for (const key of keys)
|
|
28
|
+
out[key] = true;
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** OR-merge explicit `features` with flags implied by installed systems.
|
|
33
|
+
* @internal */
|
|
34
|
+
export function mergeSystemFeatures(explicit, systems) {
|
|
35
|
+
const fromSystems = featuresFromSystems(systems);
|
|
36
|
+
if (explicit === undefined) {
|
|
37
|
+
return Object.keys(fromSystems).length === 0 ? undefined : fromSystems;
|
|
38
|
+
}
|
|
39
|
+
const merged = { ...explicit };
|
|
40
|
+
for (const key of Object.keys(fromSystems)) {
|
|
41
|
+
if (fromSystems[key] === true)
|
|
42
|
+
merged[key] = true;
|
|
43
|
+
}
|
|
44
|
+
return merged;
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type StoreHandle } from "../store/defineStore.js";
|
|
2
|
+
/** Store slot holding the id of the dialogue currently open, or absent when none is showing. */
|
|
3
|
+
export declare const DIALOGUE_STORE_KEY = "jg.dialogue";
|
|
4
|
+
/** Typed handle onto the open-dialogue slot — React reads it via `useOpenDialogueId`; game code uses `ctx.game.dialogue`. */
|
|
5
|
+
export declare const dialogueSlot: StoreHandle<string | undefined>;
|
|
6
|
+
/** The minimal keyed-store surface {@link createGameDialogue} writes through — satisfied by `ctx.game.store`. */
|
|
7
|
+
interface DialogueStore {
|
|
8
|
+
get(key: string): unknown;
|
|
9
|
+
set(key: string, value: unknown): void;
|
|
10
|
+
delete(key: string): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `ctx.game.dialogue` — the blessed open/close bridge for the `talkable`/`dialogue.open` prompt flow. A game
|
|
14
|
+
* opts in with `features.dialogue`, and the runtime both builds this surface and auto-registers the
|
|
15
|
+
* `dialogue.open`/`dialogue.close` commands a `talkable(id)` prompt dispatches, so no game re-implements the
|
|
16
|
+
* store, the command pair, or the open/close bookkeeping. React reads the open id via `useOpenDialogueId`.
|
|
17
|
+
*/
|
|
18
|
+
export interface GameDialogue {
|
|
19
|
+
/** Show the dialogue with this catalog id (what a `talkable(id)` prompt / `dialogue.open` command carries). */
|
|
20
|
+
open(id: string): void;
|
|
21
|
+
/** Close whatever dialogue is open — the no-op when nothing is showing. */
|
|
22
|
+
close(): void;
|
|
23
|
+
/** The open dialogue id, or `null` when none is showing. */
|
|
24
|
+
openId(): string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build a {@link GameDialogue} over one keyed-store slot. Writes flow through the reactive store, so opening
|
|
28
|
+
* or closing bumps `ctx.version()` and a `useOpenDialogueId` selector re-renders.
|
|
29
|
+
*
|
|
30
|
+
* @capability dialogue-bridge open/close the talkable→DialogueBox flow with no per-game store or command glue
|
|
31
|
+
*/
|
|
32
|
+
export declare function createGameDialogue(store: DialogueStore): GameDialogue;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineStore } from "../store/defineStore.js";
|
|
2
|
+
/** Store slot holding the id of the dialogue currently open, or absent when none is showing. */
|
|
3
|
+
export const DIALOGUE_STORE_KEY = "jg.dialogue";
|
|
4
|
+
/** Typed handle onto the open-dialogue slot — React reads it via `useOpenDialogueId`; game code uses `ctx.game.dialogue`. */
|
|
5
|
+
export const dialogueSlot = defineStore(DIALOGUE_STORE_KEY, undefined);
|
|
6
|
+
/**
|
|
7
|
+
* Build a {@link GameDialogue} over one keyed-store slot. Writes flow through the reactive store, so opening
|
|
8
|
+
* or closing bumps `ctx.version()` and a `useOpenDialogueId` selector re-renders.
|
|
9
|
+
*
|
|
10
|
+
* @capability dialogue-bridge open/close the talkable→DialogueBox flow with no per-game store or command glue
|
|
11
|
+
*/
|
|
12
|
+
export function createGameDialogue(store) {
|
|
13
|
+
return {
|
|
14
|
+
open: (id) => store.set(DIALOGUE_STORE_KEY, id),
|
|
15
|
+
close: () => store.delete(DIALOGUE_STORE_KEY),
|
|
16
|
+
openId: () => {
|
|
17
|
+
const value = store.get(DIALOGUE_STORE_KEY);
|
|
18
|
+
return typeof value === "string" ? value : null;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|