threedog 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/core/Animator.js +267 -0
- package/core/Assets.js +240 -0
- package/core/Audio.js +267 -0
- package/core/Baked.js +72 -0
- package/core/Batching.js +247 -0
- package/core/Budget.js +221 -0
- package/core/Clock.js +94 -0
- package/core/Commits.js +77 -0
- package/core/Describe.js +134 -0
- package/core/Engine.js +221 -0
- package/core/Events.js +95 -0
- package/core/I18n.js +94 -0
- package/core/Input.js +245 -0
- package/core/Inspect.js +97 -0
- package/core/InspectScene.js +187 -0
- package/core/Jobs.js +146 -0
- package/core/Loading.js +149 -0
- package/core/Ops.js +272 -0
- package/core/Random.js +52 -0
- package/core/Rays.js +160 -0
- package/core/SaveStore.js +85 -0
- package/core/Saves.js +253 -0
- package/core/Stream.js +279 -0
- package/core/Threads.js +158 -0
- package/core/UrlState.js +93 -0
- package/core/Vars.js +34 -0
- package/core/actor.js +23 -0
- package/core/assetEntry.js +89 -0
- package/core/assetLoad.js +190 -0
- package/core/assetManifest.js +35 -0
- package/core/audioRules.js +121 -0
- package/core/audioVoice.js +225 -0
- package/core/batchGroups.js +116 -0
- package/core/canvasBox.js +63 -0
- package/core/dayTime.js +15 -0
- package/core/describeText.js +136 -0
- package/core/easing.js +34 -0
- package/core/errorCodes.js +172 -0
- package/core/errorHints.js +203 -0
- package/core/errors.js +40 -0
- package/core/events.generated.js +84 -0
- package/core/ground.js +102 -0
- package/core/inputContext.js +69 -0
- package/core/inputDefaults.js +22 -0
- package/core/inputPad.js +35 -0
- package/core/inputPointer.js +48 -0
- package/core/inputTouch.js +48 -0
- package/core/lifecycle.js +68 -0
- package/core/lightWatch.js +36 -0
- package/core/loop.js +199 -0
- package/core/math.js +33 -0
- package/core/modules.js +182 -0
- package/core/movement.js +19 -0
- package/core/mulberry32.js +14 -0
- package/core/opsCheck.js +86 -0
- package/core/opsGuard.js +26 -0
- package/core/opsHistory.js +27 -0
- package/core/page.js +78 -0
- package/core/pureWorker.js +5 -0
- package/core/saveApply.js +128 -0
- package/core/saveFiles.js +139 -0
- package/core/saveIds.js +53 -0
- package/core/saveVersions.js +97 -0
- package/core/scatter.js +92 -0
- package/core/sceneMethods.js +125 -0
- package/core/screenToGround.js +39 -0
- package/core/session.js +171 -0
- package/core/shadowTypes.js +15 -0
- package/core/skip.js +104 -0
- package/core/startup.js +133 -0
- package/core/streamCells.js +24 -0
- package/core/streamSources.js +73 -0
- package/core/styleParts.js +96 -0
- package/core/targeting.js +64 -0
- package/core/thingOps.js +157 -0
- package/core/things.js +198 -0
- package/core/threadPure.js +120 -0
- package/core/threadServe.js +25 -0
- package/core/tier.js +11 -0
- package/core/validate.js +188 -0
- package/docs/AI.md +149 -0
- package/docs/API.md +84 -0
- package/docs/CODEMAP.md +335 -0
- package/docs/COMMANDS.md +96 -0
- package/docs/CONVENTIONS.md +134 -0
- package/docs/PERF.md +217 -0
- package/docs/THREE.md +86 -0
- package/docs/api/ambience.md +15 -0
- package/docs/api/assets.md +60 -0
- package/docs/api/audio.md +53 -0
- package/docs/api/budget.md +40 -0
- package/docs/api/cameraRig.md +120 -0
- package/docs/api/characters.md +142 -0
- package/docs/api/clock.md +7 -0
- package/docs/api/collision.md +35 -0
- package/docs/api/content.md +63 -0
- package/docs/api/debug.md +10 -0
- package/docs/api/dialogue.md +39 -0
- package/docs/api/engine.md +190 -0
- package/docs/api/entities.md +61 -0
- package/docs/api/events.md +91 -0
- package/docs/api/flow.md +27 -0
- package/docs/api/grids.md +11 -0
- package/docs/api/ground.md +16 -0
- package/docs/api/hlod.md +34 -0
- package/docs/api/hud.md +31 -0
- package/docs/api/i18n.md +10 -0
- package/docs/api/input.md +24 -0
- package/docs/api/interactions.md +31 -0
- package/docs/api/inventory.md +66 -0
- package/docs/api/jobs.md +10 -0
- package/docs/api/level.md +41 -0
- package/docs/api/lightPool.md +56 -0
- package/docs/api/music.md +34 -0
- package/docs/api/nav.md +26 -0
- package/docs/api/net.md +14 -0
- package/docs/api/openWorld.md +24 -0
- package/docs/api/particles.md +41 -0
- package/docs/api/photo.md +15 -0
- package/docs/api/post.md +9 -0
- package/docs/api/quests.md +36 -0
- package/docs/api/rays.md +26 -0
- package/docs/api/rigid.md +84 -0
- package/docs/api/saves.md +31 -0
- package/docs/api/settings.md +36 -0
- package/docs/api/sky.md +58 -0
- package/docs/api/stream.md +31 -0
- package/docs/api/style.md +134 -0
- package/docs/api/terrain.md +34 -0
- package/docs/api/timeline.md +39 -0
- package/docs/api/tools.md +55 -0
- package/docs/api/triggers.md +56 -0
- package/docs/api/vars.md +9 -0
- package/docs/api/vegetation.md +52 -0
- package/docs/api/water.md +48 -0
- package/docs/api/weather.md +29 -0
- package/docs/api/world.md +30 -0
- package/docs/recipes/01-new-game.md +148 -0
- package/docs/recipes/02-npc.md +151 -0
- package/docs/recipes/03-items-pickups.md +158 -0
- package/docs/recipes/04-quests.md +83 -0
- package/docs/recipes/05-props-bake.md +159 -0
- package/docs/recipes/06-clock-events.md +104 -0
- package/docs/recipes/07-flow-scenes-pause.md +128 -0
- package/docs/recipes/08-weather-sky.md +74 -0
- package/docs/recipes/09-style-pack.md +234 -0
- package/docs/recipes/10-blender-level.md +67 -0
- package/docs/recipes/11-vehicles.md +55 -0
- package/docs/recipes/12-navmesh.md +57 -0
- package/docs/recipes/13-animation.md +146 -0
- package/docs/recipes/14-custom-module.md +91 -0
- package/docs/recipes/15-perf.md +78 -0
- package/docs/recipes/16-dev-bridge.md +146 -0
- package/docs/recipes/18-world.md +185 -0
- package/docs/recipes/19-shooting-picking.md +76 -0
- package/docs/recipes/20-content-actions-save.md +176 -0
- package/docs/recipes/21-camera.md +104 -0
- package/docs/recipes/22-shop-gold.md +107 -0
- package/docs/recipes/23-ops.md +139 -0
- package/docs/recipes/26-ui-parts.md +138 -0
- package/docs/recipes/27-net.md +96 -0
- package/docs/recipes/28-terrain.md +80 -0
- package/docs/recipes/29-grid.md +87 -0
- package/docs/recipes/30-templates.md +131 -0
- package/docs/recipes/31-audio.md +126 -0
- package/docs/recipes/32-action-game.md +33 -0
- package/docs/recipes/33-stream-sources.md +37 -0
- package/docs/recipes/34-environment-lighting.md +35 -0
- package/docs/recipes/35-style-from-reference.md +89 -0
- package/docs/recipes/36-sky-ground-plant-looks.md +116 -0
- package/docs/recipes/37-terrain-look-hooks.md +97 -0
- package/docs/recipes/38-environment-look-hooks.md +81 -0
- package/docs/recipes/40-scene.md +79 -0
- package/docs/recipes/41-thing-registry.md +64 -0
- package/docs/recipes/42-terrain-shape.md +64 -0
- package/docs/recipes/43-shader-patches-surface-looks.md +118 -0
- package/docs/recipes/44-water-weather-look-hooks.md +133 -0
- package/docs/recipes/45-cascaded-shadows.md +51 -0
- package/docs/recipes/46-blender-art-route.md +92 -0
- package/docs/recipes/47-island-snow-backdrop.md +44 -0
- package/examples/action/DESIGN.md +3 -0
- package/examples/action/GAMEMAP.md +127 -0
- package/examples/action/content/actions.js +8 -0
- package/examples/action/content/audio.js +9 -0
- package/examples/action/content/index.js +9 -0
- package/examples/action/content/items.js +4 -0
- package/examples/action/content/places.js +4 -0
- package/examples/action/content/props.js +11 -0
- package/examples/action/content/templates.js +10 -0
- package/examples/action/look.js +5 -0
- package/examples/action/main.js +137 -0
- package/examples/action/models.js +25 -0
- package/examples/sheepisland/GAMEMAP.md +108 -0
- package/examples/sheepisland/content/index.js +6 -0
- package/examples/sheepisland/content/props.js +19 -0
- package/examples/sheepisland/content/templates.js +5 -0
- package/examples/sheepisland/content/vegetation.js +8 -0
- package/examples/sheepisland/main.js +71 -0
- package/examples/sheepisland/params.js +25 -0
- package/examples/sheepisland/style/index.js +79 -0
- package/examples/sheepisland/style/models.js +59 -0
- package/examples/sheepisland/views.js +9 -0
- package/examples/styletest/GAMEMAP.md +135 -0
- package/examples/styletest/content/index.js +9 -0
- package/examples/styletest/content/items.js +8 -0
- package/examples/styletest/content/npcs.js +8 -0
- package/examples/styletest/content/places.js +5 -0
- package/examples/styletest/content/props.js +16 -0
- package/examples/styletest/content/templates.js +9 -0
- package/examples/styletest/content/vegetation.js +31 -0
- package/examples/styletest/look.js +11 -0
- package/examples/styletest/main.js +95 -0
- package/examples/styletest/models.js +87 -0
- package/examples/styletest/overrides.js +33 -0
- package/examples/styletest/panel.js +135 -0
- package/examples/styletest/params.js +32 -0
- package/examples/styletest/views.js +31 -0
- package/examples/world/DESIGN.md +5 -0
- package/examples/world/GAMEMAP.md +171 -0
- package/examples/world/content/actions.js +8 -0
- package/examples/world/content/audio.js +25 -0
- package/examples/world/content/bodies.js +12 -0
- package/examples/world/content/containers.js +4 -0
- package/examples/world/content/dialogues.js +33 -0
- package/examples/world/content/index.js +17 -0
- package/examples/world/content/items.js +10 -0
- package/examples/world/content/npcs.js +14 -0
- package/examples/world/content/pickups.js +11 -0
- package/examples/world/content/places.js +6 -0
- package/examples/world/content/props.js +12 -0
- package/examples/world/content/quests.js +15 -0
- package/examples/world/content/rules.js +23 -0
- package/examples/world/content/templates.js +5 -0
- package/examples/world/content/vegetation.js +32 -0
- package/examples/world/main.js +168 -0
- package/examples/world/models.js +28 -0
- package/index.d.ts +279 -0
- package/index.js +120 -0
- package/llms.txt +56 -0
- package/modules/ambience/Ambience.js +183 -0
- package/modules/camera/FirstPersonCamera.js +133 -0
- package/modules/camera/FixedCamera.js +155 -0
- package/modules/camera/FollowCamera.js +85 -0
- package/modules/camera/RtsCamera.js +134 -0
- package/modules/camera/common.js +152 -0
- package/modules/camera/index.js +11 -0
- package/modules/characters/Character.js +223 -0
- package/modules/characters/NPC.js +242 -0
- package/modules/characters/assetModel.js +42 -0
- package/modules/characters/astar.js +59 -0
- package/modules/characters/behaviors.js +72 -0
- package/modules/characters/footsteps.js +13 -0
- package/modules/characters/index.js +212 -0
- package/modules/characters/moveHelpers.js +29 -0
- package/modules/characters/movers/common.js +62 -0
- package/modules/characters/movers/rapier.js +74 -0
- package/modules/characters/movers/simple.js +38 -0
- package/modules/characters/npcAvoid.js +129 -0
- package/modules/characters/npcSim.js +144 -0
- package/modules/characters/npcView.js +42 -0
- package/modules/characters/pathAsync.js +107 -0
- package/modules/characters/pathJob.js +61 -0
- package/modules/characters/pathWorker.js +7 -0
- package/modules/characters/playerStrings.js +12 -0
- package/modules/characters/proceduralRig.js +54 -0
- package/modules/collision/Collision.js +176 -0
- package/modules/collision/grid.js +63 -0
- package/modules/content/ids.js +95 -0
- package/modules/content/index.js +152 -0
- package/modules/content/loader.js +187 -0
- package/modules/content/models.js +69 -0
- package/modules/content/packs.js +69 -0
- package/modules/content/props.js +89 -0
- package/modules/content/rules.js +133 -0
- package/modules/content/templates.js +189 -0
- package/modules/debug/DebugPanel.js +168 -0
- package/modules/entities/Entities.js +239 -0
- package/modules/entities/build.js +25 -0
- package/modules/entities/index.js +4 -0
- package/modules/flow/index.js +98 -0
- package/modules/gameplay/Container.js +227 -0
- package/modules/gameplay/Containers.js +89 -0
- package/modules/gameplay/Dialogue.js +216 -0
- package/modules/gameplay/Interactions.js +243 -0
- package/modules/gameplay/Inventory.js +214 -0
- package/modules/gameplay/Quests.js +195 -0
- package/modules/gameplay/boxOps.js +60 -0
- package/modules/gameplay/dialogueBox.js +48 -0
- package/modules/gameplay/interactionPrompt.js +28 -0
- package/modules/gameplay/inventoryOps.js +137 -0
- package/modules/gameplay/pickups.js +113 -0
- package/modules/gameplay/questLog.js +54 -0
- package/modules/gameplay/questSave.js +71 -0
- package/modules/grid/Grid.js +184 -0
- package/modules/grid/Layer.js +142 -0
- package/modules/grid/index.js +236 -0
- package/modules/grid/ops.js +73 -0
- package/modules/grid/preview.js +85 -0
- package/modules/grid/tiles.js +75 -0
- package/modules/hlod/index.js +164 -0
- package/modules/hud/index.js +164 -0
- package/modules/hud/parts.js +80 -0
- package/modules/level/geometry.js +46 -0
- package/modules/level/heightfield.js +160 -0
- package/modules/level/index.js +231 -0
- package/modules/level/nodes.js +84 -0
- package/modules/lights/index.js +224 -0
- package/modules/music/Music.js +290 -0
- package/modules/music/index.js +2 -0
- package/modules/music/rules.js +28 -0
- package/modules/nav/index.js +154 -0
- package/modules/nav/navPath.js +17 -0
- package/modules/net/Client.js +136 -0
- package/modules/net/Host.js +117 -0
- package/modules/net/Net.js +49 -0
- package/modules/net/index.js +75 -0
- package/modules/net/sync.js +114 -0
- package/modules/net/transports.js +118 -0
- package/modules/particles/Particles.js +179 -0
- package/modules/particles/effect.js +112 -0
- package/modules/particles/shaders.js +28 -0
- package/modules/photo/Photo.js +143 -0
- package/modules/rigid/RigidBodies.js +262 -0
- package/modules/rigid/Vehicles.js +97 -0
- package/modules/rigid/sync.js +158 -0
- package/modules/settings/Settings.js +294 -0
- package/modules/settings/apply.js +20 -0
- package/modules/settings/index.js +3 -0
- package/modules/settings/sections.js +156 -0
- package/modules/settings/strings.js +53 -0
- package/modules/settings/view.js +65 -0
- package/modules/sky/Sky.js +257 -0
- package/modules/sky/calendar.js +80 -0
- package/modules/sky/cascades.js +125 -0
- package/modules/sky/clouds.js +79 -0
- package/modules/sky/domeLayers.js +33 -0
- package/modules/sky/environment.js +115 -0
- package/modules/sky/fog.js +136 -0
- package/modules/sky/frame.js +76 -0
- package/modules/sky/layers.js +69 -0
- package/modules/sky/look.js +50 -0
- package/modules/sky/schedule.js +80 -0
- package/modules/sky/shader.js +96 -0
- package/modules/sky/shadow.js +80 -0
- package/modules/sky/skyModule.js +59 -0
- package/modules/terrain/ChunkManager.js +291 -0
- package/modules/terrain/chunkJob.js +19 -0
- package/modules/terrain/chunkQueries.js +42 -0
- package/modules/terrain/chunkWorker.js +5 -0
- package/modules/terrain/index.js +110 -0
- package/modules/terrain/mountTerrain.js +32 -0
- package/modules/terrain/terrainColorMap.js +41 -0
- package/modules/terrain/terrainDefaults.js +39 -0
- package/modules/terrain/terrainEdit.js +139 -0
- package/modules/terrain/terrainGen.js +155 -0
- package/modules/terrain/terrainIsland.js +131 -0
- package/modules/terrain/terrainMesh.js +92 -0
- package/modules/terrain/terrainShape.js +108 -0
- package/modules/terrain/terrainShapeMain.js +41 -0
- package/modules/terrain/terrainTexture.js +44 -0
- package/modules/timeline/Timeline.js +249 -0
- package/modules/timeline/Tween.js +118 -0
- package/modules/timeline/letterbox.js +24 -0
- package/modules/timeline/shots.js +88 -0
- package/modules/triggers/index.js +261 -0
- package/modules/vegetation/Vegetation.js +255 -0
- package/modules/vegetation/groundChunks.js +177 -0
- package/modules/vegetation/index.js +40 -0
- package/modules/vegetation/modelGeometry.js +21 -0
- package/modules/water/Water.js +144 -0
- package/modules/water/surface.js +88 -0
- package/modules/weather/Weather.js +251 -0
- package/modules/weather/particles.js +92 -0
- package/modules/weather/shaders.js +49 -0
- package/modules/world/World.js +231 -0
- package/modules/world/cells.js +42 -0
- package/modules/world/index.js +64 -0
- package/modules/world/persist.js +107 -0
- package/modules/world/pos.js +20 -0
- package/modules/world/records.js +89 -0
- package/modules/world/sim.js +175 -0
- package/modules/world/simFar.js +82 -0
- package/modules/world/state.js +115 -0
- package/modules/world/views.js +182 -0
- package/package.json +66 -4
- package/presets.js +96 -0
- package/render/PostFX.js +243 -0
- package/render/detail.js +105 -0
- package/render/effects.js +142 -0
- package/render/engineUniforms.js +23 -0
- package/render/fuse.js +72 -0
- package/render/lighting.js +100 -0
- package/render/lights.js +16 -0
- package/render/materials.js +203 -0
- package/render/patches.js +252 -0
- package/render/surface.js +67 -0
- package/render/uniformDecl.js +29 -0
- package/types/common.d.ts +34 -0
- package/types/core.d.ts +1773 -0
- package/types/gameplay.d.ts +1812 -0
- package/types/generated/core/Audio.d.ts +200 -0
- package/types/generated/core/Batching.d.ts +47 -0
- package/types/generated/core/Budget.d.ts +90 -0
- package/types/generated/core/Commits.d.ts +31 -0
- package/types/generated/core/Events.d.ts +46 -0
- package/types/generated/core/I18n.d.ts +30 -0
- package/types/generated/core/Input.d.ts +118 -0
- package/types/generated/core/Jobs.d.ts +41 -0
- package/types/generated/core/Ops.d.ts +162 -0
- package/types/generated/core/Random.d.ts +49 -0
- package/types/generated/core/Rays.d.ts +49 -0
- package/types/generated/core/Saves.d.ts +161 -0
- package/types/generated/core/Stream.d.ts +93 -0
- package/types/generated/core/Threads.d.ts +82 -0
- package/types/generated/core/audioVoice.d.ts +47 -0
- package/types/generated/core/page.d.ts +18 -0
- package/types/generated/core/session.d.ts +48 -0
- package/types/generated/modules/ambience/Ambience.d.ts +48 -0
- package/types/generated/modules/debug/DebugPanel.d.ts +24 -0
- package/types/generated/modules/flow/index.d.ts +10 -0
- package/types/generated/modules/grid/Grid.d.ts +151 -0
- package/types/generated/modules/grid/Layer.d.ts +64 -0
- package/types/generated/modules/grid/index.d.ts +86 -0
- package/types/generated/modules/hlod/index.d.ts +11 -0
- package/types/generated/modules/hud/index.d.ts +10 -0
- package/types/generated/modules/lights/index.d.ts +13 -0
- package/types/generated/modules/music/Music.d.ts +111 -0
- package/types/generated/modules/net/Net.d.ts +34 -0
- package/types/generated/modules/net/index.d.ts +53 -0
- package/types/generated/modules/net/transports.d.ts +58 -0
- package/types/generated/modules/particles/Particles.d.ts +69 -0
- package/types/generated/modules/sky/Sky.d.ts +152 -0
- package/types/generated/modules/sky/skyModule.d.ts +10 -0
- package/types/generated/modules/timeline/Timeline.d.ts +51 -0
- package/types/generated/modules/water/Water.d.ts +29 -0
- package/types/generated/modules/weather/Weather.d.ts +72 -0
- package/types/generated/modules/world/World.d.ts +242 -0
- package/types/generated/modules/world/index.d.ts +15 -0
- package/types/generated/render/PostFX.d.ts +128 -0
- package/types/generated/render/materials.d.ts +90 -0
- package/types/generated/render/patches.d.ts +41 -0
- package/types/generated/ui/Focus.d.ts +11 -0
- package/types/generated/ui/LoadingScreen.d.ts +2 -0
- package/types/generated/ui/UI.d.ts +57 -0
- package/types/nav.d.ts +52 -0
- package/types/physics.d.ts +584 -0
- package/types/style.d.ts +628 -0
- package/types/worker.d.ts +11 -0
- package/types/world.d.ts +772 -0
- package/ui/Focus.js +51 -0
- package/ui/LoadingScreen.js +42 -0
- package/ui/Parts.js +195 -0
- package/ui/UI.js +167 -0
- package/ui/defaults.js +85 -0
- package/ui/theme.js +124 -0
- package/ui/touchPart.js +49 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/net/index.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Optional co-op multiplayer: one host owns the state, clients mirror it and ask for changes through ops. Installed as engine.net.
|
|
4
|
+
* Host: peers' requests run as `ops.run(name, args, { source: 'net', actor })` only for ops defined with net: 'peer', with the op's args shape
|
|
5
|
+
* checked, the optional owner check, and a per-peer rate limit; the result comes back after the state diff that contains it.
|
|
6
|
+
* State: world records, containers, vars and the other save parts are sent as a snapshot on join and as diffs every syncEvery steps.
|
|
7
|
+
* Client: ops.run of a peer op returns { ok: true, pending: true, seq } (watch state or the net:result event, not the return value);
|
|
8
|
+
* its own avatar moves locally and is sent to the host (clamped to maxSpeed); other avatars glide between updates.
|
|
9
|
+
* Defaults per peer on the host (avatar: true): a world record { id: actor, kind: 'player' } (not saved) and a container with the actor id.
|
|
10
|
+
* @param {{ role: 'host' | 'client', transport: any, sync?: 'auto' | string[], syncEvery?: number, keepAlive?: number, rate?: number, burst?: number, maxSpeed?: number, posEvery?: number,
|
|
11
|
+
* actorFor?: (peerId: number) => string, actorFields?: string[], avatarFields?: string[], interpolate?: string[], avatar?: boolean,
|
|
12
|
+
* onJoin?: (e: any, peer: { id: number, actor: string }) => void, onLeave?: (e: any, peer: { id: number, actor: string }) => void }} opts
|
|
13
|
+
* sync: save parts to sync ('auto' = world, containers, vars and every other save part except random / level); syncEvery: steps between diffs (3 = 20/s);
|
|
14
|
+
* rate / burst: op requests per second per peer and the burst allowance; actorFields: record fields holding actor ids (swapped like ids, default ['owner']);
|
|
15
|
+
* avatarFields: own-avatar fields the client sends with its position; interpolate: record kinds that glide on clients (default ['player']).
|
|
16
|
+
* @returns {import('../../../core').ModuleDef<Net>}
|
|
17
|
+
* @example
|
|
18
|
+
* // host
|
|
19
|
+
* engine.ops.define('chest.take', { net: 'peer', args: { chest: 'id', item: 'string' },
|
|
20
|
+
* can: (e, a, ctx) => e.inventory.container(a.chest).has(a.item) || 'empty',
|
|
21
|
+
* run: (e, a, ctx) => e.inventory.transfer(a.chest, ctx.actor, a.item, 1) });
|
|
22
|
+
* engine.use(net({ role: 'host', transport: webSocket('ws://localhost:8787/farm', { host: true }) }));
|
|
23
|
+
* // client (same game code, same op definitions)
|
|
24
|
+
* engine.use(net({ role: 'client', transport: webSocket('ws://192.168.1.5:8787/farm') }));
|
|
25
|
+
* engine.ops.run('chest.take', { chest: 'chest-1', item: 'apple' }); // -> { ok: true, pending: true, seq: 1 }
|
|
26
|
+
* @experimental
|
|
27
|
+
*/
|
|
28
|
+
export function net(opts?: {
|
|
29
|
+
role: "host" | "client";
|
|
30
|
+
transport: any;
|
|
31
|
+
sync?: "auto" | string[];
|
|
32
|
+
syncEvery?: number;
|
|
33
|
+
keepAlive?: number;
|
|
34
|
+
rate?: number;
|
|
35
|
+
burst?: number;
|
|
36
|
+
maxSpeed?: number;
|
|
37
|
+
posEvery?: number;
|
|
38
|
+
actorFor?: (peerId: number) => string;
|
|
39
|
+
actorFields?: string[];
|
|
40
|
+
avatarFields?: string[];
|
|
41
|
+
interpolate?: string[];
|
|
42
|
+
avatar?: boolean;
|
|
43
|
+
onJoin?: (e: any, peer: {
|
|
44
|
+
id: number;
|
|
45
|
+
actor: string;
|
|
46
|
+
}) => void;
|
|
47
|
+
onLeave?: (e: any, peer: {
|
|
48
|
+
id: number;
|
|
49
|
+
actor: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
}): import("../../../core").ModuleDef<Net>;
|
|
52
|
+
import { Net } from './Net.js';
|
|
53
|
+
export { fakeNetwork, webSocket } from "./transports.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/net/transports.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* An in-process network for tests and offline demos: one host and any number of clients in the same page, with optional latency, jitter and loss.
|
|
4
|
+
* Messages are deep-copied on send (no shared objects, like a real wire). Order per link is kept, as on a WebSocket.
|
|
5
|
+
* manual: true delivers only when you call advance(ms) (deterministic tests); otherwise messages land after real time.
|
|
6
|
+
* @param {{ latency?: number, jitter?: number, loss?: number, seed?: number, manual?: boolean }} [opts] latency / jitter in ms, loss 0..1
|
|
7
|
+
* @returns {{ host(): any, connect(opts?: { key?: string }): any, advance(ms: number): void, readonly now: number, loss: number, latency: number, jitter: number }}
|
|
8
|
+
* @example
|
|
9
|
+
* const wire = fakeNetwork({ latency: 80, jitter: 30, loss: 0.05, manual: true });
|
|
10
|
+
* host.use(net({ role: 'host', transport: wire.host() }));
|
|
11
|
+
* guest.use(net({ role: 'client', transport: wire.connect() }));
|
|
12
|
+
* wire.advance(100); // deliver what is due in the next 100 ms
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
15
|
+
export function fakeNetwork(opts?: {
|
|
16
|
+
latency?: number;
|
|
17
|
+
jitter?: number;
|
|
18
|
+
loss?: number;
|
|
19
|
+
seed?: number;
|
|
20
|
+
manual?: boolean;
|
|
21
|
+
}): {
|
|
22
|
+
host(): any;
|
|
23
|
+
connect(opts?: {
|
|
24
|
+
key?: string;
|
|
25
|
+
}): any;
|
|
26
|
+
advance(ms: number): void;
|
|
27
|
+
readonly now: number;
|
|
28
|
+
loss: number;
|
|
29
|
+
latency: number;
|
|
30
|
+
jitter: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* WebSocket transport: talks to the relay in packages/tools/net-relay.mjs (`node packages/tools/net-relay.mjs 8787`).
|
|
34
|
+
* The host joins a room with host: true; clients join the same room. The relay assigns peer ids and remembers each client's key for reconnects.
|
|
35
|
+
* Messages are JSON. For a dedicated server or Colyseus, write another transport with the same send / on / close shape instead.
|
|
36
|
+
* @param {string} url e.g. 'ws://localhost:8787/my-room'
|
|
37
|
+
* @param {{ host?: boolean, key?: string }} [opts] key: reuse a previous peer id after a reconnect (read transport.key after 'open')
|
|
38
|
+
* @returns {{ send(msg: any, to?: number): void, on(type: string, fn: Function): { remove(): void }, close(): void, key: string | null, id: number | null }}
|
|
39
|
+
* @example
|
|
40
|
+
* engine.use(net({ role: 'host', transport: webSocket('ws://localhost:8787/farm', { host: true }) }));
|
|
41
|
+
* // on a friend's machine
|
|
42
|
+
* const t = webSocket('ws://192.168.1.5:8787/farm', { key: localStorage.netKey });
|
|
43
|
+
* t.on('open', () => { localStorage.netKey = t.key; });
|
|
44
|
+
* engine.use(net({ role: 'client', transport: t }));
|
|
45
|
+
* @experimental
|
|
46
|
+
*/
|
|
47
|
+
export function webSocket(url: string, { host, key }?: {
|
|
48
|
+
host?: boolean;
|
|
49
|
+
key?: string;
|
|
50
|
+
}): {
|
|
51
|
+
send(msg: any, to?: number): void;
|
|
52
|
+
on(type: string, fn: Function): {
|
|
53
|
+
remove(): void;
|
|
54
|
+
};
|
|
55
|
+
close(): void;
|
|
56
|
+
key: string | null;
|
|
57
|
+
id: number | null;
|
|
58
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/particles/Particles.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Particles -> engine.particles
|
|
4
|
+
* @returns {ModuleDef<Particles>}
|
|
5
|
+
*/
|
|
6
|
+
export function particles(): ModuleDef<Particles>;
|
|
7
|
+
/** @import { ModuleDef } from '../../../core' */
|
|
8
|
+
/** @import { Object3D, PositionLike } from '../../../common' */
|
|
9
|
+
/** @import { ParticleEffect, ParticleEmitter, ParticleOptions } from '../../../gameplay' */
|
|
10
|
+
/** engine.particles */
|
|
11
|
+
export class Particles {
|
|
12
|
+
/** Defined effects @type {Map<string, ParticleEffect>} */
|
|
13
|
+
effects: Map<string, ParticleEffect>;
|
|
14
|
+
/**
|
|
15
|
+
* Define an effect (same name replaces it, and emitters attached to it move to the new definition); params sit on top of the style
|
|
16
|
+
* pack preset. Returns the effect object: .points is its THREE.Points, .material is the shader material
|
|
17
|
+
* @param {string} name
|
|
18
|
+
* @param {ParticleOptions} [opts]
|
|
19
|
+
* @returns {ParticleEffect}
|
|
20
|
+
*/
|
|
21
|
+
define(name: string, opts?: ParticleOptions): ParticleEffect;
|
|
22
|
+
/**
|
|
23
|
+
* Whether this effect has been defined
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
has(name: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Burst: emit count particles at once (default 10) at position (Vector3 / Object3D / [x, y, z] / {x, y, z}). overrides affect this batch only (color, speed, direction...; max/texture/blending cannot be changed temporarily)
|
|
30
|
+
* @param {string} name
|
|
31
|
+
* @param {PositionLike} position
|
|
32
|
+
* @param {{ count?: number, overrides?: ParticleOptions | null }} [opts]
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
emit(name: string, position: PositionLike, opts?: {
|
|
36
|
+
count?: number;
|
|
37
|
+
overrides?: ParticleOptions | null;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Keep emitting while following an object: rate per second, offset in the object's local coordinates [x, y, z] (meters). Returns a handle { remove(), rate, active } (active = false pauses)
|
|
41
|
+
* @param {string} name
|
|
42
|
+
* @param {Object3D} object3d
|
|
43
|
+
* @param {{ rate?: number, offset?: number[], overrides?: ParticleOptions | null }} [opts]
|
|
44
|
+
* @returns {ParticleEmitter}
|
|
45
|
+
*/
|
|
46
|
+
attach(name: string, object3d: THREE.Object3D, opts?: {
|
|
47
|
+
rate?: number;
|
|
48
|
+
offset?: number[];
|
|
49
|
+
overrides?: ParticleOptions | null;
|
|
50
|
+
}): ParticleEmitter;
|
|
51
|
+
/**
|
|
52
|
+
* Live particle count (no name = all)
|
|
53
|
+
* @param {string} [name]
|
|
54
|
+
* @returns {number}
|
|
55
|
+
*/
|
|
56
|
+
count(name?: string): number;
|
|
57
|
+
/**
|
|
58
|
+
* Clear one effect's (or all) particles
|
|
59
|
+
* @param {string} [name]
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
clear(name?: string): void;
|
|
63
|
+
}
|
|
64
|
+
import type { ModuleDef } from '../../../core';
|
|
65
|
+
import type { ParticleEffect } from '../../../gameplay';
|
|
66
|
+
import * as THREE from 'three';
|
|
67
|
+
import type { ParticleOptions } from '../../../gameplay';
|
|
68
|
+
import type { PositionLike } from '../../../common';
|
|
69
|
+
import type { ParticleEmitter } from '../../../gameplay';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/sky/Sky.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.sky */
|
|
3
|
+
export class Sky {
|
|
4
|
+
/**
|
|
5
|
+
* Sky time of day: 0-1 (0 midnight, 0.25 6am, 0.5 noon, 0.75 6pm); one day = dayLength game seconds (the unit of engine.clock.now). Fixed-step seconds
|
|
6
|
+
* (unaffected by timeScale) are engine.elapsed @type {number}
|
|
7
|
+
*/
|
|
8
|
+
timeOfDay: number;
|
|
9
|
+
/**
|
|
10
|
+
* Game seconds per day (1 sky hour = dayLength / 24 game seconds; at timeScale 1 game seconds equal fixed-step seconds); Infinity = the time of day never
|
|
11
|
+
* moves @type {number}
|
|
12
|
+
*/
|
|
13
|
+
dayLength: number;
|
|
14
|
+
/** Day number (1-based) @type {number} */
|
|
15
|
+
day: number;
|
|
16
|
+
/** Days per season for seasons given by name only @type {number} */
|
|
17
|
+
daysPerSeason: number;
|
|
18
|
+
/** Season names, [] when the game has no seasons (the default) @type {string[]} */
|
|
19
|
+
seasons: string[];
|
|
20
|
+
/** Dome mesh @type {Object3D} */
|
|
21
|
+
dome: THREE.Object3D;
|
|
22
|
+
/** Hemisphere ambient light (engine.lights.hemi, driven by the sky) @type {any} */
|
|
23
|
+
hemi: any;
|
|
24
|
+
/** Sun directional light (engine.lights.sun driven by the sky; moonlight at night, shadows live on it) @type {any} */
|
|
25
|
+
sun: any;
|
|
26
|
+
/** Sun direction (unit vector toward the sun) @type {Vector3} */
|
|
27
|
+
sunDir: THREE.Vector3;
|
|
28
|
+
/**
|
|
29
|
+
* Sun orbit: tilt = north-south tilt, sway = east-west swing, distance = light distance (meters) @type {{ tilt: number, sway: number, distance: number }}
|
|
30
|
+
*/
|
|
31
|
+
orbit: {
|
|
32
|
+
tilt: number;
|
|
33
|
+
sway: number;
|
|
34
|
+
distance: number;
|
|
35
|
+
};
|
|
36
|
+
/** Current shadow params (change via setShadow) @readonly @type {SkyShadowParams} */
|
|
37
|
+
readonly shadow: SkyShadowParams;
|
|
38
|
+
/** three's CSM (addons/csm) while shadow.cascades > 1, else null; its lights[0] is sun (recipes/45) @type {any} */
|
|
39
|
+
csm: any;
|
|
40
|
+
/** Hours per day @type {number} */
|
|
41
|
+
hoursPerDay: number;
|
|
42
|
+
/** Composite of all modifier layers (read-only; use modify to adjust brightness) @readonly @type {SkyModifiers} */
|
|
43
|
+
readonly modifiers: SkyModifiers;
|
|
44
|
+
/**
|
|
45
|
+
* Write a modifier layer (only the given fields; unwritten fields have no effect); values null removes the layer. Weather uses the 'weather' layer, games use
|
|
46
|
+
* their own layer name.
|
|
47
|
+
* Layers composite every frame: sun / ambient / fog multiply; tint blends weighted by tintAmount; flash takes the max
|
|
48
|
+
* @example engine.sky.modify('cave', { sun: 0.3, ambient: 0.4 }); engine.sky.modify('cave', null);
|
|
49
|
+
* @param {string} owner
|
|
50
|
+
* @param {SkyLayer | null} values
|
|
51
|
+
* @returns {this}
|
|
52
|
+
*/
|
|
53
|
+
modify(owner: string, values: SkyLayer | null): this;
|
|
54
|
+
/**
|
|
55
|
+
* Shadow resolution (pixels)
|
|
56
|
+
* @returns {number}
|
|
57
|
+
*/
|
|
58
|
+
get shadowMapSize(): number;
|
|
59
|
+
/** Clock text, e.g. "18:00" */
|
|
60
|
+
get clock(): string;
|
|
61
|
+
/** Sun elevation -1 (midnight) ... 0 (horizon) ... 1 (noon). Day/night is computed only here; other modules read isDay / daylight */
|
|
62
|
+
get sunHeight(): number;
|
|
63
|
+
/** Whether it is daytime (sun above the horizon) */
|
|
64
|
+
get isDay(): boolean;
|
|
65
|
+
/** Daylight amount 0-1 (0 at night, 1 at noon); ambience etc. fade by it */
|
|
66
|
+
get daylight(): number;
|
|
67
|
+
/** Current season index, -1 without seasons */
|
|
68
|
+
get seasonIndex(): number;
|
|
69
|
+
/** Current season name, e.g. 'spring'; null without seasons @type {string | null} */
|
|
70
|
+
get season(): string | null;
|
|
71
|
+
/** Day within the season (1-based); 0 without seasons */
|
|
72
|
+
get dayOfSeason(): number;
|
|
73
|
+
/** Fraction of the season elapsed, 0-1 (includes time of day); 0 without seasons */
|
|
74
|
+
get seasonProgress(): number;
|
|
75
|
+
/** Total game time in days (fractional), for growth, cooldowns and the like */
|
|
76
|
+
get totalDays(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Call fn every day at a clock time: at('18:00', fn) or at(0.75, fn).
|
|
79
|
+
* Fires only when time moves forward across the clock time: natural flow, step fast-forward and setting timeOfDay later all count;
|
|
80
|
+
* crossing several triggers at once is replayed per catchUp; rewinding time and loading a save do not fire, they only reset the baseline.
|
|
81
|
+
* To hold a state during a time range (lights, shop door) use between
|
|
82
|
+
* @param {string | number} clock 'HH:MM' or 0-1
|
|
83
|
+
* @param {(day: number) => void} fn
|
|
84
|
+
* @param {SkyAtOptions} [opts]
|
|
85
|
+
* @returns {Handle}
|
|
86
|
+
*/
|
|
87
|
+
at(clock: string | number, fn: (day: number) => void, opts?: SkyAtOptions): Handle;
|
|
88
|
+
/**
|
|
89
|
+
* Time-range switch: on() while clock time is in [from, to), otherwise off() (from > to wraps midnight).
|
|
90
|
+
* Aligns once immediately on registration, new game, load, applying a scenario and time rewind; afterwards it calls on/off when crossing a boundary
|
|
91
|
+
* @example engine.sky.between('18:00', '06:00', { on: () => lamp.on(), off: () => lamp.off() })
|
|
92
|
+
* @param {string | number} from
|
|
93
|
+
* @param {string | number} to
|
|
94
|
+
* @param {SkyBetweenOptions} opts
|
|
95
|
+
* @returns {Handle}
|
|
96
|
+
*/
|
|
97
|
+
between(from: string | number, to: string | number, opts: SkyBetweenOptions): Handle;
|
|
98
|
+
/**
|
|
99
|
+
* Call fn(day) at the start of each day (00:00)
|
|
100
|
+
* @param {(day: number) => void} fn
|
|
101
|
+
* @param {SkyAtOptions} [opts]
|
|
102
|
+
* @returns {Handle}
|
|
103
|
+
*/
|
|
104
|
+
daily(fn: (day: number) => void, opts?: SkyAtOptions): Handle;
|
|
105
|
+
/**
|
|
106
|
+
* Call fn(seasonName) on entering season name
|
|
107
|
+
* @param {string} name
|
|
108
|
+
* @param {(season: string) => void} fn
|
|
109
|
+
* @returns {Handle}
|
|
110
|
+
*/
|
|
111
|
+
onSeason(name: string, fn: (season: string) => void): Handle;
|
|
112
|
+
/**
|
|
113
|
+
* Change shadow params (only the given fields): bias / normalBias prevent banding; updateEvery updates shadows every N frames (1 = every frame);
|
|
114
|
+
* snap snap = shadow center snap grid (meters, or 'texel' to snap to shadow pixels); ahead = meters to shift the shadow center in front of the view;
|
|
115
|
+
* type = 'basic' (hard edge) | 'pcf' | 'vsm' (soft, costlier; switching rebuilds the shadow map and recompiles materials, so do it rarely);
|
|
116
|
+
* radius = edge softness (pcf, vsm; no effect on basic); blurSamples = blur quality (vsm only); cascades 2-4 = cascaded shadows, 1 = off (recipes/45)
|
|
117
|
+
* @param {Partial<SkyShadowParams>} [opts]
|
|
118
|
+
* @returns {this}
|
|
119
|
+
*/
|
|
120
|
+
setShadow(opts?: Partial<SkyShadowParams>): this;
|
|
121
|
+
/**
|
|
122
|
+
* Change shadow resolution (raise temporarily for photo mode)
|
|
123
|
+
* @param {number} n pixels
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
setShadowMapSize(n: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* Environment lighting (scene.environment), separate from the background and off by default. source 'sky' builds it from the procedural sky (rebuilt at
|
|
129
|
+
* most every `interval` seconds, only when the sky changed); an asset name or path (.hdr, .jpg, .ktx2) is an equirectangular panorama. intensity scales
|
|
130
|
+
* the light (default 1), rotation turns it around Y (radians). Given fields change, the rest stay; null turns it off. Lambert surfaces get soft ambient
|
|
131
|
+
* light from it (no reflections); lower the hemisphere ambient when you turn it on (recipes/09)
|
|
132
|
+
* @example engine.sky.setEnvironment({ source: 'sky', intensity: 0.8 }); engine.sky.setEnvironment(null);
|
|
133
|
+
* @param {{ source?: string | null, intensity?: number, rotation?: number, interval?: number } | null} [opts]
|
|
134
|
+
* @returns {this}
|
|
135
|
+
*/
|
|
136
|
+
setEnvironment(opts?: {
|
|
137
|
+
source?: string | null;
|
|
138
|
+
intensity?: number;
|
|
139
|
+
rotation?: number;
|
|
140
|
+
interval?: number;
|
|
141
|
+
} | null): this;
|
|
142
|
+
/** Environment lighting now: { source, intensity, rotation, interval, builds }, null when off @type {SkyEnvironmentInfo | null} */
|
|
143
|
+
get environment(): SkyEnvironmentInfo | null;
|
|
144
|
+
}
|
|
145
|
+
import * as THREE from 'three';
|
|
146
|
+
import type { SkyShadowParams } from '../../../style';
|
|
147
|
+
import type { SkyModifiers } from '../../../world';
|
|
148
|
+
import type { SkyLayer } from '../../../world';
|
|
149
|
+
import type { SkyAtOptions } from '../../../world';
|
|
150
|
+
import type { Handle } from '../../../common';
|
|
151
|
+
import type { SkyBetweenOptions } from '../../../world';
|
|
152
|
+
import type { SkyEnvironmentInfo } from '../../../world';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/sky/skyModule.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Sky, day/night, calendar -> engine.sky
|
|
4
|
+
* @param {SkyOptions} [opts]
|
|
5
|
+
* @returns {ModuleDef<Sky>}
|
|
6
|
+
*/
|
|
7
|
+
export function sky(opts?: SkyOptions): ModuleDef<Sky>;
|
|
8
|
+
import type { SkyOptions } from '../../../world';
|
|
9
|
+
import { Sky } from './Sky.js';
|
|
10
|
+
import type { ModuleDef } from '../../../core';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/timeline/Timeline.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Timeline (cutscenes, tweens) -> engine.timeline.
|
|
4
|
+
* timeline({ skipKeys: ['Escape', 'Backspace'] })(timeline({ skipKeys: ['Escape', 'Backspace'] }) (Esc is the back key, dispatched by the UI focus stack)
|
|
5
|
+
* Optional dependency: dialogue (say step). The camera module cooperates with engine.cameraOverride automatically.
|
|
6
|
+
* @param {TimelineOptions} [opts]
|
|
7
|
+
* @returns {ModuleDef<Timeline>}
|
|
8
|
+
*/
|
|
9
|
+
export function timeline(opts?: TimelineOptions): ModuleDef<Timeline>;
|
|
10
|
+
/** engine.timeline */
|
|
11
|
+
export class Timeline {
|
|
12
|
+
/** Skip every cutscene immediately (set by scenario param cutscene=skip) @type {boolean} */
|
|
13
|
+
skipAll: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a cutscene is playing
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
get playing(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* General tween (the only entry point for tweens in the engine): await engine.timeline.tween(mesh, { 'position.y': 2 }, 1, 'outCubic'); duration in seconds.
|
|
21
|
+
* Returns a Promise (with finish()/cancel())
|
|
22
|
+
* @param {any} target
|
|
23
|
+
* @param {TweenTo} to
|
|
24
|
+
* @param {number} [duration]
|
|
25
|
+
* @param {Ease} [ease]
|
|
26
|
+
* @returns {TweenPromise}
|
|
27
|
+
*/
|
|
28
|
+
tween(target: any, to: TweenTo, duration?: number, ease?: Ease): TweenPromise;
|
|
29
|
+
/**
|
|
30
|
+
* Play a timeline; resolves with { skipped } when it ends
|
|
31
|
+
* @param {TimelineStep | TimelineStep[]} steps
|
|
32
|
+
* @param {TimelinePlayOptions} [opts]
|
|
33
|
+
* @returns {Promise<{ skipped: boolean }>}
|
|
34
|
+
*/
|
|
35
|
+
play(steps: TimelineStep | TimelineStep[], opts?: TimelinePlayOptions): Promise<{
|
|
36
|
+
skipped: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Skip all (or one) playing timelines
|
|
40
|
+
* @param {any} [run]
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
skip(run?: any): void;
|
|
44
|
+
}
|
|
45
|
+
import type { TimelineOptions } from '../../../gameplay';
|
|
46
|
+
import type { ModuleDef } from '../../../core';
|
|
47
|
+
import type { TweenTo } from '../../../gameplay';
|
|
48
|
+
import type { Ease } from '../../../common';
|
|
49
|
+
import type { TweenPromise } from '../../../gameplay';
|
|
50
|
+
import type { TimelineStep } from '../../../gameplay';
|
|
51
|
+
import type { TimelinePlayOptions } from '../../../gameplay';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/water/Water.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Water → engine.water. Global level defaults to the terrain water level; independent bodies use engine.addWaterBody()
|
|
4
|
+
* @param {WaterOptions} [opts]
|
|
5
|
+
* @returns {ModuleDef<Water>}
|
|
6
|
+
*/
|
|
7
|
+
export function water(opts?: WaterOptions): ModuleDef<Water>;
|
|
8
|
+
/** engine.water */
|
|
9
|
+
export class Water {
|
|
10
|
+
/**
|
|
11
|
+
* Water material (shared by all water)
|
|
12
|
+
* @type {Material}
|
|
13
|
+
*/
|
|
14
|
+
material: THREE.Material;
|
|
15
|
+
/**
|
|
16
|
+
* Water body → mesh
|
|
17
|
+
* @type {Map<WaterBody, THREE.Mesh>}
|
|
18
|
+
*/
|
|
19
|
+
bodies: Map<WaterBody, THREE.Mesh>;
|
|
20
|
+
/**
|
|
21
|
+
* Global water mesh (null when absent)
|
|
22
|
+
* @type {THREE.Mesh | null}
|
|
23
|
+
*/
|
|
24
|
+
sea: THREE.Mesh | null;
|
|
25
|
+
}
|
|
26
|
+
import type { WaterOptions } from '../../../world';
|
|
27
|
+
import type { ModuleDef } from '../../../core';
|
|
28
|
+
import * as THREE from 'three';
|
|
29
|
+
import type { WaterBody } from '../../../world';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/modules/weather/Weather.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/**
|
|
3
|
+
* Weather → engine.weather (install sky first)
|
|
4
|
+
* @param {WeatherOptions} [opts]
|
|
5
|
+
* @returns {ModuleDef<Weather>}
|
|
6
|
+
*/
|
|
7
|
+
export function weather(opts?: WeatherOptions): ModuleDef<Weather>;
|
|
8
|
+
/** engine.weather */
|
|
9
|
+
export class Weather {
|
|
10
|
+
/**
|
|
11
|
+
* The weather types this game has: name -> numbers (the standard fields plus any of the game's own, all blended on change) @type {Record<string,
|
|
12
|
+
* WeatherPreset>}
|
|
13
|
+
*/
|
|
14
|
+
types: Record<string, WeatherPreset>;
|
|
15
|
+
/** Current (mid-transition) weather parameters @type {WeatherPreset} */
|
|
16
|
+
current: WeatherPreset;
|
|
17
|
+
/** Current weather name @type {string} */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Automatic weather on/off @type {boolean} */
|
|
20
|
+
auto: boolean;
|
|
21
|
+
/** Candidates for automatic weather (repeat a name to make it likelier) @type {string[]} */
|
|
22
|
+
autoPool: string[];
|
|
23
|
+
/** Automatic weather interval [min, max] seconds @type {number[]} */
|
|
24
|
+
autoInterval: number[];
|
|
25
|
+
/** Transition seconds for automatic weather @type {number} */
|
|
26
|
+
autoTransition: number;
|
|
27
|
+
/** Default particle count per system (halved on low-tier devices) @type {number} */
|
|
28
|
+
particles: number;
|
|
29
|
+
/** Particle systems drawn now: field -> { field, object, uniforms } (rain / snow when the table has them, plus define()) @type {Map<string, any>} */
|
|
30
|
+
systems: Map<string, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Draw particles for a field of this game's weather table (its amount is weather.current[field], so they fade with the weather). spec takes the
|
|
33
|
+
* keys of style.weather.rain (shape, color, size, speed, sway, density, glsl...) or create(engine, { area, count }) => { object, update } for a
|
|
34
|
+
* system of your own. The same field again replaces it, rain and snow included. See recipes/44-water-weather-look-hooks.md
|
|
35
|
+
* @example
|
|
36
|
+
* engine.weather.define('ash', { shape: 'soft', color: 0x555555, size: 14, speed: 0.8, sway: 3 }); // types: { ashfall: { ash: 1, grey: 0.5 } }
|
|
37
|
+
* @param {string} field
|
|
38
|
+
* @param {import('../../../style').StyleWeatherParticles} [spec]
|
|
39
|
+
* @returns {{ field: string, object: THREE.Object3D, uniforms: Record<string, { value: any }> | null }}
|
|
40
|
+
*/
|
|
41
|
+
define(field: string, spec?: import("../../../style").StyleWeatherParticles): {
|
|
42
|
+
field: string;
|
|
43
|
+
object: THREE.Object3D;
|
|
44
|
+
uniforms: Record<string, {
|
|
45
|
+
value: any;
|
|
46
|
+
}> | null;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Automatic weather on/off
|
|
50
|
+
* @param {boolean} on
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
setAuto(on: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Switch weather. seconds: transition seconds, default 15
|
|
56
|
+
* @param {WeatherName} name
|
|
57
|
+
* @param {number} [seconds]
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
set(name: WeatherName, seconds?: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Display name of a weather (string table weather.<name>, falls back to the name itself); defaults to the current weather
|
|
63
|
+
* @param {string} [name]
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
label(name?: string): string;
|
|
67
|
+
}
|
|
68
|
+
import type { WeatherOptions } from '../../../world';
|
|
69
|
+
import type { ModuleDef } from '../../../core';
|
|
70
|
+
import type { WeatherPreset } from '../../../world';
|
|
71
|
+
import * as THREE from 'three';
|
|
72
|
+
import type { WeatherName } from '../../../world';
|