@jgengine/core 0.10.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 +13 -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/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 +1 -0
- package/dist/authoring.js +1 -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 +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 +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 +190 -7
- package/dist/editor/commands.js +727 -55
- package/dist/editor/document.d.ts +159 -13
- package/dist/editor/document.js +750 -19
- 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 +73 -6
- package/dist/editor/index.js +6 -2
- 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 +107 -1
- 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 +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 +100 -2
- package/dist/game/defineGame.js +39 -2
- 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 +35 -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 +92 -7
- 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 +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/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 -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/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 +16 -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 +35 -8
- package/dist/movement/movementModel.js +42 -14
- package/dist/movement/playerMovement.js +65 -10
- 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 +22 -0
- package/dist/random/rng.js +28 -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 +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 +42 -3
- package/dist/runtime/adapter.js +44 -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/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 +114 -13
- package/dist/runtime/gameContext.js +303 -395
- 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 +8 -3
- package/dist/runtime/hostedGameRunner.js +26 -3
- package/dist/runtime/hostedWorldSession.d.ts +12 -4
- package/dist/runtime/hostedWorldSession.js +11 -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 +30 -3
- package/dist/runtime/worldSnapshot.js +20 -5
- package/dist/scene/assetCatalog.d.ts +21 -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 +13 -1
- package/dist/scene/colliders.js +37 -1
- package/dist/scene/entityStats.d.ts +11 -2
- package/dist/scene/entityStats.js +11 -2
- 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 +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 +5 -0
- package/dist/store/observableKeyedStore.js +34 -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 +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 +33 -1
- package/dist/ui/hudLayout.js +204 -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/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/features.d.ts +115 -7
- package/dist/world/features.js +56 -5
- 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 +8 -0
- package/dist/world/roads.js +38 -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/terraform.d.ts +213 -1
- package/dist/world/terraform.js +655 -20
- package/dist/world/terrain.d.ts +119 -20
- package/dist/world/terrain.js +247 -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 +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 -5389
package/dist/gameplay.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export { Behaviour, BehaviourModule, createBehaviourWorld } from "./behaviour/behaviour.js";
|
|
2
|
+
export {} from "./board/laneBoard.js";
|
|
3
|
+
export { createCardPile, createCardPileState, draw, moveCards, peek, pileRng, shuffleWithRng, } from "./cards/cardPile.js";
|
|
4
|
+
export { runPipeline } from "./cards/modifierPipeline.js";
|
|
5
|
+
export {} from "./crafting/crop.js";
|
|
6
|
+
export { advanceTransport, createProductionState, drainOutput, feedProduction, productionBuilding, resolvePowerGrid, tickProduction, } from "./crafting/production.js";
|
|
7
|
+
export { canCraft, craft, craftSeconds, createRecipeGraph, stationSatisfied, } from "./crafting/recipe.js";
|
|
8
|
+
export { createListingBook } from "./economy/listingBook.js";
|
|
9
|
+
export { addScheduledRule, advanceLedger, annotate, balanceOf, cancelRule, capAmount, createResourceLedger, curveScale, pauseRule, redirect, rejectWhen, resumeRule, taxFraction, thresholdScale, } from "./economy/resourceLedger.js";
|
|
10
|
+
export {} from "./economy/techTree.js";
|
|
11
|
+
export { balance, charge, chargeAll, createEmptyWallet, grant, isOverdrawn } from "./economy/wallet.js";
|
|
12
|
+
export { DEFAULT_CHAT_BODY_LENGTH, DEFAULT_CHAT_HISTORY_LIMIT, DEFAULT_CHAT_RATE_LIMIT, createChatRateLimiter, } from "./game/chat.js";
|
|
13
|
+
export { playControlsActive } from "./game/controlGate.js";
|
|
14
|
+
export { createCosmetics } from "./game/cosmetics.js";
|
|
15
|
+
export { defineGame, } from "./game/defineGame.js";
|
|
16
|
+
export { defineSystem } from "./game/defineSystem.js";
|
|
17
|
+
export { createGameDialogue, dialogueSlot } from "./game/dialogue.js";
|
|
18
|
+
export { createGameEvents, } from "./game/events.js";
|
|
19
|
+
export { appendFeed, createGameFeed, pruneFeed, } from "./game/feed.js";
|
|
20
|
+
export { gamePhase, setGamePhase } from "./game/gamePhase.js";
|
|
21
|
+
export { createKeyValueStore } from "./game/keyValueStore.js";
|
|
22
|
+
export { createLeaderboard } from "./game/leaderboard.js";
|
|
23
|
+
export { createLevelSequence } from "./game/levelSequence.js";
|
|
24
|
+
export { createLoadouts } from "./game/loadout.js";
|
|
25
|
+
export { evaluateLootFilter, lootFilter } from "./game/lootFilter.js";
|
|
26
|
+
export { createLootPipeline, defineLootPipeline, } from "./game/lootPipeline.js";
|
|
27
|
+
export { createLootRegistry, lootTable } from "./game/lootTable.js";
|
|
28
|
+
export { resolveOneShotClip } from "./game/modelAnimation.js";
|
|
29
|
+
export { evaluateObjective } from "./game/objectives.js";
|
|
30
|
+
export { createLayerRegistry, diffParams, orderLayers, resolveParams, resolveSelection, validateLayers, } from "./game/paramLayers.js";
|
|
31
|
+
export { DEFAULT_PING_CATEGORIES, PING_FEED_ACTION, createPingSystem, } from "./game/ping.js";
|
|
32
|
+
export { CAMERA_FRUSTUM_DEFAULTS, worldHealthBarAllowsRole, } from "./game/playableGame.js";
|
|
33
|
+
export { curve, evalCurve, leveling, } from "./game/progression.js";
|
|
34
|
+
export { createQuestJournal } from "./game/quest.js";
|
|
35
|
+
export { RaceState, createLapTimer, createRaceState, finishRaceSession, firstPastPost, idleRaceSession, lapDurations, parDelta, placementOf, raceOutcomeOf, racePlacements, raceTrack, splitSegments, startRaceCountdown, tickRaceSession, } from "./game/race.js";
|
|
36
|
+
export { createRecordBook } from "./game/recordBook.js";
|
|
37
|
+
export { createRuleRegistry, rerollRules, selectRules, } from "./game/ruleSelection.js";
|
|
38
|
+
export { createRunDraft } from "./game/runDraft.js";
|
|
39
|
+
export { createSaveStore, localSaveBackend, memorySaveBackend, remoteSaveBackend, } from "./game/saveStore.js";
|
|
40
|
+
export { createSocial, } from "./game/social.js";
|
|
41
|
+
export { createSpawnPoints } from "./game/spawnPoints.js";
|
|
42
|
+
export { composeGameLoop } from "./game/systemRuntime.js";
|
|
43
|
+
export { DEFAULT_FIXED_STAGES, DEFAULT_FRAME_STAGES, compileSystemSchedule, } from "./game/systemSchedule.js";
|
|
44
|
+
export { createTalentTree } from "./game/talents.js";
|
|
45
|
+
export { appendToast, createToastQueue, pruneToasts } from "./game/toasts.js";
|
|
46
|
+
export { createUnlockCatalog, createUnlocks } from "./game/unlocks.js";
|
|
47
|
+
export { createVfxInstanceStore, } from "./game/vfxInstance.js";
|
|
48
|
+
export { DEFAULT_PICKUP_RADIUS, WORLD_ITEM_ENTITY_NAME, } from "./game/worldItem.js";
|
|
49
|
+
export {} from "./input/actionBindings.js";
|
|
50
|
+
export { NEUTRAL_AXIS } from "./input/axisInput.js";
|
|
51
|
+
export { applyBindingOverrides, clearBindingOverride, loadBindingOverrides, saveBindingOverride, } from "./input/bindingOverrides.js";
|
|
52
|
+
export { createGestureSurfaceTracker } from "./input/gestureSurface.js";
|
|
53
|
+
export { aimToPoint } from "./input/pointer.js";
|
|
54
|
+
export { normalizePointerToAxis } from "./input/pointerAxis.js";
|
|
55
|
+
export { createTouchGestureTracker } from "./input/touchGestures.js";
|
|
56
|
+
export { DEFAULT_TOUCH_STYLE, TOUCH_STYLES, TOUCH_STYLE_OPTIONS, deriveTouchScheme, touchButtonShape, touchCode, withTouchCodes, } from "./input/touchScheme.js";
|
|
57
|
+
export {} from "./inventory/inventoryModel.js";
|
|
58
|
+
export {} from "./inventory/shapedGrid.js";
|
|
59
|
+
export {} from "./inventory/slotModel.js";
|
|
60
|
+
export { createDeliveryQueue, insureLost, partitionOnDeath, resolveConsolation, } from "./inventory/storageTier.js";
|
|
61
|
+
export { createAffixRoller, seededRng } from "./item/affix.js";
|
|
62
|
+
export { applyWear, createDurability, createDurabilityTracker, durabilityFraction, isDisabled, repairQuote, wear, } from "./item/durability.js";
|
|
63
|
+
export { activeSetBonuses, applySetBonuses, candidateViolatesForbid, captureProvenance, countSetMembers, identityOf, isIdentityValid, matchesQuery, validateIdentity, } from "./item/itemIdentity.js";
|
|
64
|
+
export { createItemInstanceRegistry, proceduralLootEntry } from "./item/itemInstanceRegistry.js";
|
|
65
|
+
export { generate, } from "./item/itemgen.js";
|
|
66
|
+
export { computeEffectiveStats, createModularItem, install, isComplete, missingRequiredSlots, partInSlot, slotAccepts, uninstall, } from "./item/modularItem.js";
|
|
67
|
+
export { createItemUse } from "./item/use.js";
|
|
68
|
+
export { createUseBehaviorRegistry, } from "./item/useBehavior.js";
|
|
69
|
+
export { createWeaponStats } from "./item/weapon.js";
|
|
70
|
+
export { createStatGraph, statModifierContributions, } from "./progression/statGraph.js";
|
|
71
|
+
export {} from "./puzzle/cellGrid.js";
|
|
72
|
+
export {} from "./puzzle/fallingPiece.js";
|
|
73
|
+
export { createNameGenerator } from "./random/nameGen.js";
|
|
74
|
+
export { pickUniform, pickWeighted } from "./random/pick.js";
|
|
75
|
+
export { seededStreams } from "./random/rng.js";
|
|
76
|
+
export { addValue, clampValue, createPairKeyCodec, driftValue, getValue, setValue, towardValue, } from "./relation/keyedValues.js";
|
|
77
|
+
export { crossThresholds, tierAt, } from "./relation/thresholds.js";
|
|
78
|
+
export { evaluatePredicate, readPath, } from "./rules/predicate.js";
|
|
79
|
+
export { getRuleEffect, listRuleEffects, registerRuleEffect } from "./rules/ruleEffects.js";
|
|
80
|
+
export { createTriggeredRuleEngine, } from "./rules/triggeredRules.js";
|
|
81
|
+
export { createRing, ringSampleAt } from "./session/ring.js";
|
|
82
|
+
export {} from "./session/roles.js";
|
|
83
|
+
export {} from "./session/roundState.js";
|
|
84
|
+
export { createDecayMeterSet, decayMeterMoodles, decayMeterSnapshot, decayMeterState, decayMeters, initDecayMeters, refillMeter, } from "./survival/decayMeter.js";
|
|
85
|
+
export { createMoodleStack, stackMoodles } from "./survival/moodle.js";
|
|
86
|
+
export { createMultiRegionHealth } from "./survival/regionHealth.js";
|
|
87
|
+
export { createCommitController } from "./turn/commit.js";
|
|
88
|
+
export { createIntentBoard } from "./turn/intent.js";
|
|
89
|
+
export { createTurnLoop } from "./turn/turnLoop.js";
|
|
90
|
+
export { activeJobs, cancelJob, createWorkQueue, enqueue, fifoOrdering, jobById, jobProgress, pauseJob, priorityOrdering, queueSize, queuedJobs, resumeJob, tick, } from "./work/jobQueue.js";
|
|
91
|
+
export { unitTrainingConfig, } from "./work/unitTraining.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export * from "./runtime/hostedGameRunner.js";
|
|
7
|
-
export * from "./runtime/hostedWorldSession.js";
|
|
8
|
-
export * from "./runtime/worldMirror.js";
|
|
9
|
-
export * from "./runtime/worldChannel.js";
|
|
10
|
-
export * from "./runtime/commandRunner.js";
|
|
11
|
-
export * from "./runtime/gameRuntime.js";
|
|
12
|
-
export * from "./runtime/adapter.js";
|
|
13
|
-
export * from "./runtime/transport.js";
|
|
14
|
-
export * from "./runtime/visibility.js";
|
|
1
|
+
/**
|
|
2
|
+
* Package root — deep-path imports only for engine APIs (`@jgengine/core/<domain>/<file>`).
|
|
3
|
+
* Re-exports {@link VERSION} / {@link CHANGELOG} so `import { VERSION } from "@jgengine/core"` works.
|
|
4
|
+
*/
|
|
5
|
+
export { VERSION, CHANGELOG, type ChangelogEntry } from "./meta/changelog.js";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export * from "./runtime/hostedGameRunner.js";
|
|
7
|
-
export * from "./runtime/hostedWorldSession.js";
|
|
8
|
-
export * from "./runtime/worldMirror.js";
|
|
9
|
-
export * from "./runtime/worldChannel.js";
|
|
10
|
-
export * from "./runtime/commandRunner.js";
|
|
11
|
-
export * from "./runtime/gameRuntime.js";
|
|
12
|
-
export * from "./runtime/adapter.js";
|
|
13
|
-
export * from "./runtime/transport.js";
|
|
14
|
-
export * from "./runtime/visibility.js";
|
|
1
|
+
/**
|
|
2
|
+
* Package root — deep-path imports only for engine APIs (`@jgengine/core/<domain>/<file>`).
|
|
3
|
+
* Re-exports {@link VERSION} / {@link CHANGELOG} so `import { VERSION } from "@jgengine/core"` works.
|
|
4
|
+
*/
|
|
5
|
+
export { VERSION, CHANGELOG } from "./meta/changelog.js";
|
|
@@ -10,13 +10,17 @@ export interface ActionBinding<TCode extends string = string> {
|
|
|
10
10
|
secondary: TCode | null;
|
|
11
11
|
}
|
|
12
12
|
export type ActionBindingMap<TAction extends string, TCode extends string = string> = Record<TAction, ActionBinding<TCode>>;
|
|
13
|
+
/** @internal */
|
|
13
14
|
export declare function bindingMatches<TCode extends string>(code: TCode, binding: ActionBinding<TCode>): boolean;
|
|
14
|
-
/** First action (in the map's key order) bound to the given control code, or null.
|
|
15
|
+
/** First action (in the map's key order) bound to the given control code, or null.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
15
18
|
export declare function resolveBoundAction<TAction extends string, TCode extends string>(code: TCode, bindings: ActionBindingMap<TAction, TCode>): TAction | null;
|
|
16
19
|
/**
|
|
17
20
|
* Collapse left/right modifier variants of a KeyboardEvent.code so bindings
|
|
18
21
|
* store one logical key.
|
|
19
|
-
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
20
24
|
export declare function normalizeKeyCode(code: string): string;
|
|
21
25
|
export interface ActionBindingModes<TCode extends string = string> {
|
|
22
26
|
hold?: ActionBinding<TCode>[];
|
|
@@ -31,6 +35,7 @@ export type ActionCodes<TCode extends string = string> = readonly TCode[] | {
|
|
|
31
35
|
};
|
|
32
36
|
/** Maps each game action name to the input codes (hold/toggle keys, repeat rate) that trigger it. */
|
|
33
37
|
export type ActionCodesMap<TAction extends string = string, TCode extends string = string> = Record<TAction, ActionCodes<TCode>>;
|
|
38
|
+
/** @internal */
|
|
34
39
|
export declare function actionRepeatMs(codes: ActionCodes | undefined): number | undefined;
|
|
35
40
|
export interface ShouldDispatchActionInput {
|
|
36
41
|
pressed: boolean;
|
|
@@ -39,24 +44,35 @@ export interface ShouldDispatchActionInput {
|
|
|
39
44
|
lastFiredAt: number | null;
|
|
40
45
|
now: number;
|
|
41
46
|
}
|
|
47
|
+
/** @internal */
|
|
42
48
|
export declare function shouldDispatchAction({ pressed, down, repeatMs, lastFiredAt, now }: ShouldDispatchActionInput): boolean;
|
|
49
|
+
/** @internal */
|
|
43
50
|
export declare function toActionStateBindingMap<TAction extends string, TCode extends string>(map: ActionCodesMap<TAction, TCode>): ActionStateBindingMap<TAction, TCode>;
|
|
51
|
+
/** @internal */
|
|
44
52
|
export declare function hotbarSlotBindings(count: number, options?: {
|
|
45
53
|
action?: (slot: number) => string;
|
|
46
54
|
}): ActionCodesMap;
|
|
47
|
-
/** 0-based slot index for a hotbar-slot action name (`slot1`, `hotbarSlot1`), or null.
|
|
55
|
+
/** 0-based slot index for a hotbar-slot action name (`slot1`, `hotbarSlot1`), or null.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
48
58
|
export declare function hotbarSlotActionIndex(action: string): number | null;
|
|
59
|
+
/** @internal */
|
|
49
60
|
export declare function isHotbarSlotAction(action: string): boolean;
|
|
50
61
|
/**
|
|
51
62
|
* Convention mapping a bound input action to the command it fires: the action's
|
|
52
63
|
* own name when a command by that name exists, otherwise a `ui.<action>`
|
|
53
64
|
* fallback. Reserved actions (consumed natively by the shell) and hotbar slots
|
|
54
65
|
* yield null so the shell can handle them itself.
|
|
55
|
-
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
56
68
|
export declare function resolveActionCommand(action: string, has: (command: string) => boolean, reserved: ReadonlySet<string>): string | null;
|
|
57
|
-
/** Short display label for a raw key/button code (e.g. `"KeyW"` → `"W"`).
|
|
69
|
+
/** Short display label for a raw key/button code (e.g. `"KeyW"` → `"W"`).
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
58
72
|
export declare function bindingLabel(code: string): string;
|
|
59
|
-
/** Short display label for an action's first bound code, or null when unbound.
|
|
73
|
+
/** Short display label for an action's first bound code, or null when unbound.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
60
76
|
export declare function actionLabel(map: ActionCodesMap, action: string): string | null;
|
|
61
77
|
export interface ActionStateTracker<TAction extends string> {
|
|
62
78
|
handleDown(code: string): TAction | null;
|
|
@@ -66,4 +82,5 @@ export interface ActionStateTracker<TAction extends string> {
|
|
|
66
82
|
endFrame(): void;
|
|
67
83
|
reset(): void;
|
|
68
84
|
}
|
|
85
|
+
/** @internal */
|
|
69
86
|
export declare function createActionStateTracker<TAction extends string, TCode extends string = string>(map: ActionStateBindingMap<TAction, TCode>): ActionStateTracker<TAction>;
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
* the same model serves keyboard codes, mouse buttons, touch controls, or
|
|
6
6
|
* gamepad inputs.
|
|
7
7
|
*/
|
|
8
|
+
/** @internal */
|
|
8
9
|
export function bindingMatches(code, binding) {
|
|
9
10
|
return code === binding.primary || code === binding.secondary;
|
|
10
11
|
}
|
|
11
|
-
/** First action (in the map's key order) bound to the given control code, or null.
|
|
12
|
+
/** First action (in the map's key order) bound to the given control code, or null.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
12
15
|
export function resolveBoundAction(code, bindings) {
|
|
13
16
|
for (const action of Object.keys(bindings)) {
|
|
14
17
|
if (bindingMatches(code, bindings[action]))
|
|
@@ -19,7 +22,8 @@ export function resolveBoundAction(code, bindings) {
|
|
|
19
22
|
/**
|
|
20
23
|
* Collapse left/right modifier variants of a KeyboardEvent.code so bindings
|
|
21
24
|
* store one logical key.
|
|
22
|
-
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
23
27
|
export function normalizeKeyCode(code) {
|
|
24
28
|
if (code === "ShiftLeft" || code === "ShiftRight")
|
|
25
29
|
return "Shift";
|
|
@@ -27,11 +31,13 @@ export function normalizeKeyCode(code) {
|
|
|
27
31
|
return "Control";
|
|
28
32
|
return code;
|
|
29
33
|
}
|
|
34
|
+
/** @internal */
|
|
30
35
|
export function actionRepeatMs(codes) {
|
|
31
36
|
if (codes === undefined || Array.isArray(codes))
|
|
32
37
|
return undefined;
|
|
33
38
|
return codes.repeatMs;
|
|
34
39
|
}
|
|
40
|
+
/** @internal */
|
|
35
41
|
export function shouldDispatchAction({ pressed, down, repeatMs, lastFiredAt, now }) {
|
|
36
42
|
if (pressed)
|
|
37
43
|
return true;
|
|
@@ -44,6 +50,7 @@ export function shouldDispatchAction({ pressed, down, repeatMs, lastFiredAt, now
|
|
|
44
50
|
function toBindings(codes) {
|
|
45
51
|
return codes.map((code) => ({ primary: code, secondary: null }));
|
|
46
52
|
}
|
|
53
|
+
/** @internal */
|
|
47
54
|
export function toActionStateBindingMap(map) {
|
|
48
55
|
const result = {};
|
|
49
56
|
for (const action of Object.keys(map)) {
|
|
@@ -70,6 +77,7 @@ const HOTBAR_DIGIT_CODES = [
|
|
|
70
77
|
"Digit9",
|
|
71
78
|
"Digit0",
|
|
72
79
|
];
|
|
80
|
+
/** @internal */
|
|
73
81
|
export function hotbarSlotBindings(count, options) {
|
|
74
82
|
if (!Number.isInteger(count) || count < 1 || count > HOTBAR_DIGIT_CODES.length) {
|
|
75
83
|
throw new Error(`hotbarSlotBindings: count must be an integer in [1, ${HOTBAR_DIGIT_CODES.length}]`);
|
|
@@ -82,11 +90,14 @@ export function hotbarSlotBindings(count, options) {
|
|
|
82
90
|
return map;
|
|
83
91
|
}
|
|
84
92
|
const HOTBAR_SLOT_ACTION = /^(?:hotbar)?slot(\d+)$/i;
|
|
85
|
-
/** 0-based slot index for a hotbar-slot action name (`slot1`, `hotbarSlot1`), or null.
|
|
93
|
+
/** 0-based slot index for a hotbar-slot action name (`slot1`, `hotbarSlot1`), or null.
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
86
96
|
export function hotbarSlotActionIndex(action) {
|
|
87
97
|
const match = HOTBAR_SLOT_ACTION.exec(action);
|
|
88
98
|
return match === null ? null : Number(match[1]) - 1;
|
|
89
99
|
}
|
|
100
|
+
/** @internal */
|
|
90
101
|
export function isHotbarSlotAction(action) {
|
|
91
102
|
return HOTBAR_SLOT_ACTION.test(action);
|
|
92
103
|
}
|
|
@@ -95,7 +106,8 @@ export function isHotbarSlotAction(action) {
|
|
|
95
106
|
* own name when a command by that name exists, otherwise a `ui.<action>`
|
|
96
107
|
* fallback. Reserved actions (consumed natively by the shell) and hotbar slots
|
|
97
108
|
* yield null so the shell can handle them itself.
|
|
98
|
-
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
99
111
|
export function resolveActionCommand(action, has, reserved) {
|
|
100
112
|
if (reserved.has(action) || isHotbarSlotAction(action))
|
|
101
113
|
return null;
|
|
@@ -127,7 +139,9 @@ const CODE_LABELS = {
|
|
|
127
139
|
ArrowLeft: "←",
|
|
128
140
|
ArrowRight: "→",
|
|
129
141
|
};
|
|
130
|
-
/** Short display label for a raw key/button code (e.g. `"KeyW"` → `"W"`).
|
|
142
|
+
/** Short display label for a raw key/button code (e.g. `"KeyW"` → `"W"`).
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
131
145
|
export function bindingLabel(code) {
|
|
132
146
|
const direct = CODE_LABELS[code];
|
|
133
147
|
if (direct !== undefined)
|
|
@@ -138,7 +152,9 @@ export function bindingLabel(code) {
|
|
|
138
152
|
return code.slice(5);
|
|
139
153
|
return code.length === 1 ? code.toUpperCase() : code;
|
|
140
154
|
}
|
|
141
|
-
/** Short display label for an action's first bound code, or null when unbound.
|
|
155
|
+
/** Short display label for an action's first bound code, or null when unbound.
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
142
158
|
export function actionLabel(map, action) {
|
|
143
159
|
const codes = map[action];
|
|
144
160
|
if (codes === undefined)
|
|
@@ -159,6 +175,7 @@ function resolveActionBindingModes(config) {
|
|
|
159
175
|
return { hold: config, toggle: [] };
|
|
160
176
|
return { hold: config.hold ?? [], toggle: config.toggle ?? [] };
|
|
161
177
|
}
|
|
178
|
+
/** @internal */
|
|
162
179
|
export function createActionStateTracker(map) {
|
|
163
180
|
const actions = Object.keys(map);
|
|
164
181
|
const modesByAction = new Map(actions.map((action) => [action, resolveActionBindingModes(map[action])]));
|
|
@@ -23,7 +23,9 @@ export interface AxisRange {
|
|
|
23
23
|
max: number;
|
|
24
24
|
}
|
|
25
25
|
export declare const AXIS_RANGE: Record<AxisName, AxisRange>;
|
|
26
|
+
/** @internal */
|
|
26
27
|
export declare function clampAxis(value: number, range: AxisRange): number;
|
|
28
|
+
/** @internal */
|
|
27
29
|
export declare function rampToward(current: number, target: number, rate: number, dt: number): number;
|
|
28
30
|
/**
|
|
29
31
|
* Analog control channel — distinct from the digital action bindings. Throttle/brake/steer/handbrake
|
|
@@ -31,7 +33,8 @@ export declare function rampToward(current: number, target: number, rate: number
|
|
|
31
33
|
* a gamepad axis via `setAnalog`. `sample(dt, isDown, pointer?)` folds the current held-key state into
|
|
32
34
|
* the smoothed value; a binding's `pointer` source takes over from its keys while a pointer is active,
|
|
33
35
|
* and a `setAnalog` override replaces both for that axis until cleared.
|
|
34
|
-
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
35
38
|
export declare class AxisChannel {
|
|
36
39
|
private readonly bindings;
|
|
37
40
|
private readonly smoothing;
|
|
@@ -68,6 +71,8 @@ export interface GenericAxisChannel<TAxes extends string> {
|
|
|
68
71
|
* `AxisChannel` ramps toward, exposed as a pure read for `ctx.input.axis` and headless sampling.
|
|
69
72
|
* Each axis is its binding's positive-minus-negative held state (or its pointer source while a pointer
|
|
70
73
|
* is active), clamped to the axis range; axes without a listed range default to bipolar `[-1, 1]`.
|
|
71
|
-
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
72
76
|
export declare function sampleAxisBindings<TAxes extends string>(bindings: Record<TAxes, AxisBinding>, isDown: (code: string) => boolean, pointer?: PointerAxisState | null, ranges?: Partial<Record<TAxes, AxisRange>>): Record<TAxes, number>;
|
|
77
|
+
/** @internal */
|
|
73
78
|
export declare function createAxisChannel<TAxes extends string>(config: GenericAxisConfig<TAxes>): GenericAxisChannel<TAxes>;
|
package/dist/input/axisInput.js
CHANGED
|
@@ -6,9 +6,11 @@ export const AXIS_RANGE = {
|
|
|
6
6
|
steer: { min: -1, max: 1 },
|
|
7
7
|
handbrake: { min: 0, max: 1 },
|
|
8
8
|
};
|
|
9
|
+
/** @internal */
|
|
9
10
|
export function clampAxis(value, range) {
|
|
10
11
|
return value < range.min ? range.min : value > range.max ? range.max : value;
|
|
11
12
|
}
|
|
13
|
+
/** @internal */
|
|
12
14
|
export function rampToward(current, target, rate, dt) {
|
|
13
15
|
if (!Number.isFinite(rate))
|
|
14
16
|
return target;
|
|
@@ -29,7 +31,8 @@ function digitalTarget(binding, isDown) {
|
|
|
29
31
|
* a gamepad axis via `setAnalog`. `sample(dt, isDown, pointer?)` folds the current held-key state into
|
|
30
32
|
* the smoothed value; a binding's `pointer` source takes over from its keys while a pointer is active,
|
|
31
33
|
* and a `setAnalog` override replaces both for that axis until cleared.
|
|
32
|
-
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
33
36
|
export class AxisChannel {
|
|
34
37
|
bindings;
|
|
35
38
|
smoothing;
|
|
@@ -80,7 +83,8 @@ const BIPOLAR_RANGE = { min: -1, max: 1 };
|
|
|
80
83
|
* `AxisChannel` ramps toward, exposed as a pure read for `ctx.input.axis` and headless sampling.
|
|
81
84
|
* Each axis is its binding's positive-minus-negative held state (or its pointer source while a pointer
|
|
82
85
|
* is active), clamped to the axis range; axes without a listed range default to bipolar `[-1, 1]`.
|
|
83
|
-
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
84
88
|
export function sampleAxisBindings(bindings, isDown, pointer, ranges) {
|
|
85
89
|
const out = {};
|
|
86
90
|
for (const axis of Object.keys(bindings)) {
|
|
@@ -91,6 +95,7 @@ export function sampleAxisBindings(bindings, isDown, pointer, ranges) {
|
|
|
91
95
|
}
|
|
92
96
|
return out;
|
|
93
97
|
}
|
|
98
|
+
/** @internal */
|
|
94
99
|
export function createAxisChannel(config) {
|
|
95
100
|
const axes = Object.keys(config.bindings);
|
|
96
101
|
const smoothing = config.smoothing ?? 6;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional RTS binding composition over the genre-agnostic selection-bookmark
|
|
3
|
+
* store (`@jgengine/core/scene/selectionBookmarks`). It maps the classic control-
|
|
4
|
+
* group idiom — Ctrl+digit binds, digit recalls, a second digit tap within a
|
|
5
|
+
* window focuses — onto opaque bookmark keys, without pulling input mapping into
|
|
6
|
+
* the store. Games that want a different scheme (named bookmarks, gamepad, touch)
|
|
7
|
+
* skip this and call the store directly.
|
|
8
|
+
*
|
|
9
|
+
* The resolver is pure: it turns a decoded key event plus the last-recall memory
|
|
10
|
+
* into an intent, so the same logic works under any capture layer and stays
|
|
11
|
+
* replay-safe. The caller owns actually binding/recalling and the focus hook.
|
|
12
|
+
*/
|
|
13
|
+
/** What a control-group key press means once modifiers and double-tap timing are resolved. */
|
|
14
|
+
export type ControlGroupIntent =
|
|
15
|
+
/** Ctrl+digit: save the current selection under `key`. */
|
|
16
|
+
{
|
|
17
|
+
kind: "bind";
|
|
18
|
+
key: string;
|
|
19
|
+
}
|
|
20
|
+
/** Digit: recall the set saved under `key` into the active selection. */
|
|
21
|
+
| {
|
|
22
|
+
kind: "recall";
|
|
23
|
+
key: string;
|
|
24
|
+
}
|
|
25
|
+
/** Second digit tap within the double-tap window: recall and focus the camera on `key`. */
|
|
26
|
+
| {
|
|
27
|
+
kind: "focus";
|
|
28
|
+
key: string;
|
|
29
|
+
};
|
|
30
|
+
/** A decoded control-group key press plus the memory needed to detect a double-tap. */
|
|
31
|
+
export interface ControlGroupInput {
|
|
32
|
+
/** The pressed group digit, 0–9. */
|
|
33
|
+
digit: number;
|
|
34
|
+
/** True when a bind modifier (Ctrl by default) was held. */
|
|
35
|
+
bindModifier: boolean;
|
|
36
|
+
/** Monotonic time of this press, same clock as `lastRecall`. */
|
|
37
|
+
now: number;
|
|
38
|
+
/** The previous recall (its key and time), or null if none — drives double-tap focus detection. */
|
|
39
|
+
lastRecall: {
|
|
40
|
+
key: string;
|
|
41
|
+
at: number;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
/** Tuning for the control-group idiom: the double-tap focus window and the bookmark-key namespace. */
|
|
45
|
+
export interface ControlGroupOptions {
|
|
46
|
+
/** Max gap (ms) between two recalls of the same group that counts as a focus double-tap. Default 300. */
|
|
47
|
+
doubleTapMs?: number;
|
|
48
|
+
/** Prefix for the generated bookmark key, so control groups can share a store with other bookmarks. Default `""` (bare digit). */
|
|
49
|
+
keyPrefix?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The stable bookmark key for a control-group `digit` under `options.keyPrefix` —
|
|
53
|
+
* the key a caller passes to `SelectionBookmarks.bind`/`recall` to store a group
|
|
54
|
+
* without going through {@link resolveControlGroupIntent}.
|
|
55
|
+
*
|
|
56
|
+
* @capability rts-control-groups map Ctrl+digit / digit / double-tap presses onto selection-bookmark bind / recall / focus intents
|
|
57
|
+
*/
|
|
58
|
+
export declare function controlGroupKey(digit: number, options?: ControlGroupOptions): string;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve a control-group key press into a {@link ControlGroupIntent}: Ctrl+digit
|
|
61
|
+
* binds, a bare digit recalls, and a second recall of the same group within
|
|
62
|
+
* `doubleTapMs` focuses. Pure — the caller applies the intent against the store
|
|
63
|
+
* and its own focus hook, and records the returned recall for the next call.
|
|
64
|
+
*
|
|
65
|
+
* @capability rts-control-groups map Ctrl+digit / digit / double-tap presses onto selection-bookmark bind / recall / focus intents
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveControlGroupIntent(input: ControlGroupInput, options?: ControlGroupOptions): ControlGroupIntent;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional RTS binding composition over the genre-agnostic selection-bookmark
|
|
3
|
+
* store (`@jgengine/core/scene/selectionBookmarks`). It maps the classic control-
|
|
4
|
+
* group idiom — Ctrl+digit binds, digit recalls, a second digit tap within a
|
|
5
|
+
* window focuses — onto opaque bookmark keys, without pulling input mapping into
|
|
6
|
+
* the store. Games that want a different scheme (named bookmarks, gamepad, touch)
|
|
7
|
+
* skip this and call the store directly.
|
|
8
|
+
*
|
|
9
|
+
* The resolver is pure: it turns a decoded key event plus the last-recall memory
|
|
10
|
+
* into an intent, so the same logic works under any capture layer and stays
|
|
11
|
+
* replay-safe. The caller owns actually binding/recalling and the focus hook.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The stable bookmark key for a control-group `digit` under `options.keyPrefix` —
|
|
15
|
+
* the key a caller passes to `SelectionBookmarks.bind`/`recall` to store a group
|
|
16
|
+
* without going through {@link resolveControlGroupIntent}.
|
|
17
|
+
*
|
|
18
|
+
* @capability rts-control-groups map Ctrl+digit / digit / double-tap presses onto selection-bookmark bind / recall / focus intents
|
|
19
|
+
*/
|
|
20
|
+
export function controlGroupKey(digit, options = {}) {
|
|
21
|
+
if (!Number.isInteger(digit) || digit < 0 || digit > 9) {
|
|
22
|
+
throw new Error(`controlGroupKey: digit must be an integer in [0, 9], got ${digit}`);
|
|
23
|
+
}
|
|
24
|
+
return `${options.keyPrefix ?? ""}${digit}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a control-group key press into a {@link ControlGroupIntent}: Ctrl+digit
|
|
28
|
+
* binds, a bare digit recalls, and a second recall of the same group within
|
|
29
|
+
* `doubleTapMs` focuses. Pure — the caller applies the intent against the store
|
|
30
|
+
* and its own focus hook, and records the returned recall for the next call.
|
|
31
|
+
*
|
|
32
|
+
* @capability rts-control-groups map Ctrl+digit / digit / double-tap presses onto selection-bookmark bind / recall / focus intents
|
|
33
|
+
*/
|
|
34
|
+
export function resolveControlGroupIntent(input, options = {}) {
|
|
35
|
+
const key = controlGroupKey(input.digit, options);
|
|
36
|
+
if (input.bindModifier)
|
|
37
|
+
return { kind: "bind", key };
|
|
38
|
+
const doubleTapMs = options.doubleTapMs ?? 300;
|
|
39
|
+
const isDoubleTap = input.lastRecall !== null && input.lastRecall.key === key && input.now - input.lastRecall.at <= doubleTapMs;
|
|
40
|
+
return { kind: isDoubleTap ? "focus" : "recall", key };
|
|
41
|
+
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* capture layer renders a virtual joystick, on-screen buttons, and a gesture
|
|
4
4
|
* surface, and feeds synthetic `touch:<action>` codes into the same
|
|
5
5
|
* ActionStateTracker the keyboard uses, so games gain touch play without any
|
|
6
|
-
* per-game input code.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* per-game input code. Session-lifecycle actions (start/restart/pause/menu/…)
|
|
7
|
+
* are left off the derived dock — they live in the start screen, pause menu, or
|
|
8
|
+
* settings sheet, never as a chip over live play. Games refine the derived
|
|
9
|
+
* defaults through TouchControlsConfig (gesture bindings, button curation) or
|
|
10
|
+
* opt out entirely with `touch: false`.
|
|
9
11
|
*/
|
|
10
12
|
import { type ActionCodesMap } from "./actionBindings.js";
|
|
11
13
|
export declare const TOUCH_CODE_PREFIX = "touch:";
|
|
@@ -31,6 +33,50 @@ export interface TouchGestureBindings {
|
|
|
31
33
|
/** Continuous drag: repeats the directional action every `stepPx` of travel. Wins over swipes on its axis, except a flick can still fire the swipe binding for a direction the drag leaves unbound. */
|
|
32
34
|
drag?: TouchDragBinding;
|
|
33
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Physical silhouette a touch button wears. The capture layer draws each as its
|
|
38
|
+
* own shape — a `pedal` reads as a foot pedal, a `lever` as a pull handle, a
|
|
39
|
+
* `trigger` as a firing paddle — so a control looks like the thing it does
|
|
40
|
+
* instead of a labelled circle. `circle`/`square` are the neutral fallbacks.
|
|
41
|
+
*/
|
|
42
|
+
export type TouchButtonShape = "circle" | "square" | "pedal" | "lever" | "trigger" | "wheel" | "tab";
|
|
43
|
+
/**
|
|
44
|
+
* Screen zone a touch cluster or button docks to. The four corners plus the
|
|
45
|
+
* mid `left`/`right` rails (vertical stacks, MMO-style hotbars) and the
|
|
46
|
+
* `bottom-center` / `top-center` strips let controls use the whole viewport
|
|
47
|
+
* instead of piling into one bottom bar.
|
|
48
|
+
*/
|
|
49
|
+
export type TouchAnchor = "bottom-left" | "bottom-center" | "bottom-right" | "left" | "right" | "top-left" | "top-center" | "top-right";
|
|
50
|
+
/**
|
|
51
|
+
* Player-selectable skin for the whole touch layer. A style is a material +
|
|
52
|
+
* geometry preset (not just colours), chosen in Settings → Controls and
|
|
53
|
+
* persisted; `glass` is the translucent default, the rest are opt-in looks.
|
|
54
|
+
*/
|
|
55
|
+
export type TouchStyle = "glass" | "arcade" | "mechanical" | "minimal";
|
|
56
|
+
/** Every touch skin id, in menu order. */
|
|
57
|
+
export declare const TOUCH_STYLES: readonly TouchStyle[];
|
|
58
|
+
/** Touch skins as `{ value, label }` rows for the Settings → Controls selector. */
|
|
59
|
+
export declare const TOUCH_STYLE_OPTIONS: readonly {
|
|
60
|
+
value: TouchStyle;
|
|
61
|
+
label: string;
|
|
62
|
+
}[];
|
|
63
|
+
/** Skin used when neither the game nor the player picks one. */
|
|
64
|
+
export declare const DEFAULT_TOUCH_STYLE: TouchStyle;
|
|
65
|
+
/** Where each touch cluster docks; unset falls back to the classic bottom layout. */
|
|
66
|
+
export interface TouchLayoutConfig {
|
|
67
|
+
/** Virtual joystick / movement zone. Default `bottom-left`. */
|
|
68
|
+
movement?: TouchAnchor;
|
|
69
|
+
/** Primary action cluster. Default `bottom-right`. */
|
|
70
|
+
actions?: TouchAnchor;
|
|
71
|
+
/** Utility chip row. Default `bottom-center`. */
|
|
72
|
+
utility?: TouchAnchor;
|
|
73
|
+
}
|
|
74
|
+
/** The dock zone each cluster resolved to, after applying game config over the bottom-layout defaults. */
|
|
75
|
+
export interface ResolvedTouchLayout {
|
|
76
|
+
movement: TouchAnchor;
|
|
77
|
+
actions: TouchAnchor;
|
|
78
|
+
utility: TouchAnchor;
|
|
79
|
+
}
|
|
34
80
|
export interface TouchButtonSpec {
|
|
35
81
|
action: string;
|
|
36
82
|
label?: string;
|
|
@@ -38,11 +84,21 @@ export interface TouchButtonSpec {
|
|
|
38
84
|
icon?: string | false;
|
|
39
85
|
/** Overrides the derived classification: `primary` renders as a large thumb button, `utility` as a small chip away from the thumb zones. */
|
|
40
86
|
kind?: TouchButtonKind;
|
|
87
|
+
/** Physical silhouette; unset derives one from the action name (`brake`→pedal, `handbrake`→lever, `fire`→trigger, …). */
|
|
88
|
+
shape?: TouchButtonShape;
|
|
89
|
+
/** Docks this button on its own instead of joining its cluster — e.g. a brake pedal pinned to the right rail. */
|
|
90
|
+
anchor?: TouchAnchor;
|
|
91
|
+
/** Custom art drawn as the button face instead of the built-in silhouette — any image URL or `data:image/svg+xml` URI (a slot frame, spell plate, …); the icon/label still sits on top. */
|
|
92
|
+
image?: string;
|
|
93
|
+
}
|
|
94
|
+
/** Restricts the virtual joystick to one axis — a `horizontal` zone reads as a steering control, freeing throttle/brake to become pedal buttons. */
|
|
95
|
+
export interface TouchMovementConfig {
|
|
96
|
+
axis?: "both" | "horizontal" | "vertical";
|
|
41
97
|
}
|
|
42
98
|
export interface TouchControlsConfig {
|
|
43
|
-
/** `false` removes the virtual joystick even when movement actions are bound. */
|
|
44
|
-
movement?: false;
|
|
45
|
-
/** Curated on-screen buttons (order preserved); omit to derive one button per remaining action. */
|
|
99
|
+
/** `false` removes the virtual joystick even when movement actions are bound; an object restricts it to one axis. */
|
|
100
|
+
movement?: false | TouchMovementConfig;
|
|
101
|
+
/** Curated on-screen buttons (order preserved); omit to derive one button per remaining action. Derivation skips session-lifecycle actions (start/restart/pause/menu/…); list one here to dock it anyway. */
|
|
46
102
|
buttons?: readonly (string | TouchButtonSpec)[];
|
|
47
103
|
/** Play-surface gestures; actions consumed here stop appearing as derived buttons. */
|
|
48
104
|
gestures?: TouchGestureBindings;
|
|
@@ -52,6 +108,10 @@ export interface TouchControlsConfig {
|
|
|
52
108
|
lookSensitivity?: number;
|
|
53
109
|
/** Actions to leave off the derived button cluster. */
|
|
54
110
|
hidden?: readonly string[];
|
|
111
|
+
/** Dock each cluster to a screen zone; omit for the classic bottom layout. */
|
|
112
|
+
layout?: TouchLayoutConfig;
|
|
113
|
+
/** Suggested default skin; the player's Settings choice overrides it. Default `glass`. */
|
|
114
|
+
style?: TouchStyle;
|
|
55
115
|
}
|
|
56
116
|
export interface TouchJoystick {
|
|
57
117
|
up: string | null;
|
|
@@ -67,6 +127,12 @@ export interface TouchButton {
|
|
|
67
127
|
icon: string | false | null;
|
|
68
128
|
/** `primary` = frequent gameplay verb, rendered as a large thumb button; `utility` = meta action (start, restart, pause, toggles), rendered as a small chip. */
|
|
69
129
|
kind: TouchButtonKind;
|
|
130
|
+
/** Physical silhouette to draw. */
|
|
131
|
+
shape: TouchButtonShape;
|
|
132
|
+
/** Per-button dock override; null joins the cluster's anchor. */
|
|
133
|
+
anchor: TouchAnchor | null;
|
|
134
|
+
/** Custom face art (image/SVG URL); null draws the built-in silhouette. */
|
|
135
|
+
image: string | null;
|
|
70
136
|
}
|
|
71
137
|
export interface TouchScheme {
|
|
72
138
|
joystick: TouchJoystick | null;
|
|
@@ -74,7 +140,17 @@ export interface TouchScheme {
|
|
|
74
140
|
gestures: TouchGestureBindings | null;
|
|
75
141
|
look: boolean;
|
|
76
142
|
lookSensitivity: number;
|
|
143
|
+
/** Resolved dock zones for the three clusters. */
|
|
144
|
+
layout: ResolvedTouchLayout;
|
|
145
|
+
/** Game-suggested default skin; the shell swaps in the player's choice when set. */
|
|
146
|
+
style: TouchStyle;
|
|
77
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Default silhouette for an action; `circle` when nothing more specific fits.
|
|
150
|
+
*
|
|
151
|
+
* @capability touch-controls default on-screen button silhouette for a touch action
|
|
152
|
+
*/
|
|
153
|
+
export declare function touchButtonShape(action: string): TouchButtonShape;
|
|
78
154
|
export declare function touchButtonKind(action: string): TouchButtonKind;
|
|
79
155
|
export declare function touchActionLabel(action: string): string;
|
|
80
156
|
export interface DeriveTouchSchemeOptions {
|