threedog 0.0.0-stage → 0.2.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 +5 -0
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/core/Animator.js +268 -0
- package/core/Assets.js +256 -0
- package/core/Audio.js +267 -0
- package/core/Baked.js +72 -0
- package/core/Batching.js +247 -0
- package/core/Budget.js +221 -0
- package/core/Clock.js +94 -0
- package/core/Commits.js +77 -0
- package/core/DebugOverrides.js +143 -0
- package/core/Describe.js +145 -0
- package/core/Engine.js +184 -0
- package/core/Events.js +153 -0
- package/core/I18n.js +94 -0
- package/core/Input.js +245 -0
- package/core/Inspect.js +77 -0
- package/core/InspectScene.js +191 -0
- package/core/Jobs.js +146 -0
- package/core/Loading.js +149 -0
- package/core/MaterialInfo.js +32 -0
- package/core/Ops.js +256 -0
- package/core/Random.js +52 -0
- package/core/Rays.js +160 -0
- package/core/SaveStore.js +85 -0
- package/core/Saves.js +254 -0
- package/core/Stream.js +279 -0
- package/core/Threads.js +158 -0
- package/core/UrlState.js +94 -0
- package/core/Vars.js +35 -0
- package/core/Views.js +49 -0
- package/core/actor.js +23 -0
- package/core/assetEntry.js +89 -0
- package/core/assetLoad.js +190 -0
- package/core/assetManifest.js +35 -0
- package/core/assetReport.js +83 -0
- package/core/audioRules.js +121 -0
- package/core/audioVoice.js +225 -0
- package/core/batchGroups.js +116 -0
- package/core/canvasBox.js +63 -0
- package/core/catalog.js +169 -0
- package/core/checks.js +67 -0
- package/core/claims.js +51 -0
- package/core/dayTime.js +15 -0
- package/core/debugView.js +76 -0
- package/core/describeRender.js +45 -0
- package/core/describeText.js +143 -0
- package/core/easing.js +34 -0
- package/core/errorCodes.js +205 -0
- package/core/errorHints.js +208 -0
- package/core/errors.js +40 -0
- package/core/events.generated.js +84 -0
- package/core/ground.js +102 -0
- package/core/holds.js +106 -0
- package/core/inputContext.js +69 -0
- package/core/inputDefaults.js +22 -0
- package/core/inputPad.js +35 -0
- package/core/inputPointer.js +48 -0
- package/core/inputTouch.js +48 -0
- package/core/lifecycle.js +69 -0
- package/core/lightWatch.js +56 -0
- package/core/look/coreParts.js +112 -0
- package/core/look/layers.js +136 -0
- package/core/look/part.js +173 -0
- package/core/look/report.js +79 -0
- package/core/look/write.js +86 -0
- package/core/loop.js +200 -0
- package/core/math.js +33 -0
- package/core/modules.js +196 -0
- package/core/movement.js +19 -0
- package/core/mulberry32.js +14 -0
- package/core/opsAtomic.js +31 -0
- package/core/opsCheck.js +97 -0
- package/core/opsFail.js +20 -0
- package/core/opsGuard.js +26 -0
- package/core/opsHistory.js +27 -0
- package/core/opsRun.js +77 -0
- package/core/page.js +78 -0
- package/core/params.js +132 -0
- package/core/pureWorker.js +5 -0
- package/core/renamed.js +21 -0
- package/core/saveApply.js +128 -0
- package/core/saveFiles.js +139 -0
- package/core/saveIds.js +53 -0
- package/core/saveVersions.js +97 -0
- package/core/scatter.js +92 -0
- package/core/sceneMethods.js +100 -0
- package/core/screenToGround.js +39 -0
- package/core/services.js +73 -0
- package/core/session.js +171 -0
- package/core/shadowTypes.js +15 -0
- package/core/skip.js +104 -0
- package/core/startup.js +135 -0
- package/core/streamCells.js +24 -0
- package/core/streamSources.js +73 -0
- package/core/styleParts.js +96 -0
- package/core/targeting.js +64 -0
- package/core/thingExplain.js +68 -0
- package/core/thingOps.js +168 -0
- package/core/things.js +212 -0
- package/core/threadPure.js +120 -0
- package/core/threadServe.js +25 -0
- package/core/tier.js +11 -0
- package/core/util.js +11 -0
- package/core/validate.js +204 -0
- package/docs/AI.md +123 -0
- package/docs/API.md +83 -0
- package/docs/CODEMAP.md +347 -0
- package/docs/COMMANDS.md +108 -0
- package/docs/CONVENTIONS.md +145 -0
- package/docs/PERF.md +217 -0
- package/docs/THREE.md +86 -0
- package/docs/api/ambience.md +15 -0
- package/docs/api/assets.md +62 -0
- package/docs/api/audio.md +53 -0
- package/docs/api/budget.md +40 -0
- package/docs/api/cameraRig.md +120 -0
- package/docs/api/characters.md +144 -0
- package/docs/api/clock.md +7 -0
- package/docs/api/collision.md +39 -0
- package/docs/api/content.md +64 -0
- package/docs/api/dialogue.md +39 -0
- package/docs/api/engine.md +199 -0
- package/docs/api/entities.md +61 -0
- package/docs/api/events.md +95 -0
- package/docs/api/flow.md +27 -0
- package/docs/api/grids.md +11 -0
- package/docs/api/ground.md +16 -0
- package/docs/api/hlod.md +34 -0
- package/docs/api/hud.md +31 -0
- package/docs/api/i18n.md +10 -0
- package/docs/api/input.md +24 -0
- package/docs/api/interactions.md +31 -0
- package/docs/api/inventory.md +66 -0
- package/docs/api/jobs.md +10 -0
- package/docs/api/level.md +41 -0
- package/docs/api/lightPool.md +56 -0
- package/docs/api/music.md +34 -0
- package/docs/api/nav.md +26 -0
- package/docs/api/net.md +14 -0
- package/docs/api/openWorld.md +24 -0
- package/docs/api/particles.md +41 -0
- package/docs/api/photo.md +15 -0
- package/docs/api/post.md +10 -0
- package/docs/api/quests.md +36 -0
- package/docs/api/rays.md +26 -0
- package/docs/api/rigid.md +84 -0
- package/docs/api/saves.md +32 -0
- package/docs/api/settings.md +36 -0
- package/docs/api/sky.md +58 -0
- package/docs/api/stream.md +31 -0
- package/docs/api/style.md +134 -0
- package/docs/api/terrain.md +34 -0
- package/docs/api/timeline.md +39 -0
- package/docs/api/tools.md +57 -0
- package/docs/api/triggers.md +56 -0
- package/docs/api/vars.md +9 -0
- package/docs/api/vegetation.md +52 -0
- package/docs/api/water.md +48 -0
- package/docs/api/weather.md +29 -0
- package/docs/api/world.md +30 -0
- package/docs/recipes/01-new-game.md +148 -0
- package/docs/recipes/02-npc.md +167 -0
- package/docs/recipes/03-items-pickups.md +158 -0
- package/docs/recipes/04-quests.md +83 -0
- package/docs/recipes/05-props-bake.md +159 -0
- package/docs/recipes/06-clock-events.md +117 -0
- package/docs/recipes/07-flow-scenes-pause.md +132 -0
- package/docs/recipes/08-weather-sky.md +74 -0
- package/docs/recipes/09-style-pack.md +234 -0
- package/docs/recipes/10-blender-level.md +67 -0
- package/docs/recipes/11-vehicles.md +55 -0
- package/docs/recipes/12-navmesh.md +79 -0
- package/docs/recipes/13-animation.md +149 -0
- package/docs/recipes/14-custom-module.md +91 -0
- package/docs/recipes/15-perf.md +78 -0
- package/docs/recipes/16-dev-bridge.md +180 -0
- package/docs/recipes/18-world.md +185 -0
- package/docs/recipes/19-shooting-picking.md +76 -0
- package/docs/recipes/20-content-actions-save.md +176 -0
- package/docs/recipes/21-camera.md +153 -0
- package/docs/recipes/22-shop-gold.md +107 -0
- package/docs/recipes/23-ops.md +175 -0
- package/docs/recipes/26-ui-parts.md +138 -0
- package/docs/recipes/27-net.md +96 -0
- package/docs/recipes/28-terrain.md +80 -0
- package/docs/recipes/29-grid.md +87 -0
- package/docs/recipes/30-templates.md +131 -0
- package/docs/recipes/31-audio.md +126 -0
- package/docs/recipes/32-action-game.md +33 -0
- package/docs/recipes/33-stream-sources.md +37 -0
- package/docs/recipes/34-environment-lighting.md +36 -0
- package/docs/recipes/35-style-from-reference.md +89 -0
- package/docs/recipes/36-sky-ground-plant-looks.md +116 -0
- package/docs/recipes/37-terrain-look-hooks.md +97 -0
- package/docs/recipes/38-environment-look-hooks.md +83 -0
- package/docs/recipes/40-scene.md +108 -0
- package/docs/recipes/41-thing-registry.md +93 -0
- package/docs/recipes/42-terrain-shape.md +64 -0
- package/docs/recipes/43-shader-patches-surface-looks.md +120 -0
- package/docs/recipes/44-water-weather-look-hooks.md +135 -0
- package/docs/recipes/45-cascaded-shadows.md +51 -0
- package/docs/recipes/46-blender-art-route.md +114 -0
- package/docs/recipes/47-island-snow-backdrop.md +44 -0
- package/docs/recipes/48-make-material.md +70 -0
- package/docs/recipes/49-game-module-contract.md +71 -0
- package/docs/recipes/50-own-renderer.md +12 -0
- package/docs/recipes/51-capability-catalog.md +63 -0
- package/docs/recipes/52-look.md +108 -0
- package/examples/action/DESIGN.md +3 -0
- package/examples/action/GAMEMAP.md +127 -0
- package/examples/action/content/actions.js +8 -0
- package/examples/action/content/audio.js +9 -0
- package/examples/action/content/index.js +10 -0
- package/examples/action/content/items.js +4 -0
- package/examples/action/content/places.js +4 -0
- package/examples/action/content/props.js +11 -0
- package/examples/action/content/templates.js +10 -0
- package/examples/action/content/views.js +6 -0
- package/examples/action/look.js +5 -0
- package/examples/action/main.js +137 -0
- package/examples/action/models.js +25 -0
- package/examples/sheepisland/GAMEMAP.md +107 -0
- package/examples/sheepisland/content/index.js +6 -0
- package/examples/sheepisland/content/props.js +19 -0
- package/examples/sheepisland/content/templates.js +5 -0
- package/examples/sheepisland/content/vegetation.js +8 -0
- package/examples/sheepisland/main.js +71 -0
- package/examples/sheepisland/params.js +25 -0
- package/examples/sheepisland/style/index.js +79 -0
- package/examples/sheepisland/style/models.js +59 -0
- package/examples/sheepisland/views.js +9 -0
- package/examples/styletest/GAMEMAP.md +135 -0
- package/examples/styletest/content/index.js +9 -0
- package/examples/styletest/content/items.js +8 -0
- package/examples/styletest/content/npcs.js +8 -0
- package/examples/styletest/content/places.js +5 -0
- package/examples/styletest/content/props.js +16 -0
- package/examples/styletest/content/templates.js +9 -0
- package/examples/styletest/content/vegetation.js +31 -0
- package/examples/styletest/look.js +11 -0
- package/examples/styletest/main.js +95 -0
- package/examples/styletest/models.js +87 -0
- package/examples/styletest/overrides.js +33 -0
- package/examples/styletest/panel.js +135 -0
- package/examples/styletest/params.js +32 -0
- package/examples/styletest/views.js +31 -0
- package/examples/world/DESIGN.md +5 -0
- package/examples/world/GAMEMAP.md +171 -0
- package/examples/world/content/actions.js +8 -0
- package/examples/world/content/audio.js +25 -0
- package/examples/world/content/bodies.js +12 -0
- package/examples/world/content/containers.js +4 -0
- package/examples/world/content/dialogues.js +33 -0
- package/examples/world/content/index.js +17 -0
- package/examples/world/content/items.js +10 -0
- package/examples/world/content/npcs.js +14 -0
- package/examples/world/content/pickups.js +11 -0
- package/examples/world/content/places.js +6 -0
- package/examples/world/content/props.js +12 -0
- package/examples/world/content/quests.js +15 -0
- package/examples/world/content/rules.js +23 -0
- package/examples/world/content/templates.js +5 -0
- package/examples/world/content/vegetation.js +32 -0
- package/examples/world/main.js +168 -0
- package/examples/world/models.js +28 -0
- package/index.d.ts +306 -0
- package/index.js +122 -0
- package/llms.txt +61 -0
- package/modules/ambience/Ambience.js +186 -0
- package/modules/camera/FirstPersonCamera.js +131 -0
- package/modules/camera/FixedCamera.js +162 -0
- package/modules/camera/FollowCamera.js +91 -0
- package/modules/camera/RtsCamera.js +132 -0
- package/modules/camera/common.js +182 -0
- package/modules/camera/index.js +11 -0
- package/modules/camera/projection.js +34 -0
- package/modules/characters/Character.js +235 -0
- package/modules/characters/NPC.js +242 -0
- package/modules/characters/assetModel.js +42 -0
- package/modules/characters/astar.js +66 -0
- package/modules/characters/behaviors.js +72 -0
- package/modules/characters/footsteps.js +13 -0
- package/modules/characters/index.js +215 -0
- package/modules/characters/moveHelpers.js +29 -0
- package/modules/characters/movers/common.js +62 -0
- package/modules/characters/movers/rapier.js +74 -0
- package/modules/characters/movers/simple.js +43 -0
- package/modules/characters/npcAvoid.js +129 -0
- package/modules/characters/npcSim.js +150 -0
- package/modules/characters/npcView.js +42 -0
- package/modules/characters/pathAsync.js +113 -0
- package/modules/characters/pathJob.js +62 -0
- package/modules/characters/pathWorker.js +7 -0
- package/modules/characters/playerStrings.js +12 -0
- package/modules/characters/proceduralRig.js +58 -0
- package/modules/characters/useModel.js +22 -0
- package/modules/characters/walkTo.js +58 -0
- package/modules/collision/Collision.js +274 -0
- package/modules/collision/grid.js +63 -0
- package/modules/content/explain.js +13 -0
- package/modules/content/ids.js +95 -0
- package/modules/content/index.js +154 -0
- package/modules/content/loader.js +190 -0
- package/modules/content/models.js +69 -0
- package/modules/content/packs.js +69 -0
- package/modules/content/props.js +89 -0
- package/modules/content/rules.js +134 -0
- package/modules/content/templates.js +189 -0
- package/modules/debug/DebugPanel.js +174 -0
- package/modules/entities/Entities.js +243 -0
- package/modules/entities/build.js +25 -0
- package/modules/entities/index.js +4 -0
- package/modules/flow/index.js +101 -0
- package/modules/gameplay/Container.js +227 -0
- package/modules/gameplay/Containers.js +89 -0
- package/modules/gameplay/Dialogue.js +219 -0
- package/modules/gameplay/Interactions.js +253 -0
- package/modules/gameplay/Inventory.js +224 -0
- package/modules/gameplay/Quests.js +205 -0
- package/modules/gameplay/boxOps.js +60 -0
- package/modules/gameplay/dialogueBox.js +48 -0
- package/modules/gameplay/interactionPrompt.js +28 -0
- package/modules/gameplay/inventoryOps.js +137 -0
- package/modules/gameplay/pickups.js +115 -0
- package/modules/gameplay/questLog.js +54 -0
- package/modules/gameplay/questSave.js +71 -0
- package/modules/grid/Grid.js +184 -0
- package/modules/grid/Layer.js +142 -0
- package/modules/grid/index.js +236 -0
- package/modules/grid/ops.js +73 -0
- package/modules/grid/preview.js +85 -0
- package/modules/grid/tiles.js +79 -0
- package/modules/hlod/index.js +167 -0
- package/modules/hud/index.js +167 -0
- package/modules/hud/parts.js +80 -0
- package/modules/level/geometry.js +46 -0
- package/modules/level/heightfield.js +160 -0
- package/modules/level/index.js +233 -0
- package/modules/level/nodes.js +84 -0
- package/modules/lights/index.js +227 -0
- package/modules/music/Music.js +294 -0
- package/modules/music/index.js +2 -0
- package/modules/music/rules.js +28 -0
- package/modules/nav/index.js +156 -0
- package/modules/nav/navPath.js +17 -0
- package/modules/net/Client.js +137 -0
- package/modules/net/Host.js +117 -0
- package/modules/net/Net.js +49 -0
- package/modules/net/index.js +77 -0
- package/modules/net/sync.js +114 -0
- package/modules/net/transports.js +118 -0
- package/modules/particles/Particles.js +179 -0
- package/modules/particles/effect.js +112 -0
- package/modules/particles/shaders.js +28 -0
- package/modules/photo/Photo.js +146 -0
- package/modules/rigid/RigidBodies.js +265 -0
- package/modules/rigid/Vehicles.js +97 -0
- package/modules/rigid/sync.js +158 -0
- package/modules/settings/Settings.js +297 -0
- package/modules/settings/apply.js +21 -0
- package/modules/settings/index.js +3 -0
- package/modules/settings/sections.js +156 -0
- package/modules/settings/strings.js +53 -0
- package/modules/settings/view.js +65 -0
- package/modules/sky/Sky.js +259 -0
- package/modules/sky/calendar.js +80 -0
- package/modules/sky/cascades.js +125 -0
- package/modules/sky/clouds.js +79 -0
- package/modules/sky/domeLayers.js +33 -0
- package/modules/sky/environment.js +141 -0
- package/modules/sky/fog.js +139 -0
- package/modules/sky/frame.js +77 -0
- package/modules/sky/layers.js +69 -0
- package/modules/sky/look.js +51 -0
- package/modules/sky/lookFog.js +80 -0
- package/modules/sky/lookShadow.js +50 -0
- package/modules/sky/lookSky.js +108 -0
- package/modules/sky/schedule.js +80 -0
- package/modules/sky/shader.js +96 -0
- package/modules/sky/shadow.js +74 -0
- package/modules/sky/skyModule.js +60 -0
- package/modules/terrain/ChunkManager.js +260 -0
- package/modules/terrain/chunkJob.js +19 -0
- package/modules/terrain/chunkLevels.js +40 -0
- package/modules/terrain/chunkQueries.js +42 -0
- package/modules/terrain/chunkWorker.js +5 -0
- package/modules/terrain/index.js +118 -0
- package/modules/terrain/lookGround.js +61 -0
- package/modules/terrain/mountTerrain.js +32 -0
- package/modules/terrain/terrainColorMap.js +41 -0
- package/modules/terrain/terrainDefaults.js +39 -0
- package/modules/terrain/terrainEdit.js +139 -0
- package/modules/terrain/terrainGen.js +155 -0
- package/modules/terrain/terrainIsland.js +131 -0
- package/modules/terrain/terrainMesh.js +92 -0
- package/modules/terrain/terrainShape.js +108 -0
- package/modules/terrain/terrainShapeMain.js +41 -0
- package/modules/terrain/terrainTexture.js +44 -0
- package/modules/timeline/Timeline.js +253 -0
- package/modules/timeline/Tween.js +114 -0
- package/modules/timeline/letterbox.js +24 -0
- package/modules/timeline/shots.js +90 -0
- package/modules/triggers/index.js +268 -0
- package/modules/vegetation/Vegetation.js +256 -0
- package/modules/vegetation/groundChunks.js +177 -0
- package/modules/vegetation/index.js +43 -0
- package/modules/vegetation/lookWind.js +37 -0
- package/modules/vegetation/modelGeometry.js +21 -0
- package/modules/water/Water.js +160 -0
- package/modules/water/look.js +80 -0
- package/modules/water/surface.js +88 -0
- package/modules/weather/Weather.js +242 -0
- package/modules/weather/look.js +75 -0
- package/modules/weather/particles.js +92 -0
- package/modules/weather/shaders.js +49 -0
- package/modules/weather/strings.js +15 -0
- package/modules/world/World.js +231 -0
- package/modules/world/cells.js +42 -0
- package/modules/world/explain.js +11 -0
- package/modules/world/index.js +71 -0
- package/modules/world/persist.js +107 -0
- package/modules/world/pos.js +20 -0
- package/modules/world/records.js +89 -0
- package/modules/world/sim.js +175 -0
- package/modules/world/simFar.js +82 -0
- package/modules/world/state.js +115 -0
- package/modules/world/thingSource.js +44 -0
- package/modules/world/views.js +182 -0
- package/package.json +66 -4
- package/presets.js +96 -0
- package/render/PostFX.js +240 -0
- package/render/detail.js +105 -0
- package/render/effects.js +144 -0
- package/render/engineUniforms.js +23 -0
- package/render/fuse.js +84 -0
- package/render/lighting.js +100 -0
- package/render/lights.js +18 -0
- package/render/lookSurface.js +161 -0
- package/render/materials.js +220 -0
- package/render/patches.js +252 -0
- package/render/postLook.js +86 -0
- package/render/surface.js +69 -0
- package/render/uniformDecl.js +29 -0
- package/types/common.d.ts +34 -0
- package/types/core.d.ts +1965 -0
- package/types/gameplay.d.ts +1822 -0
- package/types/generated/core/Audio.d.ts +200 -0
- package/types/generated/core/Batching.d.ts +47 -0
- package/types/generated/core/Budget.d.ts +90 -0
- package/types/generated/core/Commits.d.ts +31 -0
- package/types/generated/core/DebugOverrides.d.ts +52 -0
- package/types/generated/core/Events.d.ts +89 -0
- package/types/generated/core/I18n.d.ts +30 -0
- package/types/generated/core/Input.d.ts +118 -0
- package/types/generated/core/Jobs.d.ts +41 -0
- package/types/generated/core/Ops.d.ts +203 -0
- package/types/generated/core/Random.d.ts +49 -0
- package/types/generated/core/Rays.d.ts +49 -0
- package/types/generated/core/Saves.d.ts +162 -0
- package/types/generated/core/Stream.d.ts +93 -0
- package/types/generated/core/Threads.d.ts +82 -0
- package/types/generated/core/Views.d.ts +33 -0
- package/types/generated/core/audioVoice.d.ts +47 -0
- package/types/generated/core/page.d.ts +18 -0
- package/types/generated/core/session.d.ts +48 -0
- package/types/generated/modules/ambience/Ambience.d.ts +48 -0
- package/types/generated/modules/debug/DebugPanel.d.ts +24 -0
- package/types/generated/modules/flow/index.d.ts +10 -0
- package/types/generated/modules/grid/Grid.d.ts +151 -0
- package/types/generated/modules/grid/Layer.d.ts +65 -0
- package/types/generated/modules/grid/index.d.ts +86 -0
- package/types/generated/modules/hlod/index.d.ts +11 -0
- package/types/generated/modules/hud/index.d.ts +10 -0
- package/types/generated/modules/lights/index.d.ts +13 -0
- package/types/generated/modules/music/Music.d.ts +111 -0
- package/types/generated/modules/net/Net.d.ts +34 -0
- package/types/generated/modules/net/index.d.ts +53 -0
- package/types/generated/modules/net/transports.d.ts +58 -0
- package/types/generated/modules/particles/Particles.d.ts +69 -0
- package/types/generated/modules/sky/Sky.d.ts +145 -0
- package/types/generated/modules/sky/skyModule.d.ts +10 -0
- package/types/generated/modules/timeline/Timeline.d.ts +51 -0
- package/types/generated/modules/water/Water.d.ts +29 -0
- package/types/generated/modules/weather/Weather.d.ts +62 -0
- package/types/generated/modules/world/World.d.ts +242 -0
- package/types/generated/modules/world/index.d.ts +15 -0
- package/types/generated/render/PostFX.d.ts +125 -0
- package/types/generated/render/materials.d.ts +100 -0
- package/types/generated/render/patches.d.ts +41 -0
- package/types/generated/ui/Focus.d.ts +11 -0
- package/types/generated/ui/LoadingScreen.d.ts +2 -0
- package/types/generated/ui/UI.d.ts +57 -0
- package/types/nav.d.ts +52 -0
- package/types/physics.d.ts +592 -0
- package/types/style.d.ts +638 -0
- package/types/worker.d.ts +11 -0
- package/types/world.d.ts +772 -0
- package/ui/Focus.js +51 -0
- package/ui/LoadingScreen.js +42 -0
- package/ui/Parts.js +199 -0
- package/ui/UI.js +167 -0
- package/ui/defaults.js +85 -0
- package/ui/theme.js +124 -0
- package/ui/touchPart.js +49 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Audio.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.audio: buses, sounds by name, ducking. Sfx play by name from the game's audio.sounds (file, variants or synth). */
|
|
3
|
+
export class Audio {
|
|
4
|
+
/** The browser AudioContext (exists only after the first click) @type {any} */
|
|
5
|
+
ctx: any;
|
|
6
|
+
/** Volume per bus 0-1 ('master' is the total). Every key is a bus: levels: { voice: 1 } adds a 'voice' bus @type {Record<string, number>} */
|
|
7
|
+
levels: Record<string, number>;
|
|
8
|
+
/**
|
|
9
|
+
* The game's sound config from createEngine({ audio }); sounds and footsteps also hold content packs' (copies: the game's object is never changed).
|
|
10
|
+
* Content packs' ambience / music rules go to ambience() / music(), not here
|
|
11
|
+
* @type {import('../../core').AudioConfig}
|
|
12
|
+
*/
|
|
13
|
+
config: import("../../core").AudioConfig;
|
|
14
|
+
/** Bus input GainNodes by name (connect your own nodes here); empty until audio unlocks @type {Record<string, any>} */
|
|
15
|
+
buses: Record<string, any>;
|
|
16
|
+
/** The game's current mode for rule lists, e.g. 'combat' / 'explore' (condition `state` in music and ambience rules) @type {string | null} */
|
|
17
|
+
state: string | null;
|
|
18
|
+
/** The master GainNode (every bus ends here) @type {any} */
|
|
19
|
+
master: any;
|
|
20
|
+
/** 2 s of white noise, reused by synthesized sounds @type {any} */
|
|
21
|
+
noise: any;
|
|
22
|
+
/** Is audio usable (the player has clicked/pressed a key)? @returns {boolean} */
|
|
23
|
+
get running(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Add a bus of your own (routed to master). It gets a settings slider like the others (label key settings.vol.<name>)
|
|
26
|
+
* @param {string} name
|
|
27
|
+
* @param {number} [level]
|
|
28
|
+
* @returns {this}
|
|
29
|
+
* @example engine.audio.addBus('voice', 1); engine.audio.sfx('line-01', { bus: 'voice' });
|
|
30
|
+
*/
|
|
31
|
+
addBus(name: string, level?: number): this;
|
|
32
|
+
/**
|
|
33
|
+
* Set a bus volume 0-1 ('master' for the total)
|
|
34
|
+
* @param {string} bus
|
|
35
|
+
* @param {number} v
|
|
36
|
+
* @returns {void}
|
|
37
|
+
* @example engine.audio.setVolume('music', 0.3);
|
|
38
|
+
*/
|
|
39
|
+
setVolume(bus: string, v: number): void;
|
|
40
|
+
/**
|
|
41
|
+
* Lower buses until the handle is removed (dialogue, pause menu, a cutscene). Several ducks stack (their levels multiply).
|
|
42
|
+
* @param {Record<string, number>} levels bus -> multiplier 0-1
|
|
43
|
+
* @param {{ fade?: number }} [opts] fade seconds both ways (0.3)
|
|
44
|
+
* @returns {{ remove(fade?: number): void }}
|
|
45
|
+
* @example const d = engine.audio.duck({ music: 0.3, ambience: 0.5 }); engine.events.once('dialogue:end', () => d.remove());
|
|
46
|
+
*/
|
|
47
|
+
duck(levels: Record<string, number>, opts?: {
|
|
48
|
+
fade?: number;
|
|
49
|
+
}): {
|
|
50
|
+
remove(fade?: number): void;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Register a synthesized sound: synthFn(audio, params, out) connects its nodes to `out` and returns its length in seconds
|
|
54
|
+
* (or { stop(time) } for a loop). Plays for sounds entries that name it ('synth' or { synth: name }); a name with no sounds entry
|
|
55
|
+
* plays it too unless builtIn (engine modules pass builtIn: true so their synths stay silent until the game asks).
|
|
56
|
+
* @param {string} name
|
|
57
|
+
* @param {SynthFn} synthFn
|
|
58
|
+
* @param {{ builtIn?: boolean, bus?: string, params?: Record<string, any> }} [opts] bus: default bus ('sfx'); params: default params
|
|
59
|
+
* @returns {this}
|
|
60
|
+
* @example engine.audio.register('ding', (a, p, out) => { a.tone({ freq: 880 * p.pitch, dur: 0.2, out }); return 0.2; });
|
|
61
|
+
*/
|
|
62
|
+
register(name: string, synthFn: SynthFn, opts?: {
|
|
63
|
+
builtIn?: boolean;
|
|
64
|
+
bus?: string;
|
|
65
|
+
params?: Record<string, any>;
|
|
66
|
+
}): this;
|
|
67
|
+
/**
|
|
68
|
+
* Add a condition key for music / ambience rule lists: `when: { [name]: value }` calls test(value, engine). Modules add theirs
|
|
69
|
+
* (sky: time, weather: weather, triggers: zone); the engine has `state` (engine.audio.state).
|
|
70
|
+
* @param {string} name
|
|
71
|
+
* @param {(value: any, e: any) => boolean} test
|
|
72
|
+
* @returns {{ remove(): void }}
|
|
73
|
+
* @example engine.audio.condition('inside', v => engine.vars.flag('indoors') === v);
|
|
74
|
+
*/
|
|
75
|
+
condition(name: string, test: (value: any, e: any) => boolean): {
|
|
76
|
+
remove(): void;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Add a measure: a number rule data compares (`when: { daylight: { gt: 0.15 } }`; gt / gte / lt / lte) and adds up (`volume: { add: { wind: 0.08 } }`).
|
|
80
|
+
* sky adds daylight, weather rain / snow / wind, ambience nearWater / altitude. A name is a condition or a measure, not both
|
|
81
|
+
* @param {string} name
|
|
82
|
+
* @param {(e: any) => number} fn
|
|
83
|
+
* @returns {{ remove(): void }}
|
|
84
|
+
* @example engine.audio.measure('danger', e => e.vars.counter('alarm') / 10); // data: when: { danger: { gt: 0.5 } }
|
|
85
|
+
*/
|
|
86
|
+
measure(name: string, fn: (e: any) => number): {
|
|
87
|
+
remove(): void;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The current value of a measure (debug, tests); undefined when none is registered under that name
|
|
91
|
+
* @param {string} name
|
|
92
|
+
* @returns {number | undefined}
|
|
93
|
+
*/
|
|
94
|
+
value(name: string): number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Does a rule's `when` hold now? An object needs every key to hold (condition keys, or measure comparisons); a function gets
|
|
97
|
+
* (engine, ...extra); missing = always.
|
|
98
|
+
* @param {AudioCondition | undefined} when
|
|
99
|
+
* @param {...any} extra
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
* @example engine.audio.matches({ time: 'night', zone: 'forest', rain: { lt: 0.2 } });
|
|
102
|
+
*/
|
|
103
|
+
matches(when: AudioCondition | undefined, ...extra: any[]): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* A rule's volume now: a number, a function (engine, ...extra), or data { base, add: { measure: factor }, min, max }; missing = 1
|
|
106
|
+
* @param {AudioVolume | undefined} volume
|
|
107
|
+
* @param {...any} extra
|
|
108
|
+
* @returns {number}
|
|
109
|
+
* @example engine.audio.volumeOf({ base: 0, add: { rain: 0.22 } }); // 0.22 in full rain
|
|
110
|
+
*/
|
|
111
|
+
volumeOf(volume: AudioVolume | undefined, ...extra: any[]): number;
|
|
112
|
+
/**
|
|
113
|
+
* Play a sound by name from audio.sounds (file, variants, or a synth). Returns a SoundHandle (stop, fade, setPosition), or null when it is
|
|
114
|
+
* silent: not configured, audio still locked, or held back by the sound's cooldown. Over its `voices` limit the oldest voice stops.
|
|
115
|
+
* @param {string} name
|
|
116
|
+
* @param {{ volume?: number, pitch?: number, at?: any, bus?: string, loop?: boolean, params?: Record<string, any>, fadeIn?: number }} [opts]
|
|
117
|
+
* at: a position or an Object3D to follow (3D sound); params: extra synth params
|
|
118
|
+
* @returns {SoundHandle | null}
|
|
119
|
+
* @example engine.audio.sfx('hit', { at: enemy.root, volume: 0.8 });
|
|
120
|
+
*/
|
|
121
|
+
sfx(name: string, opts?: {
|
|
122
|
+
volume?: number;
|
|
123
|
+
pitch?: number;
|
|
124
|
+
at?: any;
|
|
125
|
+
bus?: string;
|
|
126
|
+
loop?: boolean;
|
|
127
|
+
params?: Record<string, any>;
|
|
128
|
+
fadeIn?: number;
|
|
129
|
+
}): SoundHandle | null;
|
|
130
|
+
/**
|
|
131
|
+
* What is playing (for describe and tests): bus levels, the duck multiplier per bus, live voices per sound name
|
|
132
|
+
* @returns {{ running: boolean, state: string | null, levels: Record<string, number>, ducks: Record<string, number>, voices: Record<string, number> }}
|
|
133
|
+
*/
|
|
134
|
+
get info(): {
|
|
135
|
+
running: boolean;
|
|
136
|
+
state: string | null;
|
|
137
|
+
levels: Record<string, number>;
|
|
138
|
+
ducks: Record<string, number>;
|
|
139
|
+
voices: Record<string, number>;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Synth building block: a burst of filtered noise (footsteps, shutter, rain, thunder). dur seconds, freq Hz, vol 0-1; out: the node to
|
|
143
|
+
* connect to (a synth's `out`), else the named bus
|
|
144
|
+
* @param {{ dur?: number, type?: string, freq?: number, vol?: number, bus?: string, out?: any, rate?: number, delay?: number }} [opts]
|
|
145
|
+
* @returns {void}
|
|
146
|
+
*/
|
|
147
|
+
noiseBurst(opts?: {
|
|
148
|
+
dur?: number;
|
|
149
|
+
type?: string;
|
|
150
|
+
freq?: number;
|
|
151
|
+
vol?: number;
|
|
152
|
+
bus?: string;
|
|
153
|
+
out?: any;
|
|
154
|
+
rate?: number;
|
|
155
|
+
delay?: number;
|
|
156
|
+
}): void;
|
|
157
|
+
/**
|
|
158
|
+
* Synth building block: a short tone (bird call, notification). freq/to Hz, dur seconds, pan -1..1; out as in noiseBurst
|
|
159
|
+
* @param {{ freq?: number, to?: number | null, dur?: number, vol?: number, type?: string, bus?: string, out?: any, delay?: number, pan?: number }} [opts]
|
|
160
|
+
* @returns {void}
|
|
161
|
+
* @example engine.audio.tone({ freq: 660, to: 880, dur: 0.15, bus: 'ui' });
|
|
162
|
+
*/
|
|
163
|
+
tone(opts?: {
|
|
164
|
+
freq?: number;
|
|
165
|
+
to?: number | null;
|
|
166
|
+
dur?: number;
|
|
167
|
+
vol?: number;
|
|
168
|
+
type?: string;
|
|
169
|
+
bus?: string;
|
|
170
|
+
out?: any;
|
|
171
|
+
delay?: number;
|
|
172
|
+
pan?: number;
|
|
173
|
+
}): void;
|
|
174
|
+
/**
|
|
175
|
+
* Download and decode an audio file (cached). A sound name registered in an asset pack (manifest sounds) loads that file as an
|
|
176
|
+
* engine.loading task, so sounds entries and music tracks may name assets instead of paths
|
|
177
|
+
* @param {string} url a file path or an asset pack sound name
|
|
178
|
+
* @returns {Promise<any>}
|
|
179
|
+
*/
|
|
180
|
+
load(url: string): Promise<any>;
|
|
181
|
+
/**
|
|
182
|
+
* Play an audio file by path (no sounds entry needed); resolves to a SoundHandle once the file is decoded
|
|
183
|
+
* @param {string} url
|
|
184
|
+
* @param {{ bus?: string, volume?: number, loop?: boolean, fadeIn?: number, pitch?: number, at?: any }} [opts]
|
|
185
|
+
* @returns {Promise<SoundHandle | null>} null only without Web Audio; called before the first click it still resolves and the sound starts once audio unlocks
|
|
186
|
+
* @example const h = await engine.audio.play('/sfx/door.ogg', { bus: 'ui' }); h.stop(0.5);
|
|
187
|
+
*/
|
|
188
|
+
play(url: string, opts?: {
|
|
189
|
+
bus?: string;
|
|
190
|
+
volume?: number;
|
|
191
|
+
loop?: boolean;
|
|
192
|
+
fadeIn?: number;
|
|
193
|
+
pitch?: number;
|
|
194
|
+
at?: any;
|
|
195
|
+
}): Promise<SoundHandle | null>;
|
|
196
|
+
}
|
|
197
|
+
import type { SynthFn } from '../../core';
|
|
198
|
+
import type { AudioCondition } from '../../core';
|
|
199
|
+
import type { AudioVolume } from '../../core';
|
|
200
|
+
import { SoundHandle } from './audioVoice.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Batching.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.batching: draws repeated static models as InstancedMesh batches (see the top of core/Batching.js). */
|
|
3
|
+
export class Batching {
|
|
4
|
+
/** Same model at least this many times in one cell becomes a batch (default 8) @type {number} */
|
|
5
|
+
minCount: number;
|
|
6
|
+
/** Geometries and materials a live batch draws (engine.remove does not dispose these) @type {Map<any, number>} */ held: Map<any, number>;
|
|
7
|
+
/** Parent of every batch InstancedMesh (in the scene) @type {THREE.Group} */
|
|
8
|
+
root: THREE.Group;
|
|
9
|
+
set enabled(on: boolean);
|
|
10
|
+
/** Global switch: false dissolves every batch and stops watching; true starts again (scans what is already in the scene) @type {boolean} */
|
|
11
|
+
get enabled(): boolean;
|
|
12
|
+
set cell(v: number);
|
|
13
|
+
/** Cell edge in meters (default engine.stream.cellSize) @type {number} */
|
|
14
|
+
get cell(): number;
|
|
15
|
+
/** Every batch: { mesh: InstancedMesh, cell, count, items } (items[i] is the placed object drawn by instance i) @returns {BatchInfo[]} */
|
|
16
|
+
get batches(): BatchInfo[];
|
|
17
|
+
/** batches: InstancedMesh count, instances: meshes drawn through them, saved: draw calls saved per pass (instances - batches) @returns {BatchingStats} */
|
|
18
|
+
get stats(): BatchingStats;
|
|
19
|
+
/**
|
|
20
|
+
* Where an object is drawn: [{ mesh, index }] for each of its meshes that is batched ([] when drawn on its own).
|
|
21
|
+
* @param {THREE.Object3D} obj placed object (or one of its meshes)
|
|
22
|
+
* @returns {{ mesh: THREE.InstancedMesh, index: number }[]}
|
|
23
|
+
*/
|
|
24
|
+
of(obj: THREE.Object3D): {
|
|
25
|
+
mesh: THREE.InstancedMesh;
|
|
26
|
+
index: number;
|
|
27
|
+
}[];
|
|
28
|
+
/**
|
|
29
|
+
* The placed object drawn by instance `index` of a batch mesh (for a three.js Raycaster you run yourself; engine.raycast already returns the original).
|
|
30
|
+
* @param {THREE.Object3D} mesh batch InstancedMesh
|
|
31
|
+
* @param {number} index instanceId
|
|
32
|
+
* @returns {THREE.Object3D | null}
|
|
33
|
+
*/
|
|
34
|
+
item(mesh: THREE.Object3D, index: number): THREE.Object3D | null;
|
|
35
|
+
/**
|
|
36
|
+
* Recolor one placed object: its color is multiplied by `color` (instance color when batched, a cloned material otherwise); null restores it.
|
|
37
|
+
* @param {THREE.Object3D} obj
|
|
38
|
+
* @param {THREE.ColorRepresentation | null} c
|
|
39
|
+
* @example engine.batching.tint(engine.world.view('crate_3'), 0xff8080)
|
|
40
|
+
*/
|
|
41
|
+
tint(obj: THREE.Object3D, c: THREE.ColorRepresentation | null): void;
|
|
42
|
+
/** Re-check one object now (after you changed its parts by hand); normally automatic @param {THREE.Object3D} obj */
|
|
43
|
+
refresh(obj: THREE.Object3D): void;
|
|
44
|
+
}
|
|
45
|
+
import * as THREE from 'three';
|
|
46
|
+
import type { BatchInfo } from '../../core';
|
|
47
|
+
import type { BatchingStats } from '../../core';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Budget.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* engine.budget.cost: where the main thread pays for background results (terrain chunks, vegetation, colliders, stream builds), split in stages.
|
|
4
|
+
* Always on (a few performance.now() calls per applied result). Stages: transit = worker round trip minus the worker's own compute (queueing,
|
|
5
|
+
* structured clone, waiting for a busy main thread: an async wait, not main-thread blocking, so it is an approximation); build = creating the
|
|
6
|
+
* three.js objects (geometry, meshes, instanced meshes); collider = physics colliders; upload = GPU upload and shader compile, approximated as the
|
|
7
|
+
* extra render time of frames that first draw new objects over the average render time of other frames; stream = the synchronous part of a stream
|
|
8
|
+
* build() callback.
|
|
9
|
+
*/
|
|
10
|
+
export class ApplyCost {
|
|
11
|
+
/**
|
|
12
|
+
* Per stage: n results, totalMs, maxMs of one result, frameMs (smoothed ms per frame), bytes (transit only)
|
|
13
|
+
* @returns {Record<string, { n: number, totalMs: number, maxMs: number, frameMs: number, bytes: number }>}
|
|
14
|
+
* @example engine.budget.cost.report().build // { n: 12, totalMs: 9.4, maxMs: 1.8, frameMs: 0.2, bytes: 0 }
|
|
15
|
+
*/
|
|
16
|
+
report(): Record<string, {
|
|
17
|
+
n: number;
|
|
18
|
+
totalMs: number;
|
|
19
|
+
maxMs: number;
|
|
20
|
+
frameMs: number;
|
|
21
|
+
bytes: number;
|
|
22
|
+
}>;
|
|
23
|
+
/** Forget what was counted so far (to measure one scene on its own) */
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
26
|
+
/** engine.budget: performance budget (turned on by createEngine({ budget }) or enable(); off by default, costs nothing). */
|
|
27
|
+
export class Budget {
|
|
28
|
+
/** Is it on? */
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
/** Current limits @type {BudgetLimits} */
|
|
31
|
+
limits: BudgetLimits;
|
|
32
|
+
/** Cost of applying background results, split in stages (see ApplyCost) */
|
|
33
|
+
cost: ApplyCost;
|
|
34
|
+
/**
|
|
35
|
+
* Turn on and set limits (only categories given are checked)
|
|
36
|
+
* @param {BudgetLimits} [limits]
|
|
37
|
+
* @returns {this}
|
|
38
|
+
* @example engine.budget.enable({ drawCalls: 250, fps: 55 });
|
|
39
|
+
*/
|
|
40
|
+
enable(limits?: BudgetLimits): this;
|
|
41
|
+
/** Turn off */
|
|
42
|
+
disable(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Module-defined category: read() returns the current value, opts.limit is the limit (the game's enable() takes precedence). Returns a handle { remove() }
|
|
45
|
+
* @param {string} name
|
|
46
|
+
* @param {() => number} read
|
|
47
|
+
* @param {{ limit?: number }} [opts]
|
|
48
|
+
* @returns {Handle}
|
|
49
|
+
*/
|
|
50
|
+
metric(name: string, read: () => number, opts?: {
|
|
51
|
+
limit?: number;
|
|
52
|
+
}): Handle;
|
|
53
|
+
/** Limit of a category; undefined if none was given (not checked) @param {string} name @returns {number | undefined} */
|
|
54
|
+
limitOf(name: string): number | undefined;
|
|
55
|
+
/** Budget report; null when off. In the real-time loop it returns the last second's result; in step() mode it is computed on demand @returns {BudgetReport | null} */
|
|
56
|
+
report(): BudgetReport | null;
|
|
57
|
+
/**
|
|
58
|
+
* Called by the engine when startup finishes: warns if startupMs / moduleMs is exceeded and returns the offenders (empty array if none)
|
|
59
|
+
* @param {{ totalMs: number, modules: Record<string, { init?: number, ready?: number }> }} s
|
|
60
|
+
* @returns {{ category: 'startupMs' | 'moduleMs', value: number, limit: number, top: { tag: string, ms: number }[] }[]}
|
|
61
|
+
*/
|
|
62
|
+
checkStartup(s: {
|
|
63
|
+
totalMs: number;
|
|
64
|
+
modules: Record<string, {
|
|
65
|
+
init?: number;
|
|
66
|
+
ready?: number;
|
|
67
|
+
}>;
|
|
68
|
+
}): {
|
|
69
|
+
category: "startupMs" | "moduleMs";
|
|
70
|
+
value: number;
|
|
71
|
+
limit: number;
|
|
72
|
+
top: {
|
|
73
|
+
tag: string;
|
|
74
|
+
ms: number;
|
|
75
|
+
}[];
|
|
76
|
+
}[];
|
|
77
|
+
/** Current value per category (fps/low1/cpuMs exist only once there are frame times) @returns {Record<string, number>} */
|
|
78
|
+
values(): Record<string, number>;
|
|
79
|
+
/**
|
|
80
|
+
* Estimate draw calls and triangles by userData.budgetTag (visible meshes inside the frustum; shadow casters count a second shadow draw).
|
|
81
|
+
* Returns [{ tag, drawCalls, triangles }], largest first. Called only on overrun (at most once a second) or when debugging
|
|
82
|
+
* @returns {BudgetTagStat[]}
|
|
83
|
+
*/
|
|
84
|
+
byTag(): BudgetTagStat[];
|
|
85
|
+
}
|
|
86
|
+
import type { BudgetLimits } from '../../world';
|
|
87
|
+
import * as THREE from 'three';
|
|
88
|
+
import type { Handle } from '../../common';
|
|
89
|
+
import type { BudgetReport } from '../../world';
|
|
90
|
+
import type { BudgetTagStat } from '../../world';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Commits.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
export class Commits {
|
|
3
|
+
/** Default delay (fixed steps); 30 = 0.5 s */
|
|
4
|
+
lag: number;
|
|
5
|
+
/** Totals: applied, fallbacks used because not finished when due, dropped because valid() was false */
|
|
6
|
+
stats: {
|
|
7
|
+
applied: number;
|
|
8
|
+
late: number;
|
|
9
|
+
dropped: number;
|
|
10
|
+
};
|
|
11
|
+
/** Number of requests not yet applied @returns {number} */
|
|
12
|
+
get pending(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Register a request: resolve(result) when the background work finishes, remove() if no longer wanted. apply changes gameplay state with the result; fallback computes the same result on the main thread (required); valid says whether it is still wanted when due
|
|
15
|
+
* @template [T=any]
|
|
16
|
+
* @param {{ apply: (result: T) => void, fallback: () => T, valid?: (() => boolean) | null, lag?: number }} opts
|
|
17
|
+
* @returns {{ due: number, resolve: (result: T) => void, remove: () => void }}
|
|
18
|
+
* @example const t = engine.commits.request({ apply: r => { state.path = r; }, fallback: () => computePath() });
|
|
19
|
+
* pathWorker.then(r => t.resolve(r));
|
|
20
|
+
*/
|
|
21
|
+
request<T = any>(opts: {
|
|
22
|
+
apply: (result: T) => void;
|
|
23
|
+
fallback: () => T;
|
|
24
|
+
valid?: (() => boolean) | null;
|
|
25
|
+
lag?: number;
|
|
26
|
+
}): {
|
|
27
|
+
due: number;
|
|
28
|
+
resolve: (result: T) => void;
|
|
29
|
+
remove: () => void;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/DebugOverrides.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
export class DebugOverrides {
|
|
3
|
+
/** The F3 debug panel (the debug() module), or null when it is not installed @type {any} */
|
|
4
|
+
panel: any;
|
|
5
|
+
/**
|
|
6
|
+
* Diagnostic view: 'albedo' | 'lighting' | 'shadow' | 'normals' to look at one part of the render, 'off' to restore. Temporary and owner-scoped; never saved
|
|
7
|
+
* (describe().render says which view is active, so it is not mistaken for the real look). While one owner's view is on, another owner can neither switch it
|
|
8
|
+
* nor turn it off without force: true; engine.debug.clear(owner) turns that owner's view off too.
|
|
9
|
+
* @example engine.debug.view('normals'); // look at the screenshot, then engine.debug.view('off')
|
|
10
|
+
* @param {'albedo' | 'lighting' | 'shadow' | 'normals' | 'off'} mode @param {{ owner?: string, force?: boolean }} [opts]
|
|
11
|
+
* @returns {{ mode: string, owner: string | null, what?: string, note?: string }}
|
|
12
|
+
*/
|
|
13
|
+
view(mode: "albedo" | "lighting" | "shadow" | "normals" | "off", opts?: {
|
|
14
|
+
owner?: string;
|
|
15
|
+
force?: boolean;
|
|
16
|
+
}): {
|
|
17
|
+
mode: string;
|
|
18
|
+
owner: string | null;
|
|
19
|
+
what?: string;
|
|
20
|
+
note?: string;
|
|
21
|
+
};
|
|
22
|
+
/** The active view ({ mode: 'off', owner: null } when none) @returns {{ mode: string, owner: string | null, what?: string }} */
|
|
23
|
+
viewState(): {
|
|
24
|
+
mode: string;
|
|
25
|
+
owner: string | null;
|
|
26
|
+
what?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Change how an object looks for diagnosis, owned by `owner`. Returns { remove() }. Never saved, never part of the game state; listed in
|
|
30
|
+
* describe().scene.overrides while active. A thing id is remembered as the id: when that thing is removed, or a load replaces it, the override is dropped.
|
|
31
|
+
* @param {string} owner who sets it (a tool or session name); engine.debug.clear(owner) removes all of that owner's overrides
|
|
32
|
+
* @param {string | import('three').Object3D} target a thing id (engine.thing), an object name or any Object3D, or a look part id ('look.tone'): then patch is that part's set() values, written on its debug layer above every game owner
|
|
33
|
+
* @param {{ visible?: boolean, material?: 'flat' | 'wire', apply?: (obj: any) => (() => void) | void }} patch flat = unlit base colour, wire = wireframe, apply = your own change (return its undo)
|
|
34
|
+
* @example const h = engine.debug.override('ai-session', 'windmill', { material: 'flat' }); h.remove(); // or engine.debug.clear('ai-session')
|
|
35
|
+
*/
|
|
36
|
+
override(owner: string, target: string | import("three").Object3D, patch: {
|
|
37
|
+
visible?: boolean;
|
|
38
|
+
material?: "flat" | "wire";
|
|
39
|
+
apply?: (obj: any) => (() => void) | void;
|
|
40
|
+
}): any;
|
|
41
|
+
/**
|
|
42
|
+
* Remove every override of one owner (nothing else), its look-part debug values and its view; returns how many were removed
|
|
43
|
+
* @param {string} owner
|
|
44
|
+
*/
|
|
45
|
+
clear(owner: string): number;
|
|
46
|
+
/** Active overrides as plain data (describe().scene.overrides) */
|
|
47
|
+
overrides(): any[];
|
|
48
|
+
/** Active overrides on one object, for engine.thing(id).explain() */
|
|
49
|
+
overridesOn(obj: any): any[];
|
|
50
|
+
/** Undo everything, drop / restore what the views put back, re-apply */
|
|
51
|
+
dispose(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Events.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.events: the event bus; modules "shout" and whoever cares listens */
|
|
3
|
+
export class Events {
|
|
4
|
+
/** How many history entries to keep, default 200; 0 records nothing */
|
|
5
|
+
historySize: number;
|
|
6
|
+
/** Cause trace ring size, default 0 = off (no cost). Set e.g. 200 in dev to record which event or op caused which follow-up event; read with trace() */
|
|
7
|
+
traceSize: number;
|
|
8
|
+
/**
|
|
9
|
+
* Verbose trace for one object (needs traceSize > 0): perception queries and state checks that name `obj` === id are recorded in full (misses too), the rest of the world only
|
|
10
|
+
* records what changed. null clears. For "why did this guard not see me": traceFocus('guard-1'), play, then read trace('sight').
|
|
11
|
+
* @param {string | null} id world record id
|
|
12
|
+
* @example engine.events.traceSize = 300; engine.events.traceFocus('guard-1');
|
|
13
|
+
*/
|
|
14
|
+
traceFocus(id: string | null): void;
|
|
15
|
+
/**
|
|
16
|
+
* Add one entry to the cause trace (no-op while traceSize is 0; check `events.traceSize > 0` first to skip building info). Returns its parent id (`ev:<n>`) to pass as info.parent of follow-ups, or null.
|
|
17
|
+
* info: code (failure code), obj (world record id it is about), data (small plain values), verbose (true = only recorded while traceFocus(obj)), parent (default: the event or op running now).
|
|
18
|
+
* The engine notes failed ops (`op:<name>`), collision.lineClear (`sight`) and NPC state changes (`npc:state`); a game's behaviors can note their own, e.g. 'npc:mode' patrol -> investigate.
|
|
19
|
+
* @param {string} name
|
|
20
|
+
* @param {{ code?: string, obj?: string, data?: object, verbose?: boolean, parent?: string }} [info]
|
|
21
|
+
* @returns {string | null}
|
|
22
|
+
* @example if (e.events.traceSize > 0) e.events.note('npc:mode', { obj: rec.id, data: { from: 'patrol', to: 'investigate' } });
|
|
23
|
+
*/
|
|
24
|
+
note(name: string, info?: {
|
|
25
|
+
code?: string;
|
|
26
|
+
obj?: string;
|
|
27
|
+
data?: object;
|
|
28
|
+
verbose?: boolean;
|
|
29
|
+
parent?: string;
|
|
30
|
+
}): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Cause chains (needs traceSize > 0): each emitted event is recorded with parent = the event (`ev:<id>`) or op (`op:<name>#<seq>`) whose handler emitted it, null when
|
|
33
|
+
* it came from outside any. chain lists the causes from the nearest to the root (as far as the ring still holds). For "why did this fire".
|
|
34
|
+
* @param {string} [name] only events of this name
|
|
35
|
+
* Entries also carry code (failure code), obj and data when noted with events.note.
|
|
36
|
+
* @returns {{ id: number, tick: number, name: string, parent: string | null, chain: string[], code?: string, obj?: string, data?: object }[]}
|
|
37
|
+
* @example engine.events.traceSize = 200; engine.ops.run('shop.buy', { item: 'bread' }); engine.events.trace('item:add').at(-1).chain; // ['op:shop.buy#12']
|
|
38
|
+
*/
|
|
39
|
+
trace(name?: string): {
|
|
40
|
+
id: number;
|
|
41
|
+
tick: number;
|
|
42
|
+
name: string;
|
|
43
|
+
parent: string | null;
|
|
44
|
+
chain: string[];
|
|
45
|
+
code?: string;
|
|
46
|
+
obj?: string;
|
|
47
|
+
data?: object;
|
|
48
|
+
}[];
|
|
49
|
+
/**
|
|
50
|
+
* Recent events (old -> new); with name, only that kind: { tick = which fixed step, name, data = summary (simple values only; objects become '…') }. For "why did it not fire", first check whether it happened at all
|
|
51
|
+
* @param {string} [name]
|
|
52
|
+
* @returns {{ tick: number, name: string, data: any }[]}
|
|
53
|
+
* @example engine.events.recent('item:add');
|
|
54
|
+
*/
|
|
55
|
+
recent(name?: string): {
|
|
56
|
+
tick: number;
|
|
57
|
+
name: string;
|
|
58
|
+
data: any;
|
|
59
|
+
}[];
|
|
60
|
+
/**
|
|
61
|
+
* Listen to an event; returns a handle { remove() }
|
|
62
|
+
* @template {EventName} K
|
|
63
|
+
* @param {K} name
|
|
64
|
+
* @param {(...args: EventArgs<K & string>) => void} fn
|
|
65
|
+
* @returns {Handle}
|
|
66
|
+
* @example const h = engine.events.on('item:add', ({ id, count }) => console.log(id, count));
|
|
67
|
+
* h.remove();
|
|
68
|
+
*/
|
|
69
|
+
on<K extends EventName>(name: K, fn: (...args: EventArgs<K & string>) => void): Handle;
|
|
70
|
+
/**
|
|
71
|
+
* Listen once; returns a handle { remove() } (can be removed before it fires)
|
|
72
|
+
* @template {EventName} K
|
|
73
|
+
* @param {K} name
|
|
74
|
+
* @param {(...args: EventArgs<K & string>) => void} fn
|
|
75
|
+
* @returns {Handle}
|
|
76
|
+
*/
|
|
77
|
+
once<K extends EventName>(name: K, fn: (...args: EventArgs<K & string>) => void): Handle;
|
|
78
|
+
/**
|
|
79
|
+
* Emit an event
|
|
80
|
+
* @template {EventName} K
|
|
81
|
+
* @param {K} name
|
|
82
|
+
* @param {EventArgs<K & string>} args
|
|
83
|
+
* @example engine.events.emit('item:add', { id: 'fish', count: 1 });
|
|
84
|
+
*/
|
|
85
|
+
emit<K extends EventName>(name: K, ...args: EventArgs<K & string>): void;
|
|
86
|
+
}
|
|
87
|
+
import type { EventName } from '../../core';
|
|
88
|
+
import type { EventArgs } from '../../core';
|
|
89
|
+
import type { Handle } from '../../common';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/I18n.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.i18n: string tables; t(key, params) fetches text and replaces {name} with params */
|
|
3
|
+
export class I18n {
|
|
4
|
+
/** Current language, e.g. 'zh-CN' */
|
|
5
|
+
locale: any;
|
|
6
|
+
/** Language used when a key is missing in the current one (default 'en') */
|
|
7
|
+
fallback: string;
|
|
8
|
+
/**
|
|
9
|
+
* Register string tables (never overrides text the game gave)
|
|
10
|
+
* @param {StringTables} tables
|
|
11
|
+
* @returns {this}
|
|
12
|
+
* @example engine.i18n.add({ 'zh-CN': { 'shop.buy': '购买 {name}' }, en: { 'shop.buy': 'Buy {name}' } });
|
|
13
|
+
*/
|
|
14
|
+
add(tables: StringTables): this;
|
|
15
|
+
/** Switch language ('auto' picks from the browser like createEngine) @param {string} l */
|
|
16
|
+
setLocale(l: string): void;
|
|
17
|
+
/** All available languages @returns {string[]} */
|
|
18
|
+
get languages(): string[];
|
|
19
|
+
/** Whether the key exists @param {string} key @returns {boolean} */
|
|
20
|
+
has(key: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch text; params replace {name}, {key:action} shows the key label
|
|
23
|
+
* @param {string} key
|
|
24
|
+
* @param {Record<string, any>} [params]
|
|
25
|
+
* @returns {string}
|
|
26
|
+
* @example engine.i18n.t('shop.buy', { name: '鱼' });
|
|
27
|
+
*/
|
|
28
|
+
t(key: string, params?: Record<string, any>): string;
|
|
29
|
+
}
|
|
30
|
+
import type { StringTables } from '../../core';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Input.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** Input: read by "action", not by "key". Key names are the browser's KeyboardEvent.code, e.g. 'KeyE', 'Space', 'ShiftLeft'; gamepad keys are 'PadA' etc. */
|
|
3
|
+
export class Input {
|
|
4
|
+
/** This frame's look-drag amount (pixels) and wheel notches */
|
|
5
|
+
look: {
|
|
6
|
+
dx: number;
|
|
7
|
+
dy: number;
|
|
8
|
+
zoom: number;
|
|
9
|
+
};
|
|
10
|
+
/** Mouse/touch pointer @type {Pointer} */
|
|
11
|
+
pointer: Pointer;
|
|
12
|
+
/** On-screen stick (touch) */
|
|
13
|
+
stick: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
/** Auto movement (stress tests, test scripts) @type {Autopilot | null} */
|
|
18
|
+
autopilot: Autopilot | null;
|
|
19
|
+
/** action name -> { keys = key list, labelKey = string-table key } @type {Map<string, { keys: string[], labelKey: string }>} */
|
|
20
|
+
actions: Map<string, {
|
|
21
|
+
keys: string[];
|
|
22
|
+
labelKey: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** Most recently used device: UI key hints follow it @type {'keyboard' | 'pad' | 'touch'} */
|
|
25
|
+
lastDevice: "keyboard" | "pad" | "touch";
|
|
26
|
+
/** Is this a touch device? */
|
|
27
|
+
touch: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Register an action. keys is a key name or array (gamepad keys such as 'PadY' can go in directly); labelKey is the display name (a string-table key or
|
|
30
|
+
* text).
|
|
31
|
+
* opts.pad: the default gamepad key for this action (gameplay-specific actions get it from the registering module; createEngine({ padBindings }) takes
|
|
32
|
+
* precedence).
|
|
33
|
+
* If the action exists, the later definition overrides (warns once in dev when the keys differ); keys the player rebound in settings are kept
|
|
34
|
+
* @param {string} action
|
|
35
|
+
* @param {string | string[]} keys
|
|
36
|
+
* @param {string} [labelKey]
|
|
37
|
+
* opts.context: the input context the action belongs to (default 'gameplay'); it is readable only while that context is on the stack and not shadowed, see
|
|
38
|
+
* push().
|
|
39
|
+
* @param {{ pad?: string | string[], context?: string }} [opts]
|
|
40
|
+
* @returns {this}
|
|
41
|
+
* @example engine.input.define('openMap', 'KeyM', 'input.openMap', { pad: 'PadY' });
|
|
42
|
+
* @example engine.input.define('brake', 'KeyB', 'Brake', { context: 'vehicle' }); // only readable while input.push('vehicle') is on the stack
|
|
43
|
+
* @example engine.input.define('attack', ['KeyJ', 'Mouse0'], 'Attack'); // mouse buttons can be bound too: Mouse0 left / Mouse1 middle / Mouse2 right
|
|
44
|
+
*/
|
|
45
|
+
define(action: string, keys: string | string[], labelKey?: string, opts?: {
|
|
46
|
+
pad?: string | string[];
|
|
47
|
+
context?: string;
|
|
48
|
+
}): this;
|
|
49
|
+
/**
|
|
50
|
+
* Touch button (appears only on touch devices); pressing it triggers the action. labelKey is the string-table key of the button text (updates when the
|
|
51
|
+
* language changes) @param {string} action @param {string} labelKey
|
|
52
|
+
*/
|
|
53
|
+
touchButton(action: string, labelKey: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Press (down true) or release an action from code, through the same path as a real key: tests, AI drivers, replays. Presses the action's first bound key
|
|
56
|
+
* @example engine.input.simulate('jump'); engine.step(1 / 60); engine.input.simulate('jump', false)
|
|
57
|
+
*/
|
|
58
|
+
simulate(action: any, down?: boolean): void;
|
|
59
|
+
/** Rebind a key @param {string} action @param {string | string[]} keys */
|
|
60
|
+
rebind(action: string, keys: string | string[]): void;
|
|
61
|
+
/** All keys bound to an action @param {string} action @returns {string[]} */
|
|
62
|
+
keysOf(action: string): string[];
|
|
63
|
+
/** Key name shown in the UI, e.g. "E" @param {string} action @returns {string} */
|
|
64
|
+
label(action: string): string;
|
|
65
|
+
/** Held (a snapshot of this step in fixed, the latest state in frame) @param {string} action @returns {boolean} */
|
|
66
|
+
down(action: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Just pressed. Read in onFixed / module fixed: pressed since the previous fixed step, true only for this step (counted once however the frame rate varies,
|
|
69
|
+
* never lost);
|
|
70
|
+
* read in onFrame / module frame: pressed this frame (UI keys only). Read gameplay keys in fixed
|
|
71
|
+
* @param {string} action @returns {boolean}
|
|
72
|
+
* @example engine.onFixed(() => { if (engine.input.pressed('jump')) player.jump(); });
|
|
73
|
+
*/
|
|
74
|
+
pressed(action: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Just released (which copy is read is the same as pressed; for things like release-to-fire after charging) @param {string} action @returns {boolean}
|
|
77
|
+
* @example if (engine.input.released('fire')) shoot(charge);
|
|
78
|
+
*/
|
|
79
|
+
released(action: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Just pressed, ignoring input contexts (for menus and dialogue themselves, which run while a context blocks the game) @param {string} action @returns
|
|
82
|
+
* {boolean}
|
|
83
|
+
*/
|
|
84
|
+
pressedRaw(action: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Push an input context (an action group, like a Unity Action Map). The top context shadows lower actions bound to the same key.
|
|
87
|
+
* Opaque by default (nothing below is readable: menus, dialogue, cutscenes); { pass: true } lets unrelated lower actions keep working (vehicle, build mode).
|
|
88
|
+
* Applies at the start of the next fixed step; actions it blocks lose their held state (no stuck keys after a menu closes). Join a context with define(..., {
|
|
89
|
+
* context }); menu keys: pressedRaw.
|
|
90
|
+
* @param {string} name e.g. 'vehicle', 'menu', 'build' (the base context is 'gameplay')
|
|
91
|
+
* @param {{ pass?: boolean }} [opts]
|
|
92
|
+
* @returns {{ name: string, remove(): void }} remove() pops it (safe to call twice)
|
|
93
|
+
* @example const h = engine.input.push('vehicle', { pass: true }); // vehicle-context actions (brake) work, and shadow gameplay actions on the same key
|
|
94
|
+
* h.remove();
|
|
95
|
+
*/
|
|
96
|
+
push(name: string, opts?: {
|
|
97
|
+
pass?: boolean;
|
|
98
|
+
}): {
|
|
99
|
+
name: string;
|
|
100
|
+
remove(): void;
|
|
101
|
+
};
|
|
102
|
+
/** Names of the active contexts, bottom to top (pending switches apply at the next fixed step) @returns {string[]} */
|
|
103
|
+
get contexts(): string[];
|
|
104
|
+
/**
|
|
105
|
+
* False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore look/zoom @returns {boolean}
|
|
106
|
+
*/
|
|
107
|
+
get enabled(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Movement direction: x positive right, y positive forward, length <= 1 (a snapshot of this step in fixed, the latest state in frame) @returns {{ x: number,
|
|
110
|
+
* y: number }}
|
|
111
|
+
*/
|
|
112
|
+
get axis(): {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
import type { Pointer } from '../../core';
|
|
118
|
+
import type { Autopilot } from '../../core';
|