@zylem/game-lib 0.9.6 → 0.9.7
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/dist/actions.d.ts +3 -3
- package/dist/api/game-lib.api.json +99547 -42343
- package/dist/api/game-lib.api.md +3809 -682
- package/dist/api/game-lib.d.ts +8657 -687
- package/dist/api/game-lib.typedoc.json +325514 -191323
- package/dist/behavior/action/fighting.d.ts +1 -0
- package/dist/behavior/action/fighting.js +1 -0
- package/dist/behavior/action/pinball.d.ts +1 -0
- package/dist/behavior/action/pinball.js +1 -0
- package/dist/behavior/action/platform.d.ts +1 -0
- package/dist/behavior/action/platform.js +1 -0
- package/dist/behavior/action/rhythm.d.ts +1 -0
- package/dist/behavior/action/rhythm.js +1 -0
- package/dist/behavior/action/shooter/first-person.d.ts +1 -0
- package/dist/behavior/action/shooter/first-person.js +1 -0
- package/dist/behavior/action/shooter/shoot-em-up.d.ts +1 -0
- package/dist/behavior/action/shooter/shoot-em-up.js +1 -0
- package/dist/behavior/action/shooter.d.ts +1 -0
- package/dist/behavior/action/shooter.js +1 -0
- package/dist/behavior/action/stealth.d.ts +1 -0
- package/dist/behavior/action/stealth.js +1 -0
- package/dist/behavior/action/survival.d.ts +1 -0
- package/dist/behavior/action/survival.js +1 -0
- package/dist/behavior/action-adventure.d.ts +1 -0
- package/dist/behavior/action-adventure.js +1 -0
- package/dist/behavior/action.d.ts +1 -0
- package/dist/behavior/action.js +1 -0
- package/dist/behavior/genre-map.d.ts +1 -0
- package/dist/behavior/genre-map.js +1 -0
- package/dist/behavior/mechanics.d.ts +1 -0
- package/dist/behavior/mechanics.js +1 -0
- package/dist/behavior/puzzle/physics.d.ts +1 -0
- package/dist/behavior/puzzle/physics.js +1 -0
- package/dist/behavior/puzzle/tile-matching.d.ts +1 -0
- package/dist/behavior/puzzle/tile-matching.js +1 -0
- package/dist/behavior/puzzle.d.ts +1 -0
- package/dist/behavior/puzzle.js +1 -0
- package/dist/behavior/role-playing/action-rpg.d.ts +1 -0
- package/dist/behavior/role-playing/action-rpg.js +1 -0
- package/dist/behavior/role-playing/monster-taming.d.ts +1 -0
- package/dist/behavior/role-playing/monster-taming.js +1 -0
- package/dist/behavior/role-playing/tactical-rpg.d.ts +1 -0
- package/dist/behavior/role-playing/tactical-rpg.js +1 -0
- package/dist/behavior/role-playing/turn-based.d.ts +1 -0
- package/dist/behavior/role-playing/turn-based.js +1 -0
- package/dist/behavior/role-playing.d.ts +1 -0
- package/dist/behavior/role-playing.js +1 -0
- package/dist/behavior/simulation/life.d.ts +1 -0
- package/dist/behavior/simulation/life.js +1 -0
- package/dist/behavior/simulation/vehicle/racing.d.ts +1 -0
- package/dist/behavior/simulation/vehicle/racing.js +1 -0
- package/dist/behavior/simulation/vehicle.d.ts +1 -0
- package/dist/behavior/simulation/vehicle.js +1 -0
- package/dist/behavior/simulation.d.ts +1 -0
- package/dist/behavior/simulation.js +1 -0
- package/dist/behavior/sports/golf.d.ts +1 -0
- package/dist/behavior/sports/golf.js +1 -0
- package/dist/behavior/sports/racing.d.ts +1 -0
- package/dist/behavior/sports/racing.js +1 -0
- package/dist/behavior/sports/racket.d.ts +1 -0
- package/dist/behavior/sports/racket.js +1 -0
- package/dist/behavior/sports/skate.d.ts +1 -0
- package/dist/behavior/sports/skate.js +1 -0
- package/dist/behavior/sports.d.ts +1 -0
- package/dist/behavior/sports.js +1 -0
- package/dist/behavior/strategy/real-time-tactics.d.ts +1 -0
- package/dist/behavior/strategy/real-time-tactics.js +1 -0
- package/dist/behavior/strategy/tower-defense.d.ts +1 -0
- package/dist/behavior/strategy/tower-defense.js +1 -0
- package/dist/behavior/strategy/turn-based-tactics.d.ts +1 -0
- package/dist/behavior/strategy/turn-based-tactics.js +1 -0
- package/dist/behavior/strategy.d.ts +1 -0
- package/dist/behavior/strategy.js +1 -0
- package/dist/behavior.d.ts +34 -0
- package/dist/bridge.d.ts +2 -2
- package/dist/bridge.js +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +1 -1
- package/dist/chunk-4DAITCJS.js +1 -0
- package/dist/chunk-63T3K5EQ.js +1 -0
- package/dist/chunk-AJSIVGDX.js +1 -0
- package/dist/{chunk-Y23IJJPD.js → chunk-CVKEWWIH.js} +1 -1
- package/dist/chunk-DYD7MDWO.js +1 -0
- package/dist/chunk-IHGRFR4H.js +1 -0
- package/dist/{chunk-RPMV7GDX.js → chunk-JJEYLGD2.js} +2 -2
- package/dist/chunk-KL7NGD76.js +1 -0
- package/dist/chunk-M2FZ224T.js +1 -0
- package/dist/chunk-MJ7RGE47.js +1 -0
- package/dist/chunk-Q22Z4PBD.js +19 -0
- package/dist/{chunk-KIFB427K.js → chunk-SD7EHS4W.js} +1 -1
- package/dist/chunk-UKNMIHAP.js +1 -0
- package/dist/chunk-Y5IU6IA5.js +1 -0
- package/dist/cinematics.d.ts +7 -5
- package/dist/core.d.ts +11 -9
- package/dist/core.js +1 -1
- package/dist/{debug-state-DhVkY2aM.d.ts → debug-state-BgX5Q0Ff.d.ts} +1 -1
- package/dist/debug.d.ts +6 -125
- package/dist/{entity-DC0P747T.d.ts → entity-CY75JJSw.d.ts} +78 -4
- package/dist/{entity-type-map-B0S5cfv7.d.ts → entity-type-map-BMaPY8cd.d.ts} +2 -2
- package/dist/entity.d.ts +5 -5
- package/dist/entity.js +1 -1
- package/dist/{game-mu6OSCrq.d.ts → game-CmkhPP-9.d.ts} +3 -3
- package/dist/game-default-LAGMEHNQ.js +1 -0
- package/dist/graphics.d.ts +3 -3
- package/dist/graphics.js +1 -1
- package/dist/{material-CxxAyJYp.d.ts → material-D1IVeQc5.d.ts} +48 -2
- package/dist/placement-session-BNQoL7Jb.d.ts +82 -0
- package/dist/placement.d.ts +52 -0
- package/dist/placement.js +1 -0
- package/dist/public.d.ts +11 -8
- package/dist/public.js +1 -1
- package/dist/{stage-B_KdSEK6.d.ts → stage-CCGJh9TD.d.ts} +176 -7
- package/dist/transform-gizmo-DappLQ9w.d.ts +123 -0
- package/dist/web-components.d.ts +9 -7
- package/dist/{zylem-camera-CWhIGXlW.d.ts → zylem-camera-BA3VPFlS.d.ts} +9 -0
- package/package.json +147 -7
- package/dist/chunk-5V52N34T.js +0 -1
- package/dist/chunk-6FGXC4T6.js +0 -19
- package/dist/chunk-FUZDTRCU.js +0 -1
- package/dist/chunk-P6IOYQHU.js +0 -1
- package/dist/chunk-QB3NL7VQ.js +0 -1
- package/dist/chunk-VKWJHFUR.js +0 -1
- package/dist/chunk-VXE3CV3K.js +0 -1
- package/dist/chunk-YRHRMVHS.js +0 -1
- package/dist/game-default-VUMUMTXA.js +0 -1
package/dist/debug.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { D as DEFAULT_SNAP_SETTINGS, w as DebugEntityResolver, v as DebugTools, S as SnapSettings, T as TRANSFORM_TOOLS, x as TransformTool, d as debugState, k as getHoveredEntity, j as getHoveredEntityId, e as getSelectedEntity, g as getSelectedEntityId, h as getSelectedEntityIds, m as getSnapSettings, t as isPickMode, u as isTransformTool, r as registerDebugEntityResolver, l as resolveDebugEntity, p as setAddType, s as setDebugTool, o as setGridVisible, i as setHoveredEntityId, a as setPaused, q as setPickMode, b as setSelectedEntity, c as setSelectedEntityId, f as setSelectedEntityIds, n as setSnapSettings } from './debug-state-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
export { D as DEFAULT_SNAP_SETTINGS, w as DebugEntityResolver, v as DebugTools, S as SnapSettings, T as TRANSFORM_TOOLS, x as TransformTool, d as debugState, k as getHoveredEntity, j as getHoveredEntityId, e as getSelectedEntity, g as getSelectedEntityId, h as getSelectedEntityIds, m as getSnapSettings, t as isPickMode, u as isTransformTool, r as registerDebugEntityResolver, l as resolveDebugEntity, p as setAddType, s as setDebugTool, o as setGridVisible, i as setHoveredEntityId, a as setPaused, q as setPickMode, b as setSelectedEntity, c as setSelectedEntityId, f as setSelectedEntityIds, n as setSnapSettings } from './debug-state-BgX5Q0Ff.js';
|
|
2
|
+
export { G as GizmoAxis, a as GizmoDelta, b as GizmoMode, d as GizmoRay, T as TransformGizmo, c as closestAxisValue, i as intersectPlane } from './transform-gizmo-DappLQ9w.js';
|
|
3
|
+
import { Scene, Object3D, Vector3 } from 'three';
|
|
4
4
|
import { c as Vec3 } from './vector-D3eDzvcA.js';
|
|
5
|
-
import { G as GameEntity } from './entity-
|
|
5
|
+
import { G as GameEntity } from './entity-CY75JJSw.js';
|
|
6
6
|
export { S as SELECTION_BOUNDS_MARGIN, a as SELECTION_THIN_AXIS_FRACTION, c as SELECTION_THIN_AXIS_MAX, b as SELECTION_THIN_AXIS_MIN, d as SelectionBoundsProvider, m as measureObjectSelectionBounds, p as padSelectionBounds, r as resolveSelectionBounds } from './selection-bounds-BKmSo9aG.js';
|
|
7
7
|
import { WebGPURenderer } from 'three/webgpu';
|
|
8
8
|
import '@zylem/behaviors/core';
|
|
9
9
|
import './simulation-body-zQw-emOr.js';
|
|
10
|
-
import './material-
|
|
10
|
+
import './material-D1IVeQc5.js';
|
|
11
11
|
import './collision-builder-BckxkdmA.js';
|
|
12
12
|
import './base-node-idopiSw5.js';
|
|
13
13
|
import './base-node-life-cycle-BK9xebT9.js';
|
|
@@ -15,125 +15,6 @@ import './stage-transition-CmGpV4tc.js';
|
|
|
15
15
|
import './events.js';
|
|
16
16
|
import 'mitt';
|
|
17
17
|
|
|
18
|
-
type GizmoMode = 'translate' | 'rotate' | 'scale';
|
|
19
|
-
/** Single-axis, planar, and uniform handle identifiers. */
|
|
20
|
-
type GizmoAxis = 'x' | 'y' | 'z' | 'xy' | 'yz' | 'xz' | 'xyz';
|
|
21
|
-
/** A raw, unsnapped drag result in world space. */
|
|
22
|
-
type GizmoDelta = {
|
|
23
|
-
kind: 'translate';
|
|
24
|
-
offset: Vector3;
|
|
25
|
-
} | {
|
|
26
|
-
kind: 'rotate';
|
|
27
|
-
axis: Vector3;
|
|
28
|
-
angle: number;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'scale';
|
|
31
|
-
factor: Vector3;
|
|
32
|
-
};
|
|
33
|
-
/** A mouse ray in world space. */
|
|
34
|
-
interface GizmoRay {
|
|
35
|
-
origin: Vector3;
|
|
36
|
-
direction: Vector3;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Closest point along an infinite line to a ray, as a distance along the line.
|
|
40
|
-
*
|
|
41
|
-
* Returns `null` when the ray is close enough to parallel with the line that the
|
|
42
|
-
* closest point becomes unstable; see {@link MAX_DRAG_GAIN}.
|
|
43
|
-
*/
|
|
44
|
-
declare function closestAxisValue(ray: GizmoRay, origin: Vector3, axis: Vector3): number | null;
|
|
45
|
-
/**
|
|
46
|
-
* Intersect a ray with the plane through `origin` with the given normal.
|
|
47
|
-
*
|
|
48
|
-
* Returns `null` for a plane seen too close to edge-on, where the hit point
|
|
49
|
-
* races away across the plane for very little pointer motion.
|
|
50
|
-
*/
|
|
51
|
-
declare function intersectPlane(ray: GizmoRay, origin: Vector3, normal: Vector3, target: Vector3): Vector3 | null;
|
|
52
|
-
declare class TransformGizmo {
|
|
53
|
-
/** Root added to the scene; carries the pivot transform. */
|
|
54
|
-
readonly root: Group<three.Object3DEventMap>;
|
|
55
|
-
private scene;
|
|
56
|
-
private modeGroups;
|
|
57
|
-
private handles;
|
|
58
|
-
private materials;
|
|
59
|
-
private geometries;
|
|
60
|
-
private mode;
|
|
61
|
-
private highlighted;
|
|
62
|
-
private drag;
|
|
63
|
-
private raycaster;
|
|
64
|
-
constructor();
|
|
65
|
-
addTo(scene: Scene): void;
|
|
66
|
-
removeFromScene(): void;
|
|
67
|
-
dispose(): void;
|
|
68
|
-
setMode(mode: GizmoMode): void;
|
|
69
|
-
getMode(): GizmoMode;
|
|
70
|
-
/** Place the gizmo at a pivot and show it. */
|
|
71
|
-
show(pivot: Vector3): void;
|
|
72
|
-
hide(): void;
|
|
73
|
-
get visible(): boolean;
|
|
74
|
-
get pivot(): Vector3;
|
|
75
|
-
/**
|
|
76
|
-
* Keep the gizmo a constant size on screen.
|
|
77
|
-
*
|
|
78
|
-
* A world-sized gizmo is unusable in an orbit view: it fills the screen up
|
|
79
|
-
* close and disappears from a distance.
|
|
80
|
-
*/
|
|
81
|
-
update(camera: Camera): void;
|
|
82
|
-
/**
|
|
83
|
-
* Which handle a ray hits, or `null`.
|
|
84
|
-
*
|
|
85
|
-
* Raycasts the gizmo's own meshes rather than the physics world. Handles are
|
|
86
|
-
* render-only objects with no colliders, so the physics raycast used to pick
|
|
87
|
-
* entities cannot see them at all.
|
|
88
|
-
*/
|
|
89
|
-
pick(ray: GizmoRay): GizmoAxis | null;
|
|
90
|
-
/**
|
|
91
|
-
* Whether a handle can be dragged from the current viewing angle.
|
|
92
|
-
*
|
|
93
|
-
* Each handle type degenerates differently: an arrow aimed at the camera has
|
|
94
|
-
* no screen-space direction left to follow, while a plane quad or rotation
|
|
95
|
-
* ring seen edge-on turns a pixel of motion into a huge sweep across it.
|
|
96
|
-
*/
|
|
97
|
-
private isHandleDraggable;
|
|
98
|
-
/** Tint a handle to show it is hovered or being dragged. */
|
|
99
|
-
setHighlight(axis: GizmoAxis | null): void;
|
|
100
|
-
/**
|
|
101
|
-
* Begin a drag on a handle.
|
|
102
|
-
*
|
|
103
|
-
* @returns `false` when the gesture cannot be tracked (a near-parallel view
|
|
104
|
-
* of the drag axis), so the caller can ignore the press rather than start a
|
|
105
|
-
* drag that would jump.
|
|
106
|
-
*/
|
|
107
|
-
beginDrag(axis: GizmoAxis, ray: GizmoRay, camera: Camera): boolean;
|
|
108
|
-
/** Raw delta for the current pointer position, or `null` when unusable. */
|
|
109
|
-
updateDrag(ray: GizmoRay, camera: Camera): GizmoDelta | null;
|
|
110
|
-
endDrag(): void;
|
|
111
|
-
get isDragging(): boolean;
|
|
112
|
-
get draggingAxis(): GizmoAxis | null;
|
|
113
|
-
private isPlaneAxis;
|
|
114
|
-
/** Signed angle of the ray's hit point around `normal`, in radians. */
|
|
115
|
-
private angleOnPlane;
|
|
116
|
-
/** Distance from pivot to the ray hit on the camera-facing plane. */
|
|
117
|
-
private cameraPlaneRadius;
|
|
118
|
-
private applyModeVisibility;
|
|
119
|
-
private makeMaterial;
|
|
120
|
-
private track;
|
|
121
|
-
/**
|
|
122
|
-
* An invisible, generously sized mesh used only for hit testing.
|
|
123
|
-
*
|
|
124
|
-
* The visible shafts and rings are a couple of pixels wide, which is
|
|
125
|
-
* miserable to click. The raycaster still reaches `visible: false` meshes,
|
|
126
|
-
* so picking accuracy is decoupled from how thin the handle looks.
|
|
127
|
-
*/
|
|
128
|
-
private makePicker;
|
|
129
|
-
private orientAlongAxis;
|
|
130
|
-
private buildTranslate;
|
|
131
|
-
private positionPlaneHandle;
|
|
132
|
-
private buildRotate;
|
|
133
|
-
private orientRing;
|
|
134
|
-
private buildScale;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
18
|
/**
|
|
138
19
|
* The y=0 construction plane, drawn so the snap lattice is legible.
|
|
139
20
|
*
|
|
@@ -287,4 +168,4 @@ declare class EntityThumbnailCache {
|
|
|
287
168
|
/** Shared cache used by the running game to feed editor entity payloads. */
|
|
288
169
|
declare const entityThumbnailCache: EntityThumbnailCache;
|
|
289
170
|
|
|
290
|
-
export { ConstructionGrid, type EntityFocusContext, EntityThumbnailCache, type EntityThumbnailCacheEntry, type EntityThumbnailResult, type
|
|
171
|
+
export { ConstructionGrid, type EntityFocusContext, EntityThumbnailCache, type EntityThumbnailCacheEntry, type EntityThumbnailResult, type Quat, degreesToRadians, entityThumbnailCache, eulerToQuaternion, focusEntity, quaternionToEuler, radiansToDegrees, registerEntityFocusContext, snapScale, snapToIncrement, snapVec3 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BufferGeometry, Material, Mesh, Group, Vector3, Color, ShaderMaterial } from 'three';
|
|
1
|
+
import { BufferGeometry, Material, Mesh, Group, Vector3, Object3D, Color, ShaderMaterial } from 'three';
|
|
2
2
|
import { SimulationColliderDefinition, TransformState, SimulationBodyDefinition, MoveableEntity, BehaviorRuntime, Vector, BehaviorDescriptor, BehaviorHandle, BehaviorRef } from '@zylem/behaviors/core';
|
|
3
3
|
import { a as SimulationBody } from './simulation-body-zQw-emOr.js';
|
|
4
|
-
import { c as Vec3, e as Vec3Input, b as Vec2Input } from './vector-D3eDzvcA.js';
|
|
5
|
-
import { M as MaterialBuilder,
|
|
4
|
+
import { c as Vec3, e as Vec3Input, b as Vec2Input, d as Vec3Components } from './vector-D3eDzvcA.js';
|
|
5
|
+
import { M as MaterialBuilder, g as MaterialOptions } from './material-D1IVeQc5.js';
|
|
6
6
|
import { C as CollisionBuilder, L as LockAxesInput, a as CollisionOptions } from './collision-builder-BckxkdmA.js';
|
|
7
7
|
import { B as BaseNode, N as NodeInterface } from './base-node-idopiSw5.js';
|
|
8
8
|
import { a as SetupContext, U as UpdateContext, D as DestroyContext, k as LoadedContext, l as CleanupContext } from './base-node-life-cycle-BK9xebT9.js';
|
|
@@ -268,6 +268,68 @@ interface Action {
|
|
|
268
268
|
reset(): void;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Pointer roles for gameplay placement.
|
|
273
|
+
*
|
|
274
|
+
* A hover or droppable area is metadata on an entity plus a box the cursor ray
|
|
275
|
+
* is tested against. The physics raycast is the wrong tool for this: it skips
|
|
276
|
+
* sensors, and an invisible hotspot should not have to be a solid collider to
|
|
277
|
+
* be clickable. Areas with a mesh already in the scene use that mesh's world
|
|
278
|
+
* bounds; everyone else uses `options.position` and `options.size`.
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
|
+
/** Anything the stage can test with a pointer ray. GameEntity satisfies this. */
|
|
282
|
+
interface PointerTargetEntity {
|
|
283
|
+
uuid: string;
|
|
284
|
+
options?: {
|
|
285
|
+
position?: Vec3Input;
|
|
286
|
+
size?: Vec3Input;
|
|
287
|
+
};
|
|
288
|
+
group?: Object3D;
|
|
289
|
+
mesh?: Object3D;
|
|
290
|
+
getPose?: () => {
|
|
291
|
+
position: {
|
|
292
|
+
x: number;
|
|
293
|
+
y: number;
|
|
294
|
+
z: number;
|
|
295
|
+
};
|
|
296
|
+
} | null;
|
|
297
|
+
}
|
|
298
|
+
/** Where the cursor is, and whether an armed placement would accept it. */
|
|
299
|
+
interface PointerAreaContext {
|
|
300
|
+
area: PointerTargetEntity;
|
|
301
|
+
position: Vec3Components;
|
|
302
|
+
normal: Vec3Components;
|
|
303
|
+
/** True when nothing is armed, or when the armed payload may land here. */
|
|
304
|
+
valid: boolean;
|
|
305
|
+
payload: unknown;
|
|
306
|
+
}
|
|
307
|
+
/** The pose a click would commit, including when it is not over an area. */
|
|
308
|
+
interface PlacementPointContext {
|
|
309
|
+
position: Vec3Components;
|
|
310
|
+
normal: Vec3Components;
|
|
311
|
+
area: PointerTargetEntity | null;
|
|
312
|
+
valid: boolean;
|
|
313
|
+
payload: unknown;
|
|
314
|
+
}
|
|
315
|
+
interface HoverAreaOptions {
|
|
316
|
+
onEnter?: (ctx: PointerAreaContext) => void;
|
|
317
|
+
onLeave?: (ctx: PointerAreaContext) => void;
|
|
318
|
+
onMove?: (ctx: PointerAreaContext) => void;
|
|
319
|
+
onClick?: (ctx: PointerAreaContext) => void;
|
|
320
|
+
}
|
|
321
|
+
interface DroppableAreaOptions extends HoverAreaOptions {
|
|
322
|
+
/** Omit to accept every payload. */
|
|
323
|
+
accepts?: (payload: unknown, area: PointerTargetEntity) => boolean;
|
|
324
|
+
/** Called after a placement commits on this area. Not a second spawn. */
|
|
325
|
+
onDrop?: (ctx: PlacementPointContext) => void;
|
|
326
|
+
/**
|
|
327
|
+
* `area` sits the preview on this area's center (a grid cell).
|
|
328
|
+
* `hit` keeps it on the ray's intersection with the area.
|
|
329
|
+
*/
|
|
330
|
+
placeAt?: 'area' | 'hit';
|
|
331
|
+
}
|
|
332
|
+
|
|
271
333
|
interface CollisionContext<T, O extends GameEntityOptions, TGlobals extends Record<string, unknown> = any> {
|
|
272
334
|
entity: T;
|
|
273
335
|
other: GameEntity<O | any>;
|
|
@@ -553,6 +615,18 @@ declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O> implem
|
|
|
553
615
|
*/
|
|
554
616
|
onCollision(callback: (params: CollisionContext<this, O>) => void, options?: CollisionRegistrationOptions): this;
|
|
555
617
|
onCollision(...callbacks: ((params: CollisionContext<this, O>) => void)[]): this;
|
|
618
|
+
/**
|
|
619
|
+
* This entity is a pointer hotspot. The stage reports enter, leave, move,
|
|
620
|
+
* and click while the cursor ray is over its bounds. One pointer role per
|
|
621
|
+
* entity; a later {@link droppableArea} replaces this one.
|
|
622
|
+
*/
|
|
623
|
+
hoverArea(options?: HoverAreaOptions): this;
|
|
624
|
+
/**
|
|
625
|
+
* This entity accepts a placement drop. Includes the hover callbacks.
|
|
626
|
+
* `accepts` defaults to every payload. `onDrop` runs after a commit and
|
|
627
|
+
* does not spawn a second entity.
|
|
628
|
+
*/
|
|
629
|
+
droppableArea(options?: DroppableAreaOptions): this;
|
|
556
630
|
/**
|
|
557
631
|
* Use a behavior on this entity via typed descriptor.
|
|
558
632
|
* Behaviors will be auto-registered as systems when the entity is spawned.
|
|
@@ -680,4 +754,4 @@ declare class GameEntity<O extends GameEntityOptions> extends BaseNode<O> implem
|
|
|
680
754
|
*/
|
|
681
755
|
declare function create(options?: Partial<GameEntityOptions>): GameEntity<GameEntityOptions>;
|
|
682
756
|
|
|
683
|
-
export { type Action as A,
|
|
757
|
+
export { type Action as A, getRotation as B, type CollisionComponent as C, type DroppableAreaOptions as D, GameEntityLifeCycle as E, EntityBuilder as F, GameEntity as G, type HoverAreaOptions as H, EntityMeshBuilder as I, EntityCollisionBuilder as J, type PointerAreaContext as P, type PlacementPointContext as a, type PointerTargetEntity as b, create as c, type GameEntityOptions as d, boxCollision as e, coneCollision as f, cylinderCollision as g, pillCollision as h, planeCollision as i, rotateYEuler as j, rotateEuler as k, rotateX as l, rotateY as m, rotateZ as n, setRotationY as o, pyramidCollision as p, setRotationX as q, rotateInDirection as r, sphereCollision as s, setRotationZ as t, setRotationDegrees as u, setRotationDegreesY as v, setRotationDegreesX as w, setRotationDegreesZ as x, setRotation as y, zoneCollision as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Vector3, Sprite, Texture, Color, Box3, Object3D, ColorRepresentation, Light, Fog, FogExp2, Scene, Raycaster } from 'three';
|
|
2
2
|
import { B as BaseNode } from './base-node-idopiSw5.js';
|
|
3
|
-
import { G as GameEntity,
|
|
3
|
+
import { G as GameEntity, d as GameEntityOptions } from './entity-CY75JJSw.js';
|
|
4
4
|
import { d as Vec3Components, e as Vec3Input, b as Vec2Input } from './vector-D3eDzvcA.js';
|
|
5
5
|
import { U as UpdateContext, a as SetupContext, D as DestroyContext, l as CleanupContext } from './base-node-life-cycle-BK9xebT9.js';
|
|
6
|
-
import { T as TexturePath,
|
|
6
|
+
import { T as TexturePath, g as MaterialOptions } from './material-D1IVeQc5.js';
|
|
7
7
|
import { d as SelectionBoundsProvider } from './selection-bounds-BKmSo9aG.js';
|
|
8
8
|
import { Simulation } from '@zylem/behaviors/core';
|
|
9
9
|
import { E as Entity } from './entity-BIf_a4dl.js';
|
package/dist/entity.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ak as ScreenAnchor } from './entity-type-map-
|
|
2
|
-
export { A as ACTOR_TYPE, a1 as AmbientLightOptions, B as BOX_TYPE, F as CONE_TYPE, L as CYLINDER_TYPE, C as CollisionShapeType, D as DISK_TYPE, a3 as DirectionalLightOptions, am as EntityForType, al as EntityTypeMap, a9 as FOG_TYPE, a2 as HemisphereLightOptions, $ as LIGHT_TYPE, ac as LINE_TYPE, a6 as LightShadowOptions, af as LinePickResult, o as OnEnterParams, p as OnExitParams, O as OnHeldParams, W as PARTICLE_SYSTEM_TYPE, Q as PILL_TYPE, P as PLANE_TYPE, I as PYRAMID_TYPE, a4 as PointLightOptions, R as RECT_TYPE, w as RectShape, S as SPHERE_TYPE, f as SPRITE_TYPE, a5 as SpotLightOptions, h as SpriteAnimation, g as SpriteImage, i as SpriteSheet, T as TEXT_TYPE, n as ZONE_TYPE, r as ZylemActor, Z as ZylemBox, E as ZylemCone, K as ZylemCylinder, y as ZylemDisk, a8 as ZylemFog, ai as ZylemFogHeightOptions, aj as ZylemFogNoiseOptions, ag as ZylemFogOptions, ah as ZylemFogType, _ as ZylemLight, a0 as ZylemLightOptions, ab as ZylemLine, ae as ZylemLineOptions, V as ZylemParticleSystem, X as ZylemParticleSystemOptions, N as ZylemPill, k as ZylemPlane, H as ZylemPyramid, v as ZylemRect, b as ZylemSphere, e as ZylemSprite, t as ZylemText, m as ZylemZone, q as createActor, c as createBox, z as createCone, J as createCylinder, x as createDisk, a7 as createFog, Y as createLight, aa as createLine, U as createParticleSystem, M as createPill, j as createPlane, G as createPyramid, u as createRect, a as createSphere, d as createSprite, s as createText, l as createZone, ad as pickZylemLine } from './entity-type-map-
|
|
3
|
-
import { G as GameEntity,
|
|
4
|
-
export { C as CollisionComponent,
|
|
1
|
+
import { ak as ScreenAnchor } from './entity-type-map-BMaPY8cd.js';
|
|
2
|
+
export { A as ACTOR_TYPE, a1 as AmbientLightOptions, B as BOX_TYPE, F as CONE_TYPE, L as CYLINDER_TYPE, C as CollisionShapeType, D as DISK_TYPE, a3 as DirectionalLightOptions, am as EntityForType, al as EntityTypeMap, a9 as FOG_TYPE, a2 as HemisphereLightOptions, $ as LIGHT_TYPE, ac as LINE_TYPE, a6 as LightShadowOptions, af as LinePickResult, o as OnEnterParams, p as OnExitParams, O as OnHeldParams, W as PARTICLE_SYSTEM_TYPE, Q as PILL_TYPE, P as PLANE_TYPE, I as PYRAMID_TYPE, a4 as PointLightOptions, R as RECT_TYPE, w as RectShape, S as SPHERE_TYPE, f as SPRITE_TYPE, a5 as SpotLightOptions, h as SpriteAnimation, g as SpriteImage, i as SpriteSheet, T as TEXT_TYPE, n as ZONE_TYPE, r as ZylemActor, Z as ZylemBox, E as ZylemCone, K as ZylemCylinder, y as ZylemDisk, a8 as ZylemFog, ai as ZylemFogHeightOptions, aj as ZylemFogNoiseOptions, ag as ZylemFogOptions, ah as ZylemFogType, _ as ZylemLight, a0 as ZylemLightOptions, ab as ZylemLine, ae as ZylemLineOptions, V as ZylemParticleSystem, X as ZylemParticleSystemOptions, N as ZylemPill, k as ZylemPlane, H as ZylemPyramid, v as ZylemRect, b as ZylemSphere, e as ZylemSprite, t as ZylemText, m as ZylemZone, q as createActor, c as createBox, z as createCone, J as createCylinder, x as createDisk, a7 as createFog, Y as createLight, aa as createLine, U as createParticleSystem, M as createPill, j as createPlane, G as createPyramid, u as createRect, a as createSphere, d as createSprite, s as createText, l as createZone, ad as pickZylemLine } from './entity-type-map-BMaPY8cd.js';
|
|
3
|
+
import { G as GameEntity, d as GameEntityOptions, F as EntityBuilder, I as EntityMeshBuilder, J as EntityCollisionBuilder } from './entity-CY75JJSw.js';
|
|
4
|
+
export { C as CollisionComponent, e as boxCollision, f as coneCollision, c as create, g as cylinderCollision, h as pillCollision, i as planeCollision, p as pyramidCollision, s as sphereCollision, z as zoneCollision } from './entity-CY75JJSw.js';
|
|
5
5
|
import { Color, Mesh } from 'three';
|
|
6
6
|
import { B as BaseNode } from './base-node-idopiSw5.js';
|
|
7
7
|
import { b as Vec2Input, e as Vec3Input } from './vector-D3eDzvcA.js';
|
|
8
|
-
import {
|
|
8
|
+
import { g as MaterialOptions } from './material-D1IVeQc5.js';
|
|
9
9
|
import './base-node-life-cycle-BK9xebT9.js';
|
|
10
10
|
import './stage-transition-CmGpV4tc.js';
|
|
11
11
|
import './selection-bounds-BKmSo9aG.js';
|
package/dist/entity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ma,b as na,c as oa,d as pa,e as qa}from"./chunk-
|
|
1
|
+
import{a as ma,b as na,c as oa,d as pa,e as qa}from"./chunk-CVKEWWIH.js";import{a as ba,b as ca,c as da,d as ea,e as fa,f as ga,g as ha,h as ia,i as ja,j as ka,l as la}from"./chunk-63T3K5EQ.js";import{a as X,b as Y,c as Z,d as _,e as $,f as aa}from"./chunk-M2FZ224T.js";import{A as J,B as K,C as L,D as M,E as N,J as R,K as S,L as T,M as U,N as V,O as W,b as j,c as k,d as l,e as m,f as n,g as o,h as p,i as q,j as r,k as s,l as t,m as u,n as v,o as w,p as x,q as y,r as z,s as A,t as B,u as C,v as D,w as E,x as F,y as G,z as I}from"./chunk-DYD7MDWO.js";import{d as H,e as O,f as P,g as Q}from"./chunk-IHGRFR4H.js";import{E as i,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h}from"./chunk-AJSIVGDX.js";import"./chunk-EVYHPR3J.js";import"./chunk-XRP4JJXL.js";import"./chunk-Q22Z4PBD.js";import"./chunk-AIQ6IVT5.js";import"./chunk-QXVH6POE.js";import"./chunk-UUOPT2N4.js";import"./chunk-4QLJUQSJ.js";import"./chunk-7WRQ2UAN.js";import"./chunk-WOT6VMZA.js";export{X as ACTOR_TYPE,p as BOX_TYPE,v as CONE_TYPE,B as CYLINDER_TYPE,I as DISK_TYPE,_ as FOG_TYPE,U as LIGHT_TYPE,ha as LINE_TYPE,ma as PARTICLE_SYSTEM_TYPE,E as PILL_TYPE,L as PLANE_TYPE,y as PYRAMID_TYPE,R as RECT_TYPE,s as SPHERE_TYPE,ea as SPRITE_TYPE,ba as TEXT_TYPE,O as ZONE_TYPE,Y as ZylemActor,q as ZylemBox,w as ZylemCone,C as ZylemCylinder,J as ZylemDisk,$ as ZylemFog,V as ZylemLight,ja as ZylemLine,na as ZylemParticleSystem,F as ZylemPill,M as ZylemPlane,z as ZylemPyramid,S as ZylemRect,t as ZylemSphere,fa as ZylemSprite,ca as ZylemText,P as ZylemZone,a as boxCollision,j as boxMesh,c as coneCollision,l as coneMesh,i as create,Z as createActor,r as createBox,x as createCone,pa as createCooldownIcon,D as createCylinder,K as createDisk,H as createEntity,la as createEntityFactory,aa as createFog,W as createLight,ka as createLine,oa as createParticleSystem,G as createPill,N as createPlane,A as createPyramid,T as createRect,u as createSphere,ga as createSprite,da as createText,Q as createZone,e as cylinderCollision,n as cylinderMesh,qa as destroy,ia as pickZylemLine,f as pillCollision,o as pillMesh,g as planeCollision,d as pyramidCollision,m as pyramidMesh,b as sphereCollision,k as sphereMesh,h as zoneCollision};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { e as InputPlayerNumber, f as InputProvider, I as Inputs, a as SetupContext, U as UpdateContext, D as DestroyContext, m as IGame, h as SetupFunction, g as UpdateFunction, j as DestroyFunction, S as StageNavigationOptions } from './base-node-life-cycle-BK9xebT9.js';
|
|
2
2
|
import { G as GameInputConfig, B as BaseGlobals, Z as ZylemGameConfig } from './game-interfaces-vF5sRi1n.js';
|
|
3
3
|
import { B as BaseNode } from './base-node-idopiSw5.js';
|
|
4
|
-
import { B as BaseEntityInterface, q as Stage } from './stage-
|
|
5
|
-
import {
|
|
4
|
+
import { B as BaseEntityInterface, q as Stage } from './stage-CCGJh9TD.js';
|
|
5
|
+
import { E as GameEntityLifeCycle } from './entity-CY75JJSw.js';
|
|
6
6
|
import { Color, Vector3 } from 'three';
|
|
7
7
|
import { d as Vec3Components } from './vector-D3eDzvcA.js';
|
|
8
8
|
import { D as DefaultTouchControlsOptions } from './default-controls-CAKJ5zlo.js';
|
|
9
9
|
import { GameEvents } from './events.js';
|
|
10
10
|
import { Simulation } from '@zylem/behaviors/core';
|
|
11
|
-
import { l as ZylemCamera, R as RendererManager } from './zylem-camera-
|
|
11
|
+
import { l as ZylemCamera, R as RendererManager } from './zylem-camera-BA3VPFlS.js';
|
|
12
12
|
import { S as StageTransitionConfig } from './stage-transition-CmGpV4tc.js';
|
|
13
13
|
|
|
14
14
|
declare class InputManager {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"./chunk-UKNMIHAP.js";import"./chunk-KL7NGD76.js";import"./chunk-WBQ5TNRZ.js";import"./chunk-BH53MBAZ.js";import"./chunk-UG22Z42P.js";import"./chunk-Y5IU6IA5.js";import"./chunk-47HAZZWF.js";import"./chunk-273CUPEO.js";import"./chunk-UM5VNQPY.js";import"./chunk-2HSR5XDQ.js";import"./chunk-D2PATZCC.js";import"./chunk-M2FZ224T.js";import"./chunk-IHGRFR4H.js";import"./chunk-AJSIVGDX.js";import"./chunk-EVYHPR3J.js";import"./chunk-XRP4JJXL.js";import"./chunk-Q22Z4PBD.js";import"./chunk-AIQ6IVT5.js";import"./chunk-QXVH6POE.js";import"./chunk-UUOPT2N4.js";import"./chunk-4QLJUQSJ.js";import"./chunk-7WRQ2UAN.js";import"./chunk-WOT6VMZA.js";import{proxy as t}from"valtio/vanilla";var s=()=>({id:"zylem",globals:{},stages:[e()],debug:!1,time:0,input:void 0}),a=t({...s()});function o(){return{id:a.id??"zylem",globals:a.globals??{},stages:a.stages??[e()],debug:a.debug,time:a.time,input:a.input}}export{o as getGameDefaultConfig};
|
package/dist/graphics.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { Z as ZylemPostEffect } from './zylem-camera-
|
|
1
|
+
import { e as ZylemTSLShader } from './material-D1IVeQc5.js';
|
|
2
|
+
export { E as EntityGlowOptions, f as ZylemShader, Z as ZylemShaderObject, b as applyEntityGlow, d as createEntityGlowMaterial, c as createNodeMaterialFromTSL, a as isGLSLShader, i as isTSLShader } from './material-D1IVeQc5.js';
|
|
3
|
+
export { Z as ZylemPostEffect } from './zylem-camera-BA3VPFlS.js';
|
|
4
4
|
export { S as StageTransitionConfig, a as StageTransitionEasing, Z as ZylemTransitionShader, c as crossfadeTransitionShader } from './stage-transition-CmGpV4tc.js';
|
|
5
5
|
export { Fn, abs, asin, atan, clamp, cos, dot, exp, float, floor, fract, length, max, min, mix, mod, normalize, positionWorld, positionWorldDirection, pow, sin, smoothstep, step, time, uniform, uv, vec2, vec3, vec4 } from 'three/tsl';
|
|
6
6
|
import 'three';
|
package/dist/graphics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as B,n as C,o as D,p as E,q as F,r as G,s as H,t as I,u as J,v as K,w as L}from"./chunk-4DAITCJS.js";import{a as o}from"./chunk-7GYFZKK7.js";import{c as a,d as b,h as c,i as d,j as e,k as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n}from"./chunk-Q22Z4PBD.js";import"./chunk-QXVH6POE.js";import"./chunk-7WRQ2UAN.js";import"./chunk-WOT6VMZA.js";export{n as Fn,A as abs,d as applyEntityGlow,z as asin,y as atan,v as clamp,x as cos,p as createBackgroundShader,c as createEntityGlowMaterial,g as createNodeMaterialFromTSL,o as crossfadeTransitionShader,I as dot,B as exp,m as float,G as floor,H as fract,f as isGLSLShader,e as isTSLShader,J as length,E as max,F as min,t as mix,L as mod,s as normalize,a as objectVertexShader,r as positionWorld,q as positionWorldDirection,C as pow,w as sin,u as smoothstep,b as standardShader,D as step,j as time,h as uniform,i as uv,K as vec2,k as vec3,l as vec4};
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Color, Material, Blending, Side } from 'three';
|
|
2
2
|
import { MeshBasicNodeMaterial } from 'three/webgpu';
|
|
3
3
|
import { b as Vec2Input } from './vector-D3eDzvcA.js';
|
|
4
4
|
|
|
5
5
|
declare function shortHash(objString: string): string;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Inexpensive fresnel glow for an entity material.
|
|
9
|
+
*
|
|
10
|
+
* This is one extra term in the material shader. It does not add a bloom
|
|
11
|
+
* pass or a second mesh.
|
|
12
|
+
*/
|
|
13
|
+
interface EntityGlowOptions {
|
|
14
|
+
/** Glow color. Defaults to the material color, then white. */
|
|
15
|
+
color?: Color | string;
|
|
16
|
+
/** Brightness multiplier. Default `2.8`. */
|
|
17
|
+
intensity?: number;
|
|
18
|
+
/**
|
|
19
|
+
* How far a flat-color glow extends past the surface, in local units.
|
|
20
|
+
* `0` keeps the mesh size. Default `0.06`. Ignored when glow is added
|
|
21
|
+
* as emissive light on a textured or custom-shader material.
|
|
22
|
+
*/
|
|
23
|
+
size?: number;
|
|
24
|
+
/**
|
|
25
|
+
* How quickly brightness falls toward the silhouette.
|
|
26
|
+
* Higher values keep the hot core tighter. Default `1.6`.
|
|
27
|
+
*/
|
|
28
|
+
falloff?: number;
|
|
29
|
+
}
|
|
30
|
+
interface ResolvedEntityGlow {
|
|
31
|
+
color: Color | string;
|
|
32
|
+
intensity: number;
|
|
33
|
+
size: number;
|
|
34
|
+
falloff: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Unlit additive glow. Bright at the center and faded at a slightly expanded
|
|
38
|
+
* silhouette, so a small mesh reads as a soft halo in a single draw.
|
|
39
|
+
*/
|
|
40
|
+
declare function createEntityGlowMaterial(options: ResolvedEntityGlow): MeshBasicNodeMaterial;
|
|
41
|
+
/**
|
|
42
|
+
* Add a fresnel emissive term to an existing node material.
|
|
43
|
+
* The original color, texture, or shader stays in place.
|
|
44
|
+
*/
|
|
45
|
+
declare function applyEntityGlow(material: Material, options: ResolvedEntityGlow): void;
|
|
46
|
+
|
|
7
47
|
/**
|
|
8
48
|
* GLSL shader object (traditional WebGL approach).
|
|
9
49
|
*
|
|
@@ -63,6 +103,12 @@ interface MaterialOptions {
|
|
|
63
103
|
* This flag is ignored.
|
|
64
104
|
*/
|
|
65
105
|
useTSL?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Soft fresnel glow in the material shader. A flat color becomes an unlit
|
|
108
|
+
* additive halo. A texture or custom shader keeps its surface and gains
|
|
109
|
+
* emissive rim light. This does not add a bloom pass.
|
|
110
|
+
*/
|
|
111
|
+
glow?: boolean | EntityGlowOptions;
|
|
66
112
|
}
|
|
67
113
|
type SharedGeometryMap = Map<symbol, number>;
|
|
68
114
|
interface SharedMaterialMapEntry {
|
|
@@ -123,4 +169,4 @@ declare class MaterialBuilder {
|
|
|
123
169
|
*/
|
|
124
170
|
declare function createNodeMaterialFromTSL(tslShader: ZylemTSLShader, opacity?: number): MeshBasicNodeMaterial;
|
|
125
171
|
|
|
126
|
-
export { MaterialBuilder as M, type TexturePath as T, type ZylemShaderObject as Z, isGLSLShader as a,
|
|
172
|
+
export { type EntityGlowOptions as E, MaterialBuilder as M, type TexturePath as T, type ZylemShaderObject as Z, isGLSLShader as a, applyEntityGlow as b, createNodeMaterialFromTSL as c, createEntityGlowMaterial as d, type ZylemTSLShader as e, type ZylemShader as f, type MaterialOptions as g, isTSLShader as i };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { G as GameEntity, a as PlacementPointContext } from './entity-CY75JJSw.js';
|
|
2
|
+
import { e as Vec3Input, d as Vec3Components } from './vector-D3eDzvcA.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The object drawn under the cursor while a placement is armed.
|
|
6
|
+
*
|
|
7
|
+
* It is not spawned. Spawning it would put a ghost in `childrenMap`, the
|
|
8
|
+
* entity list, and the physics world, and the pointer ray would hit the thing
|
|
9
|
+
* it is trying to place. The render object is cloned (geometry and materials
|
|
10
|
+
* included, so disposing the throwaway source cannot blank the preview) and
|
|
11
|
+
* parented to a scene group, the same idea as the editor's PlacementGhost.
|
|
12
|
+
* Materials are kept, not replaced with a flat color, so a sprite still looks
|
|
13
|
+
* like the sprite. Opacity is animated here; `onFrame` can drive the rest.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface RepresentativeLook {
|
|
17
|
+
opacity?: number;
|
|
18
|
+
color?: number | string;
|
|
19
|
+
}
|
|
20
|
+
interface RepresentativeFrame {
|
|
21
|
+
delta: number;
|
|
22
|
+
opacity: number;
|
|
23
|
+
setOpacity: (opacity: number) => void;
|
|
24
|
+
valid: boolean;
|
|
25
|
+
position: Vec3Components;
|
|
26
|
+
}
|
|
27
|
+
interface EntityRepresentativeOptions {
|
|
28
|
+
/** Resting opacity when a look doesn't override it. Defaults to 0.45. */
|
|
29
|
+
opacity?: number;
|
|
30
|
+
/** Seconds to fade in, and to fade between valid and invalid. */
|
|
31
|
+
fadeIn?: number;
|
|
32
|
+
/** Seconds to fade out when the session ends. */
|
|
33
|
+
fadeOut?: number;
|
|
34
|
+
valid?: RepresentativeLook;
|
|
35
|
+
invalid?: RepresentativeLook;
|
|
36
|
+
/** Added to the preview only. The spawned entity does not inherit it. */
|
|
37
|
+
offset?: Vec3Input;
|
|
38
|
+
onFrame?: (state: RepresentativeFrame) => void;
|
|
39
|
+
}
|
|
40
|
+
type RepresentativeSource = GameEntity<any> | (() => GameEntity<any>);
|
|
41
|
+
interface EntityRepresentative {
|
|
42
|
+
source: RepresentativeSource;
|
|
43
|
+
options: EntityRepresentativeOptions;
|
|
44
|
+
}
|
|
45
|
+
/** What follows the cursor. The stage builds the preview when the session arms. */
|
|
46
|
+
declare function entityRepresentative(source: RepresentativeSource, options?: EntityRepresentativeOptions): EntityRepresentative;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Authoring types for a click-to-place session.
|
|
50
|
+
*
|
|
51
|
+
* The session is armed on the stage. The representative follows the cursor,
|
|
52
|
+
* and a left click asks `spawnOnClick` for the entity to add. Drag-to-drop is
|
|
53
|
+
* not this session — picking something up is a hover-area click that arms one.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
interface ArmPlacementOptions {
|
|
57
|
+
representative: EntityRepresentative;
|
|
58
|
+
/** Handed to droppable `accepts` and to `spawnOnClick`. Author-defined. */
|
|
59
|
+
payload?: unknown;
|
|
60
|
+
/**
|
|
61
|
+
* Left click while armed. Return an entity (or a factory / promise the
|
|
62
|
+
* stage can spawn) to add it. Return `null` or `false` to reject the click.
|
|
63
|
+
* Called only when the cursor is somewhere a placement is allowed.
|
|
64
|
+
*/
|
|
65
|
+
spawnOnClick?: (ctx: PlacementPointContext) => unknown;
|
|
66
|
+
/** Stay armed after a successful click so the next click places another. */
|
|
67
|
+
repeat?: boolean;
|
|
68
|
+
/** World-unit lattice. Omit to keep the hit point or the area center. */
|
|
69
|
+
snap?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Where the preview sits while a droppable is under the cursor.
|
|
72
|
+
* Defaults to the area's own `placeAt`, then `'area'`.
|
|
73
|
+
*/
|
|
74
|
+
placeAt?: 'area' | 'hit';
|
|
75
|
+
}
|
|
76
|
+
interface PlacementSession {
|
|
77
|
+
cancel(): void;
|
|
78
|
+
setPayload(payload: unknown): void;
|
|
79
|
+
setRepresentative(representative: EntityRepresentative): void;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { type ArmPlacementOptions as A, type EntityRepresentative as E, type PlacementSession as P, type RepresentativeFrame as R, type EntityRepresentativeOptions as a, type RepresentativeLook as b, type RepresentativeSource as c, entityRepresentative as e };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { B as BaseNode } from './base-node-idopiSw5.js';
|
|
2
|
+
import { d as GameEntityOptions, H as HoverAreaOptions, G as GameEntity, P as PointerAreaContext, D as DroppableAreaOptions, a as PlacementPointContext } from './entity-CY75JJSw.js';
|
|
3
|
+
export { b as PointerTargetEntity } from './entity-CY75JJSw.js';
|
|
4
|
+
export { A as ArmPlacementOptions, E as EntityRepresentative, a as EntityRepresentativeOptions, P as PlacementSession, R as RepresentativeFrame, b as RepresentativeLook, c as RepresentativeSource, e as entityRepresentative } from './placement-session-BNQoL7Jb.js';
|
|
5
|
+
import './base-node-life-cycle-BK9xebT9.js';
|
|
6
|
+
import 'three';
|
|
7
|
+
import './stage-transition-CmGpV4tc.js';
|
|
8
|
+
import '@zylem/behaviors/core';
|
|
9
|
+
import './simulation-body-zQw-emOr.js';
|
|
10
|
+
import './vector-D3eDzvcA.js';
|
|
11
|
+
import './material-D1IVeQc5.js';
|
|
12
|
+
import 'three/webgpu';
|
|
13
|
+
import './collision-builder-BckxkdmA.js';
|
|
14
|
+
import './events.js';
|
|
15
|
+
import 'mitt';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Invisible pointer volumes.
|
|
19
|
+
*
|
|
20
|
+
* These are entities so they join a stage the same way a box does, but they
|
|
21
|
+
* have no collider. Hit testing is a ray against the authored box — a sensor
|
|
22
|
+
* would be skipped by the solid-only physics raycast, and a hotspot should
|
|
23
|
+
* not push characters around. An existing mesh can take the same role with
|
|
24
|
+
* `entity.hoverArea(...)` / `entity.droppableArea(...)`.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
type HoverAreaEntityOptions = GameEntityOptions & HoverAreaOptions;
|
|
28
|
+
type DroppableAreaEntityOptions = GameEntityOptions & DroppableAreaOptions;
|
|
29
|
+
declare const HOVER_AREA_TYPE: unique symbol;
|
|
30
|
+
declare const DROPPABLE_AREA_TYPE: unique symbol;
|
|
31
|
+
declare class ZylemHoverArea extends GameEntity<HoverAreaEntityOptions> {
|
|
32
|
+
static type: symbol;
|
|
33
|
+
protected areaName: string;
|
|
34
|
+
constructor(options?: HoverAreaEntityOptions);
|
|
35
|
+
create(): this;
|
|
36
|
+
onEnter(callback: (ctx: PointerAreaContext) => void): this;
|
|
37
|
+
onLeave(callback: (ctx: PointerAreaContext) => void): this;
|
|
38
|
+
onMove(callback: (ctx: PointerAreaContext) => void): this;
|
|
39
|
+
onClick(callback: (ctx: PointerAreaContext) => void): this;
|
|
40
|
+
}
|
|
41
|
+
declare class ZylemDroppableArea extends ZylemHoverArea {
|
|
42
|
+
static type: symbol;
|
|
43
|
+
protected areaName: string;
|
|
44
|
+
onDrop(callback: (ctx: PlacementPointContext) => void): this;
|
|
45
|
+
accepts(predicate: NonNullable<DroppableAreaOptions['accepts']>): this;
|
|
46
|
+
}
|
|
47
|
+
type HoverAreaArgs = BaseNode | Partial<HoverAreaEntityOptions>;
|
|
48
|
+
type DroppableAreaArgs = BaseNode | Partial<DroppableAreaEntityOptions>;
|
|
49
|
+
declare function createHoverArea(...args: Array<HoverAreaArgs>): ZylemHoverArea;
|
|
50
|
+
declare function createDroppableArea(...args: Array<DroppableAreaArgs>): ZylemDroppableArea;
|
|
51
|
+
|
|
52
|
+
export { DROPPABLE_AREA_TYPE, DroppableAreaOptions, HOVER_AREA_TYPE, HoverAreaOptions, PlacementPointContext, PointerAreaContext, ZylemDroppableArea, ZylemHoverArea, createDroppableArea, createHoverArea };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g}from"./chunk-MJ7RGE47.js";import{c as a}from"./chunk-Y5IU6IA5.js";import"./chunk-AJSIVGDX.js";import"./chunk-EVYHPR3J.js";import"./chunk-XRP4JJXL.js";import"./chunk-Q22Z4PBD.js";import"./chunk-AIQ6IVT5.js";import"./chunk-QXVH6POE.js";import"./chunk-7WRQ2UAN.js";import"./chunk-WOT6VMZA.js";export{c as DROPPABLE_AREA_TYPE,b as HOVER_AREA_TYPE,e as ZylemDroppableArea,d as ZylemHoverArea,g as createDroppableArea,f as createHoverArea,a as entityRepresentative};
|