@zylem/game-lib 0.4.1 → 0.5.1
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/README.md +23 -41
- package/dist/actions.d.ts +25 -0
- package/dist/actions.js +287 -8
- package/dist/actions.js.map +1 -0
- package/dist/behaviors.d.ts +108 -0
- package/dist/behaviors.js +396 -6
- package/dist/behaviors.js.map +1 -0
- package/dist/{lib/camera/zylem-camera.d.ts → camera-Dk-fOVZE.d.ts} +55 -8
- package/dist/camera.d.ts +5 -0
- package/dist/camera.js +504 -4
- package/dist/camera.js.map +1 -0
- package/dist/core-C2mjetAd.d.ts +431 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +4780 -9
- package/dist/core.js.map +1 -0
- package/dist/entities.d.ts +269 -0
- package/dist/entities.js +2161 -17
- package/dist/entities.js.map +1 -0
- package/dist/entity-bQElAdpo.d.ts +347 -0
- package/dist/entity-spawner-DNnLYnZq.d.ts +11 -0
- package/dist/main.d.ts +135 -0
- package/dist/main.js +6599 -56
- package/dist/main.js.map +1 -0
- package/dist/moveable-B_vyA6cw.d.ts +67 -0
- package/dist/stage-CrmY7V0i.d.ts +287 -0
- package/dist/stage.d.ts +26 -0
- package/dist/stage.js +2229 -15
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +12 -42
- package/LICENSE +0 -21
- package/dist/.vite/manifest.json +0 -676
- package/dist/api/actions.d.ts +0 -5
- package/dist/api/actions.d.ts.map +0 -1
- package/dist/api/behaviors.d.ts +0 -4
- package/dist/api/behaviors.d.ts.map +0 -1
- package/dist/api/camera.d.ts +0 -4
- package/dist/api/camera.d.ts.map +0 -1
- package/dist/api/core.d.ts +0 -6
- package/dist/api/core.d.ts.map +0 -1
- package/dist/api/entities.d.ts +0 -9
- package/dist/api/entities.d.ts.map +0 -1
- package/dist/api/main.d.ts +0 -32
- package/dist/api/main.d.ts.map +0 -1
- package/dist/api/stage.d.ts +0 -6
- package/dist/api/stage.d.ts.map +0 -1
- package/dist/assets/zylem-logo.png +0 -0
- package/dist/lib/actions/behaviors/actions.d.ts +0 -11
- package/dist/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.js +0 -35
- package/dist/lib/actions/behaviors/behavior.d.ts +0 -6
- package/dist/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
- package/dist/lib/actions/behaviors/character-controller.d.ts +0 -6
- package/dist/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug.d.ts +0 -10
- package/dist/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -11
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.d.ts +0 -125
- package/dist/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.js +0 -108
- package/dist/lib/actions/capabilities/rotatable.d.ts +0 -111
- package/dist/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/rotatable.js +0 -82
- package/dist/lib/actions/capabilities/transformable.d.ts +0 -7
- package/dist/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/transformable.js +0 -9
- package/dist/lib/actions/global-change.d.ts +0 -23
- package/dist/lib/actions/global-change.d.ts.map +0 -1
- package/dist/lib/actions/global-change.js +0 -40
- package/dist/lib/camera/camera.d.ts +0 -16
- package/dist/lib/camera/camera.d.ts.map +0 -1
- package/dist/lib/camera/camera.js +0 -19
- package/dist/lib/camera/fixed-2d.d.ts +0 -32
- package/dist/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/lib/camera/fixed-2d.js +0 -30
- package/dist/lib/camera/perspective.d.ts +0 -9
- package/dist/lib/camera/perspective.d.ts.map +0 -1
- package/dist/lib/camera/perspective.js +0 -10
- package/dist/lib/camera/third-person.d.ts +0 -32
- package/dist/lib/camera/third-person.d.ts.map +0 -1
- package/dist/lib/camera/third-person.js +0 -42
- package/dist/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/lib/camera/zylem-camera.js +0 -208
- package/dist/lib/collision/collision-builder.d.ts +0 -17
- package/dist/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/lib/collision/collision-builder.js +0 -46
- package/dist/lib/collision/collision-delegate.d.ts +0 -6
- package/dist/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/lib/collision/collision-delegate.js +0 -6
- package/dist/lib/collision/collision-group.d.ts +0 -11
- package/dist/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/lib/collision/collision-mask.d.ts +0 -18
- package/dist/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/lib/collision/collision.d.ts +0 -19
- package/dist/lib/collision/collision.d.ts.map +0 -1
- package/dist/lib/collision/utils.d.ts +0 -15
- package/dist/lib/collision/utils.d.ts.map +0 -1
- package/dist/lib/collision/utils.js +0 -24
- package/dist/lib/collision/world.d.ts +0 -23
- package/dist/lib/collision/world.d.ts.map +0 -1
- package/dist/lib/collision/world.js +0 -77
- package/dist/lib/core/asset-manager.d.ts +0 -2
- package/dist/lib/core/asset-manager.d.ts.map +0 -1
- package/dist/lib/core/base-node-life-cycle.d.ts +0 -68
- package/dist/lib/core/base-node-life-cycle.d.ts.map +0 -1
- package/dist/lib/core/base-node.d.ts +0 -37
- package/dist/lib/core/base-node.d.ts.map +0 -1
- package/dist/lib/core/base-node.js +0 -62
- package/dist/lib/core/entity-asset-loader.d.ts +0 -16
- package/dist/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/lib/core/entity-asset-loader.js +0 -54
- package/dist/lib/core/errors.d.ts +0 -5
- package/dist/lib/core/errors.d.ts.map +0 -1
- package/dist/lib/core/flags.d.ts +0 -3
- package/dist/lib/core/flags.d.ts.map +0 -1
- package/dist/lib/core/index.d.ts +0 -5
- package/dist/lib/core/index.d.ts.map +0 -1
- package/dist/lib/core/lazy-loader.d.ts +0 -80
- package/dist/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.d.ts +0 -17
- package/dist/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.js +0 -20
- package/dist/lib/core/preset-shader.d.ts +0 -8
- package/dist/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/lib/core/preset-shader.js +0 -26
- package/dist/lib/core/three-addons/Timer.d.ts +0 -92
- package/dist/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/lib/core/three-addons/Timer.js +0 -103
- package/dist/lib/core/utility/nodes.d.ts +0 -13
- package/dist/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/lib/core/utility/nodes.js +0 -31
- package/dist/lib/core/utility/strings.d.ts +0 -3
- package/dist/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/lib/core/utility/strings.js +0 -14
- package/dist/lib/core/utility/vector.d.ts +0 -8
- package/dist/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/lib/core/utility/vector.js +0 -8
- package/dist/lib/core/vector.d.ts +0 -4
- package/dist/lib/core/vector.d.ts.map +0 -1
- package/dist/lib/core/vessel.d.ts +0 -13
- package/dist/lib/core/vessel.d.ts.map +0 -1
- package/dist/lib/core/vessel.js +0 -26
- package/dist/lib/debug/console/console-state.d.ts +0 -20
- package/dist/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/lib/debug/console/console-state.js +0 -11
- package/dist/lib/debug/console/console-store.d.ts +0 -6
- package/dist/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.d.ts +0 -38
- package/dist/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.js +0 -40
- package/dist/lib/debug/debug-store.d.ts +0 -15
- package/dist/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/lib/debug/state-based-debug-loader.d.ts +0 -8
- package/dist/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.d.ts +0 -38
- package/dist/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.js +0 -44
- package/dist/lib/device/desktop.d.ts +0 -2
- package/dist/lib/device/desktop.d.ts.map +0 -1
- package/dist/lib/device/mobile.d.ts +0 -2
- package/dist/lib/device/mobile.d.ts.map +0 -1
- package/dist/lib/device/tablet.d.ts +0 -2
- package/dist/lib/device/tablet.d.ts.map +0 -1
- package/dist/lib/entities/actor.d.ts +0 -44
- package/dist/lib/entities/actor.d.ts.map +0 -1
- package/dist/lib/entities/actor.js +0 -122
- package/dist/lib/entities/box.d.ts +0 -27
- package/dist/lib/entities/box.d.ts.map +0 -1
- package/dist/lib/entities/box.js +0 -68
- package/dist/lib/entities/builder.d.ts +0 -28
- package/dist/lib/entities/builder.d.ts.map +0 -1
- package/dist/lib/entities/builder.js +0 -79
- package/dist/lib/entities/create.d.ts +0 -15
- package/dist/lib/entities/create.d.ts.map +0 -1
- package/dist/lib/entities/create.js +0 -31
- package/dist/lib/entities/delegates/animation.d.ts +0 -33
- package/dist/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/lib/entities/delegates/animation.js +0 -58
- package/dist/lib/entities/delegates/debug.d.ts +0 -29
- package/dist/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/lib/entities/delegates/debug.js +0 -71
- package/dist/lib/entities/delegates/loader.d.ts +0 -12
- package/dist/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/lib/entities/delegates/loader.js +0 -19
- package/dist/lib/entities/destroy.d.ts +0 -4
- package/dist/lib/entities/destroy.d.ts.map +0 -1
- package/dist/lib/entities/destroy.js +0 -15
- package/dist/lib/entities/entity.d.ts +0 -96
- package/dist/lib/entities/entity.d.ts.map +0 -1
- package/dist/lib/entities/entity.js +0 -120
- package/dist/lib/entities/index.d.ts +0 -12
- package/dist/lib/entities/index.d.ts.map +0 -1
- package/dist/lib/entities/plane.d.ts +0 -36
- package/dist/lib/entities/plane.d.ts.map +0 -1
- package/dist/lib/entities/plane.js +0 -81
- package/dist/lib/entities/rect.d.ts +0 -63
- package/dist/lib/entities/rect.d.ts.map +0 -1
- package/dist/lib/entities/rect.js +0 -160
- package/dist/lib/entities/sphere.d.ts +0 -29
- package/dist/lib/entities/sphere.d.ts.map +0 -1
- package/dist/lib/entities/sphere.js +0 -68
- package/dist/lib/entities/sprite.d.ts +0 -53
- package/dist/lib/entities/sprite.d.ts.map +0 -1
- package/dist/lib/entities/sprite.js +0 -118
- package/dist/lib/entities/text.d.ts +0 -49
- package/dist/lib/entities/text.d.ts.map +0 -1
- package/dist/lib/entities/text.js +0 -140
- package/dist/lib/entities/zone.d.ts +0 -54
- package/dist/lib/entities/zone.d.ts.map +0 -1
- package/dist/lib/entities/zone.js +0 -103
- package/dist/lib/game/game-blueprint.d.ts +0 -38
- package/dist/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.d.ts +0 -35
- package/dist/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.js +0 -57
- package/dist/lib/game/game-config.d.ts +0 -59
- package/dist/lib/game/game-config.d.ts.map +0 -1
- package/dist/lib/game/game-config.js +0 -78
- package/dist/lib/game/game-default.d.ts +0 -14
- package/dist/lib/game/game-default.d.ts.map +0 -1
- package/dist/lib/game/game-default.js +0 -23
- package/dist/lib/game/game-interfaces.d.ts +0 -29
- package/dist/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.d.ts +0 -25
- package/dist/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.js +0 -80
- package/dist/lib/game/game-state.d.ts +0 -11
- package/dist/lib/game/game-state.d.ts.map +0 -1
- package/dist/lib/game/game-state.js +0 -17
- package/dist/lib/game/game.d.ts +0 -37
- package/dist/lib/game/game.d.ts.map +0 -1
- package/dist/lib/game/game.js +0 -109
- package/dist/lib/game/zylem-game.d.ts +0 -58
- package/dist/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/lib/game/zylem-game.js +0 -140
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
- package/dist/lib/graphics/material.d.ts +0 -29
- package/dist/lib/graphics/material.d.ts.map +0 -1
- package/dist/lib/graphics/material.js +0 -64
- package/dist/lib/graphics/mesh.d.ts +0 -19
- package/dist/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/lib/graphics/mesh.js +0 -14
- package/dist/lib/graphics/render-pass.d.ts +0 -17
- package/dist/lib/graphics/render-pass.d.ts.map +0 -1
- package/dist/lib/graphics/render-pass.js +0 -56
- package/dist/lib/graphics/shaders/fragment/debug.glsl.js +0 -23
- package/dist/lib/graphics/shaders/fragment/fire.glsl.js +0 -52
- package/dist/lib/graphics/shaders/fragment/standard.glsl.js +0 -11
- package/dist/lib/graphics/shaders/fragment/stars.glsl.js +0 -44
- package/dist/lib/graphics/shaders/vertex/debug.glsl.js +0 -15
- package/dist/lib/graphics/shaders/vertex/object-shader.glsl.js +0 -11
- package/dist/lib/graphics/shaders/vertex/standard.glsl.js +0 -9
- package/dist/lib/graphics/zylem-scene.d.ts +0 -50
- package/dist/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/lib/graphics/zylem-scene.js +0 -75
- package/dist/lib/input/gamepad-provider.d.ts +0 -14
- package/dist/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/lib/input/gamepad-provider.js +0 -58
- package/dist/lib/input/input-manager.d.ts +0 -15
- package/dist/lib/input/input-manager.d.ts.map +0 -1
- package/dist/lib/input/input-manager.js +0 -70
- package/dist/lib/input/input-provider.d.ts +0 -7
- package/dist/lib/input/input-provider.d.ts.map +0 -1
- package/dist/lib/input/input.d.ts +0 -48
- package/dist/lib/input/input.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.d.ts +0 -21
- package/dist/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.js +0 -120
- package/dist/lib/interfaces/entity.d.ts +0 -26
- package/dist/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/lib/sounds/index.d.ts +0 -3
- package/dist/lib/sounds/index.d.ts.map +0 -1
- package/dist/lib/sounds/ping-pong-sound.d.ts +0 -5
- package/dist/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/lib/sounds/ricochet-sound.d.ts +0 -5
- package/dist/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.d.ts +0 -24
- package/dist/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.js +0 -53
- package/dist/lib/stage/entity-spawner.d.ts +0 -9
- package/dist/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/lib/stage/entity-spawner.js +0 -27
- package/dist/lib/stage/stage-blueprint.d.ts +0 -45
- package/dist/lib/stage/stage-blueprint.d.ts.map +0 -1
- package/dist/lib/stage/stage-blueprint.js +0 -56
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts +0 -14
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.d.ts +0 -26
- package/dist/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.js +0 -100
- package/dist/lib/stage/stage-default.d.ts +0 -3
- package/dist/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/lib/stage/stage-default.js +0 -32
- package/dist/lib/stage/stage-state.d.ts +0 -14
- package/dist/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/lib/stage/stage-state.js +0 -36
- package/dist/lib/stage/stage.d.ts +0 -33
- package/dist/lib/stage/stage.d.ts.map +0 -1
- package/dist/lib/stage/stage.js +0 -60
- package/dist/lib/stage/zylem-stage.d.ts +0 -128
- package/dist/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/lib/stage/zylem-stage.js +0 -268
- package/dist/lib/systems/test-system.d.ts +0 -2
- package/dist/lib/systems/test-system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.d.ts +0 -25
- package/dist/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.js +0 -43
- package/dist/lib/types/entity-types.d.ts +0 -24
- package/dist/lib/types/entity-types.d.ts.map +0 -1
- package/dist/lib/types/index.d.ts +0 -3
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/stage-types.d.ts +0 -26
- package/dist/lib/types/stage-types.d.ts.map +0 -1
- package/dist/lib/ui/Debug.d.ts +0 -6
- package/dist/lib/ui/Debug.d.ts.map +0 -1
- package/dist/lib/ui/console/Console.d.ts +0 -7
- package/dist/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/Menu.d.ts +0 -6
- package/dist/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/all.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/lib/ui/toolbar/Toolbar.d.ts +0 -6
- package/dist/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/tests/integration/debug.sim.spec.d.ts +0 -2
- package/dist/tests/integration/debug.sim.spec.d.ts.map +0 -1
- package/dist/tests/unit/collision/collision.spec.d.ts +0 -2
- package/dist/tests/unit/collision/collision.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/game.spec.d.ts +0 -2
- package/dist/tests/unit/core/game.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/stage.spec.d.ts +0 -2
- package/dist/tests/unit/core/stage.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/vessel.spec.d.ts +0 -2
- package/dist/tests/unit/core/vessel.spec.d.ts.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
import { RigidBody, Vector } from '@dimforge/rapier3d-compat';
|
|
3
|
+
|
|
4
|
+
interface EntityWithBody {
|
|
5
|
+
body: RigidBody | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Move entity based on a vector, adding to existing velocities
|
|
9
|
+
*/
|
|
10
|
+
declare function move(entity: EntityWithBody, vector: Vector3): void;
|
|
11
|
+
/**
|
|
12
|
+
* Reset entity velocity
|
|
13
|
+
*/
|
|
14
|
+
declare function resetVelocity(entity: EntityWithBody): void;
|
|
15
|
+
/**
|
|
16
|
+
* Enhanced moveable entity with bound methods
|
|
17
|
+
*/
|
|
18
|
+
interface MoveableEntity extends EntityWithBody {
|
|
19
|
+
moveX(delta: number): void;
|
|
20
|
+
moveY(delta: number): void;
|
|
21
|
+
moveZ(delta: number): void;
|
|
22
|
+
moveXY(deltaX: number, deltaY: number): void;
|
|
23
|
+
moveXZ(deltaX: number, deltaZ: number): void;
|
|
24
|
+
move(vector: Vector3): void;
|
|
25
|
+
resetVelocity(): void;
|
|
26
|
+
moveForwardXY(delta: number, rotation2DAngle: number): void;
|
|
27
|
+
getPosition(): Vector | null;
|
|
28
|
+
getVelocity(): Vector | null;
|
|
29
|
+
setPosition(x: number, y: number, z: number): void;
|
|
30
|
+
setPositionX(x: number): void;
|
|
31
|
+
setPositionY(y: number): void;
|
|
32
|
+
setPositionZ(z: number): void;
|
|
33
|
+
wrapAroundXY(boundsX: number, boundsY: number): void;
|
|
34
|
+
wrapAround3D(boundsX: number, boundsY: number, boundsZ: number): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Class decorator to enhance an entity with additive movement methods
|
|
38
|
+
*/
|
|
39
|
+
declare function moveable<T extends {
|
|
40
|
+
new (...args: any[]): EntityWithBody;
|
|
41
|
+
}>(constructor: T): {
|
|
42
|
+
new (...args: any[]): {
|
|
43
|
+
moveX(delta: number): void;
|
|
44
|
+
moveY(delta: number): void;
|
|
45
|
+
moveZ(delta: number): void;
|
|
46
|
+
moveXY(deltaX: number, deltaY: number): void;
|
|
47
|
+
moveXZ(deltaX: number, deltaZ: number): void;
|
|
48
|
+
move(vector: Vector3): void;
|
|
49
|
+
resetVelocity(): void;
|
|
50
|
+
moveForwardXY(delta: number, rotation2DAngle: number): void;
|
|
51
|
+
getPosition(): Vector | null;
|
|
52
|
+
getVelocity(): Vector | null;
|
|
53
|
+
setPosition(x: number, y: number, z: number): void;
|
|
54
|
+
setPositionX(x: number): void;
|
|
55
|
+
setPositionY(y: number): void;
|
|
56
|
+
setPositionZ(z: number): void;
|
|
57
|
+
wrapAroundXY(boundsX: number, boundsY: number): void;
|
|
58
|
+
wrapAround3D(boundsX: number, boundsY: number, boundsZ: number): void;
|
|
59
|
+
body: RigidBody | null;
|
|
60
|
+
};
|
|
61
|
+
} & T;
|
|
62
|
+
/**
|
|
63
|
+
* Enhance an entity with additive movement methods (retained for compatibility)
|
|
64
|
+
*/
|
|
65
|
+
declare function makeMoveable<T extends EntityWithBody>(entity: T): T & MoveableEntity;
|
|
66
|
+
|
|
67
|
+
export { type EntityWithBody as E, type MoveableEntity as M, moveable as a, move as b, makeMoveable as m, resetVelocity as r };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { G as GameEntity, U as UpdateContext, S as SetupFunction, b as UpdateFunction, D as DestroyFunction, c as SetupContext, d as DestroyContext, e as BaseNode, L as LoadingEvent } from './entity-bQElAdpo.js';
|
|
2
|
+
import * as bitecs from 'bitecs';
|
|
3
|
+
import { Vector3, Scene, Color, Object3D, Group } from 'three';
|
|
4
|
+
import RAPIER__default, { World, RigidBody, Collider } from '@dimforge/rapier3d-compat';
|
|
5
|
+
import { E as Entity, Z as ZylemCamera, L as LifecycleFunction, C as CameraDebugDelegate, b as CameraDebugState, d as CameraWrapper } from './camera-Dk-fOVZE.js';
|
|
6
|
+
|
|
7
|
+
declare class ZylemWorld implements Entity<ZylemWorld> {
|
|
8
|
+
type: string;
|
|
9
|
+
world: World;
|
|
10
|
+
collisionMap: Map<string, GameEntity<any>>;
|
|
11
|
+
collisionBehaviorMap: Map<string, GameEntity<any>>;
|
|
12
|
+
_removalMap: Map<string, GameEntity<any>>;
|
|
13
|
+
static loadPhysics(gravity: Vector3): Promise<RAPIER__default.World>;
|
|
14
|
+
constructor(world: World);
|
|
15
|
+
addEntity(entity: any): void;
|
|
16
|
+
setForRemoval(entity: any): void;
|
|
17
|
+
destroyEntity(entity: GameEntity<any>): void;
|
|
18
|
+
setup(): void;
|
|
19
|
+
update(params: UpdateContext<any>): void;
|
|
20
|
+
updatePostCollisionBehaviors(delta: number): void;
|
|
21
|
+
updateColliders(delta: number): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface SceneState {
|
|
26
|
+
backgroundColor: Color | string;
|
|
27
|
+
backgroundImage: string | null;
|
|
28
|
+
}
|
|
29
|
+
declare class ZylemScene implements Entity<ZylemScene> {
|
|
30
|
+
type: string;
|
|
31
|
+
_setup?: SetupFunction<ZylemScene>;
|
|
32
|
+
scene: Scene;
|
|
33
|
+
zylemCamera: ZylemCamera;
|
|
34
|
+
containerElement: HTMLElement | null;
|
|
35
|
+
update: LifecycleFunction<ZylemScene>;
|
|
36
|
+
_collision?: ((entity: any, other: any, globals?: any) => void) | undefined;
|
|
37
|
+
_destroy?: ((globals?: any) => void) | undefined;
|
|
38
|
+
name?: string | undefined;
|
|
39
|
+
tag?: Set<string> | undefined;
|
|
40
|
+
constructor(id: string, camera: ZylemCamera, state: SceneState);
|
|
41
|
+
setup(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Setup camera with the scene
|
|
45
|
+
*/
|
|
46
|
+
setupCamera(scene: Scene, camera: ZylemCamera): void;
|
|
47
|
+
/**
|
|
48
|
+
* Setup scene lighting
|
|
49
|
+
*/
|
|
50
|
+
setupLighting(scene: Scene): void;
|
|
51
|
+
/**
|
|
52
|
+
* Update renderer size - delegates to camera
|
|
53
|
+
*/
|
|
54
|
+
updateRenderer(width: number, height: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Add object to scene
|
|
57
|
+
*/
|
|
58
|
+
add(object: Object3D, position?: Vector3): void;
|
|
59
|
+
/**
|
|
60
|
+
* Add game entity to scene
|
|
61
|
+
*/
|
|
62
|
+
addEntity(entity: GameEntity<any>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Add debug helpers to scene
|
|
65
|
+
*/
|
|
66
|
+
debugScene(): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Base entity interface - shared across modules to prevent circular dependencies
|
|
71
|
+
*/
|
|
72
|
+
interface BaseEntityInterface {
|
|
73
|
+
uuid: string;
|
|
74
|
+
name: string;
|
|
75
|
+
eid: number;
|
|
76
|
+
group: Group | null;
|
|
77
|
+
body: RigidBody | null;
|
|
78
|
+
collider: Collider | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Game entity interface - minimal interface to break circular dependencies
|
|
82
|
+
*/
|
|
83
|
+
interface GameEntityInterface extends BaseEntityInterface {
|
|
84
|
+
type: string;
|
|
85
|
+
isStatic: boolean;
|
|
86
|
+
setPosition(x: number, y: number, z: number): void;
|
|
87
|
+
setRotation(x: number, y: number, z: number): void;
|
|
88
|
+
setScale(x: number, y: number, z: number): void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Provides BaseNode-like lifecycle without ECS/children. Consumers implement
|
|
93
|
+
* the protected hooks and may assign public setup/update/destroy callbacks.
|
|
94
|
+
*/
|
|
95
|
+
declare abstract class LifeCycleBase<TSelf> {
|
|
96
|
+
update: UpdateFunction<TSelf>;
|
|
97
|
+
setup: SetupFunction<TSelf>;
|
|
98
|
+
destroy: DestroyFunction<TSelf>;
|
|
99
|
+
protected abstract _setup(context: SetupContext<TSelf>): void;
|
|
100
|
+
protected abstract _update(context: UpdateContext<TSelf>): void;
|
|
101
|
+
protected abstract _destroy(context: DestroyContext<TSelf>): void;
|
|
102
|
+
nodeSetup(context: SetupContext<TSelf>): void;
|
|
103
|
+
nodeUpdate(context: UpdateContext<TSelf>): void;
|
|
104
|
+
nodeDestroy(context: DestroyContext<TSelf>): void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type AddEntityFactory = (params: {
|
|
108
|
+
position: Vector3;
|
|
109
|
+
normal?: Vector3;
|
|
110
|
+
}) => Promise<any> | any;
|
|
111
|
+
interface StageDebugDelegateOptions {
|
|
112
|
+
maxRayDistance?: number;
|
|
113
|
+
addEntityFactory?: AddEntityFactory | null;
|
|
114
|
+
}
|
|
115
|
+
declare class StageDebugDelegate {
|
|
116
|
+
private stage;
|
|
117
|
+
private options;
|
|
118
|
+
private mouseNdc;
|
|
119
|
+
private raycaster;
|
|
120
|
+
private isMouseDown;
|
|
121
|
+
private disposeFns;
|
|
122
|
+
private debugCursor;
|
|
123
|
+
private debugLines;
|
|
124
|
+
constructor(stage: ZylemStage, options?: StageDebugDelegateOptions);
|
|
125
|
+
update(): void;
|
|
126
|
+
dispose(): void;
|
|
127
|
+
private handleActionOnHit;
|
|
128
|
+
private attachDomListeners;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Debug delegate that bridges the stage's entity map and debug state to the camera.
|
|
133
|
+
*/
|
|
134
|
+
declare class StageCameraDebugDelegate implements CameraDebugDelegate {
|
|
135
|
+
private stage;
|
|
136
|
+
constructor(stage: ZylemStage);
|
|
137
|
+
subscribe(listener: (state: CameraDebugState) => void): () => void;
|
|
138
|
+
resolveTarget(uuid: string): Object3D | null;
|
|
139
|
+
private snapshot;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface ZylemStageConfig {
|
|
143
|
+
inputs: Record<string, string[]>;
|
|
144
|
+
backgroundColor: Color | string;
|
|
145
|
+
backgroundImage: string | null;
|
|
146
|
+
gravity: Vector3;
|
|
147
|
+
variables: Record<string, any>;
|
|
148
|
+
stageRef?: Stage;
|
|
149
|
+
}
|
|
150
|
+
type NodeLike$1 = {
|
|
151
|
+
create: Function;
|
|
152
|
+
};
|
|
153
|
+
type StageEntityInput = NodeLike$1 | Promise<any> | (() => NodeLike$1 | Promise<any>);
|
|
154
|
+
type StageOptionItem = Partial<ZylemStageConfig> | CameraWrapper | StageEntityInput;
|
|
155
|
+
type StageOptions = [] | [Partial<ZylemStageConfig>, ...StageOptionItem[]];
|
|
156
|
+
type StageState = ZylemStageConfig & {
|
|
157
|
+
entities: GameEntityInterface[];
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* ZylemStage orchestrates scene, physics world, entities, and lifecycle.
|
|
161
|
+
*
|
|
162
|
+
* Responsibilities:
|
|
163
|
+
* - Manage stage configuration (background, inputs, gravity, variables)
|
|
164
|
+
* - Initialize and own `ZylemScene` and `ZylemWorld`
|
|
165
|
+
* - Spawn, track, and remove entities; emit entity-added events
|
|
166
|
+
* - Drive per-frame updates and transform system
|
|
167
|
+
*/
|
|
168
|
+
declare class ZylemStage extends LifeCycleBase<ZylemStage> {
|
|
169
|
+
type: string;
|
|
170
|
+
state: StageState;
|
|
171
|
+
gravity: Vector3;
|
|
172
|
+
world: ZylemWorld | null;
|
|
173
|
+
scene: ZylemScene | null;
|
|
174
|
+
children: Array<BaseNode>;
|
|
175
|
+
_childrenMap: Map<number, BaseNode>;
|
|
176
|
+
_removalMap: Map<number, BaseNode>;
|
|
177
|
+
private pendingEntities;
|
|
178
|
+
private pendingPromises;
|
|
179
|
+
private isLoaded;
|
|
180
|
+
_debugMap: Map<string, BaseNode>;
|
|
181
|
+
private entityAddedHandlers;
|
|
182
|
+
private loadingHandlers;
|
|
183
|
+
ecs: bitecs.IWorld;
|
|
184
|
+
testSystem: any;
|
|
185
|
+
transformSystem: any;
|
|
186
|
+
debugDelegate: StageDebugDelegate | null;
|
|
187
|
+
cameraDebugDelegate: StageCameraDebugDelegate | null;
|
|
188
|
+
uuid: string;
|
|
189
|
+
wrapperRef: Stage | null;
|
|
190
|
+
camera?: CameraWrapper;
|
|
191
|
+
cameraRef?: ZylemCamera | null;
|
|
192
|
+
/**
|
|
193
|
+
* Create a new stage.
|
|
194
|
+
* @param options Stage options: partial config, camera, and initial entities or factories
|
|
195
|
+
*/
|
|
196
|
+
constructor(options?: StageOptions);
|
|
197
|
+
private parseOptions;
|
|
198
|
+
private isZylemStageConfig;
|
|
199
|
+
private isBaseNode;
|
|
200
|
+
private isCameraWrapper;
|
|
201
|
+
private isEntityInput;
|
|
202
|
+
private isThenable;
|
|
203
|
+
private handleEntityImmediatelyOrQueue;
|
|
204
|
+
private handlePromiseWithSpawnOnResolve;
|
|
205
|
+
private saveState;
|
|
206
|
+
private setState;
|
|
207
|
+
/**
|
|
208
|
+
* Load and initialize the stage's scene and world.
|
|
209
|
+
* @param id DOM element id for the renderer container
|
|
210
|
+
* @param camera Optional camera override
|
|
211
|
+
*/
|
|
212
|
+
load(id: string, camera?: ZylemCamera | null): Promise<void>;
|
|
213
|
+
private createDefaultCamera;
|
|
214
|
+
protected _setup(params: SetupContext<ZylemStage>): void;
|
|
215
|
+
protected _update(params: UpdateContext<ZylemStage>): void;
|
|
216
|
+
outOfLoop(): void;
|
|
217
|
+
/** Update debug overlays and helpers if enabled. */
|
|
218
|
+
debugUpdate(): void;
|
|
219
|
+
/** Cleanup owned resources when the stage is destroyed. */
|
|
220
|
+
protected _destroy(params: DestroyContext<ZylemStage>): void;
|
|
221
|
+
/**
|
|
222
|
+
* Create, register, and add an entity to the scene/world.
|
|
223
|
+
* Safe to call only after `load` when scene/world exist.
|
|
224
|
+
*/
|
|
225
|
+
spawnEntity(child: BaseNode): Promise<void>;
|
|
226
|
+
buildEntityState(child: BaseNode): Partial<BaseEntityInterface>;
|
|
227
|
+
/** Add the entity to internal maps and notify listeners. */
|
|
228
|
+
addEntityToStage(entity: BaseNode): void;
|
|
229
|
+
/**
|
|
230
|
+
* Subscribe to entity-added events.
|
|
231
|
+
* @param callback Invoked for each entity when added
|
|
232
|
+
* @param options.replayExisting If true and stage already loaded, replays existing entities
|
|
233
|
+
* @returns Unsubscribe function
|
|
234
|
+
*/
|
|
235
|
+
onEntityAdded(callback: (entity: BaseNode) => void, options?: {
|
|
236
|
+
replayExisting?: boolean;
|
|
237
|
+
}): () => void;
|
|
238
|
+
onLoading(callback: (event: LoadingEvent) => void): () => void;
|
|
239
|
+
private emitLoading;
|
|
240
|
+
/**
|
|
241
|
+
* Remove an entity and its resources by its UUID.
|
|
242
|
+
* @returns true if removed, false if not found or stage not ready
|
|
243
|
+
*/
|
|
244
|
+
removeEntityByUuid(uuid: string): boolean;
|
|
245
|
+
/** Get an entity by its name; returns null if not found. */
|
|
246
|
+
getEntityByName(name: string): BaseNode<any, any> | null;
|
|
247
|
+
logMissingEntities(): void;
|
|
248
|
+
/** Resize renderer viewport. */
|
|
249
|
+
resize(width: number, height: number): void;
|
|
250
|
+
/**
|
|
251
|
+
* Enqueue items to be spawned. Items can be:
|
|
252
|
+
* - BaseNode instances (immediate or deferred until load)
|
|
253
|
+
* - Factory functions returning BaseNode or Promise<BaseNode>
|
|
254
|
+
* - Promises resolving to BaseNode
|
|
255
|
+
*/
|
|
256
|
+
enqueue(...items: StageEntityInput[]): void;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
type NodeLike = {
|
|
260
|
+
create: Function;
|
|
261
|
+
};
|
|
262
|
+
type AnyNode = NodeLike | Promise<NodeLike>;
|
|
263
|
+
type EntityInput = AnyNode | (() => AnyNode) | (() => Promise<any>);
|
|
264
|
+
declare class Stage {
|
|
265
|
+
wrappedStage: ZylemStage | null;
|
|
266
|
+
options: StageOptionItem[];
|
|
267
|
+
update: UpdateFunction<ZylemStage>;
|
|
268
|
+
setup: SetupFunction<ZylemStage>;
|
|
269
|
+
destroy: DestroyFunction<ZylemStage>;
|
|
270
|
+
constructor(options: StageOptions);
|
|
271
|
+
load(id: string, camera?: ZylemCamera | CameraWrapper | null): Promise<void>;
|
|
272
|
+
addEntities(entities: BaseNode[]): Promise<void>;
|
|
273
|
+
add(...inputs: Array<EntityInput>): void;
|
|
274
|
+
private addToBlueprints;
|
|
275
|
+
private addToStage;
|
|
276
|
+
start(params: SetupContext<ZylemStage>): void;
|
|
277
|
+
onUpdate(...callbacks: UpdateFunction<ZylemStage>[]): void;
|
|
278
|
+
onSetup(callback: SetupFunction<ZylemStage>): void;
|
|
279
|
+
onDestroy(callback: DestroyFunction<ZylemStage>): void;
|
|
280
|
+
onLoading(callback: (event: LoadingEvent) => void): () => void;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Create a stage with optional camera
|
|
284
|
+
*/
|
|
285
|
+
declare function createStage(...options: StageOptions): Stage;
|
|
286
|
+
|
|
287
|
+
export { type BaseEntityInterface as B, type StageOptions as S, Stage as a, createStage as c };
|
package/dist/stage.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { S as StageOptions, c as createStage } from './stage-CrmY7V0i.js';
|
|
2
|
+
export { e as entitySpawner } from './entity-spawner-DNnLYnZq.js';
|
|
3
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
+
import { Static } from '@sinclair/typebox';
|
|
5
|
+
import './entity-bQElAdpo.js';
|
|
6
|
+
import 'three';
|
|
7
|
+
import '@dimforge/rapier3d-compat';
|
|
8
|
+
import 'bitecs';
|
|
9
|
+
import './camera-Dk-fOVZE.js';
|
|
10
|
+
import 'three/addons/controls/OrbitControls.js';
|
|
11
|
+
import 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
12
|
+
|
|
13
|
+
declare const StageSchema: _sinclair_typebox.TObject<{
|
|
14
|
+
id: _sinclair_typebox.TString;
|
|
15
|
+
name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
16
|
+
entities: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
17
|
+
id: _sinclair_typebox.TString;
|
|
18
|
+
type: _sinclair_typebox.TString;
|
|
19
|
+
position: _sinclair_typebox.TOptional<_sinclair_typebox.TTuple<[_sinclair_typebox.TNumber, _sinclair_typebox.TNumber]>>;
|
|
20
|
+
data: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
|
|
21
|
+
}>>;
|
|
22
|
+
assets: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
|
|
23
|
+
}>;
|
|
24
|
+
type StageBlueprint = Static<typeof StageSchema>;
|
|
25
|
+
|
|
26
|
+
export type { StageBlueprint };
|