threedog 0.5.0 → 0.8.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 +276 -1
- package/README.md +18 -13
- package/core/{Animator.js → assets/Animator.js} +28 -18
- package/core/{Assets.js → assets/Assets.js} +116 -61
- package/core/{Baked.js → assets/Baked.js} +16 -25
- package/core/assets/assetEntry.js +237 -0
- package/core/{assetHot.js → assets/assetHot.js} +7 -6
- package/core/{assetLoad.js → assets/assetLoad.js} +66 -29
- package/core/assets/assetLod.js +113 -0
- package/core/{assetManifest.js → assets/assetManifest.js} +23 -12
- package/core/{assetReport.js → assets/assetReport.js} +9 -15
- package/core/{namedModel.js → assets/namedModel.js} +24 -16
- package/core/{Audio.js → audio/Audio.js} +27 -24
- package/core/{audioRules.js → audio/audioRules.js} +8 -5
- package/core/{audioVoice.js → audio/audioVoice.js} +17 -30
- package/core/{Events.js → base/Events.js} +3 -3
- package/core/{I18n.js → base/I18n.js} +10 -10
- package/core/{Random.js → base/Random.js} +5 -4
- package/core/{easing.js → base/easing.js} +1 -1
- package/core/{errorCodes.js → base/errorCodes.js} +154 -139
- package/core/{errorHints.js → base/errorHints.js} +9 -10
- package/core/{errors.js → base/errors.js} +9 -9
- package/core/{events.generated.js → base/events.generated.js} +2 -0
- package/core/{math.js → base/math.js} +22 -4
- package/core/{params.js → base/params.js} +3 -4
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +29 -8
- package/core/{Engine.js → engine/Engine.js} +112 -105
- package/core/{Loading.js → engine/Loading.js} +4 -2
- package/core/{copies.js → engine/copies.js} +4 -4
- package/core/{headlessLoad.js → engine/headlessLoad.js} +4 -4
- package/core/{lifecycle.js → engine/lifecycle.js} +16 -16
- package/core/{loop.js → engine/loop.js} +80 -52
- package/core/{moduleSlots.js → engine/moduleSlots.js} +35 -10
- package/core/{moduleTypes.js → engine/moduleTypes.js} +30 -18
- package/core/{modules.js → engine/modules.js} +20 -17
- package/core/engine/page.js +125 -0
- package/core/{plugins.js → engine/plugins.js} +68 -103
- package/core/{services.js → engine/services.js} +47 -40
- package/core/{startup.js → engine/startup.js} +35 -35
- package/core/{Input.js → input/Input.js} +41 -27
- package/core/{inputContext.js → input/inputContext.js} +14 -5
- package/core/{inputPad.js → input/inputPad.js} +1 -1
- package/core/{inputPointer.js → input/inputPointer.js} +8 -2
- package/core/{inputTouch.js → input/inputTouch.js} +1 -1
- package/core/{Budget.js → inspect/Budget.js} +23 -22
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +60 -31
- package/core/{Describe.js → inspect/Describe.js} +33 -30
- package/core/{Inspect.js → inspect/Inspect.js} +14 -9
- package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +8 -10
- package/core/{InspectPerf.js → inspect/InspectPerf.js} +29 -16
- package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
- package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +9 -6
- package/core/inspect/UrlState.js +182 -0
- package/core/{catalog.js → inspect/catalog.js} +18 -5
- package/core/{checks.js → inspect/checks.js} +7 -5
- package/core/{debugView.js → inspect/debugView.js} +8 -8
- package/core/inspect/describeRender.js +148 -0
- package/core/{describeText.js → inspect/describeText.js} +17 -12
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +11 -9
- package/core/inspect/pictureWriters.js +342 -0
- package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
- package/core/{Ops.js → ops/Ops.js} +16 -11
- package/core/{control.js → ops/control.js} +13 -12
- package/core/ops/holds.js +139 -0
- package/core/{opsAtomic.js → ops/opsAtomic.js} +2 -1
- package/core/{opsCheck.js → ops/opsCheck.js} +4 -5
- package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
- package/core/{opsRun.js → ops/opsRun.js} +7 -4
- package/core/{owned.js → ops/owned.js} +37 -37
- package/core/{sharedPoint.js → ops/sharedPoint.js} +13 -27
- package/core/{stackFrames.js → ops/stackFrames.js} +17 -6
- package/core/{stacks.js → ops/stacks.js} +18 -20
- package/core/{wrap.js → ops/wrap.js} +8 -6
- package/core/{SaveStore.js → saves/SaveStore.js} +1 -1
- package/core/{Saves.js → saves/Saves.js} +58 -36
- package/core/{saveApply.js → saves/saveApply.js} +13 -9
- package/core/{saveFiles.js → saves/saveFiles.js} +17 -15
- package/core/{saveValues.js → saves/saveValues.js} +20 -3
- package/core/{saveVersions.js → saves/saveVersions.js} +4 -17
- package/core/{session.js → saves/session.js} +31 -17
- package/core/{Rays.js → scene/Rays.js} +27 -24
- package/core/{Views.js → scene/Views.js} +15 -6
- package/core/{adaptive.js → scene/adaptive.js} +15 -8
- package/core/{canvasBox.js → scene/canvasBox.js} +2 -3
- package/core/{engineCamera.js → scene/engineCamera.js} +1 -1
- package/core/{gameLights.js → scene/gameLights.js} +24 -7
- package/core/{grayMap.js → scene/grayMap.js} +8 -2
- package/core/{grid.js → scene/grid.js} +4 -4
- package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
- package/core/{ground.js → scene/ground.js} +9 -9
- package/core/{movement.js → scene/movement.js} +3 -3
- package/core/scene/pictureSlots.js +33 -0
- package/core/{sceneDelta.js → scene/sceneDelta.js} +14 -6
- package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -20
- package/core/scene/stepPoses.js +55 -0
- package/core/{targeting.js → scene/targeting.js} +4 -5
- package/core/{thingExplain.js → scene/thingExplain.js} +7 -6
- package/core/{thingOps.js → scene/thingOps.js} +4 -3
- package/core/{things.js → scene/things.js} +19 -6
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{tier.js → scene/tier.js} +1 -1
- package/core/scene/view.js +44 -0
- package/core/{Batching.js → stream/Batching.js} +85 -27
- package/core/{Stream.js → stream/Stream.js} +62 -33
- package/core/{batchGroups.js → stream/batchGroups.js} +18 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +41 -1
- package/core/{scatter.js → stream/scatter.js} +2 -2
- package/core/{streamSources.js → stream/streamSources.js} +12 -7
- package/core/{Commits.js → threads/Commits.js} +6 -5
- package/core/{Jobs.js → threads/Jobs.js} +12 -10
- package/core/{Threads.js → threads/Threads.js} +16 -16
- package/core/{threadPure.js → threads/threadPure.js} +7 -5
- package/core/{threadServe.js → threads/threadServe.js} +3 -3
- package/core/{Clock.js → time/Clock.js} +17 -10
- package/core/{dayTime.js → time/dayTime.js} +5 -1
- package/core/{skip.js → time/skip.js} +18 -17
- package/core/{time.js → time/time.js} +18 -12
- package/core/{uiClock.js → time/uiClock.js} +4 -4
- package/docs/AI.md +70 -63
- package/docs/API.md +30 -29
- package/docs/CODEMAP.md +98 -223
- package/docs/COMMANDS.md +80 -69
- package/docs/CONVENTIONS.md +87 -41
- package/docs/MIGRATING-0.7.md +39 -0
- package/docs/MIGRATING-0.8.md +169 -0
- package/docs/THREE.md +100 -49
- package/docs/api/assets.md +17 -16
- package/docs/api/audio.md +8 -7
- package/docs/api/budget.md +8 -4
- package/docs/api/calendar.md +10 -11
- package/docs/api/cameraRig.md +29 -29
- package/docs/api/characters.md +26 -19
- package/docs/api/clock.md +1 -1
- package/docs/api/collision.md +14 -11
- package/docs/api/content.md +6 -6
- package/docs/api/dialogue.md +3 -3
- package/docs/api/engine.md +82 -53
- package/docs/api/events.md +5 -3
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +9 -2
- package/docs/api/ground.md +4 -5
- package/docs/api/hud.md +4 -1
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +10 -9
- package/docs/api/interactions.md +6 -4
- package/docs/api/inventory.md +10 -11
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +7 -8
- package/docs/api/lightPool.md +2 -7
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +10 -10
- package/docs/api/occlusion.md +5 -0
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +8 -5
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +7 -1
- package/docs/api/post.md +24 -5
- package/docs/api/quests.md +3 -3
- package/docs/api/rays.md +5 -7
- package/docs/api/rigid.md +27 -18
- package/docs/api/saves.md +8 -7
- package/docs/api/settings.md +9 -8
- package/docs/api/sky.md +17 -14
- package/docs/api/stream.md +7 -7
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +17 -12
- package/docs/api/terrainDraw.md +12 -0
- package/docs/api/timeline.md +2 -2
- package/docs/api/tools.md +30 -26
- package/docs/api/triggers.md +2 -0
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +11 -5
- package/docs/api/vegetationDraw.md +10 -0
- package/docs/api/water.md +7 -3
- package/docs/api/weather.md +11 -6
- package/docs/api/weatherDraw.md +10 -0
- package/docs/api/world.md +6 -6
- package/docs/recipes/01-new-game.md +38 -57
- package/docs/recipes/02-npc.md +19 -20
- package/docs/recipes/03-items-pickups.md +47 -42
- package/docs/recipes/04-quests.md +3 -4
- package/docs/recipes/05-props-bake.md +72 -66
- package/docs/recipes/06-clock-events.md +30 -21
- package/docs/recipes/07-flow-scenes-pause.md +21 -17
- package/docs/recipes/08-weather-sky.md +117 -75
- package/docs/recipes/09-materials-lights-models.md +171 -0
- package/docs/recipes/10-blender-level.md +6 -7
- package/docs/recipes/11-vehicles.md +33 -25
- package/docs/recipes/12-navmesh.md +9 -8
- package/docs/recipes/13-animation.md +50 -22
- package/docs/recipes/14-custom-module.md +20 -17
- package/docs/recipes/15-perf.md +52 -29
- package/docs/recipes/16-dev-bridge.md +47 -57
- package/docs/recipes/18-world.md +45 -30
- package/docs/recipes/19-shooting-picking.md +11 -7
- package/docs/recipes/20-content-actions-save.md +36 -37
- package/docs/recipes/21-camera.md +41 -8
- package/docs/recipes/22-shop-gold.md +0 -4
- package/docs/recipes/23-ops.md +11 -11
- package/docs/recipes/26-ui-parts.md +56 -22
- package/docs/recipes/27-net.md +0 -2
- package/docs/recipes/28-terrain.md +126 -30
- package/docs/recipes/29-grid.md +16 -7
- package/docs/recipes/30-templates.md +62 -21
- package/docs/recipes/31-audio.md +9 -9
- package/docs/recipes/32-action-game.md +32 -9
- package/docs/recipes/33-stream-sources.md +2 -2
- package/docs/recipes/34-environment-lighting.md +164 -52
- package/docs/recipes/35-picture-from-reference.md +140 -0
- package/docs/recipes/36-ground-plants.md +105 -0
- package/docs/recipes/40-scene.md +105 -30
- package/docs/recipes/{43-shader-patches-surface-looks.md → 43-shader-patches-surfaces.md} +74 -106
- package/docs/recipes/44-water-weather-hooks.md +196 -0
- package/docs/recipes/45-cascaded-shadows.md +145 -25
- package/docs/recipes/46-blender-art-route.md +21 -25
- package/docs/recipes/49-game-module-contract.md +5 -5
- package/docs/recipes/50-own-renderer.md +3 -3
- package/docs/recipes/52-around-the-picture.md +137 -0
- package/docs/recipes/53-ground-up-close.md +65 -28
- package/docs/recipes/55-mods-time-wrap.md +25 -17
- package/docs/recipes/56-webgpu-tsl.md +73 -28
- package/docs/recipes/57-control.md +47 -1
- package/docs/recipes/58-input.md +3 -0
- package/docs/recipes/59-depth-post-effects.md +5 -5
- package/docs/recipes/60-judge-the-picture.md +47 -27
- package/docs/recipes/61-deploy.md +27 -0
- package/docs/recipes/62-picture-code.md +276 -0
- package/docs/recipes/63-third-person-start.md +90 -0
- package/docs/recipes/64-particles.md +35 -0
- package/docs/recipes/65-swarm.md +140 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +9 -7
- package/examples/action/main.js +5 -4
- package/examples/action/models.js +12 -14
- package/examples/action/picture/index.js +13 -0
- package/examples/action/picture/lights.js +35 -0
- package/examples/action/picture/materials.js +8 -0
- package/examples/action/picture/palette.js +33 -0
- package/examples/perf-island/.threedog/content-index.json +1 -0
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +18 -14
- package/examples/{sheepisland → perf-island}/assets.js +2 -2
- package/examples/{sheepisland → perf-island}/content/templates.js +1 -1
- package/examples/{sheepisland → perf-island}/content/vegetation.js +3 -1
- package/examples/{sheepisland → perf-island}/main.js +22 -16
- package/examples/{sheepisland/style → perf-island}/models.js +13 -24
- package/examples/{sheepisland → perf-island}/params.js +1 -1
- package/examples/perf-island/picture/index.js +20 -0
- package/examples/perf-island/picture/lights.js +34 -0
- package/examples/perf-island/picture/materials.js +61 -0
- package/examples/perf-island/picture/palette.js +60 -0
- package/examples/perf-island/picture/sky.js +20 -0
- package/examples/{sheepisland → perf-island}/views.js +1 -1
- package/examples/plain-picture/.threedog/content-index.json +1 -0
- package/examples/plain-picture/GAMEMAP.md +91 -0
- package/examples/plain-picture/main.js +48 -0
- package/examples/plain-picture/picture/index.js +21 -0
- package/examples/plain-picture/picture/lights.js +54 -0
- package/examples/plain-picture/picture/materials.js +24 -0
- package/examples/plain-picture/picture/palette.js +16 -0
- package/examples/plain-picture/picture/sky.js +37 -0
- package/examples/pullable.json +31 -9
- package/examples/rc2d/GAMEMAP.md +10 -4
- package/examples/rc2d/README.md +11 -6
- package/examples/rc2d/main.js +26 -36
- package/examples/rc2d/picture/index.js +18 -0
- package/examples/rc2d/picture/lights.js +11 -0
- package/examples/rc2d/picture/materials.js +18 -0
- package/examples/rc2d/picture/palette.js +15 -0
- package/examples/rc2d/picture/post.js +11 -0
- package/examples/rc2d/rc2d.js +18 -28
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +15 -10
- package/examples/styletest/main.js +20 -30
- package/examples/styletest/models.js +29 -29
- package/examples/styletest/params.js +1 -4
- package/examples/styletest/picture/env.js +38 -0
- package/examples/styletest/picture/index.js +16 -0
- package/examples/styletest/picture/lights.js +9 -0
- package/examples/styletest/picture/materials.js +28 -0
- package/examples/styletest/picture/palette.js +22 -0
- package/examples/techniques/contact-shadows/README.md +22 -23
- package/examples/techniques/contact-shadows/contactShadows.js +32 -16
- package/examples/techniques/contact-shadows/main.js +20 -18
- package/examples/techniques/contact-shadows/picture/index.js +14 -0
- package/examples/techniques/contact-shadows/picture/lights.js +34 -0
- package/examples/techniques/contact-shadows/picture/materials.js +12 -0
- package/examples/techniques/contact-shadows/picture/palette.js +17 -0
- package/examples/techniques/day-night-grade/README.md +13 -16
- package/examples/techniques/day-night-grade/main.js +15 -25
- package/examples/techniques/day-night-grade/picture/index.js +20 -0
- package/examples/techniques/day-night-grade/picture/lights.js +45 -0
- package/examples/techniques/day-night-grade/picture/materials.js +15 -0
- package/examples/techniques/day-night-grade/picture/palette.js +59 -0
- package/examples/techniques/day-night-grade/picture/post.js +25 -0
- package/examples/techniques/day-night-grade/picture/sky.js +33 -0
- package/examples/techniques/interior-light/README.md +16 -13
- package/examples/techniques/interior-light/interiorLight.js +19 -17
- package/examples/techniques/interior-light/main.js +31 -68
- package/examples/techniques/interior-light/picture/index.js +24 -0
- package/examples/techniques/interior-light/picture/lights.js +52 -0
- package/examples/techniques/interior-light/picture/materials.js +13 -0
- package/examples/techniques/interior-light/picture/palette.js +32 -0
- package/examples/techniques/interior-light/picture/sky.js +40 -0
- package/examples/techniques/modular-building/README.md +8 -6
- package/examples/techniques/modular-building/kit.js +2 -2
- package/examples/techniques/modular-building/main.js +9 -17
- package/examples/techniques/modular-building/picture/index.js +17 -0
- package/examples/techniques/modular-building/picture/lights.js +26 -0
- package/examples/techniques/modular-building/picture/materials.js +13 -0
- package/examples/techniques/modular-building/picture/palette.js +23 -0
- package/examples/techniques/night-lights/README.md +15 -14
- package/examples/techniques/night-lights/main.js +20 -43
- package/examples/techniques/night-lights/nightLights.js +25 -21
- package/examples/techniques/night-lights/picture/index.js +18 -0
- package/examples/techniques/night-lights/picture/lights.js +44 -0
- package/examples/techniques/night-lights/picture/materials.js +15 -0
- package/examples/techniques/night-lights/picture/palette.js +34 -0
- package/examples/techniques/night-lights/picture/post.js +9 -0
- package/examples/techniques/night-lights/picture/sky.js +36 -0
- package/examples/techniques/outlines-and-rim/README.md +2 -2
- package/examples/techniques/outlines-and-rim/main.js +15 -38
- package/examples/techniques/outlines-and-rim/outlines.js +3 -3
- package/examples/techniques/outlines-and-rim/picture/index.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/lights.js +18 -0
- package/examples/techniques/outlines-and-rim/picture/materials.js +11 -0
- package/examples/techniques/outlines-and-rim/picture/palette.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/post.js +10 -0
- package/examples/techniques/procedural-animation/README.md +6 -4
- package/examples/techniques/procedural-animation/main.js +9 -7
- package/examples/techniques/procedural-animation/picture/index.js +15 -0
- package/examples/techniques/procedural-animation/picture/lights.js +35 -0
- package/examples/techniques/procedural-animation/picture/materials.js +10 -0
- package/examples/techniques/procedural-animation/picture/palette.js +16 -0
- package/examples/techniques/procedural-animation/picture/sky.js +31 -0
- package/examples/techniques/procedural-animation/proceduralAnim.js +1 -1
- package/examples/techniques/procedural-surface/README.md +2 -0
- package/examples/techniques/procedural-surface/main.js +17 -55
- package/examples/techniques/procedural-surface/picture/index.js +14 -0
- package/examples/techniques/procedural-surface/picture/lights.js +18 -0
- package/examples/techniques/procedural-surface/picture/materials.js +34 -0
- package/examples/techniques/procedural-surface/picture/palette.js +15 -0
- package/examples/techniques/stylized-shading/README.md +13 -14
- package/examples/techniques/stylized-shading/main.js +11 -42
- package/examples/techniques/stylized-shading/picture/index.js +14 -0
- package/examples/techniques/stylized-shading/picture/lights.js +23 -0
- package/examples/techniques/stylized-shading/picture/materials.js +18 -0
- package/examples/techniques/stylized-shading/picture/palette.js +19 -0
- package/examples/techniques/stylized-shading/shading.js +2 -2
- package/examples/techniques/sun-and-key-light/README.md +20 -22
- package/examples/techniques/sun-and-key-light/keyLight.js +47 -29
- package/examples/techniques/sun-and-key-light/main.js +19 -63
- package/examples/techniques/sun-and-key-light/picture/index.js +13 -0
- package/examples/techniques/sun-and-key-light/picture/lights.js +33 -0
- package/examples/techniques/sun-and-key-light/picture/materials.js +9 -0
- package/examples/techniques/sun-and-key-light/picture/palette.js +29 -0
- package/examples/techniques/sun-and-key-light/picture/sky.js +16 -0
- package/examples/techniques/three-looks/README.md +21 -0
- package/examples/techniques/three-looks/main.js +58 -0
- package/examples/techniques/three-looks/picture/cartoon.js +23 -0
- package/examples/techniques/three-looks/picture/cinematic.js +27 -0
- package/examples/techniques/three-looks/picture/comic.js +27 -0
- package/examples/techniques/three-looks/picture/index.js +14 -0
- package/examples/techniques/three-looks/picture/sun.js +23 -0
- package/examples/techniques/wet-road/README.md +7 -4
- package/examples/techniques/wet-road/main.js +18 -38
- package/examples/techniques/wet-road/picture/index.js +17 -0
- package/examples/techniques/wet-road/picture/lights.js +57 -0
- package/examples/techniques/wet-road/picture/materials.js +16 -0
- package/examples/techniques/wet-road/picture/palette.js +24 -0
- package/examples/techniques/wet-road/picture/sky.js +46 -0
- package/examples/webgpu-tsl/GAMEMAP.md +10 -4
- package/examples/webgpu-tsl/README.md +13 -10
- package/examples/webgpu-tsl/main.js +30 -7
- package/examples/webgpu-tsl/picture/index.js +18 -0
- package/examples/webgpu-tsl/picture/lights.js +25 -0
- package/examples/webgpu-tsl/picture/materials.js +36 -0
- package/examples/webgpu-tsl/picture/palette.js +23 -0
- package/examples/webgpu-tsl/picture/post.js +16 -0
- package/examples/webgpu-tsl/picture/sky.js +30 -0
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +16 -12
- package/examples/world/art/humanoid.js +9 -13
- package/examples/world/art/index.js +2 -2
- package/examples/world/art/models.js +3 -4
- package/examples/world/art/shapes.js +2 -2
- package/examples/world/assets.js +2 -2
- package/examples/world/content/audio.js +1 -1
- package/examples/world/content/items.js +1 -1
- package/examples/world/content/props.js +1 -1
- package/examples/world/content/templates.js +1 -1
- package/examples/world/content/vegetation.js +1 -1
- package/examples/world/main.js +10 -10
- package/examples/world/models.js +17 -7
- package/examples/world/picture/index.js +20 -0
- package/examples/world/picture/lights.js +41 -0
- package/examples/world/picture/materials.js +34 -0
- package/examples/world/picture/palette.js +74 -0
- package/examples/world/picture/post.js +9 -0
- package/examples/world/picture/sky.js +39 -0
- package/index.d.ts +14 -22
- package/index.js +36 -36
- package/llms.txt +19 -21
- package/modules/ambience/Ambience.js +12 -9
- package/modules/calendar/Calendar.js +20 -20
- package/modules/calendar/index.js +14 -13
- package/modules/calendar/schedule.js +11 -6
- package/modules/calendar/seasons.js +7 -7
- package/modules/camera/FirstPersonCamera.js +2 -2
- package/modules/camera/FixedCamera.js +14 -15
- package/modules/camera/FollowCamera.js +4 -4
- package/modules/camera/RtsCamera.js +11 -11
- package/modules/camera/common.js +51 -25
- package/modules/camera/contract.js +1 -0
- package/modules/camera/projection.js +2 -2
- package/modules/characters/Character.js +47 -39
- package/modules/characters/NPC.js +30 -22
- package/modules/characters/assetModel.js +18 -13
- package/modules/characters/astar.js +7 -5
- package/modules/characters/behaviors.js +4 -5
- package/modules/characters/contract.js +2 -2
- package/modules/characters/index.js +172 -193
- package/modules/characters/moveHelpers.js +14 -3
- package/modules/characters/movers/common.js +22 -15
- package/modules/characters/movers/manual.js +4 -1
- package/modules/characters/movers/rapier.js +7 -6
- package/modules/characters/movers/simple.js +3 -3
- package/modules/characters/movers/support.js +32 -18
- package/modules/characters/npcAvoid.js +4 -4
- package/modules/characters/npcSim.js +28 -18
- package/modules/characters/npcView.js +6 -5
- package/modules/characters/pathAsync.js +12 -10
- package/modules/characters/pathWorker.js +1 -1
- package/modules/characters/player.js +108 -0
- package/modules/characters/playerStrings.js +2 -2
- package/modules/characters/proceduralRig.js +19 -5
- package/modules/characters/useModel.js +5 -5
- package/modules/characters/walkTo.js +11 -17
- package/modules/collision/Collision.js +30 -22
- package/modules/collision/contract.js +15 -0
- package/modules/content/explain.js +1 -2
- package/modules/content/fields.js +24 -3
- package/modules/content/ids.js +2 -2
- package/modules/content/index.js +68 -98
- package/modules/content/loader.js +14 -17
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +66 -18
- package/modules/content/packs.js +3 -3
- package/modules/content/parts.js +2 -2
- package/modules/content/places.js +35 -0
- package/modules/content/props.js +19 -14
- package/modules/content/rules.js +34 -22
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +24 -22
- package/modules/content/words.js +34 -0
- package/modules/debug/DebugPanel.js +10 -43
- package/modules/flow/contract.js +1 -1
- package/modules/flow/index.js +11 -7
- package/modules/gameplay/Container.js +12 -11
- package/modules/gameplay/Containers.js +14 -5
- package/modules/gameplay/Dialogue.js +13 -11
- package/modules/gameplay/Interactions.js +115 -27
- package/modules/gameplay/Inventory.js +11 -12
- package/modules/gameplay/Quests.js +16 -9
- package/modules/gameplay/boxOps.js +1 -1
- package/modules/gameplay/dialogueBox.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +4 -5
- package/modules/gameplay/interactionPrompt.js +1 -1
- package/modules/gameplay/interactions.contract.js +1 -1
- package/modules/gameplay/inventoryOps.js +2 -3
- package/modules/gameplay/pickups.js +81 -44
- package/modules/gameplay/questLog.js +2 -2
- package/modules/gameplay/questSave.js +3 -3
- package/modules/grid/Grid.js +1 -1
- package/modules/grid/Layer.js +16 -3
- package/modules/grid/index.js +47 -19
- package/modules/grid/preview.js +29 -20
- package/modules/grid/tiles.js +19 -23
- package/modules/hlod/index.js +38 -55
- package/modules/hud/index.js +27 -8
- package/modules/hud/parts.js +13 -11
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +12 -10
- package/modules/level/index.js +48 -152
- package/modules/level/load.js +79 -0
- package/modules/level/meshes.js +65 -0
- package/modules/level/nodes.js +6 -7
- package/modules/lights/index.js +34 -183
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +88 -0
- package/modules/music/Music.js +31 -27
- package/modules/music/rules.js +1 -1
- package/modules/nav/contract.js +14 -0
- package/modules/nav/index.js +11 -10
- package/modules/net/Client.js +7 -7
- package/modules/net/Host.js +7 -7
- package/modules/net/Net.js +1 -1
- package/modules/net/index.js +5 -4
- package/modules/net/sync.js +2 -2
- package/modules/net/transports.js +2 -2
- package/modules/particles/Particles.js +49 -25
- package/modules/particles/effect.js +27 -10
- package/modules/particles/shaders.js +2 -1
- package/modules/photo/Photo.js +26 -27
- package/modules/rigid/RigidBodies.js +66 -43
- package/modules/rigid/Vehicles.js +2 -3
- package/modules/rigid/ragdoll.js +287 -0
- package/modules/rigid/ragdollBones.js +159 -0
- package/modules/rigid/sync.js +6 -6
- package/modules/settings/Settings.js +114 -45
- package/modules/settings/apply.js +10 -10
- package/modules/settings/sections.js +16 -14
- package/modules/settings/strings.js +1 -1
- package/modules/settings/view.js +3 -3
- package/modules/sky/Sky.js +125 -103
- package/modules/sky/clouds.js +22 -23
- package/modules/sky/dome.js +113 -0
- package/modules/sky/domeLayers.js +13 -13
- package/modules/sky/environment.js +47 -171
- package/modules/sky/fog.js +5 -180
- package/modules/sky/frame.js +42 -97
- package/modules/sky/season.js +9 -3
- package/modules/sky/shader.js +49 -44
- package/modules/sky/skyModule.js +25 -35
- package/modules/sky/tint.js +9 -11
- package/modules/swarm/Swarm.js +346 -0
- package/modules/swarm/draw.js +68 -0
- package/modules/swarm/grid.js +63 -0
- package/modules/terrain/ChunkManager.js +97 -62
- package/modules/terrain/chunkQueries.js +7 -24
- package/modules/terrain/chunkWorker.js +1 -1
- package/modules/terrain/draw.js +157 -0
- package/modules/terrain/index.js +60 -88
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +4 -3
- package/modules/terrain/terrainEdit.js +32 -27
- package/modules/terrain/terrainGen.js +19 -14
- package/modules/terrain/terrainIsland.js +2 -2
- package/modules/terrain/terrainMesh.js +7 -6
- package/modules/terrain/terrainShape.js +8 -10
- package/modules/terrain/terrainShapeMain.js +3 -3
- package/modules/timeline/Timeline.js +27 -19
- package/modules/timeline/Tween.js +6 -6
- package/modules/timeline/shots.js +5 -7
- package/modules/triggers/index.js +19 -15
- package/modules/vegetation/Vegetation.js +87 -39
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +196 -0
- package/modules/vegetation/groundChunks.js +11 -31
- package/modules/vegetation/index.js +18 -16
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +140 -93
- package/modules/water/surface.js +56 -56
- package/modules/weather/Weather.js +84 -38
- package/modules/weather/particles.js +18 -10
- package/modules/weather/shaders.js +1 -1
- package/modules/weather/weatherDraw.js +145 -0
- package/modules/world/World.js +10 -10
- package/modules/world/explain.js +1 -1
- package/modules/world/index.js +18 -12
- package/modules/world/persist.js +73 -25
- package/modules/world/pos.js +4 -4
- package/modules/world/records.js +28 -8
- package/modules/world/sim.js +4 -4
- package/modules/world/state.js +12 -5
- package/modules/world/thingSource.js +4 -2
- package/modules/world/views.js +12 -10
- package/package.json +44 -8
- package/presets.js +3 -5
- package/render/PostFX.js +233 -63
- package/render/backend.js +72 -32
- package/render/cascades.js +200 -0
- package/render/cascades.tsl.js +93 -0
- package/render/daylight.js +56 -0
- package/render/detail.js +13 -12
- package/render/effects.js +60 -42
- package/render/fuse.js +3 -3
- package/render/fx/cel.tsl.js +42 -0
- package/render/fx/cloudShadow.tsl.js +3 -3
- package/render/fx/detail.tsl.js +1 -1
- package/render/fx/index.js +10 -13
- package/render/fx/library.tsl.js +11 -0
- package/render/fx/lighting.tsl.js +2 -1
- package/render/fx/nodeErrors.tsl.js +2 -2
- package/render/fx/objectOrigin.tsl.js +1 -2
- package/render/fx/patchNodes.tsl.js +6 -16
- package/render/fx/postWebGPU.tsl.js +55 -28
- package/render/fx/sky.tsl.js +34 -109
- package/render/fx/uniforms.tsl.js +4 -4
- package/render/fx/water.tsl.js +1 -1
- package/render/fx/wind.tsl.js +1 -1
- package/render/fxNumbers.js +3 -0
- package/render/layers.js +14 -0
- package/render/lighting.js +11 -8
- package/render/lightmap.js +142 -0
- package/render/lights.js +26 -204
- package/render/lit.js +24 -0
- package/render/materials.js +47 -162
- package/render/mergeCommon.js +22 -0
- package/render/modeling.js +2 -2
- package/render/neutral.js +23 -0
- package/render/occlusion.js +200 -0
- package/render/ownFrame.js +5 -5
- package/render/patches.js +46 -41
- package/render/postWebGL.js +19 -9
- package/render/probes.js +182 -128
- package/render/recordSweep.js +117 -0
- package/render/shaderErrors.js +10 -9
- package/render/shadowCache.tsl.js +107 -0
- package/render/shadowTypes.js +9 -0
- package/render/shadows.js +451 -0
- package/render/slots.js +11 -11
- package/render/terms.js +63 -113
- package/render/uniformDecl.js +2 -2
- package/types/core.d.ts +489 -405
- package/types/gameplay.d.ts +225 -114
- package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +23 -8
- package/types/generated/core/{audioVoice.d.ts → audio/audioVoice.d.ts} +2 -2
- package/types/generated/core/{Events.d.ts → base/Events.d.ts} +4 -4
- package/types/generated/core/{I18n.d.ts → base/I18n.d.ts} +7 -15
- package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
- package/types/generated/core/engine/page.d.ts +24 -0
- package/types/generated/core/{Input.d.ts → input/Input.d.ts} +21 -10
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +16 -8
- package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +4 -3
- package/types/generated/core/{control.d.ts → ops/control.d.ts} +4 -10
- package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +37 -13
- package/types/generated/core/{session.d.ts → saves/session.d.ts} +2 -1
- package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
- package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +1 -1
- package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
- package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +18 -16
- package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
- package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
- package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
- package/types/generated/modules/calendar/Calendar.d.ts +10 -11
- package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
- package/types/generated/modules/grid/Layer.d.ts +9 -1
- package/types/generated/modules/grid/index.d.ts +32 -8
- package/types/generated/modules/music/Music.d.ts +7 -5
- package/types/generated/modules/particles/Particles.d.ts +14 -7
- package/types/generated/modules/sky/Sky.d.ts +101 -23
- package/types/generated/modules/sky/skyModule.d.ts +1 -1
- package/types/generated/modules/swarm/Swarm.d.ts +80 -0
- package/types/generated/modules/timeline/Timeline.d.ts +2 -1
- package/types/generated/modules/water/Water.d.ts +51 -3
- package/types/generated/modules/weather/Weather.d.ts +44 -10
- package/types/generated/modules/weather/weatherDraw.d.ts +11 -0
- package/types/generated/modules/world/World.d.ts +7 -5
- package/types/generated/render/PostFX.d.ts +69 -20
- package/types/generated/render/lighting.d.ts +29 -0
- package/types/generated/render/materials.d.ts +20 -44
- package/types/generated/render/occlusion.d.ts +22 -0
- package/types/generated/render/patches.d.ts +1 -0
- package/types/generated/ui/Focus.d.ts +1 -0
- package/types/generated/ui/UI.d.ts +1 -0
- package/types/nav.d.ts +11 -11
- package/types/physics.d.ts +104 -73
- package/types/tsl.d.ts +45 -4
- package/types/world.d.ts +372 -86
- package/ui/Focus.js +21 -10
- package/ui/LoadingScreen.js +2 -2
- package/ui/Parts.js +12 -7
- package/ui/UI.js +17 -17
- package/ui/cursor.js +1 -1
- package/ui/defaults.js +3 -2
- package/ui/theme.js +36 -28
- package/ui/touchPart.js +1 -1
- package/core/UrlState.js +0 -110
- package/core/assetEntry.js +0 -106
- package/core/describeRender.js +0 -71
- package/core/holds.js +0 -134
- package/core/look/coreParts.js +0 -219
- package/core/look/part.js +0 -253
- package/core/look/points.js +0 -255
- package/core/look/report.js +0 -96
- package/core/look/shadowPart.js +0 -63
- package/core/look/state.js +0 -45
- package/core/look/write.js +0 -70
- package/core/page.js +0 -79
- package/core/shadowTypes.js +0 -16
- package/core/styleParts.js +0 -114
- package/core/util.js +0 -17
- package/docs/MIGRATING-0.3.md +0 -248
- package/docs/MIGRATING-0.4.md +0 -228
- package/docs/MIGRATING-0.5.md +0 -68
- package/docs/PERF.md +0 -245
- package/docs/api/style.md +0 -136
- package/docs/api/terrainLook.md +0 -10
- package/docs/api/vegetationLook.md +0 -10
- package/docs/api/weatherLook.md +0 -10
- package/docs/recipes/09-style.md +0 -218
- package/docs/recipes/35-style-from-reference.md +0 -153
- package/docs/recipes/36-sky-ground-plant-looks.md +0 -118
- package/docs/recipes/37-terrain-look-hooks.md +0 -119
- package/docs/recipes/38-environment-look-hooks.md +0 -99
- package/docs/recipes/41-thing-registry.md +0 -97
- package/docs/recipes/42-terrain-shape.md +0 -64
- package/docs/recipes/44-water-weather-look-hooks.md +0 -144
- package/docs/recipes/47-island-snow-backdrop.md +0 -45
- package/docs/recipes/48-make-material.md +0 -75
- package/docs/recipes/52-look.md +0 -282
- package/docs/recipes/54-three-idioms.md +0 -88
- package/examples/action/look.js +0 -5
- package/examples/sheepisland/.threedog/content-index.json +0 -1
- package/examples/sheepisland/style/index.js +0 -79
- package/examples/styletest/look.js +0 -11
- package/examples/techniques/day-night-grade/dayNightGrade.js +0 -76
- package/examples/webgpu-tsl/tslScene.js +0 -75
- package/examples/world/style/index.js +0 -61
- package/examples/world/style/plugins/10-bloom.js +0 -5
- package/modules/sky/cascades.js +0 -186
- package/modules/sky/cascades.tsl.js +0 -82
- package/modules/sky/look.js +0 -54
- package/modules/sky/lookFog.js +0 -76
- package/modules/sky/lookShadow.js +0 -62
- package/modules/sky/lookSky.js +0 -169
- package/modules/sky/shadow.js +0 -98
- package/modules/terrain/look.js +0 -83
- package/modules/terrain/lookGround.js +0 -66
- package/modules/vegetation/look.js +0 -119
- package/modules/vegetation/lookWind.js +0 -98
- package/modules/water/look.js +0 -91
- package/modules/water/surfaceDefaults.js +0 -3
- package/modules/weather/look.js +0 -74
- package/modules/weather/weatherLook.js +0 -135
- package/render/lookGlow.js +0 -139
- package/render/lookSurface.js +0 -224
- package/render/postLook.js +0 -164
- package/render/surface.js +0 -105
- package/types/generated/core/page.d.ts +0 -18
- package/types/generated/modules/weather/weatherLook.d.ts +0 -12
- package/types/style.d.ts +0 -671
- /package/core/{Vars.js → base/Vars.js} +0 -0
- /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
- /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
- /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
- /package/core/{actor.js → ops/actor.js} +0 -0
- /package/core/{opsFail.js → ops/opsFail.js} +0 -0
- /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
- /package/core/{saveIds.js → saves/saveIds.js} +0 -0
- /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
- /package/core/{cells.js → stream/cells.js} +0 -0
- /package/core/{streamCells.js → stream/streamCells.js} +0 -0
- /package/core/{pureWorker.js → threads/pureWorker.js} +0 -0
- /package/examples/{sheepisland → perf-island}/content/index.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/props.js +0 -0
package/types/gameplay.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Gameplay modules: timeline, level, triggers, world changes, particles, settings, music, characters/NPCs, interactions, dialogue, inventory,
|
|
2
2
|
// quests, photo mode, ambience, debug.
|
|
3
|
-
import type { Object3D, Vector3, Vector2, Quaternion, Texture, ColorLike, Vec3Like, Ease, Handle, Range, XZ, Loose, PositionLike } from './common';
|
|
3
|
+
import type { Object3D, Vector3, Vector2, Quaternion, Texture, ColorLike, Vec3Like, Ease, Handle, Range, XZ, Loose, PositionLike, Material } from './common';
|
|
4
4
|
import type { Engine } from './core';
|
|
5
|
-
import type { Input } from './generated/core/Input';
|
|
5
|
+
import type { Input } from './generated/core/input/Input';
|
|
6
6
|
import type { Animator, AnimatorOptions, Rideable } from './physics';
|
|
7
7
|
import type { WorldRecord } from './generated/modules/world/World';
|
|
8
8
|
|
|
@@ -93,15 +93,15 @@ export interface LevelOptions {
|
|
|
93
93
|
outside?: number;
|
|
94
94
|
/** Water surface height (meters), default no water */
|
|
95
95
|
waterLevel?: number;
|
|
96
|
-
/** Expand the collision box outward by this much (meters) */
|
|
96
|
+
/** Expand the collision box outward by this much (meters) @experimental */
|
|
97
97
|
colliderPad?: number;
|
|
98
|
-
/** Minimum height of the collision box (meters) */
|
|
98
|
+
/** Minimum height of the collision box (meters) @experimental */
|
|
99
99
|
colliderHeight?: number;
|
|
100
|
-
/** Treat it as a step edge when the height difference between adjacent grid points exceeds this (meters), default 0.6 */
|
|
100
|
+
/** Treat it as a step edge when the height difference between adjacent grid points exceeds this (meters), default 0.6 @experimental */
|
|
101
101
|
sharpEdge?: number;
|
|
102
|
-
/** Hide the marker placeholder meshes, default true */
|
|
102
|
+
/** Hide the marker placeholder meshes, default true @experimental */
|
|
103
103
|
hideMarkers?: boolean;
|
|
104
|
-
/** Add the scene to engine.scene, default true */
|
|
104
|
+
/** Add the scene to engine.scene, default true @experimental */
|
|
105
105
|
addToScene?: boolean;
|
|
106
106
|
}
|
|
107
107
|
/** Markers in the level (spawn, npc_*, trigger_*, marker_*), in world coordinates */
|
|
@@ -112,13 +112,11 @@ export interface LevelLoadedEvent { root: Object3D; markers: Record<string, Leve
|
|
|
112
112
|
export interface Level {
|
|
113
113
|
/** Scene root node */
|
|
114
114
|
root: Object3D | null;
|
|
115
|
-
/** Same as root (the name consistent with player.object and ent.object) */
|
|
116
|
-
readonly object: Object3D | null;
|
|
117
115
|
/** All markers: name -> marker */
|
|
118
116
|
markers: Record<string, LevelMarker>;
|
|
119
117
|
/** Spawn point position */
|
|
120
118
|
spawn: Vector3;
|
|
121
|
-
/** Heightfield (for debugging) */
|
|
119
|
+
/** Heightfield (for debugging) @experimental */
|
|
122
120
|
heightfield: any;
|
|
123
121
|
/** Whether loading is finished */
|
|
124
122
|
readonly ready: boolean;
|
|
@@ -126,7 +124,7 @@ export interface Level {
|
|
|
126
124
|
marker(name: string): LevelMarker | null;
|
|
127
125
|
/** Get all markers whose names start with prefix, e.g. markersWith('npc_') */
|
|
128
126
|
markersWith(prefix: string): LevelMarker[];
|
|
129
|
-
/** Unload the level (the scene is fully deleted with engine.remove; collision, ray registrations and things registered with track are removed together) */
|
|
127
|
+
/** Unload the level (the scene is fully deleted with engine.remove; collision, ray registrations and things registered with track are removed together) @experimental */
|
|
130
128
|
unload(): void;
|
|
131
129
|
/**
|
|
132
130
|
* Change level: unload the current one, load the new one (glTF path/asset name, or a THREE object), and emit level:loaded when done. When a load
|
|
@@ -213,13 +211,16 @@ export interface TriggerEvent { tag: string; trigger: Trigger; who: Vector3 | nu
|
|
|
213
211
|
export interface TriggersOptions {
|
|
214
212
|
/** Action name that toggles the debug view 'triggers' (engine.debug.view), default 'triggersDebug' */
|
|
215
213
|
action?: string;
|
|
214
|
+
/** Line color of the debug view 'triggers', default neutral gray */
|
|
215
|
+
debugColor?: ColorLike;
|
|
216
|
+
/** Line opacity of the debug view 'triggers', default 0.8 */
|
|
217
|
+
debugOpacity?: number;
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
/** engine.triggers */
|
|
219
221
|
export interface Triggers {
|
|
220
222
|
/** All trigger zones (a new array) */
|
|
221
223
|
list(): Trigger[];
|
|
222
|
-
action: string;
|
|
223
224
|
/** Add a trigger zone */
|
|
224
225
|
add(opts?: TriggerOptions): Trigger;
|
|
225
226
|
/** Delete all (delete a single one with trigger.remove()) */
|
|
@@ -234,9 +235,9 @@ export interface Triggers {
|
|
|
234
235
|
// Particles particles()
|
|
235
236
|
// ======================================================================
|
|
236
237
|
|
|
237
|
-
/** Particle effect parameters (
|
|
238
|
+
/** Particle effect parameters (define(), and each entry of particles({ effects, default })). All optional */
|
|
238
239
|
export interface ParticleOptions {
|
|
239
|
-
/** Maximum alive at once, default 120 (
|
|
240
|
+
/** Maximum alive at once, default 120 (60 on low-tier devices; a number the game gives stands) */
|
|
240
241
|
max?: number;
|
|
241
242
|
/** Seconds each particle lives [min, max] */
|
|
242
243
|
lifetime?: Range;
|
|
@@ -288,17 +289,66 @@ export interface ParticleEmitter extends Handle {
|
|
|
288
289
|
[key: string]: any;
|
|
289
290
|
}
|
|
290
291
|
/** A particle effect */
|
|
291
|
-
export interface ParticleEffect {
|
|
292
|
+
export interface ParticleEffect {
|
|
293
|
+
name: string; o: ParticleOptions; max: number; alive: number; points: Object3D;
|
|
294
|
+
/** The plain three.js material drawn; set yours and it is drawn as given, null gives the engine's back */
|
|
295
|
+
material: Material | null;
|
|
296
|
+
/** The engine material's { value } objects (uMap, uHasMap, uScale, uMaxPx), written whichever material is drawn; a ShaderMaterial of yours can share them */
|
|
297
|
+
readonly uniforms: Record<string, { value: any }>;
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
}
|
|
300
|
+
/** particles() options */
|
|
301
|
+
export interface ParticlesOptions {
|
|
302
|
+
/** Effect params by name: under what define() gives, and defined on the first emit / attach when define() never ran */
|
|
303
|
+
effects?: Record<string, ParticleOptions>;
|
|
304
|
+
/** Params every effect starts from */
|
|
305
|
+
default?: ParticleOptions;
|
|
306
|
+
}
|
|
292
307
|
|
|
293
308
|
// Particles (engine.particles) is generated from the JSDoc in modules/particles/Particles.js (npm run map); only the type is re-exported here
|
|
294
309
|
import type { Particles } from './generated/modules/particles/Particles';
|
|
310
|
+
|
|
311
|
+
// Swarm swarm()
|
|
312
|
+
|
|
313
|
+
/** Options of engine.swarm(). See recipes/65-swarm.md */
|
|
314
|
+
export interface SwarmOptions {
|
|
315
|
+
/** Unique name: shown in describe(), the key in a save */
|
|
316
|
+
name: string;
|
|
317
|
+
/** Most objects alive at once; all memory is taken up front */
|
|
318
|
+
capacity: number;
|
|
319
|
+
/** Plain three.js geometry, stays the game's to dispose. Leave out with material for a swarm that draws nothing */
|
|
320
|
+
geometry?: import('three').BufferGeometry;
|
|
321
|
+
/** Plain three.js material, stays the game's to dispose */
|
|
322
|
+
material?: import('three').Material;
|
|
323
|
+
/** Number columns beside x, y, z. yaw, pitch, roll (radians, order YXZ) and scale are also drawn by the engine */
|
|
324
|
+
fields?: string[];
|
|
325
|
+
/** Per-object colour: columns r, g, b (linear) and spawn({ color: 0xff8800 }) */
|
|
326
|
+
color?: boolean;
|
|
327
|
+
/** Time channel of the onStep dt (default 'world') */
|
|
328
|
+
channel?: string;
|
|
329
|
+
/** Grid cell for near, in meters: about the usual query radius (default 2) */
|
|
330
|
+
cell?: number;
|
|
331
|
+
/** Keep this swarm in saves; otherwise it is empty after a load or new game */
|
|
332
|
+
save?: boolean;
|
|
333
|
+
}
|
|
334
|
+
/** The columns of a swarm: d.x[row], d.vx[row]... and d.id[row], the handle of that row */
|
|
335
|
+
export type SwarmData = { x: Float32Array; y: Float32Array; z: Float32Array; id: Float64Array } & Record<string, Float32Array | Float64Array>;
|
|
336
|
+
/** Runs for each live row every fixed step; returning false removes the object, anything else keeps it */
|
|
337
|
+
export type SwarmRowFn = (d: SwarmData, i: number, dt: number) => unknown;
|
|
338
|
+
import type { Swarm } from './generated/modules/swarm/Swarm';
|
|
339
|
+
export type { Swarm };
|
|
340
|
+
/** engine.swarm: call it to make a swarm */
|
|
341
|
+
export interface SwarmMaker {
|
|
342
|
+
/** Make a swarm. Returns a Swarm: spawn, free, row, onStep, near, clear, dispose, count, capacity, data, mesh */
|
|
343
|
+
(opts: SwarmOptions): Swarm;
|
|
344
|
+
}
|
|
295
345
|
export type { Particles };
|
|
296
346
|
|
|
297
347
|
// ======================================================================
|
|
298
348
|
// Settings menu settings()
|
|
299
349
|
// ======================================================================
|
|
300
350
|
|
|
301
|
-
/** Contents of a graphics quality preset */
|
|
351
|
+
/** Contents of a graphics quality preset. pixelRatio is a share from 0 to 1 of the ratio the engine picked for this device, so one preset fits every screen */
|
|
302
352
|
export interface QualityPreset { pixelRatio?: number; shadows?: boolean; antialias?: boolean; bloom?: boolean; ao?: boolean; viewChunks?: number; density?: number; [key: string]: any }
|
|
303
353
|
/**
|
|
304
354
|
* The tools a settings tab's render(tools, e, s) receives: escaping, translation and the control helpers (each returns HTML)
|
|
@@ -341,10 +391,12 @@ export interface SettingsOptions {
|
|
|
341
391
|
/**
|
|
342
392
|
* Tabs: true (default) graphics, audio, controls, language, saves; false none; or a list by name, which may include the optional
|
|
343
393
|
* 'game' (resume, load a save, back to title) and 'camera' (mouse sensitivity, invert Y, field of view; saved as camera.sensitivity / camera.invertY
|
|
344
|
-
* / camera.fov)
|
|
394
|
+
* / camera.fov). The entry { id: 'graphics', omit } leaves graphics rows out (quality, pixelRatio, shadows, antialias, bloom, ao, adaptive, viewChunks,
|
|
395
|
+
* density): an omitted row stays the game's value, and no preset or stored value moves it
|
|
345
396
|
* @example settings({ sections: ['game', 'graphics', 'audio', 'controls', 'camera'] })
|
|
397
|
+
* @example settings({ sections: [{ id: 'graphics', omit: ['pixelRatio', 'antialias', 'adaptive'] }, 'audio', 'controls', 'language', 'saves'] }) // a fixed pixel look
|
|
346
398
|
*/
|
|
347
|
-
sections?: boolean | string[];
|
|
399
|
+
sections?: boolean | (string | { id: 'graphics'; omit: string[] })[];
|
|
348
400
|
/**
|
|
349
401
|
* Pause gameplay while the menu is open (with flow installed it switches to flow's 'paused' and returns to the previous state on close; without flow
|
|
350
402
|
* it uses engine.freeze); the picture keeps running, default false
|
|
@@ -354,20 +406,19 @@ export interface SettingsOptions {
|
|
|
354
406
|
|
|
355
407
|
/** engine.settings */
|
|
356
408
|
export interface Settings {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
values: Record<string, any>;
|
|
409
|
+
/** All current setting values, read only (set() changes one). pixelRatio is the renderer's real ratio */
|
|
410
|
+
readonly values: Record<string, any>;
|
|
360
411
|
/** Graphics presets */
|
|
361
412
|
presets: Record<string, QualityPreset>;
|
|
362
|
-
/** Tabs */
|
|
413
|
+
/** Tabs @experimental */
|
|
363
414
|
sections: Map<string, any>;
|
|
364
|
-
/** Whether the menu is open */
|
|
415
|
+
/** Whether the menu is open @experimental */
|
|
365
416
|
readonly isOpen: boolean;
|
|
366
417
|
/** Read a setting, e.g. get('vol.music') */
|
|
367
418
|
get(key: string): any;
|
|
368
419
|
/** Change a setting (takes effect immediately + saved) */
|
|
369
420
|
set(key: string, value: any, opts?: { save?: boolean }): void;
|
|
370
|
-
/** Graphics preset: 'low' | 'medium' | 'high' */
|
|
421
|
+
/** Graphics preset: 'low' | 'medium' | 'high' @experimental */
|
|
371
422
|
preset(name: 'low' | 'medium' | 'high' | (string & {})): void;
|
|
372
423
|
/** Game-defined setting: default value + apply function (saved automatically), or { apply, limits }. limits names the shared value(s) the row
|
|
373
424
|
* restricts on the settings layer, like the built-in shadows row: off holds it off (the scene, weather or a cutscene cannot turn it back on),
|
|
@@ -375,15 +426,16 @@ export interface Settings {
|
|
|
375
426
|
define<T = any>(key: string, def: T, apply?: ((value: T, e: Engine) => void) | { apply?: (value: T, e: Engine) => void; limits?: string | string[] }): this;
|
|
376
427
|
/** Add a tab of your own, or a built-in / optional one by name: addSection('camera') */
|
|
377
428
|
addSection(id: string, section?: SettingsSection): this;
|
|
378
|
-
removeSection(id: string): void;
|
|
379
429
|
open(): void;
|
|
380
430
|
close(): void;
|
|
381
431
|
toggle(on?: boolean): void;
|
|
382
|
-
/**
|
|
432
|
+
/** Put one setting (or all, with no key) back to its default: the engine's start value, or the default the game gave define(). Keys: resetBindings */
|
|
433
|
+
reset(key?: string): void;
|
|
434
|
+
/** Restore all keys to defaults @experimental */
|
|
383
435
|
resetBindings(): void;
|
|
384
436
|
/** Change the first key of an action to code */
|
|
385
437
|
rebind(action: string, code: string): void;
|
|
386
|
-
/** Key list (for the UI) */
|
|
438
|
+
/** Key list (for the UI) @experimental */
|
|
387
439
|
actionList(): any[];
|
|
388
440
|
/** Save to the browser */
|
|
389
441
|
save(): void;
|
|
@@ -411,7 +463,7 @@ export interface MusicOptions {
|
|
|
411
463
|
fade?: number;
|
|
412
464
|
/** Duck the music bus during dialogue to this (0-1, e.g. 0.35); default false = no duck (the game opts in) */
|
|
413
465
|
duckDialogue?: number | false;
|
|
414
|
-
/** Fade seconds for the ducking */
|
|
466
|
+
/** Fade seconds for the ducking @experimental */
|
|
415
467
|
duckFade?: number;
|
|
416
468
|
/** Rule debounce seconds, default 2 */
|
|
417
469
|
hold?: number;
|
|
@@ -445,7 +497,7 @@ export interface CharacterFacts { base: string; speed: number; grounded: boolean
|
|
|
445
497
|
export type CharacterStates = (character: Character, facts: CharacterFacts) => string | null | undefined;
|
|
446
498
|
/** Character parameters (shared by the player and NPCs) */
|
|
447
499
|
export interface CharacterOptions {
|
|
448
|
-
/** Per-character part colors: recolor the body's meshes marked userData.part (a humanoid rig: body, skin, legs, hair)
|
|
500
|
+
/** Per-character part colors: recolor the body's meshes marked userData.part (a humanoid rig: body, skin, legs, hair) */
|
|
449
501
|
colors?: { body?: ColorLike; skin?: ColorLike; legs?: ColorLike; hair?: ColorLike };
|
|
450
502
|
/** Walking speed (m/s), default 4.5 */
|
|
451
503
|
speed?: number;
|
|
@@ -547,10 +599,8 @@ export type CharacterState = 'idle' | 'walk' | 'run' | 'swim' | 'jump' | 'fall'
|
|
|
547
599
|
/** Character (player and NPCs) */
|
|
548
600
|
export declare class Character {
|
|
549
601
|
constructor(engine: Engine, opts?: CharacterOptions);
|
|
550
|
-
/** Root node
|
|
602
|
+
/** Root node: add it to the scene with engine.add(character.root) when you built the Character yourself; add children, change visible and scale on it */
|
|
551
603
|
root: Object3D;
|
|
552
|
-
/** Same as root: add children, change visible and scale on it */
|
|
553
|
-
readonly object: Object3D;
|
|
554
604
|
/** Position (= root.position) */
|
|
555
605
|
readonly position: Vector3;
|
|
556
606
|
/** Horizontal velocity (x, y map to world x, z). Writable: a write is an impulse the mover steers back toward the input (lasting knockback: push(); full control: mover 'manual') */
|
|
@@ -560,11 +610,11 @@ export declare class Character {
|
|
|
560
610
|
* root.rotation.y)
|
|
561
611
|
*/
|
|
562
612
|
facing: number;
|
|
563
|
-
/** Vertical velocity (m/s). Writable: setting it is an impulse (launch() does the same and also leaves the ground cleanly) */
|
|
613
|
+
/** Vertical velocity (m/s), kept apart from velocity, which is horizontal only (velocity.y is world z, not this). Writable: setting it is an impulse (launch() does the same and also leaves the ground cleanly) */
|
|
564
614
|
vy: number;
|
|
565
615
|
/** Whether standing on the ground */
|
|
566
616
|
grounded: boolean;
|
|
567
|
-
/** Whether swimming */
|
|
617
|
+
/** Whether swimming @experimental */
|
|
568
618
|
swimming: boolean;
|
|
569
619
|
/** Current action state */
|
|
570
620
|
state: CharacterState;
|
|
@@ -574,15 +624,23 @@ export declare class Character {
|
|
|
574
624
|
faceMode: FaceMode;
|
|
575
625
|
/** What faceMode 'target' faces */
|
|
576
626
|
faceTarget: PositionLike | null;
|
|
577
|
-
/** Player only: whether the camera module follows it (see PlayerOptions.cameraFollow) */
|
|
627
|
+
/** Player only: whether the camera module follows it (see PlayerOptions.cameraFollow) @experimental */
|
|
578
628
|
cameraFollow?: boolean;
|
|
579
629
|
/** Move at a fixed velocity (m/s) for seconds, ignoring move()'s direction and without turning (knockback, dodge roll); gravity and collision still apply */
|
|
580
630
|
push(vx: number, vz: number, seconds: number): void;
|
|
581
|
-
speed: number; runSpeed: number; radius: number; water: CharacterWater; states: CharacterStates | null;
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
|
|
585
|
-
/**
|
|
631
|
+
speed: number; runSpeed: number; radius: number; water: CharacterWater; states: CharacterStates | null;
|
|
632
|
+
/** @experimental */ swimDepth: number;
|
|
633
|
+
/** @experimental */ swimSpeedFactor: number;
|
|
634
|
+
/** @experimental */ turnSpeed: number;
|
|
635
|
+
/** @experimental */ acceleration: number; gravity: number; jumpSpeed: number;
|
|
636
|
+
/** @experimental */ stepHeight: number;
|
|
637
|
+
/** @experimental */ airControl: number;
|
|
638
|
+
/** @experimental */ coyoteTime: number; canJump: boolean;
|
|
639
|
+
/** Base jump values (the game's; modifiers go through engine.mod('move.jumpSpeed')) @experimental */
|
|
640
|
+
maxJumps: number;
|
|
641
|
+
/** @experimental */ airJumpSpeed: number | null;
|
|
642
|
+
/** @experimental */ jumpBuffer: number;
|
|
643
|
+
/** Fall check (see CharacterOptions.fall); a plain property @experimental */
|
|
586
644
|
fall: false | { belowY: number | ((character: Character) => boolean) };
|
|
587
645
|
/** Time channel the engine drives it on (see CharacterOptions.channel) */
|
|
588
646
|
channel: string;
|
|
@@ -593,25 +651,21 @@ export declare class Character {
|
|
|
593
651
|
* @example engine.mod('move.speed', { owner: 'haste', id: 'player', mul: 1.2, for: 5 }); player.stat('speed') // 1.2 x player.speed
|
|
594
652
|
*/
|
|
595
653
|
stat(name: 'speed' | 'runSpeed' | 'gravity' | 'jumpSpeed' | 'canJump'): number;
|
|
596
|
-
/** Give back n jumps for this airtime (pickup, wall touch) */
|
|
654
|
+
/** Give back n jumps for this airtime (pickup, wall touch) @experimental */
|
|
597
655
|
addJumps(n?: number): this;
|
|
598
|
-
/** All jumps back, as if it had landed */
|
|
656
|
+
/** All jumps back, as if it had landed @experimental */
|
|
599
657
|
resetJumps(): this;
|
|
600
658
|
/**
|
|
601
659
|
* Throw it upward at speed m/s (jump pad, spring): leaves the ground, ends coyote time, the ground jump counts as used (air jumps stay); emits character:launch
|
|
602
660
|
* @example player.launch(19, { owner: 'pad' })
|
|
603
661
|
*/
|
|
604
662
|
launch(speed: number, opts?: { owner?: string }): this;
|
|
605
|
-
/** Jump state now, read-only */
|
|
663
|
+
/** Jump state now, read-only @experimental */
|
|
606
664
|
jumpState(): { grounded: boolean; coyoteLeft: number; bufferLeft: number; jumpsUsed: number; jumpsLeft: number; vy: number };
|
|
607
665
|
/** What it stands on, read-only (reused object); 'platform' = a registered support (characters.support), which carries it */
|
|
608
666
|
readonly support: { kind: 'ground' | 'platform' | 'collider' | 'water' | null; object: any; id: string | null; safe: boolean; velocity: { x: number; y: number; z: number } };
|
|
609
667
|
/** Last spot it stood still on safe ground (where a fall returns it); null until it first stands. Saved with the motion */
|
|
610
668
|
safeGround: Vector3 | null;
|
|
611
|
-
/** Called when a foot lands (the argument is the ground type underfoot) */
|
|
612
|
-
onStep: ((groundType: string) => void) | null;
|
|
613
|
-
/** Called on landing (the argument is the landing speed) */
|
|
614
|
-
onLand: ((impact: number) => void) | null;
|
|
615
669
|
/** How it walks now; name is 'simple' | 'rapier' | 'manual', controller is the native Rapier character controller (when rapier). Assign a name to switch: c.mover = 'manual' */
|
|
616
670
|
get mover(): { name: 'simple' | 'rapier' | 'manual'; controller?: any; body?: any; collider?: any; move(dirX: number, dirZ: number, run: boolean, dt: number): void; dispose?(): void };
|
|
617
671
|
set mover(name: 'simple' | 'rapier' | 'manual');
|
|
@@ -621,7 +675,7 @@ export declare class Character {
|
|
|
621
675
|
ready: boolean;
|
|
622
676
|
/**
|
|
623
677
|
* Settles (never rejects) when a model named by asset is swapped in or has failed; already settled otherwise
|
|
624
|
-
* @example const npc = new Character(engine, { model: 'villager' }).
|
|
678
|
+
* @example const npc = new Character(engine, { model: 'villager' }); engine.add(npc.root); // import { Character } from 'threedog' await npc.whenReady;
|
|
625
679
|
* npc.playAction('Wave');
|
|
626
680
|
*/
|
|
627
681
|
readonly whenReady: Promise<void>;
|
|
@@ -650,8 +704,6 @@ export declare class Character {
|
|
|
650
704
|
* @example createPlayer({ ...presets.player.thirdPerson, maxJumps: 2 }) // double jump
|
|
651
705
|
*/
|
|
652
706
|
jump(opts?: { air?: boolean }): this;
|
|
653
|
-
/** Add to the scene */
|
|
654
|
-
addTo(scene?: any): this;
|
|
655
707
|
/** Put it on the ground at position (Vector3 / object / [x, y, z] / { x, z }) */
|
|
656
708
|
placeAt(position: PositionLike): this;
|
|
657
709
|
/**
|
|
@@ -679,9 +731,10 @@ export declare class Character {
|
|
|
679
731
|
/**
|
|
680
732
|
* Copy the motion state into a plain object (velocity, vertical velocity, heading, movement amount, grounded, swimming) to store in world data; after
|
|
681
733
|
* the model is rebuilt or a save is loaded, loadMotion continues from it with identical results
|
|
734
|
+
* @experimental
|
|
682
735
|
*/
|
|
683
736
|
saveMotion(out?: CharacterMotion): CharacterMotion;
|
|
684
|
-
/** Restore the motion state from the plain object of saveMotion */
|
|
737
|
+
/** Restore the motion state from the plain object of saveMotion @experimental */
|
|
685
738
|
loadMotion(m: CharacterMotion | null | undefined): this;
|
|
686
739
|
}
|
|
687
740
|
/** Result of Character.saveMotion (plain values, can be saved); facing is the same as Character.facing: 0 = +Z, forward (sin f, cos f) */
|
|
@@ -843,6 +896,12 @@ export interface NPCManager {
|
|
|
843
896
|
}
|
|
844
897
|
/** engine.characters */
|
|
845
898
|
export interface CharactersApi {
|
|
899
|
+
/**
|
|
900
|
+
* The three.js material of every placeholder capsule. Set it to swap the look of all of them at once; used as given, with no patches added. A character
|
|
901
|
+
* with colors.body draws with a copy of it in that color. A model's own materials are the model's.
|
|
902
|
+
* @example engine.characters.material = new THREE.MeshToonMaterial({ color: 0xd9a066 });
|
|
903
|
+
*/
|
|
904
|
+
material: Material;
|
|
846
905
|
/**
|
|
847
906
|
* Find a spawn point: searches outward from position (default origin) for walkable (not steep, no obstacle), non-water ground, without assuming
|
|
848
907
|
* terrain height; e.g. findSpawn(v, { minH: 3, maxH: 20 }). Returns a Vector3 (y is the ground height)
|
|
@@ -868,6 +927,7 @@ export interface CharactersApi {
|
|
|
868
927
|
/**
|
|
869
928
|
* Delete the current player (exits the vehicle first, stops responding to keys, fully deletes the model). The player save (key player) carries the
|
|
870
929
|
* position and the vehicle; loading an on-foot save exits the vehicle first
|
|
930
|
+
* @experimental
|
|
871
931
|
*/
|
|
872
932
|
removePlayer(): void;
|
|
873
933
|
/**
|
|
@@ -901,8 +961,10 @@ export interface FindSpawnOptions { minH?: number; maxH?: number; maxSlope?: num
|
|
|
901
961
|
export interface CharactersOptions {
|
|
902
962
|
/** Whether to enable NPCs (engine.npcs), default true */
|
|
903
963
|
npcs?: boolean;
|
|
904
|
-
/** Near tiers for large NPC crowds, off by default (every near NPC walks every fixed step); same as engine.npcs.tiers(opts) */
|
|
964
|
+
/** Near tiers for large NPC crowds, off by default (every near NPC walks every fixed step); same as engine.npcs.tiers(opts) @experimental */
|
|
905
965
|
npcTiers?: { fullRadius: number; nearEvery: number };
|
|
966
|
+
/** What every character's Animator starts from, e.g. { fade: 0.15 }; a model's manifest mapping and the character's own animation win over it */
|
|
967
|
+
animation?: AnimatorOptions;
|
|
906
968
|
}
|
|
907
969
|
/**
|
|
908
970
|
* Pathfinding options: step is the grid size (meters, A*), maxNodes the maximum cells searched (A*), radius the character radius (meters,
|
|
@@ -914,12 +976,40 @@ export interface FindPathOptions { step?: number; maxNodes?: number; radius?: nu
|
|
|
914
976
|
// Interactions interactions()
|
|
915
977
|
// ======================================================================
|
|
916
978
|
|
|
979
|
+
/** One live interaction, as interactions.get(id) and interactions.items give it */
|
|
980
|
+
export interface Interaction {
|
|
981
|
+
id: string;
|
|
982
|
+
/** What it follows; a fixed position is an empty Object3D placed there */
|
|
983
|
+
object: Object3D;
|
|
984
|
+
label: string | ((object: Object3D, ctx: { actor: string }) => string);
|
|
985
|
+
radius: number;
|
|
986
|
+
action: string;
|
|
987
|
+
onUse?: (object: Object3D, ctx: { actor: string }) => any;
|
|
988
|
+
enabled: (object: Object3D, ctx: { actor: string }) => boolean;
|
|
989
|
+
height?: number;
|
|
990
|
+
hold: number;
|
|
991
|
+
approach: boolean;
|
|
992
|
+
once: boolean;
|
|
993
|
+
counter?: string;
|
|
994
|
+
}
|
|
995
|
+
/** inventory.add: what went in, or why nothing did */
|
|
996
|
+
export interface ItemAddResult {
|
|
997
|
+
ok: boolean;
|
|
998
|
+
/** The entry they went into ('arrow', 'sword#3'); set when ok */
|
|
999
|
+
key?: string;
|
|
1000
|
+
/** How many fit (a partial fit places what fits); set when ok */
|
|
1001
|
+
added?: number;
|
|
1002
|
+
/** 'full' when none fit */
|
|
1003
|
+
code?: 'full';
|
|
1004
|
+
facts?: { id: string; n: number };
|
|
1005
|
+
nextActions?: any[];
|
|
1006
|
+
}
|
|
917
1007
|
export interface InteractionOptions {
|
|
918
1008
|
/** Stable id for the op interaction.use { id } (default: the world record id it was built for, else a running number) */
|
|
919
1009
|
id?: string;
|
|
920
1010
|
/** Prompt text, or a function (object, { actor }) returning text; actor = world record id of who looks at it */
|
|
921
1011
|
label?: string | ((object: Object3D, ctx: { actor: string }) => string);
|
|
922
|
-
/** How close the actor must be (meters),
|
|
1012
|
+
/** How close the actor must be (meters), measured from the object's origin in 3D, not its edge, so a large object (a boat, a house) needs a larger radius or a small marker object at the spot to use. Default interactions({ radius }) = 2.5 */
|
|
923
1013
|
radius?: number;
|
|
924
1014
|
/** Key action name, default 'interact' (E key). Give one object a second verb by adding another interaction with another action */
|
|
925
1015
|
action?: string;
|
|
@@ -942,14 +1032,17 @@ export interface InteractionOptions {
|
|
|
942
1032
|
hold?: number;
|
|
943
1033
|
/** Walk the player there first (walkTo, stops 1.2 m away), then use it; with radius: Infinity it can be used from anywhere (point-and-click) */
|
|
944
1034
|
approach?: boolean;
|
|
1035
|
+
/** Hide the object after a use and allow no second one (onUse returning { ok: false } leaves it). Saved under id, else the object's name; development throws when it has neither */
|
|
1036
|
+
once?: boolean;
|
|
1037
|
+
/** Name of a HUD counter each use adds 1 to (hud.bump; nothing without hud()). Saved; read the total with hud.value(name) */
|
|
1038
|
+
counter?: string;
|
|
945
1039
|
}
|
|
946
1040
|
/** engine.interactions */
|
|
947
1041
|
export interface Interactions {
|
|
948
|
-
|
|
949
|
-
/** How high the prompt floats (meters) */
|
|
1042
|
+
/** How high the prompt floats (meters) @experimental */
|
|
950
1043
|
promptHeight: number;
|
|
951
1044
|
/** All interactions in the order added (a fresh array each read; get(id) finds one without it) */
|
|
952
|
-
readonly items:
|
|
1045
|
+
readonly items: Interaction[];
|
|
953
1046
|
/** Default reach of add() in meters (2.5) */
|
|
954
1047
|
radius: number;
|
|
955
1048
|
/** How the one in front of the actor is chosen; can be changed at runtime */
|
|
@@ -965,8 +1058,8 @@ export interface Interactions {
|
|
|
965
1058
|
* Returns a handle { remove() }
|
|
966
1059
|
*/
|
|
967
1060
|
add(target: Object3D | PositionLike, opts?: InteractionOptions): Handle;
|
|
968
|
-
/** The interaction with this id, or
|
|
969
|
-
get(id: string):
|
|
1061
|
+
/** The interaction with this id, or undefined. Using one is the op: engine.ops.run('interaction.use', { id }) (no id = the one the actor would pick) */
|
|
1062
|
+
get(id: string): Interaction | undefined;
|
|
970
1063
|
}
|
|
971
1064
|
/**
|
|
972
1065
|
* What the 'prompt' UI part receives in update(view) every frame while an interaction is in reach (hide() when none). Call use() on click: it runs the
|
|
@@ -976,10 +1069,10 @@ export interface Interactions {
|
|
|
976
1069
|
export interface PromptView {
|
|
977
1070
|
/** Interaction id */
|
|
978
1071
|
id: string;
|
|
979
|
-
/** Action that uses it ('interact') and its key label ('E') */
|
|
1072
|
+
/** Action that uses it ('interact') and its key label ('E'; 'No key' when the action needs one and has none, '' when it has none on purpose) */
|
|
980
1073
|
action: string;
|
|
981
1074
|
key: string;
|
|
982
|
-
/** The interaction's label, and the default text 'E · label' */
|
|
1075
|
+
/** The interaction's label, and the default text 'E · label' ('label' alone with an empty key) */
|
|
983
1076
|
label: string;
|
|
984
1077
|
text: string;
|
|
985
1078
|
/** Screen pixels above the target */
|
|
@@ -1072,7 +1165,7 @@ export interface BubbleView { speaker: string; text: string; x: number; y: numbe
|
|
|
1072
1165
|
export interface Dialogue {
|
|
1073
1166
|
/** Story state: state.flags is engine.vars.flags (autosaved) */
|
|
1074
1167
|
readonly state: DialogueState;
|
|
1075
|
-
/** All scripts */
|
|
1168
|
+
/** All scripts @experimental */
|
|
1076
1169
|
scripts: Map<string, DialogueScript>;
|
|
1077
1170
|
/**
|
|
1078
1171
|
* The dialogue in progress (null when none). speaker: the script name; node: the current node OBJECT (its fields: text, choices, data...);
|
|
@@ -1080,10 +1173,10 @@ export interface Dialogue {
|
|
|
1080
1173
|
* @example const atAsk = engine.dialogue.active?.id === 'ask'; // the node id; active.node.data holds the node's own fields
|
|
1081
1174
|
*/
|
|
1082
1175
|
readonly active: { speaker: string; nodes: DialogueScript; node?: DialogueNode; id?: string; onEnd: (() => void) | null } | null;
|
|
1083
|
-
/** The script the main dialogue is playing */
|
|
1176
|
+
/** The script the main dialogue is playing @experimental */
|
|
1084
1177
|
readonly speaking: string | null;
|
|
1085
|
-
/** Typing speed (characters/second) */
|
|
1086
|
-
|
|
1178
|
+
/** Typing speed (characters/second) @experimental */
|
|
1179
|
+
charsPerSecond: number;
|
|
1087
1180
|
/** Define a dialogue (the name is usually the speaker) */
|
|
1088
1181
|
define(speaker: string, nodes: DialogueScript): void;
|
|
1089
1182
|
/**
|
|
@@ -1230,7 +1323,7 @@ export interface PickupOptions {
|
|
|
1230
1323
|
name?: string;
|
|
1231
1324
|
/** Shape on the ground: a model name from an asset pack (default the item's model, else 'pickup:<item>', else 'pickup', else a gray box) */
|
|
1232
1325
|
model?: string;
|
|
1233
|
-
/** Color of the gray placeholder / a geometry-only model (default the item's color, else
|
|
1326
|
+
/** Color of the gray placeholder / a geometry-only model (default the item's color, else pickups({ color })) */
|
|
1234
1327
|
color?: ColorLike;
|
|
1235
1328
|
/** Reach in meters, default pickups({ radius }) (2) */
|
|
1236
1329
|
radius?: number;
|
|
@@ -1238,7 +1331,7 @@ export interface PickupOptions {
|
|
|
1238
1331
|
auto?: boolean;
|
|
1239
1332
|
/** The game's own three.js object for this one pickup (only detached when it goes; otherwise the model name decides the shape) */
|
|
1240
1333
|
mesh?: Object3D | null;
|
|
1241
|
-
/**
|
|
1334
|
+
/** Calendar seconds until it reappears, 0 = never reappears */
|
|
1242
1335
|
respawnSeconds?: number;
|
|
1243
1336
|
/** Bob up and down and rotate, default true */
|
|
1244
1337
|
bob?: boolean;
|
|
@@ -1256,6 +1349,16 @@ export interface Pickups {
|
|
|
1256
1349
|
radius: number;
|
|
1257
1350
|
/** Who walks into auto pickups: default engine.actor plus net peers on a host, none on a client */
|
|
1258
1351
|
takers: (e: Engine) => string[];
|
|
1352
|
+
/**
|
|
1353
|
+
* The three.js material of every placeholder box and geometry-only model. Set it to swap all of them at once; used as given. A pickup with its own color or a
|
|
1354
|
+
* vertex-colored geometry draws with a copy of it carrying that color
|
|
1355
|
+
* @example engine.pickups.material = new THREE.MeshStandardMaterial({ color: 0xffd24a, metalness: 0.8 })
|
|
1356
|
+
*/
|
|
1357
|
+
material: Material;
|
|
1358
|
+
/** Edge of the placeholder box (meters), read when one is built */
|
|
1359
|
+
size: number;
|
|
1360
|
+
/** Height above the ground new pickups float at (meters) @experimental */
|
|
1361
|
+
lift: number;
|
|
1259
1362
|
/**
|
|
1260
1363
|
* Place a pickup on the ground at position; its y, if any, is the reference height on multi-layer ground (needs the interactions module unless auto):
|
|
1261
1364
|
* spawn(v, { give: 'berry', count: 2 }). Returns a handle, remove() deletes it
|
|
@@ -1267,10 +1370,16 @@ export interface Pickups {
|
|
|
1267
1370
|
export interface PickupsOptions {
|
|
1268
1371
|
/** Reach of pickups that do not set their own radius (meters), default 2 */
|
|
1269
1372
|
radius?: number;
|
|
1270
|
-
/** Pickups have a model, float and spin only within this distance (meters) of the stream sources, default 60 */
|
|
1373
|
+
/** Pickups have a model, float and spin only within this distance (meters) of the stream sources, default 60 @experimental */
|
|
1271
1374
|
showDistance?: number;
|
|
1272
1375
|
/** Who walks into auto pickups (actor ids); default engine.actor, plus net peers on a host */
|
|
1273
1376
|
takers?: (e: Engine) => string[];
|
|
1377
|
+
/** Color of the placeholder box and geometry-only models when the pickup and its item set none, default 0xcccccc */
|
|
1378
|
+
color?: ColorLike;
|
|
1379
|
+
/** Edge of the placeholder box (meters), default 0.25 */
|
|
1380
|
+
size?: number;
|
|
1381
|
+
/** Height above the ground a pickup floats at (meters), default 0.4 */
|
|
1382
|
+
lift?: number;
|
|
1274
1383
|
}
|
|
1275
1384
|
|
|
1276
1385
|
/**
|
|
@@ -1289,7 +1398,7 @@ export interface Container {
|
|
|
1289
1398
|
/** Whether there are at least n (default 1) */
|
|
1290
1399
|
has(x: string, n?: number): boolean;
|
|
1291
1400
|
/** One entry by key, or null */
|
|
1292
|
-
get(key: string): ItemEntry |
|
|
1401
|
+
get(key: string): ItemEntry | undefined;
|
|
1293
1402
|
/** Slots used */
|
|
1294
1403
|
readonly slotsUsed: number;
|
|
1295
1404
|
/** Total weight */
|
|
@@ -1298,8 +1407,8 @@ export interface Container {
|
|
|
1298
1407
|
list(): ItemEntry[];
|
|
1299
1408
|
/** How many more fit (Infinity = no limit), for an item without data, with this data, or like an existing entry key */
|
|
1300
1409
|
room(x: string, data?: Record<string, any>): number;
|
|
1301
|
-
/** Add n (default 1), optionally with data; returns
|
|
1302
|
-
add(id: string, n?: number, opts?: { data?: Record<string, any>; silent?: boolean }):
|
|
1410
|
+
/** Add n (default 1), optionally with data; returns { ok: true, key, added } (added: how many fit), or { ok: false, code: 'full' } when none fit; silent suppresses the toast (only the bag of engine.actor shows one) */
|
|
1411
|
+
add(id: string, n?: number, opts?: { data?: Record<string, any>; silent?: boolean }): ItemAddResult;
|
|
1303
1412
|
/** Remove n (default 1) of an item or entry key, returns false if there are not enough */
|
|
1304
1413
|
remove(x: string, n?: number): boolean;
|
|
1305
1414
|
/**
|
|
@@ -1319,15 +1428,13 @@ export interface Container {
|
|
|
1319
1428
|
export interface Inventory {
|
|
1320
1429
|
/** true: gameplay freezes while the inventory window is open (set from inventory({ pauseGame }) or at runtime) */
|
|
1321
1430
|
pauseGame: boolean;
|
|
1322
|
-
/**
|
|
1323
|
-
defs: Map<string, ItemDef>;
|
|
1324
|
-
/** Slot limit of the player inventory */
|
|
1431
|
+
/** Slot limit of the player inventory @experimental */
|
|
1325
1432
|
capacity: number;
|
|
1326
|
-
/** Player inventory: the bag of engine.actor (= of()) */
|
|
1433
|
+
/** Player inventory: the bag of engine.actor (= of()) @experimental */
|
|
1327
1434
|
readonly bag: Container;
|
|
1328
1435
|
/** The bag of an actor (default engine.actor): the container with the actor's id, created empty on first use; inside an op pass ctx.actor */
|
|
1329
1436
|
of(actor?: string): Container;
|
|
1330
|
-
defaultStack: number;
|
|
1437
|
+
/** @experimental */ defaultStack: number;
|
|
1331
1438
|
action: string;
|
|
1332
1439
|
/** Define an item (chainable) */
|
|
1333
1440
|
define(id: string, def: ItemDef): this;
|
|
@@ -1337,14 +1444,12 @@ export interface Inventory {
|
|
|
1337
1444
|
count(x: string): number;
|
|
1338
1445
|
/** Whether there are at least n (default 1) */
|
|
1339
1446
|
has(x: string, n?: number): boolean;
|
|
1340
|
-
/** Slots used */
|
|
1341
|
-
readonly slotsUsed: number;
|
|
1342
1447
|
/** Player inventory entries (for custom UI) */
|
|
1343
1448
|
list(): ItemEntry[];
|
|
1344
|
-
/** One player inventory entry by key, or
|
|
1345
|
-
get(key: string): ItemEntry |
|
|
1346
|
-
/** Add n to the player inventory (default 1), opts { data, silent }; returns
|
|
1347
|
-
add(id: string, n?: number, opts?: { data?: Record<string, any>; silent?: boolean }):
|
|
1449
|
+
/** One player inventory entry by key, or undefined */
|
|
1450
|
+
get(key: string): ItemEntry | undefined;
|
|
1451
|
+
/** Add n to the player inventory (default 1), opts { data, silent }; returns { ok: true, key, added }, or { ok: false, code: 'full' } when none fit */
|
|
1452
|
+
add(id: string, n?: number, opts?: { data?: Record<string, any>; silent?: boolean }): ItemAddResult;
|
|
1348
1453
|
/** Remove n (default 1) of an item or entry key, returns false if there are not enough */
|
|
1349
1454
|
remove(x: string, n?: number): boolean;
|
|
1350
1455
|
/**
|
|
@@ -1368,9 +1473,9 @@ export interface Inventory {
|
|
|
1368
1473
|
transfer(from: Container | string, to: Container | string, item: string, n?: number): number;
|
|
1369
1474
|
/** Delete a container together with its contents ('player' cannot be deleted), returns whether one was deleted */
|
|
1370
1475
|
removeContainer(id: string): boolean;
|
|
1371
|
-
/** Every container's items as plain data, the player bag included: { [containerId]: entries } (what setContents takes; net syncs through these two) */
|
|
1476
|
+
/** Every container's items as plain data, the player bag included: { [containerId]: entries } (what setContents takes; net syncs through these two) @experimental */
|
|
1372
1477
|
contents(): Record<string, any[]>;
|
|
1373
|
-
/** Replace containers' items from contents() data, silently like a save load; a null entry empties that container, only: true empties the rest too */
|
|
1478
|
+
/** Replace containers' items from contents() data, silently like a save load; a null entry empties that container, only: true empties the rest too @experimental */
|
|
1374
1479
|
setContents(data: Record<string, any[] | null>, opts?: { only?: boolean }): void;
|
|
1375
1480
|
}
|
|
1376
1481
|
export interface InventoryOptions {
|
|
@@ -1382,7 +1487,7 @@ export interface InventoryOptions {
|
|
|
1382
1487
|
capacity?: number;
|
|
1383
1488
|
/** Weight limit of the player inventory, default Infinity */
|
|
1384
1489
|
maxWeight?: number;
|
|
1385
|
-
/** Default stack limit, default 99 */
|
|
1490
|
+
/** Default stack limit, default 99 @experimental */
|
|
1386
1491
|
defaultStack?: number;
|
|
1387
1492
|
}
|
|
1388
1493
|
|
|
@@ -1426,7 +1531,6 @@ export interface QuestDef {
|
|
|
1426
1531
|
}
|
|
1427
1532
|
/** engine.quests */
|
|
1428
1533
|
export interface Quests {
|
|
1429
|
-
defs: Map<string, QuestDef>;
|
|
1430
1534
|
/** The quest log (UI part 'questLog'): open, toggle(on?), refresh() */
|
|
1431
1535
|
win: { readonly open: boolean; toggle(on?: boolean): void; refresh(): void };
|
|
1432
1536
|
/** Define a quest (chainable) */
|
|
@@ -1437,10 +1541,10 @@ export interface Quests {
|
|
|
1437
1541
|
state(id: string): { step: number; steps: number; done: boolean; failed: boolean; active: boolean } | null;
|
|
1438
1542
|
/** Finish the current step from code (its done() is not asked) and go on; the last step completes the quest. false when not active */
|
|
1439
1543
|
advance(id: string): boolean;
|
|
1440
|
-
isDone(id: string): boolean;
|
|
1544
|
+
/** @experimental */ isDone(id: string): boolean;
|
|
1441
1545
|
/** Started, not done and not failed */
|
|
1442
1546
|
isActive(id: string): boolean;
|
|
1443
|
-
/** Its fail condition held (start(id) begins it again) */
|
|
1547
|
+
/** Its fail condition held (start(id) begins it again) @experimental */
|
|
1444
1548
|
isFailed(id: string): boolean;
|
|
1445
1549
|
/** Check completion conditions once immediately */
|
|
1446
1550
|
check(): void;
|
|
@@ -1472,7 +1576,7 @@ export interface QuestLogView {
|
|
|
1472
1576
|
export interface QuestsOptions {
|
|
1473
1577
|
/** Action name that opens the quest log, default 'quests' */
|
|
1474
1578
|
action?: string;
|
|
1475
|
-
/** Check interval (
|
|
1579
|
+
/** Check interval (real seconds, checked in the fixed step; not checked while frozen / paused), default 0.5 @experimental */
|
|
1476
1580
|
checkInterval?: number;
|
|
1477
1581
|
/**
|
|
1478
1582
|
* Messages on quest start / step / done: true a toast with kind 'quest' (default) · false none · a function to show them your way.
|
|
@@ -1509,7 +1613,7 @@ export interface PhotoTakeOptions {
|
|
|
1509
1613
|
format?: string;
|
|
1510
1614
|
}
|
|
1511
1615
|
export interface PhotoOptions extends PhotoTakeOptions {
|
|
1512
|
-
/** How many photos the album keeps at most, default 50 */
|
|
1616
|
+
/** How many photos the album keeps at most, default 50 @experimental */
|
|
1513
1617
|
maxAlbum?: number;
|
|
1514
1618
|
}
|
|
1515
1619
|
/** engine.photo */
|
|
@@ -1518,10 +1622,12 @@ export interface Photo {
|
|
|
1518
1622
|
album: PhotoShot[];
|
|
1519
1623
|
/** The op photo.take's can: return true, or false / a reason string to refuse (e.g. () => engine.inventory.has('film') || 'noFilm') */
|
|
1520
1624
|
canTake: () => boolean | string;
|
|
1521
|
-
scale: number; shadowMapSize: number; bloom: boolean; quality: number;
|
|
1625
|
+
scale: number; shadowMapSize: number; bloom: boolean; quality: number;
|
|
1626
|
+
/** @experimental */ format: string;
|
|
1627
|
+
/** @experimental */ maxAlbum: number;
|
|
1522
1628
|
/** Capture a photo now without checks. Gameplay takes photos through the op: engine.ops.run('photo.take') (checks canTake, logged) */
|
|
1523
1629
|
take(opts?: PhotoTakeOptions): PhotoShot;
|
|
1524
|
-
/** What is in the middle of the frame (NPC, entity, named object, vegetation), null if nothing; this is the subject of take() */
|
|
1630
|
+
/** What is in the middle of the frame (NPC, entity, named object, vegetation), null if nothing; this is the subject of take() @experimental */
|
|
1525
1631
|
subject(): { name: string; kind: string; distance: number } | null;
|
|
1526
1632
|
}
|
|
1527
1633
|
|
|
@@ -1568,6 +1674,8 @@ export interface WindowOptions {
|
|
|
1568
1674
|
data?: () => any;
|
|
1569
1675
|
/** What to do on the back key (Esc), default closes the window (an open window is on the UI focus stack, and Esc goes only to the topmost) */
|
|
1570
1676
|
onCancel?: () => void;
|
|
1677
|
+
/** false: no close button and Esc does nothing, so only the game's own buttons end it (a win or lose window must not drop the player back into the game). Default true */
|
|
1678
|
+
closable?: boolean;
|
|
1571
1679
|
}
|
|
1572
1680
|
/** An entry of the UI focus stack (returned by uiFocus(engine).push) */
|
|
1573
1681
|
export interface FocusHandle extends Handle {
|
|
@@ -1632,7 +1740,7 @@ export interface Clock {
|
|
|
1632
1740
|
* Call fn after seconds calendar seconds; if an event name is passed, the event is emitted when due (with data, can be saved).
|
|
1633
1741
|
* { channel } counts that time channel's seconds instead (a poison tick that slows down in bullet time)
|
|
1634
1742
|
*/
|
|
1635
|
-
after(seconds: number, fnOrEvent: (() => void) | string,
|
|
1743
|
+
after(seconds: number, fnOrEvent: (() => void) | string, opts?: { data?: any; channel?: string }): Handle;
|
|
1636
1744
|
/** Call once every seconds calendar seconds ({ channel }: 'real' or a time channel's seconds instead) */
|
|
1637
1745
|
every(seconds: number, fn: () => void, opts?: { channel?: string }): Handle;
|
|
1638
1746
|
}
|
|
@@ -1644,7 +1752,7 @@ export interface ModHandle {
|
|
|
1644
1752
|
change(value: any): boolean;
|
|
1645
1753
|
}
|
|
1646
1754
|
/** Shared-point layers, lowest first. Most code never passes one: game code and game modules are 'game'; effects (weather, bullet time) pass 'effect' */
|
|
1647
|
-
export type SharedLayer = 'engine' | '
|
|
1755
|
+
export type SharedLayer = 'engine' | 'game' | 'effect' | 'system' | 'settings' | 'debug';
|
|
1648
1756
|
/**
|
|
1649
1757
|
* engine.mod options: exactly one of set / add / mul / clamp on a number point (set on a value point); none on a hold ('freeze') or a slot;
|
|
1650
1758
|
* value on a 'top' point. Inside a layer: set, then add, then mul, then clamp; a higher layer's set hides what is below. Two owners setting one
|
|
@@ -1672,11 +1780,6 @@ export interface Stack {
|
|
|
1672
1780
|
readonly name: string; readonly kind: 'number' | 'value' | 'any' | 'top' | 'one';
|
|
1673
1781
|
/** The describe().shared row */
|
|
1674
1782
|
row(id?: string): SharedRow;
|
|
1675
|
-
/** Whoever applies this point to a three.js property saw an outside write: stop applying it (check yielded); describe says writer three */
|
|
1676
|
-
yieldToThree(at?: string | null): void;
|
|
1677
|
-
/** Hand a yielded point back to the layers */
|
|
1678
|
-
reclaim(): void;
|
|
1679
|
-
readonly yielded: boolean;
|
|
1680
1783
|
/** The current value, always recomputed from base + the entries now present (a slot: the holder's name or null) */
|
|
1681
1784
|
value(id?: string): any;
|
|
1682
1785
|
holders(id?: string): ModHolder[];
|
|
@@ -1686,7 +1789,7 @@ export interface Stack {
|
|
|
1686
1789
|
/** End owner's entry; false when it held none */
|
|
1687
1790
|
release(owner: string, opts?: { id?: string }): boolean;
|
|
1688
1791
|
}
|
|
1689
|
-
/** engine.stacks: every shared point by name ('time.<channel>', 'time.local', 'clock.rate', 'freeze', '
|
|
1792
|
+
/** engine.stacks: every shared point by name ('time.<channel>', 'time.local', 'clock.rate', 'freeze', 'halt', 'camera', 'debug.view', slots, your own) */
|
|
1690
1793
|
export interface Stacks {
|
|
1691
1794
|
/**
|
|
1692
1795
|
* Define your own point: kind 'number' (default, base 1), 'value' (any data, set only), 'any' (true while held), 'top' (latest holder wins),
|
|
@@ -1704,19 +1807,19 @@ export interface Stacks {
|
|
|
1704
1807
|
}
|
|
1705
1808
|
/** engine.time: time channels (world, player, your own). Speeds change only through engine.mod('time.<channel>', ...) */
|
|
1706
1809
|
export interface Time {
|
|
1707
|
-
/** Define a channel; parent (default 'world') multiplies its speed */
|
|
1810
|
+
/** Define a channel; parent (default 'world') multiplies its speed @experimental */
|
|
1708
1811
|
channel(name: string, opts?: { parent?: string | null; stack?: string }): Time;
|
|
1709
|
-
channels(): string[];
|
|
1812
|
+
/** @experimental */ channels(): string[];
|
|
1710
1813
|
/** Effective speed: parent x the channel's stack (x the record's 'time.local' stack when id is given) */
|
|
1711
1814
|
scale(name: string, id?: string): number;
|
|
1712
|
-
/** Fixed steps run this playthrough: the one time counter
|
|
1815
|
+
/** Fixed steps run this playthrough: the one time counter; every other time is a read-only view of it */
|
|
1713
1816
|
readonly tick: number;
|
|
1714
1817
|
/**
|
|
1715
1818
|
* Seconds on a view: 'real' (tick / 60, no scale, stops while frozen), 'ambient' (= uniforms.uTime, keeps moving while frozen),
|
|
1716
1819
|
* 'calendar' (= engine.clock.now) or a channel ('world', 'player', your own)
|
|
1717
1820
|
*/
|
|
1718
1821
|
now(name: 'real' | 'ambient' | 'calendar' | 'world' | 'player' | (string & {})): number;
|
|
1719
|
-
/** This fixed step's dt on a channel (1/60 x scale). Change a speed with engine.mod('time.<channel>', { owner, set | mul }); timers: engine.clock.after(s, fn, data, { channel }) */
|
|
1822
|
+
/** This fixed step's dt on a channel (1/60 x scale). Change a speed with engine.mod('time.<channel>', { owner, set | mul }); timers: engine.clock.after(s, fn, data, { channel }) @experimental */
|
|
1720
1823
|
dt(name: string, id?: string): number;
|
|
1721
1824
|
}
|
|
1722
1825
|
/** engine.vars: story flags and counters (autosaved) */
|
|
@@ -1727,7 +1830,7 @@ export interface Vars {
|
|
|
1727
1830
|
counters: Record<string, number>;
|
|
1728
1831
|
/** Read a flag */
|
|
1729
1832
|
flag(key: string): any;
|
|
1730
|
-
/** Set a flag (default true) */
|
|
1833
|
+
/** Set a flag (default true) @experimental */
|
|
1731
1834
|
setFlag(key: string, value?: any): void;
|
|
1732
1835
|
/** Read a counter (0 if none) */
|
|
1733
1836
|
counter(key: string): number;
|
|
@@ -1773,12 +1876,14 @@ export interface PropDef {
|
|
|
1773
1876
|
/** Rotation about the Y axis (radians) */
|
|
1774
1877
|
rot?: number;
|
|
1775
1878
|
scale?: number;
|
|
1776
|
-
/** Collision: 'box' cuboid, 'circle' cylinder, false none (default) */
|
|
1777
|
-
collide?: 'box' | 'circle' | false;
|
|
1879
|
+
/** Collision: 'box' cuboid of the bounds, 'circle' cylinder on the model's base, { circle, occluder } the same with its radius in model meters (scales with the prop) and occluder: false so the follow camera passes it; false none (default) */
|
|
1880
|
+
collide?: 'box' | 'circle' | false | { circle: number; occluder?: boolean };
|
|
1778
1881
|
/** Register for ray acceleration (engine.raycast can hit it), default true */
|
|
1779
1882
|
static?: boolean;
|
|
1780
1883
|
/** false: never drawn through engine.batching (default: repeated props batch automatically) */
|
|
1781
1884
|
batch?: boolean;
|
|
1885
|
+
/** true: lower-detail levels far away (`threedog assets optimize --lod`), or rising distances in meters. Collision, rays and saves keep the full model; such a copy is never batched @experimental */
|
|
1886
|
+
lod?: boolean | number[];
|
|
1782
1887
|
}
|
|
1783
1888
|
/** engine.content: loads the plain data of the game's content/*.js into the engine */
|
|
1784
1889
|
export interface Content {
|
|
@@ -1808,7 +1913,7 @@ export interface Content {
|
|
|
1808
1913
|
*/
|
|
1809
1914
|
template(name: string): Readonly<ContentTemplate>;
|
|
1810
1915
|
/**
|
|
1811
|
-
* The fields one content entry may have (core/params.js spec format): what an editor panel lists and what content-check validates against.
|
|
1916
|
+
* The fields one content entry may have (core/base/params.js spec format): what an editor panel lists and what content-check validates against.
|
|
1812
1917
|
* name: a template name (placement fields plus its state fields, default = the value in state), an engine entry shape ('props', 'props.template',
|
|
1813
1918
|
* 'props.grid', 'pickups', 'views'), a game kind that declares fields (content/rules.js kinds), or a world record id. Unknown names throw.
|
|
1814
1919
|
* @example engine.content.fields('crop').stage // { type: 'int', optional: true, default: 0, min: 0, max: 4 }
|
|
@@ -1822,10 +1927,10 @@ export interface Content {
|
|
|
1822
1927
|
*/
|
|
1823
1928
|
spawn(name: string, at: any, fields?: { id?: string; rot?: number; scale?: number; y?: number; items?: Record<string, number>; [stateField: string]: any }): WorldRecord;
|
|
1824
1929
|
}
|
|
1825
|
-
/** One stage of a template with stages: a named step it stays in for duration
|
|
1930
|
+
/** One stage of a template with stages: a named step it stays in for duration calendar seconds (clock.now), e.g. seed -> sprout -> ripe, cold -> armed */
|
|
1826
1931
|
export interface ContentTemplateStage {
|
|
1827
1932
|
name: string;
|
|
1828
|
-
/**
|
|
1933
|
+
/** Calendar seconds spent in this stage; only the last stage may leave it out (it stays there) */
|
|
1829
1934
|
duration?: number;
|
|
1830
1935
|
/** Multiplies the instance's scale while in this stage */
|
|
1831
1936
|
scale?: number;
|
|
@@ -1834,7 +1939,7 @@ export interface ContentTemplateStage {
|
|
|
1834
1939
|
}
|
|
1835
1940
|
/** template:stage event: a template instance entered a new stage by growing (several stages crossed at once give one event) */
|
|
1836
1941
|
export interface TemplateStageEvent { id: string; template: string; stage: number; name: string }
|
|
1837
|
-
/** One field of a content entry (engine.content.fields): the core/params.js spec as plain data */
|
|
1942
|
+
/** One field of a content entry (engine.content.fields): the core/base/params.js spec as plain data */
|
|
1838
1943
|
export interface ContentField {
|
|
1839
1944
|
type: 'string' | 'number' | 'int' | 'bool' | 'position' | 'id' | 'any' | 'object' | 'array' | 'function';
|
|
1840
1945
|
optional?: boolean;
|
|
@@ -1849,10 +1954,12 @@ export interface ContentField {
|
|
|
1849
1954
|
export interface ContentTemplate {
|
|
1850
1955
|
/** Model name (style generator or assets name); every instance clones one shared prototype */
|
|
1851
1956
|
model: string | any[];
|
|
1852
|
-
/** Collision box
|
|
1853
|
-
collide?: 'box' | 'circle';
|
|
1957
|
+
/** Collision: 'box' cuboid of the bounds, 'circle' cylinder on the model's base, { circle, occluder } the same with its radius in model meters (scales with the instance) and occluder: false so the follow camera passes it; omitted or false = does not block */
|
|
1958
|
+
collide?: 'box' | 'circle' | false | { circle: number; occluder?: boolean };
|
|
1854
1959
|
/** false = not registered for rays */
|
|
1855
1960
|
static?: boolean;
|
|
1961
|
+
/** true: lower-detail levels far away (`threedog assets optimize --lod`), or rising distances in meters; such copies are never batched @experimental */
|
|
1962
|
+
lod?: boolean | number[];
|
|
1856
1963
|
/** Interaction: using an instance runs op with { id } */
|
|
1857
1964
|
interact?: { op: string; label?: string | ((rec: WorldRecord, e: Engine) => string); radius?: number; height?: number; action?: string; enabled?: (rec: WorldRecord, e: Engine) => boolean };
|
|
1858
1965
|
/** Each instance gets a container with its record id; items = starting goods (placed once) */
|
|
@@ -1916,7 +2023,7 @@ export interface FlowTransitionOptions {
|
|
|
1916
2023
|
export interface Flow {
|
|
1917
2024
|
/** Current state name */
|
|
1918
2025
|
state: string;
|
|
1919
|
-
/** A scene transition is in progress */
|
|
2026
|
+
/** A scene transition is in progress @experimental */
|
|
1920
2027
|
readonly transitioning: boolean;
|
|
1921
2028
|
/** Define a state (built-in 'playing', 'paused') */
|
|
1922
2029
|
define(name: string, def: FlowStateDef): this;
|
|
@@ -1983,8 +2090,12 @@ export interface Hud {
|
|
|
1983
2090
|
markers: HudMarker[];
|
|
1984
2091
|
/** Add an objective marker: target is an object, position or place name */
|
|
1985
2092
|
marker(target: HudTarget, opts?: HudMarkerOptions): HudMarker;
|
|
1986
|
-
/** Counter or text status (calling again with the same id = update; calling every frame is fine): counter('fish', { label: '鱼', value: 2, max: 5 }), counter('clock', { value: '08:30' }); no value = the label alone */
|
|
2093
|
+
/** Counter or text status (calling again with the same id = update; calling every frame is fine): counter('fish', { label: '鱼', value: 2, max: 5 }), counter('clock', { value: '08:30' }); no value = the label alone, no label = the value alone (the id is not shown) */
|
|
1987
2094
|
counter(id: string, opts: { label?: string; icon?: string; value?: number | string; max?: number; anchor?: HudAnchor }): void;
|
|
2095
|
+
/** Add n (default 1) to a number counter, return the new value; one not declared yet starts at 0 with its id as the label */
|
|
2096
|
+
bump(id: string, n?: number): number;
|
|
2097
|
+
/** Current value of a counter or bar (number or text), undefined when there is none; reads what interactions.add({ counter }) has added up */
|
|
2098
|
+
value(id: string): number | string | undefined;
|
|
1988
2099
|
/** Progress bar (calling again with the same id = update; calling every frame is fine, the DOM is untouched when the value is unchanged),
|
|
1989
2100
|
* value/max 0–max */
|
|
1990
2101
|
bar(id: string, opts: { value: number; max?: number; label?: string; anchor?: HudAnchor }): void;
|