@jgengine/core 0.10.0 → 0.12.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 +39 -2
- 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/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/ai/spawnDirector.d.ts +7 -2
- package/dist/ai/spawnDirector.js +18 -15
- package/dist/ai/spawnPoint.d.ts +3 -1
- package/dist/ai/spawnPoint.js +3 -1
- 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/authoring.d.ts +2 -1
- package/dist/authoring.js +2 -1
- 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 +5 -1
- package/dist/combat/dotField.js +5 -1
- 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 +5 -0
- package/dist/combat/projectiles.js +32 -14
- package/dist/combat/receivedDamage.d.ts +117 -0
- package/dist/combat/receivedDamage.js +92 -0
- package/dist/combat/regenShield.d.ts +5 -1
- package/dist/combat/regenShield.js +5 -1
- 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 +18 -1
- package/dist/combat/shotOrigin.js +39 -0
- 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 +35 -0
- package/dist/combat.js +35 -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/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/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/devtools/types.d.ts +212 -0
- package/dist/devtools/types.js +1 -0
- package/dist/economy/auctionBook.d.ts +122 -0
- package/dist/economy/auctionBook.js +213 -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/priceHistory.d.ts +44 -0
- package/dist/economy/priceHistory.js +89 -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/unlockPoints.d.ts +92 -0
- package/dist/economy/unlockPoints.js +103 -0
- package/dist/economy/wallet.d.ts +26 -2
- package/dist/economy/wallet.js +35 -6
- package/dist/editor/commandApply.d.ts +5 -0
- package/dist/editor/commandApply.js +755 -0
- package/dist/editor/commands.d.ts +235 -7
- package/dist/editor/commands.js +82 -124
- package/dist/editor/directives.d.ts +94 -0
- package/dist/editor/directives.js +206 -0
- package/dist/editor/document.d.ts +194 -13
- package/dist/editor/document.js +1166 -19
- 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/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 +98 -6
- package/dist/editor/index.js +13 -2
- package/dist/editor/liveSync.d.ts +127 -0
- package/dist/editor/liveSync.js +249 -0
- package/dist/editor/minimap.d.ts +31 -0
- package/dist/editor/minimap.js +73 -0
- package/dist/editor/runtimeInspector.d.ts +88 -0
- package/dist/editor/runtimeInspector.js +239 -0
- package/dist/editor/streamer.d.ts +66 -0
- package/dist/editor/streamer.js +68 -0
- package/dist/editor/types.d.ts +250 -1
- package/dist/editor/world.d.ts +136 -0
- package/dist/editor/world.js +303 -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/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/connectedPlayers.d.ts +6 -4
- package/dist/game/connectedPlayers.js +2 -2
- package/dist/game/cosmetics.d.ts +9 -0
- package/dist/game/cosmetics.js +16 -0
- package/dist/game/defineGame.d.ts +110 -5
- package/dist/game/defineGame.js +49 -4
- package/dist/game/defineSystem.d.ts +90 -0
- package/dist/game/defineSystem.js +47 -0
- package/dist/game/dialogue.d.ts +33 -0
- package/dist/game/dialogue.js +21 -0
- package/dist/game/events.d.ts +63 -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/leaderboard.d.ts +5 -0
- package/dist/game/leaderboard.js +5 -0
- 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 +19 -2
- package/dist/game/lootTable.js +15 -5
- 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 +116 -432
- package/dist/game/playableGame.js +1 -1
- package/dist/game/progression.d.ts +35 -0
- package/dist/game/progression.js +19 -0
- package/dist/game/quest.d.ts +8 -0
- package/dist/game/quest.js +30 -3
- package/dist/game/race.d.ts +141 -0
- package/dist/game/race.js +169 -0
- package/dist/game/recordBook.d.ts +3 -1
- 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/tribe.d.ts +184 -0
- package/dist/game/tribe.js +432 -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 +93 -0
- package/dist/gameplay.js +93 -0
- package/dist/index.d.ts +5 -14
- package/dist/index.js +5 -14
- package/dist/input/actionBindings.d.ts +23 -6
- package/dist/input/actionBindings.js +23 -6
- package/dist/input/axisInput.d.ts +7 -2
- package/dist/input/axisInput.js +7 -2
- 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/lockpick.d.ts +61 -0
- package/dist/interaction/lockpick.js +168 -0
- package/dist/interaction/proximityPrompt.d.ts +2 -0
- package/dist/interaction/proximityPrompt.js +2 -0
- 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/encumbrance.d.ts +69 -0
- package/dist/inventory/encumbrance.js +68 -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 +6 -3
- 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 +39 -2
- 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 +50 -9
- package/dist/movement/movementModel.js +75 -29
- package/dist/movement/playerMovement.js +167 -12
- 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 +16 -8
- package/dist/multiplayer/lagCompensation.d.ts +5 -0
- package/dist/multiplayer/lagCompensation.js +5 -0
- package/dist/multiplayer/presenceModel.d.ts +11 -1
- package/dist/multiplayer/presenceModel.js +17 -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 +31 -0
- package/dist/physics/drivableVehicle.js +16 -0
- 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 +108 -1
- package/dist/physics/kinematicVehicle.js +212 -15
- package/dist/physics/physicsWorld.d.ts +50 -12
- package/dist/physics/physicsWorld.js +120 -122
- package/dist/physics/radialImpulse.d.ts +25 -0
- package/dist/physics/radialImpulse.js +27 -0
- package/dist/physics/vehicleObstacles.d.ts +44 -0
- package/dist/physics/vehicleObstacles.js +115 -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 +26 -1
- package/dist/random/rng.js +32 -9
- 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 +20 -0
- package/dist/render/postProcessing.js +21 -1
- 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 +55 -3
- package/dist/runtime/adapter.js +57 -1
- 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/combat.d.ts +51 -0
- package/dist/runtime/context/combat.js +130 -0
- package/dist/runtime/context/combatFx.d.ts +23 -0
- package/dist/runtime/context/combatFx.js +161 -0
- 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/registries.d.ts +13 -0
- package/dist/runtime/context/registries.js +84 -0
- package/dist/runtime/context/scene.d.ts +59 -0
- package/dist/runtime/context/scene.js +291 -0
- package/dist/runtime/context/snapshotCodecs.d.ts +12 -0
- package/dist/runtime/context/snapshotCodecs.js +26 -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 +157 -0
- package/dist/runtime/descriptors/features.d.ts +79 -0
- package/dist/runtime/descriptors/features.js +299 -0
- package/dist/runtime/gameContext.d.ts +2 -327
- package/dist/runtime/gameContext.js +273 -778
- package/dist/runtime/gameContextTypes.d.ts +467 -0
- package/dist/runtime/gameContextTypes.js +1 -0
- package/dist/runtime/gameRuntime.d.ts +1 -0
- package/dist/runtime/gameRuntime.js +1 -0
- package/dist/runtime/headlessRunner.d.ts +62 -0
- package/dist/runtime/headlessRunner.js +45 -0
- package/dist/runtime/hostPersistence.d.ts +12 -0
- package/dist/runtime/hostPersistence.js +12 -0
- package/dist/runtime/hostPolicy.d.ts +51 -0
- package/dist/runtime/hostPolicy.js +68 -0
- package/dist/runtime/hostedGameRunner.d.ts +11 -4
- package/dist/runtime/hostedGameRunner.js +27 -3
- package/dist/runtime/hostedWorldSession.d.ts +15 -5
- package/dist/runtime/hostedWorldSession.js +12 -4
- package/dist/runtime/inputSnapshot.d.ts +8 -3
- package/dist/runtime/inputSnapshot.js +6 -2
- package/dist/runtime/motionIntents.d.ts +11 -2
- package/dist/runtime/motionIntents.js +16 -2
- 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 +7 -3
- package/dist/runtime/worldChannel.js +51 -6
- package/dist/runtime/worldMirror.d.ts +14 -2
- package/dist/runtime/worldMirror.js +15 -2
- package/dist/runtime/worldProjection.d.ts +47 -0
- package/dist/runtime/worldProjection.js +52 -0
- package/dist/runtime/worldReplication.d.ts +30 -7
- package/dist/runtime/worldReplication.js +41 -9
- package/dist/runtime/worldSnapshot.d.ts +42 -3
- package/dist/runtime/worldSnapshot.js +34 -7
- package/dist/scene/assetCatalog.d.ts +26 -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 +257 -0
- package/dist/scene/authoredTriggers.d.ts +219 -0
- package/dist/scene/authoredTriggers.js +454 -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 +67 -0
- package/dist/scene/colliders.d.ts +71 -1
- package/dist/scene/colliders.js +145 -1
- 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 +18 -11
- package/dist/scene/entityStats.js +21 -16
- package/dist/scene/entityStore.d.ts +12 -1
- package/dist/scene/entityStore.js +15 -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 +256 -0
- package/dist/scene/sceneKinds.js +218 -0
- package/dist/scene/sceneOwnership.d.ts +169 -0
- package/dist/scene/sceneOwnership.js +179 -0
- package/dist/scene/sceneRaycast.js +15 -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/spawnLevelStats.d.ts +110 -0
- package/dist/stats/spawnLevelStats.js +140 -0
- package/dist/stats/statModifiers.d.ts +5 -0
- package/dist/stats/statModifiers.js +5 -0
- package/dist/stats/statPool.d.ts +70 -0
- package/dist/stats/statPool.js +59 -0
- package/dist/store/changeSignal.d.ts +3 -0
- package/dist/store/changeSignal.js +2 -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 +7 -0
- package/dist/store/observableKeyedStore.js +35 -2
- package/dist/survival/decayMeter.d.ts +55 -0
- package/dist/survival/decayMeter.js +130 -57
- package/dist/survival/moodle.d.ts +2 -0
- package/dist/survival/regionHealth.d.ts +6 -0
- package/dist/survival/regionHealth.js +6 -3
- package/dist/tactics/fallingGrid.d.ts +4 -2
- package/dist/tactics/fallingGrid.js +4 -2
- 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 +30 -11
- package/dist/ui/gameLayout.js +30 -11
- package/dist/ui/hudDocument.d.ts +114 -0
- package/dist/ui/hudDocument.js +220 -0
- package/dist/ui/hudLayout.d.ts +38 -1
- package/dist/ui/hudLayout.js +220 -17
- package/dist/ui/selectionModel.d.ts +92 -0
- package/dist/ui/selectionModel.js +88 -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/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/authoredEntities.d.ts +29 -0
- package/dist/world/authoredEntities.js +29 -0
- package/dist/world/authoredObjects.d.ts +72 -0
- package/dist/world/authoredObjects.js +81 -0
- 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/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/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/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/features.d.ts +133 -10
- package/dist/world/features.js +66 -6
- 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/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/pathInstances.d.ts +27 -0
- package/dist/world/pathInstances.js +27 -0
- package/dist/world/pathNetwork.d.ts +159 -0
- package/dist/world/pathNetwork.js +684 -0
- package/dist/world/pathTerrain.d.ts +80 -0
- package/dist/world/pathTerrain.js +142 -0
- package/dist/world/place.d.ts +166 -0
- package/dist/world/place.js +96 -0
- package/dist/world/placeAsset.d.ts +81 -0
- package/dist/world/placeAsset.js +79 -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/poleLineKind.d.ts +40 -0
- package/dist/world/poleLineKind.js +97 -0
- package/dist/world/polyline.d.ts +34 -0
- package/dist/world/polyline.js +88 -0
- package/dist/world/resourceNode.d.ts +109 -0
- package/dist/world/resourceNode.js +140 -0
- package/dist/world/roads.d.ts +8 -0
- package/dist/world/roads.js +38 -0
- package/dist/world/scatter.js +2 -20
- 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 +29 -0
- package/dist/world/streets.js +55 -0
- package/dist/world/terraform.d.ts +213 -1
- package/dist/world/terraform.js +627 -22
- package/dist/world/terrain.d.ts +164 -20
- package/dist/world/terrain.js +325 -41
- 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 +141 -0
- package/dist/world.js +141 -0
- package/package.json +32 -8
- 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 +54 -0
- package/skills/jgengine/api.md +527 -0
- package/skills/jgengine/capabilities.md +131 -0
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-combat/SKILL.md +38 -0
- package/skills/jgengine-combat/api.md +585 -0
- package/skills/jgengine-combat/capabilities.md +213 -0
- package/skills/jgengine-combat/recipes/portable-stat-pools.md +122 -0
- package/skills/jgengine-combat/reference.md +108 -0
- package/skills/jgengine-gameplay/SKILL.md +39 -0
- package/skills/jgengine-gameplay/api.md +1920 -0
- package/skills/jgengine-gameplay/capabilities.md +454 -0
- package/skills/jgengine-gameplay/reference-systems.md +56 -0
- package/skills/jgengine-world/SKILL.md +51 -0
- package/skills/jgengine-world/api.md +3056 -0
- package/skills/jgengine-world/capabilities.md +476 -0
- package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
- package/skills/jgengine-world/reference.md +261 -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 -5389
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,30 +1,122 @@
|
|
|
1
1
|
/** The full authored scene: every marker, volume, path, and note for a game. */
|
|
2
2
|
export type { EditorDocument } from "./types.js";
|
|
3
|
+
/** A sculpted heightfield overlay stored on a document ΓÇö the terraform snapshot of offset deltas. */
|
|
4
|
+
export type { EditorTerrain } from "./types.js";
|
|
5
|
+
/** A baked top-down minimap (PNG data URI + world bounds) persisted on the scene document. */
|
|
6
|
+
export type { EditorMinimapBake } from "./types.js";
|
|
7
|
+
/** Scene-document sky/fog/lighting bag edited by the lighting workspace. */
|
|
8
|
+
export type { EditorEnvironment, EditorFogConfig, EditorSkyPreset } from "./types.js";
|
|
3
9
|
/** Per-kind show/hide flags for the editor's layer panel. */
|
|
4
10
|
export type { EditorKindVisibility } from "./types.js";
|
|
11
|
+
/** The four placeable-object collections a prefab fragment or clipboard fragment carries. */
|
|
12
|
+
export type { EditorFragmentContent } from "./types.js";
|
|
13
|
+
/** A serializable, reusable stamp of authored objects ΓÇö "make prefab" / "insert prefab" / detach. */
|
|
14
|
+
export type { EditorPrefab } from "./types.js";
|
|
15
|
+
/** A named, persisted list of object ids ΓÇö selection bookmark and/or locked production group. */
|
|
16
|
+
export type { EditorCollection } from "./types.js";
|
|
17
|
+
/** One row in a gameplay data catalog — id + optional label + meta matching the catalog schema. */
|
|
18
|
+
export type { EditorCatalogEntry } from "./types.js";
|
|
19
|
+
/** Persisted values for one gameplay data catalog on the scene document. */
|
|
20
|
+
export type { EditorCatalogData } from "./types.js";
|
|
21
|
+
/**
|
|
22
|
+
* Game-exported catalog definition: ParamSchema + default entries for in-editor tuning.
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import type { EditorCatalogDefinition } from "@jgengine/core/editor/index";
|
|
26
|
+
* export const editorCatalogs: EditorCatalogDefinition[] = [{
|
|
27
|
+
* id: "towers", label: "Towers",
|
|
28
|
+
* schema: { fields: [{ key: "damage", type: "number", default: 8, min: 1, max: 100 }] },
|
|
29
|
+
* entries: [{ id: "tower_archer", label: "Archer", meta: { damage: 8 } }],
|
|
30
|
+
* }];
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export type { EditorCatalogDefinition } from "./types.js";
|
|
34
|
+
/** Accepted shape for a game's `editorCatalogs` export: definitions, or a factory. */
|
|
35
|
+
export type { EditorCatalogsInput } from "./types.js";
|
|
36
|
+
/** Well-known catalog id for authored entity definitions consumed by the default content path. */
|
|
37
|
+
export { ENTITY_CATALOG_ID, entityDefinitionSchema, entityEntryFromCatalog, resolveCatalogDefinitions } from "./entityCatalog.js";
|
|
38
|
+
/** Minimal document shape {@link entityEntryFromCatalog} reads — any `EditorDocument` satisfies it. */
|
|
39
|
+
export type { EntityCatalogDocumentLike } from "./entityCatalog.js";
|
|
5
40
|
/** Accepted shape for a game's `editorLayers` export: a document, partial data, or a factory. */
|
|
6
41
|
export type { EditorLayersInput } from "./types.js";
|
|
7
|
-
/** A placeable point object in the scene
|
|
42
|
+
/** A placeable point object in the scene ΓÇö spawn, mob, chest, POI, etc. */
|
|
8
43
|
export type { EditorMarker } from "./types.js";
|
|
9
44
|
/** A free-text annotation pinned to a world position for designers. */
|
|
10
45
|
export type { EditorNote } from "./types.js";
|
|
11
|
-
/** A polyline of points
|
|
46
|
+
/** A polyline of points ΓÇö road, corridor, patrol route ΓÇö placed in the scene. */
|
|
12
47
|
export type { EditorPath } from "./types.js";
|
|
13
48
|
/** A world-space point used across editor markers, volumes, and paths. */
|
|
14
49
|
export type { EditorVec3 } from "./types.js";
|
|
15
|
-
/** A spatial region
|
|
50
|
+
/** A spatial region ΓÇö zone, aggro range, capture area ΓÇö placed in the scene. */
|
|
16
51
|
export type { EditorVolume } from "./types.js";
|
|
17
52
|
/** Collision shape a volume is rendered and tested as. */
|
|
18
53
|
export type { EditorVolumeShape } from "./types.js";
|
|
54
|
+
/** HUD layout section on the scene document — panel id → anchor/offset/size/visibility. */
|
|
55
|
+
export type { EditorUiDocument, EditorUiPanelLayout, HudPanelTypeDef, HudResizeAxes } from "./types.js";
|
|
19
56
|
export { WELL_KNOWN_MARKER_KINDS, WELL_KNOWN_PATH_KINDS, WELL_KNOWN_VOLUME_KINDS, } from "./types.js";
|
|
20
|
-
export { cloneEditorDocument, createEmptyEditorDocument, editorDocumentBounds, exportEditorDocumentJson, findEditorMarker, findEditorNote, findEditorPath, findEditorVolume, importEditorDocumentJson, listEditorKinds, mergeEditorDocuments, normalizeEditorLayers, } from "./document.js";
|
|
57
|
+
export { applyEditorDocumentOverlay, cloneEditorDocument, collectDescendants, createEmptyEditorDocument, createPrefabFragment, decodeEditorDocument, editorChildren, editorDocumentBounds, editorDocumentExtras, editorDocumentSize, editorMarkerPosition, editorMarkerXZ, editorParentOf, editorRoots, exportEditorDocumentJson, extractEditorFragment, findEditorCatalog, findEditorCatalogEntry, findEditorCollection, findEditorMarker, findEditorNote, findEditorPath, findEditorPrefab, findEditorVolume, importEditorDocumentJson, isEditorObjectCollectionLocked, isEditorObjectHidden, isEditorObjectLocked, isEditorObjectSelfLocked, listEditorKinds, mergeEditorDocuments, normalizeEditorLayers, requireEditorMarker, seedEditorCatalogs, wouldCreateCycle, } from "./document.js";
|
|
58
|
+
/** One field-level failure surfaced while decoding an untrusted editor document. */
|
|
59
|
+
export type { EditorDocumentDiagnostic } from "./document.js";
|
|
60
|
+
export { WORLD_BASE_SHARD_ID, WORLD_MANIFEST_KIND, decodeWorldManifest, exportWorldManifestJson, loadWorldDocument, selectWorldShards, shardMatchesQuery, singleShardWorldManifest, splitEditorDocumentIntoShards, } from "./world.js";
|
|
61
|
+
/** A sharded world manifest (`world.json`): grid + shard list + streaming config. */
|
|
62
|
+
export type { DecodeWorldManifestResult, SplitWorldOptions, SplitWorldResult, WorldGrid, WorldManifest, WorldManifestShard, WorldQuery, WorldShardBounds, WorldShardResidency, WorldShardResolver, WorldStreamingConfig, } from "./world.js";
|
|
63
|
+
/** Result of {@link decodeEditorDocument}: a typed document, or every diagnostic collected while decoding it. */
|
|
64
|
+
export type { DecodeEditorDocumentResult } from "./document.js";
|
|
65
|
+
export { environmentContentFromDocument, skyConfigFromEnvironment, skyFromDocument, terrainBoundsFromDocument, } from "./environment.js";
|
|
66
|
+
/** Coordinate/placement content of an `environment()` world derived from the scene document. */
|
|
67
|
+
export type { EnvironmentContent, EnvironmentContentOptions } from "./environment.js";
|
|
68
|
+
export { bakeMinimapFromDocument, documentBakeZones } from "./minimap.js";
|
|
69
|
+
/** Editor-side minimap bake from the scene document (footprint + biome-tint zones). */
|
|
70
|
+
export type { DocumentBakeOptions } from "./minimap.js";
|
|
71
|
+
export { createWorldStreamer, shardDistance } from "./streamer.js";
|
|
72
|
+
/** A stateful proximity streamer that schedules shard load/unload as the camera moves. */
|
|
73
|
+
export type { StreamUpdate, StreamerShard, WorldStreamer, WorldStreamerConfig } from "./streamer.js";
|
|
74
|
+
/** A procedural directive on the scene document — scatter props or a mob population. */
|
|
75
|
+
export type { EditorDirective, EditorDirectiveArea, EditorDirectiveKind, EditorPopulationDirective, EditorPopulationSpecies, EditorScatterDirective, } from "./types.js";
|
|
76
|
+
export { applyDirectiveOverlay, materializeDirective, materializeDirectives, materializePopulationDirective, materializeScatterDirective, resolveDirectiveFootprint, } from "./directives.js";
|
|
77
|
+
/** The deterministic bake of scene directives into per-instance placements + sparse overlays. */
|
|
78
|
+
export type { DirectiveFootprint, DirectiveInstancePatch, EditorDirectiveOverlay, MaterializedInstance, } from "./directives.js";
|
|
21
79
|
/** Creates an editor session with undo/redo history seeded from an initial document. */
|
|
22
80
|
export { createEditorSession } from "./commands.js";
|
|
23
|
-
/** Compact snapshot of a session state
|
|
81
|
+
/** Compact snapshot of a session state ΓÇö counts, selection, and the selected object. */
|
|
24
82
|
export { summarizeEditorSession } from "./commands.js";
|
|
25
|
-
/** A single editor mutation
|
|
83
|
+
/** A single editor mutation ΓÇö select, move, add, remove, undo/redo ΓÇö dispatched to a session. */
|
|
26
84
|
export type { EditorCommand } from "./commands.js";
|
|
85
|
+
/** Per-dispatch options; `coalesce` merges consecutive same-key edits into one undo step. */
|
|
86
|
+
export type { EditorDispatchOptions } from "./commands.js";
|
|
27
87
|
/** Stateful, undoable handle for driving scene edits from UI or an MCP agent. */
|
|
28
88
|
export type { EditorSession } from "./commands.js";
|
|
29
89
|
/** The document plus current selection at a point in editor history. */
|
|
30
90
|
export type { EditorSessionState } from "./commands.js";
|
|
91
|
+
export { applyDocumentPatch, applyRuntimeStateDelta, createDocumentLiveSync, getDocumentLiveSync, installDocumentLiveSync, runtimeEntityWriteBackCommand, subscribeDocumentLiveSyncInstall, } from "./liveSync.js";
|
|
92
|
+
/** Versioned document mutation on the editorΓåöruntime live-sync stream. */
|
|
93
|
+
export type { DocumentPatch, ApplyDocumentPatchResult } from "./liveSync.js";
|
|
94
|
+
/** Two-way live-sync bus: document patches out, runtime state deltas back. */
|
|
95
|
+
export type { DocumentLiveSync, DocumentLiveEvent } from "./liveSync.js";
|
|
96
|
+
/** Ephemeral runtime entity/tunable state streamed on the reverse channel. */
|
|
97
|
+
export type { RuntimeEntityState, RuntimeStateDelta, RuntimeStateSnapshot } from "./liveSync.js";
|
|
98
|
+
export { consumeRuntimePlayStep, createRuntimePlayControl, getRuntimeInspectorValue, planRuntimeInspectorSet, runtimeEntityMetaWriteBackCommand, summarizeRuntimeInspector, } from "./runtimeInspector.js";
|
|
99
|
+
/** Play-mode sim gate and reverse-channel inspector summary/get/set pure helpers. */
|
|
100
|
+
export type { RuntimeInspectorGetResult, RuntimeInspectorSetPlan, RuntimeInspectorSummary, RuntimePlayControl, } from "./runtimeInspector.js";
|
|
101
|
+
export { CURRENT_GRID_SCHEMA_VERSION, cloneGridLayer, createGridLayer, eraseGridCell, eyedropGridCell, fillGridRect, findGridPaletteEntry, floodFillGrid, forEachGridCell, getGridCell, getGridCellAtWorld, gridCellCount, gridCellEntries, gridCellKey, gridCellToWorld, gridCellsOfValue, gridEmptyValue, gridGlyphMap, inGridBounds, migrateGridLayer, paintGridCells, parseGridCellKey, resizeGridLayer, setGridCell, worldToGridCell, } from "./grid.js";
|
|
102
|
+
/** How a grid layer's columns and rows map onto world axes (`"xz"` top-down, `"xy"` side view). */
|
|
103
|
+
export type { EditorGridAxes } from "./grid.js";
|
|
104
|
+
/** A sparse, editor-owned tile grid serialized on the scene document. */
|
|
105
|
+
export type { EditorGridLayer } from "./grid.js";
|
|
106
|
+
/** One selectable value in a grid layer's palette — value id, glyph, color, and typed payload. */
|
|
107
|
+
export type { EditorGridPaletteEntry } from "./grid.js";
|
|
108
|
+
/** One resolved cell of a grid layer — its column, row, and value id. */
|
|
109
|
+
export type { EditorGridCell } from "./grid.js";
|
|
110
|
+
/** A single paint/erase edit: set cell `col,row` to `value` (empty value erases). */
|
|
111
|
+
export type { EditorGridCellEdit } from "./grid.js";
|
|
112
|
+
/** Fields accepted when constructing a grid layer via `createGridLayer`. */
|
|
113
|
+
export type { CreateGridLayerInit } from "./grid.js";
|
|
114
|
+
export { exportAsciiGrid, exportCsvGrid, importAsciiGrid, importCsvGrid, } from "./gridAdapters.js";
|
|
115
|
+
/** Options for importing an ASCII/glyph map into a grid layer. */
|
|
116
|
+
export type { AsciiGridImportOptions } from "./gridAdapters.js";
|
|
117
|
+
/** Options for rendering a grid layer back out as an ASCII/glyph map. */
|
|
118
|
+
export type { AsciiGridExportOptions } from "./gridAdapters.js";
|
|
119
|
+
/** Options for importing a CSV grid (one value id per cell) into a grid layer. */
|
|
120
|
+
export type { CsvGridImportOptions } from "./gridAdapters.js";
|
|
121
|
+
/** Options for exporting a grid layer as CSV. */
|
|
122
|
+
export type { CsvGridExportOptions } from "./gridAdapters.js";
|
package/dist/editor/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
/** Well-known catalog id for authored entity definitions consumed by the default content path. */
|
|
2
|
+
export { ENTITY_CATALOG_ID, entityDefinitionSchema, entityEntryFromCatalog, resolveCatalogDefinitions } from "./entityCatalog.js";
|
|
1
3
|
export { WELL_KNOWN_MARKER_KINDS, WELL_KNOWN_PATH_KINDS, WELL_KNOWN_VOLUME_KINDS, } from "./types.js";
|
|
2
|
-
export { cloneEditorDocument, createEmptyEditorDocument, editorDocumentBounds, exportEditorDocumentJson, findEditorMarker, findEditorNote, findEditorPath, findEditorVolume, importEditorDocumentJson, listEditorKinds, mergeEditorDocuments, normalizeEditorLayers, } from "./document.js";
|
|
4
|
+
export { applyEditorDocumentOverlay, cloneEditorDocument, collectDescendants, createEmptyEditorDocument, createPrefabFragment, decodeEditorDocument, editorChildren, editorDocumentBounds, editorDocumentExtras, editorDocumentSize, editorMarkerPosition, editorMarkerXZ, editorParentOf, editorRoots, exportEditorDocumentJson, extractEditorFragment, findEditorCatalog, findEditorCatalogEntry, findEditorCollection, findEditorMarker, findEditorNote, findEditorPath, findEditorPrefab, findEditorVolume, importEditorDocumentJson, isEditorObjectCollectionLocked, isEditorObjectHidden, isEditorObjectLocked, isEditorObjectSelfLocked, listEditorKinds, mergeEditorDocuments, normalizeEditorLayers, requireEditorMarker, seedEditorCatalogs, wouldCreateCycle, } from "./document.js";
|
|
5
|
+
export { WORLD_BASE_SHARD_ID, WORLD_MANIFEST_KIND, decodeWorldManifest, exportWorldManifestJson, loadWorldDocument, selectWorldShards, shardMatchesQuery, singleShardWorldManifest, splitEditorDocumentIntoShards, } from "./world.js";
|
|
6
|
+
export { environmentContentFromDocument, skyConfigFromEnvironment, skyFromDocument, terrainBoundsFromDocument, } from "./environment.js";
|
|
7
|
+
export { bakeMinimapFromDocument, documentBakeZones } from "./minimap.js";
|
|
8
|
+
export { createWorldStreamer, shardDistance } from "./streamer.js";
|
|
9
|
+
export { applyDirectiveOverlay, materializeDirective, materializeDirectives, materializePopulationDirective, materializeScatterDirective, resolveDirectiveFootprint, } from "./directives.js";
|
|
3
10
|
/** Creates an editor session with undo/redo history seeded from an initial document. */
|
|
4
11
|
export { createEditorSession } from "./commands.js";
|
|
5
|
-
/** Compact snapshot of a session state
|
|
12
|
+
/** Compact snapshot of a session state ΓÇö counts, selection, and the selected object. */
|
|
6
13
|
export { summarizeEditorSession } from "./commands.js";
|
|
14
|
+
export { applyDocumentPatch, applyRuntimeStateDelta, createDocumentLiveSync, getDocumentLiveSync, installDocumentLiveSync, runtimeEntityWriteBackCommand, subscribeDocumentLiveSyncInstall, } from "./liveSync.js";
|
|
15
|
+
export { consumeRuntimePlayStep, createRuntimePlayControl, getRuntimeInspectorValue, planRuntimeInspectorSet, runtimeEntityMetaWriteBackCommand, summarizeRuntimeInspector, } from "./runtimeInspector.js";
|
|
16
|
+
export { CURRENT_GRID_SCHEMA_VERSION, cloneGridLayer, createGridLayer, eraseGridCell, eyedropGridCell, fillGridRect, findGridPaletteEntry, floodFillGrid, forEachGridCell, getGridCell, getGridCellAtWorld, gridCellCount, gridCellEntries, gridCellKey, gridCellToWorld, gridCellsOfValue, gridEmptyValue, gridGlyphMap, inGridBounds, migrateGridLayer, paintGridCells, parseGridCellKey, resizeGridLayer, setGridCell, worldToGridCell, } from "./grid.js";
|
|
17
|
+
export { exportAsciiGrid, exportCsvGrid, importAsciiGrid, importCsvGrid, } from "./gridAdapters.js";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type EditorCommand } from "./commands.js";
|
|
2
|
+
import type { EditorDocument, EditorVec3 } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* One versioned document mutation on the live-sync stream. `snapshot` replaces the whole
|
|
5
|
+
* document; `commands` replays structural editor commands onto the current document.
|
|
6
|
+
* `baseRevision` must match the receiver's current revision unless `force` is set (document
|
|
7
|
+
* authority from the editor).
|
|
8
|
+
*/
|
|
9
|
+
export type DocumentPatch = {
|
|
10
|
+
type: "snapshot";
|
|
11
|
+
revision?: number;
|
|
12
|
+
baseRevision: number;
|
|
13
|
+
document: EditorDocument;
|
|
14
|
+
} | {
|
|
15
|
+
type: "commands";
|
|
16
|
+
revision?: number;
|
|
17
|
+
baseRevision: number;
|
|
18
|
+
commands: readonly EditorCommand[];
|
|
19
|
+
};
|
|
20
|
+
/** Result of applying a {@link DocumentPatch} to a document + revision pair. */
|
|
21
|
+
export type ApplyDocumentPatchResult = {
|
|
22
|
+
ok: true;
|
|
23
|
+
document: EditorDocument;
|
|
24
|
+
revision: number;
|
|
25
|
+
patch: DocumentPatch;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
error: string;
|
|
29
|
+
};
|
|
30
|
+
/** One live entity row the runtime may stream to the editor (play-mode inspector feed). */
|
|
31
|
+
export interface RuntimeEntityState {
|
|
32
|
+
id: string;
|
|
33
|
+
position?: EditorVec3;
|
|
34
|
+
rotationY?: number;
|
|
35
|
+
values?: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/** Full ephemeral runtime view held on the reverse channel — never mutates the document. */
|
|
38
|
+
export interface RuntimeStateSnapshot {
|
|
39
|
+
seq: number;
|
|
40
|
+
entities: Record<string, RuntimeEntityState>;
|
|
41
|
+
tunables: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Incremental runtime state for the reverse channel. Entity rows upsert by id; `removeIds`
|
|
45
|
+
* drop rows; `tunables` shallow-merge. Ephemeral unless written back as a document patch.
|
|
46
|
+
*/
|
|
47
|
+
export interface RuntimeStateDelta {
|
|
48
|
+
seq: number;
|
|
49
|
+
at: number;
|
|
50
|
+
entities?: readonly RuntimeEntityState[];
|
|
51
|
+
removeIds?: readonly string[];
|
|
52
|
+
tunables?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
/** Event emitted when the authoritative document changes on a {@link DocumentLiveSync}. */
|
|
55
|
+
export interface DocumentLiveEvent {
|
|
56
|
+
document: EditorDocument;
|
|
57
|
+
revision: number;
|
|
58
|
+
patch: DocumentPatch;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Applies a versioned document patch. Rejects base-revision mismatches unless `force` (document
|
|
62
|
+
* is authoritative — the editor forces when publishing its own session state).
|
|
63
|
+
* @capability editor-live-sync apply a versioned document patch onto a live scene document
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyDocumentPatch(document: EditorDocument, revision: number, patch: DocumentPatch, options?: {
|
|
66
|
+
force?: boolean;
|
|
67
|
+
}): ApplyDocumentPatchResult;
|
|
68
|
+
/**
|
|
69
|
+
* Merges a runtime delta into a snapshot without touching the scene document — runtime overrides
|
|
70
|
+
* stay ephemeral until an explicit write-back produces a document patch.
|
|
71
|
+
* @capability editor-live-sync merge a runtime state delta into the reverse-channel snapshot
|
|
72
|
+
*/
|
|
73
|
+
export declare function applyRuntimeStateDelta(snapshot: RuntimeStateSnapshot, delta: Omit<RuntimeStateDelta, "seq"> & {
|
|
74
|
+
seq?: number;
|
|
75
|
+
}): {
|
|
76
|
+
snapshot: RuntimeStateSnapshot;
|
|
77
|
+
delta: RuntimeStateDelta;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Builds an undoable document command from an ephemeral runtime entity row (write-back). Returns
|
|
81
|
+
* null when there is nothing to promote. Does not mutate document or clear the override — the
|
|
82
|
+
* caller dispatches the command and then clears the override.
|
|
83
|
+
* @capability editor-live-sync promote a runtime entity override into a document write-back command
|
|
84
|
+
*/
|
|
85
|
+
export declare function runtimeEntityWriteBackCommand(document: EditorDocument, entity: RuntimeEntityState): EditorCommand | null;
|
|
86
|
+
/** Two-way live-sync bus: document patches out, runtime state deltas back. */
|
|
87
|
+
export interface DocumentLiveSync {
|
|
88
|
+
getDocument(): EditorDocument;
|
|
89
|
+
getRevision(): number;
|
|
90
|
+
applyPatch(patch: DocumentPatch, options?: {
|
|
91
|
+
force?: boolean;
|
|
92
|
+
}): ApplyDocumentPatchResult;
|
|
93
|
+
/** Document-authoritative full replace (editor session mirror). */
|
|
94
|
+
replaceDocument(document: EditorDocument): DocumentLiveEvent;
|
|
95
|
+
pullPatches(sinceRevision: number): DocumentPatch[];
|
|
96
|
+
subscribeDocument(listener: (event: DocumentLiveEvent) => void): () => void;
|
|
97
|
+
getRuntimeState(): RuntimeStateSnapshot;
|
|
98
|
+
pushRuntimeDelta(delta: Omit<RuntimeStateDelta, "seq">): RuntimeStateDelta;
|
|
99
|
+
pullRuntimeDeltas(sinceSeq: number): RuntimeStateDelta[];
|
|
100
|
+
subscribeRuntime(listener: (delta: RuntimeStateDelta, snapshot: RuntimeStateSnapshot) => void): () => void;
|
|
101
|
+
setRuntimeOverride(entity: RuntimeEntityState): void;
|
|
102
|
+
clearRuntimeOverride(id: string): void;
|
|
103
|
+
getRuntimeOverrides(): Readonly<Record<string, RuntimeEntityState>>;
|
|
104
|
+
/**
|
|
105
|
+
* Promote an ephemeral override into a document command patch when the id exists in the
|
|
106
|
+
* document. Clears the override only after a successful apply.
|
|
107
|
+
*/
|
|
108
|
+
writeBackOverride(id: string): ApplyDocumentPatchResult | {
|
|
109
|
+
ok: false;
|
|
110
|
+
error: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Creates an in-memory two-way live-sync bus seeded from an initial document. Document is
|
|
115
|
+
* authoritative; runtime overrides are ephemeral until {@link DocumentLiveSync.writeBackOverride}.
|
|
116
|
+
* @capability editor-live-sync two-way document/runtime live-sync bus for editor↔game
|
|
117
|
+
*/
|
|
118
|
+
export declare function createDocumentLiveSync(initial: EditorDocument): DocumentLiveSync;
|
|
119
|
+
/** Publishes a live-sync bus globally so AuthoredScene / games can subscribe without prop drilling. */
|
|
120
|
+
export declare function installDocumentLiveSync(sync: DocumentLiveSync): () => void;
|
|
121
|
+
/** Returns the globally installed live-sync bus, or null when none is mounted. */
|
|
122
|
+
export declare function getDocumentLiveSync(): DocumentLiveSync | null;
|
|
123
|
+
/**
|
|
124
|
+
* Subscribe to install/uninstall of the global live-sync bus (AuthoredScene re-attaches when the
|
|
125
|
+
* editor host mounts over a running game).
|
|
126
|
+
*/
|
|
127
|
+
export declare function subscribeDocumentLiveSyncInstall(listener: () => void): () => void;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { createEditorSession } from "./commands.js";
|
|
2
|
+
import { cloneEditorDocument } from "./document.js";
|
|
3
|
+
const MAX_PATCH_LOG = 64;
|
|
4
|
+
const MAX_RUNTIME_LOG = 128;
|
|
5
|
+
/**
|
|
6
|
+
* Applies a versioned document patch. Rejects base-revision mismatches unless `force` (document
|
|
7
|
+
* is authoritative — the editor forces when publishing its own session state).
|
|
8
|
+
* @capability editor-live-sync apply a versioned document patch onto a live scene document
|
|
9
|
+
*/
|
|
10
|
+
export function applyDocumentPatch(document, revision, patch, options) {
|
|
11
|
+
if (!options?.force && patch.baseRevision !== revision) {
|
|
12
|
+
return {
|
|
13
|
+
ok: false,
|
|
14
|
+
error: `baseRevision mismatch: patch=${patch.baseRevision} current=${revision}`,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (patch.type === "snapshot") {
|
|
18
|
+
const nextDoc = cloneEditorDocument(patch.document);
|
|
19
|
+
const nextRevision = revision + 1;
|
|
20
|
+
return {
|
|
21
|
+
ok: true,
|
|
22
|
+
document: nextDoc,
|
|
23
|
+
revision: nextRevision,
|
|
24
|
+
patch: { ...patch, revision: nextRevision, document: nextDoc },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (patch.commands.length === 0) {
|
|
28
|
+
return { ok: false, error: "commands patch is empty" };
|
|
29
|
+
}
|
|
30
|
+
const session = createEditorSession(cloneEditorDocument(document));
|
|
31
|
+
for (const command of patch.commands) {
|
|
32
|
+
session.dispatch(command);
|
|
33
|
+
}
|
|
34
|
+
const nextDoc = session.getState().document;
|
|
35
|
+
const nextRevision = revision + 1;
|
|
36
|
+
return {
|
|
37
|
+
ok: true,
|
|
38
|
+
document: nextDoc,
|
|
39
|
+
revision: nextRevision,
|
|
40
|
+
patch: { ...patch, revision: nextRevision },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Merges a runtime delta into a snapshot without touching the scene document — runtime overrides
|
|
45
|
+
* stay ephemeral until an explicit write-back produces a document patch.
|
|
46
|
+
* @capability editor-live-sync merge a runtime state delta into the reverse-channel snapshot
|
|
47
|
+
*/
|
|
48
|
+
export function applyRuntimeStateDelta(snapshot, delta) {
|
|
49
|
+
const entities = { ...snapshot.entities };
|
|
50
|
+
if (delta.removeIds !== undefined) {
|
|
51
|
+
for (const id of delta.removeIds)
|
|
52
|
+
delete entities[id];
|
|
53
|
+
}
|
|
54
|
+
if (delta.entities !== undefined) {
|
|
55
|
+
for (const row of delta.entities) {
|
|
56
|
+
const prev = entities[row.id];
|
|
57
|
+
entities[row.id] = {
|
|
58
|
+
id: row.id,
|
|
59
|
+
position: row.position ?? prev?.position,
|
|
60
|
+
rotationY: row.rotationY ?? prev?.rotationY,
|
|
61
|
+
values: row.values === undefined && prev?.values === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: { ...prev?.values, ...row.values },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const tunables = delta.tunables === undefined ? snapshot.tunables : { ...snapshot.tunables, ...delta.tunables };
|
|
68
|
+
const seq = snapshot.seq + 1;
|
|
69
|
+
const applied = {
|
|
70
|
+
seq,
|
|
71
|
+
at: delta.at,
|
|
72
|
+
...(delta.entities === undefined ? {} : { entities: delta.entities }),
|
|
73
|
+
...(delta.removeIds === undefined ? {} : { removeIds: delta.removeIds }),
|
|
74
|
+
...(delta.tunables === undefined ? {} : { tunables: delta.tunables }),
|
|
75
|
+
};
|
|
76
|
+
return { snapshot: { seq, entities, tunables }, delta: applied };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Builds an undoable document command from an ephemeral runtime entity row (write-back). Returns
|
|
80
|
+
* null when there is nothing to promote. Does not mutate document or clear the override — the
|
|
81
|
+
* caller dispatches the command and then clears the override.
|
|
82
|
+
* @capability editor-live-sync promote a runtime entity override into a document write-back command
|
|
83
|
+
*/
|
|
84
|
+
export function runtimeEntityWriteBackCommand(document, entity) {
|
|
85
|
+
const marker = document.markers.find((entry) => entry.id === entity.id);
|
|
86
|
+
if (marker !== undefined) {
|
|
87
|
+
if (entity.position === undefined && entity.rotationY === undefined)
|
|
88
|
+
return null;
|
|
89
|
+
return {
|
|
90
|
+
type: "setTransform",
|
|
91
|
+
id: entity.id,
|
|
92
|
+
...(entity.position === undefined ? {} : { position: { ...entity.position } }),
|
|
93
|
+
...(entity.rotationY === undefined ? {} : { rotationY: entity.rotationY }),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const volume = document.volumes.find((entry) => entry.id === entity.id);
|
|
97
|
+
if (volume !== undefined) {
|
|
98
|
+
if (entity.position === undefined)
|
|
99
|
+
return null;
|
|
100
|
+
return { type: "setTransform", id: entity.id, position: { ...entity.position } };
|
|
101
|
+
}
|
|
102
|
+
const note = document.annotations.find((entry) => entry.id === entity.id);
|
|
103
|
+
if (note !== undefined) {
|
|
104
|
+
if (entity.position === undefined)
|
|
105
|
+
return null;
|
|
106
|
+
return { type: "setTransform", id: entity.id, position: { ...entity.position } };
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates an in-memory two-way live-sync bus seeded from an initial document. Document is
|
|
112
|
+
* authoritative; runtime overrides are ephemeral until {@link DocumentLiveSync.writeBackOverride}.
|
|
113
|
+
* @capability editor-live-sync two-way document/runtime live-sync bus for editor↔game
|
|
114
|
+
*/
|
|
115
|
+
export function createDocumentLiveSync(initial) {
|
|
116
|
+
let document = cloneEditorDocument(initial);
|
|
117
|
+
let revision = 0;
|
|
118
|
+
let runtime = { seq: 0, entities: {}, tunables: {} };
|
|
119
|
+
const overrides = {};
|
|
120
|
+
const patchLog = [];
|
|
121
|
+
const runtimeLog = [];
|
|
122
|
+
const documentListeners = new Set();
|
|
123
|
+
const runtimeListeners = new Set();
|
|
124
|
+
const emitDocument = (event) => {
|
|
125
|
+
for (const listener of documentListeners)
|
|
126
|
+
listener(event);
|
|
127
|
+
};
|
|
128
|
+
const commit = (result) => {
|
|
129
|
+
document = result.document;
|
|
130
|
+
revision = result.revision;
|
|
131
|
+
patchLog.push(result.patch);
|
|
132
|
+
if (patchLog.length > MAX_PATCH_LOG)
|
|
133
|
+
patchLog.splice(0, patchLog.length - MAX_PATCH_LOG);
|
|
134
|
+
const event = {
|
|
135
|
+
document,
|
|
136
|
+
revision,
|
|
137
|
+
patch: result.patch,
|
|
138
|
+
};
|
|
139
|
+
emitDocument(event);
|
|
140
|
+
return event;
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
getDocument: () => document,
|
|
144
|
+
getRevision: () => revision,
|
|
145
|
+
applyPatch(patch, options) {
|
|
146
|
+
const result = applyDocumentPatch(document, revision, patch, options);
|
|
147
|
+
if (!result.ok)
|
|
148
|
+
return result;
|
|
149
|
+
commit(result);
|
|
150
|
+
return result;
|
|
151
|
+
},
|
|
152
|
+
replaceDocument(next) {
|
|
153
|
+
const result = applyDocumentPatch(document, revision, { type: "snapshot", baseRevision: revision, document: next }, { force: true });
|
|
154
|
+
if (!result.ok) {
|
|
155
|
+
throw new Error(result.error);
|
|
156
|
+
}
|
|
157
|
+
return commit(result);
|
|
158
|
+
},
|
|
159
|
+
pullPatches(sinceRevision) {
|
|
160
|
+
return patchLog.filter((patch) => (patch.revision ?? 0) > sinceRevision);
|
|
161
|
+
},
|
|
162
|
+
subscribeDocument(listener) {
|
|
163
|
+
documentListeners.add(listener);
|
|
164
|
+
return () => {
|
|
165
|
+
documentListeners.delete(listener);
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
getRuntimeState: () => runtime,
|
|
169
|
+
pushRuntimeDelta(delta) {
|
|
170
|
+
const applied = applyRuntimeStateDelta(runtime, delta);
|
|
171
|
+
runtime = applied.snapshot;
|
|
172
|
+
runtimeLog.push(applied.delta);
|
|
173
|
+
if (runtimeLog.length > MAX_RUNTIME_LOG)
|
|
174
|
+
runtimeLog.splice(0, runtimeLog.length - MAX_RUNTIME_LOG);
|
|
175
|
+
for (const listener of runtimeListeners)
|
|
176
|
+
listener(applied.delta, runtime);
|
|
177
|
+
return applied.delta;
|
|
178
|
+
},
|
|
179
|
+
pullRuntimeDeltas(sinceSeq) {
|
|
180
|
+
return runtimeLog.filter((delta) => delta.seq > sinceSeq);
|
|
181
|
+
},
|
|
182
|
+
subscribeRuntime(listener) {
|
|
183
|
+
runtimeListeners.add(listener);
|
|
184
|
+
return () => {
|
|
185
|
+
runtimeListeners.delete(listener);
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
setRuntimeOverride(entity) {
|
|
189
|
+
const prev = overrides[entity.id];
|
|
190
|
+
overrides[entity.id] = {
|
|
191
|
+
id: entity.id,
|
|
192
|
+
position: entity.position ?? prev?.position,
|
|
193
|
+
rotationY: entity.rotationY ?? prev?.rotationY,
|
|
194
|
+
values: entity.values === undefined && prev?.values === undefined
|
|
195
|
+
? undefined
|
|
196
|
+
: { ...prev?.values, ...entity.values },
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
clearRuntimeOverride(id) {
|
|
200
|
+
delete overrides[id];
|
|
201
|
+
},
|
|
202
|
+
getRuntimeOverrides: () => ({ ...overrides }),
|
|
203
|
+
writeBackOverride(id) {
|
|
204
|
+
const entity = overrides[id];
|
|
205
|
+
if (entity === undefined)
|
|
206
|
+
return { ok: false, error: `no runtime override for "${id}"` };
|
|
207
|
+
const command = runtimeEntityWriteBackCommand(document, entity);
|
|
208
|
+
if (command === null) {
|
|
209
|
+
return { ok: false, error: `override "${id}" has nothing to write back into the document` };
|
|
210
|
+
}
|
|
211
|
+
const result = applyDocumentPatch(document, revision, { type: "commands", baseRevision: revision, commands: [command] }, { force: true });
|
|
212
|
+
if (!result.ok)
|
|
213
|
+
return result;
|
|
214
|
+
commit(result);
|
|
215
|
+
delete overrides[id];
|
|
216
|
+
return result;
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const GLOBAL_KEY = "__jgengineDocumentLiveSync";
|
|
221
|
+
const INSTALL_LISTENERS = new Set();
|
|
222
|
+
/** Publishes a live-sync bus globally so AuthoredScene / games can subscribe without prop drilling. */
|
|
223
|
+
export function installDocumentLiveSync(sync) {
|
|
224
|
+
const root = globalThis;
|
|
225
|
+
root[GLOBAL_KEY] = sync;
|
|
226
|
+
for (const listener of INSTALL_LISTENERS)
|
|
227
|
+
listener();
|
|
228
|
+
return () => {
|
|
229
|
+
if (root[GLOBAL_KEY] === sync)
|
|
230
|
+
delete root[GLOBAL_KEY];
|
|
231
|
+
for (const listener of INSTALL_LISTENERS)
|
|
232
|
+
listener();
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Returns the globally installed live-sync bus, or null when none is mounted. */
|
|
236
|
+
export function getDocumentLiveSync() {
|
|
237
|
+
const root = globalThis;
|
|
238
|
+
return root[GLOBAL_KEY] ?? null;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Subscribe to install/uninstall of the global live-sync bus (AuthoredScene re-attaches when the
|
|
242
|
+
* editor host mounts over a running game).
|
|
243
|
+
*/
|
|
244
|
+
export function subscribeDocumentLiveSyncInstall(listener) {
|
|
245
|
+
INSTALL_LISTENERS.add(listener);
|
|
246
|
+
return () => {
|
|
247
|
+
INSTALL_LISTENERS.delete(listener);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type MinimapBakeBounds, type MinimapBakeOptions, type MinimapBakeZone } from "../world/minimapBake.js";
|
|
2
|
+
import type { EditorDocument } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The biome-tint zones a document contributes to a bake: every volume carrying a `color` becomes a
|
|
5
|
+
* polygon tint over its footprint. (The optional stretch from #1036 — a bare bake still reads as
|
|
6
|
+
* terrain without any.)
|
|
7
|
+
* @capability minimap-bake derive biome-tint zones for a bake from the scene document
|
|
8
|
+
*/
|
|
9
|
+
export declare function documentBakeZones(doc: EditorDocument): MinimapBakeZone[];
|
|
10
|
+
/** Options for {@link bakeMinimapFromDocument}. */
|
|
11
|
+
export interface DocumentBakeOptions extends MinimapBakeOptions {
|
|
12
|
+
/** Explicit bounds; default = the document's object bounds padded by `padding`. */
|
|
13
|
+
bounds?: MinimapBakeBounds;
|
|
14
|
+
/** Padding (m) around the derived bounds when `bounds` is omitted. Default 16. */
|
|
15
|
+
padding?: number;
|
|
16
|
+
/** Ground normal sampler for slope shading (optional). */
|
|
17
|
+
sampleNormal?: (x: number, z: number) => readonly [number, number, number];
|
|
18
|
+
/** Water level — ground at or below renders as water. */
|
|
19
|
+
waterLevel?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Bakes a minimap image from a scene document plus a terrain height sampler: sizes the footprint to
|
|
23
|
+
* the authored objects (or an explicit `bounds`), tints biome-colored volumes, and rasterizes the
|
|
24
|
+
* terrain top-down. Returns `{ background, mapBounds }` for the `Minimap` props. The editor runs this
|
|
25
|
+
* as its bake action and stores the result on the document.
|
|
26
|
+
* @capability minimap-bake bake a minimap PNG + bounds from the authored scene document
|
|
27
|
+
*/
|
|
28
|
+
export declare function bakeMinimapFromDocument(doc: EditorDocument, sampleHeight: (x: number, z: number) => number, options?: DocumentBakeOptions): {
|
|
29
|
+
background: string;
|
|
30
|
+
mapBounds: MinimapBakeBounds;
|
|
31
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { bakeMinimapImage, minimapBakeToPngDataUri, } from "../world/minimapBake.js";
|
|
2
|
+
import { editorDocumentBounds } from "./document.js";
|
|
3
|
+
/**
|
|
4
|
+
* The editor-side minimap bake (#1036): bake a top-down terrain image straight from the authored
|
|
5
|
+
* scene document. The document owns the zones (biome-tinted volumes) and the footprint; the caller
|
|
6
|
+
* supplies the composed `sampleHeight` (base terrain + the document's sculpt), since the sculpt on
|
|
7
|
+
* the document is a delta over the game's base terrain. Returns the `{ background, mapBounds }` the
|
|
8
|
+
* `Minimap`/`WorldMap` props take, so the editor stores that on the document and runtime consumes it
|
|
9
|
+
* with no new render path. Deterministic for a fixed scene — safe for verify/CI.
|
|
10
|
+
*/
|
|
11
|
+
/** A volume that carries a `color` tints the bake over its XZ footprint. */
|
|
12
|
+
function volumeFootprint(volume) {
|
|
13
|
+
const half = volume.halfExtents !== undefined
|
|
14
|
+
? { x: volume.halfExtents.x, z: volume.halfExtents.z }
|
|
15
|
+
: volume.radius !== undefined
|
|
16
|
+
? { x: volume.radius, z: volume.radius }
|
|
17
|
+
: null;
|
|
18
|
+
if (half === null)
|
|
19
|
+
return null;
|
|
20
|
+
const { x, z } = volume.center;
|
|
21
|
+
return [
|
|
22
|
+
[x - half.x, z - half.z],
|
|
23
|
+
[x + half.x, z - half.z],
|
|
24
|
+
[x + half.x, z + half.z],
|
|
25
|
+
[x - half.x, z + half.z],
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The biome-tint zones a document contributes to a bake: every volume carrying a `color` becomes a
|
|
30
|
+
* polygon tint over its footprint. (The optional stretch from #1036 — a bare bake still reads as
|
|
31
|
+
* terrain without any.)
|
|
32
|
+
* @capability minimap-bake derive biome-tint zones for a bake from the scene document
|
|
33
|
+
*/
|
|
34
|
+
export function documentBakeZones(doc) {
|
|
35
|
+
const zones = [];
|
|
36
|
+
for (const volume of doc.volumes) {
|
|
37
|
+
if (volume.color === undefined)
|
|
38
|
+
continue;
|
|
39
|
+
const polygon = volumeFootprint(volume);
|
|
40
|
+
if (polygon === null)
|
|
41
|
+
continue;
|
|
42
|
+
zones.push({ polygon, color: volume.color, alpha: 0.4 });
|
|
43
|
+
}
|
|
44
|
+
return zones;
|
|
45
|
+
}
|
|
46
|
+
/** Falls back to a small square when the document has no spatial objects. */
|
|
47
|
+
function boundsFromDocument(doc, padding) {
|
|
48
|
+
const b = editorDocumentBounds(doc);
|
|
49
|
+
if (b === null)
|
|
50
|
+
return { minX: -32, minZ: -32, maxX: 32, maxZ: 32 };
|
|
51
|
+
return { minX: b.min.x - padding, minZ: b.min.z - padding, maxX: b.max.x + padding, maxZ: b.max.z + padding };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Bakes a minimap image from a scene document plus a terrain height sampler: sizes the footprint to
|
|
55
|
+
* the authored objects (or an explicit `bounds`), tints biome-colored volumes, and rasterizes the
|
|
56
|
+
* terrain top-down. Returns `{ background, mapBounds }` for the `Minimap` props. The editor runs this
|
|
57
|
+
* as its bake action and stores the result on the document.
|
|
58
|
+
* @capability minimap-bake bake a minimap PNG + bounds from the authored scene document
|
|
59
|
+
*/
|
|
60
|
+
export function bakeMinimapFromDocument(doc, sampleHeight, options = {}) {
|
|
61
|
+
const bounds = options.bounds ?? boundsFromDocument(doc, options.padding ?? 16);
|
|
62
|
+
const bake = bakeMinimapImage({
|
|
63
|
+
bounds,
|
|
64
|
+
sampleHeight,
|
|
65
|
+
...(options.sampleNormal === undefined ? {} : { sampleNormal: options.sampleNormal }),
|
|
66
|
+
...(options.waterLevel === undefined ? {} : { waterLevel: options.waterLevel }),
|
|
67
|
+
zones: documentBakeZones(doc),
|
|
68
|
+
}, {
|
|
69
|
+
...(options.resolution === undefined ? {} : { resolution: options.resolution }),
|
|
70
|
+
...(options.palette === undefined ? {} : { palette: options.palette }),
|
|
71
|
+
});
|
|
72
|
+
return { background: minimapBakeToPngDataUri(bake), mapBounds: bake.bounds };
|
|
73
|
+
}
|