@zylem/game-lib 0.6.0 → 0.6.3
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 +9 -16
- package/dist/actions.d.ts +30 -21
- package/dist/actions.js +628 -145
- package/dist/actions.js.map +1 -1
- package/dist/behavior/platformer-3d.d.ts +296 -0
- package/dist/behavior/platformer-3d.js +518 -0
- package/dist/behavior/platformer-3d.js.map +1 -0
- package/dist/behavior/ricochet-2d.d.ts +274 -0
- package/dist/behavior/ricochet-2d.js +394 -0
- package/dist/behavior/ricochet-2d.js.map +1 -0
- package/dist/behavior/screen-wrap.d.ts +86 -0
- package/dist/behavior/screen-wrap.js +195 -0
- package/dist/behavior/screen-wrap.js.map +1 -0
- package/dist/behavior/thruster.d.ts +10 -0
- package/dist/behavior/thruster.js +234 -0
- package/dist/behavior/thruster.js.map +1 -0
- package/dist/behavior/world-boundary-2d.d.ts +141 -0
- package/dist/behavior/world-boundary-2d.js +181 -0
- package/dist/behavior/world-boundary-2d.js.map +1 -0
- package/dist/behavior-descriptor-BWNWmIjv.d.ts +142 -0
- package/dist/{blueprints-BOCc3Wve.d.ts → blueprints-BWGz8fII.d.ts} +2 -2
- package/dist/camera-B5e4c78l.d.ts +468 -0
- package/dist/camera.d.ts +3 -2
- package/dist/camera.js +962 -166
- package/dist/camera.js.map +1 -1
- package/dist/composition-DrzFrbqI.d.ts +218 -0
- package/dist/{core-CZhozNRH.d.ts → core-DAkskq6Y.d.ts} +97 -65
- package/dist/core.d.ts +12 -6
- package/dist/core.js +4449 -1052
- package/dist/core.js.map +1 -1
- package/dist/{entities-BAxfJOkk.d.ts → entities-DC9ce_vx.d.ts} +154 -45
- package/dist/entities.d.ts +5 -2
- package/dist/entities.js +2505 -722
- package/dist/entities.js.map +1 -1
- package/dist/entity-BpbZqg19.d.ts +1100 -0
- package/dist/entity-types-DAu8sGJH.d.ts +26 -0
- package/dist/global-change-Dc8uCKi2.d.ts +25 -0
- package/dist/main.d.ts +472 -29
- package/dist/main.js +11877 -6124
- package/dist/main.js.map +1 -1
- package/dist/{stage-types-CD21XoIU.d.ts → stage-types-BFsm3qsZ.d.ts} +255 -26
- package/dist/stage.d.ts +11 -6
- package/dist/stage.js +3462 -491
- package/dist/stage.js.map +1 -1
- package/dist/thruster-DhRaJnoL.d.ts +172 -0
- package/dist/world-Be5m1XC1.d.ts +31 -0
- package/package.json +21 -4
- package/dist/behaviors.d.ts +0 -106
- package/dist/behaviors.js +0 -398
- package/dist/behaviors.js.map +0 -1
- package/dist/camera-CpbDr4-V.d.ts +0 -116
- package/dist/entity-COvRtFNG.d.ts +0 -395
- package/dist/moveable-B_vyA6cw.d.ts +0 -67
- package/dist/transformable-CUhvyuYO.d.ts +0 -67
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as GameEntity, P as GameEntityOptions, U as UpdateContext, M as DestroyContext, N as BaseNode, as as TexturePath, V as Vec3, R as MaterialOptions } from './entity-BpbZqg19.js';
|
|
2
2
|
import { Vector3, Sprite, Color, Vector2, Object3D } from 'three';
|
|
3
|
-
import
|
|
4
|
-
import { E as Entity } from './entity-Bq_eNEDI.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Interface for entities that handle collision events.
|
|
8
|
-
*/
|
|
9
|
-
interface CollisionHandlerDelegate {
|
|
10
|
-
handlePostCollision(params: any): boolean;
|
|
11
|
-
handleIntersectionEvent(params: any): void;
|
|
12
|
-
}
|
|
13
|
-
declare class ZylemWorld implements Entity<ZylemWorld> {
|
|
14
|
-
type: string;
|
|
15
|
-
world: World;
|
|
16
|
-
collisionMap: Map<string, GameEntity<any>>;
|
|
17
|
-
collisionBehaviorMap: Map<string, GameEntity<any>>;
|
|
18
|
-
_removalMap: Map<string, GameEntity<any>>;
|
|
19
|
-
static loadPhysics(gravity: Vector3): Promise<RAPIER__default.World>;
|
|
20
|
-
constructor(world: World);
|
|
21
|
-
addEntity(entity: any): void;
|
|
22
|
-
setForRemoval(entity: any): void;
|
|
23
|
-
destroyEntity(entity: GameEntity<any>): void;
|
|
24
|
-
setup(): void;
|
|
25
|
-
update(params: UpdateContext<any>): void;
|
|
26
|
-
updatePostCollisionBehaviors(delta: number): void;
|
|
27
|
-
updateColliders(delta: number): void;
|
|
28
|
-
destroy(): void;
|
|
29
|
-
}
|
|
3
|
+
import { C as CollisionHandlerDelegate } from './world-Be5m1XC1.js';
|
|
30
4
|
|
|
31
5
|
type SpriteImage = {
|
|
32
6
|
name: string;
|
|
@@ -61,12 +35,12 @@ declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
|
61
35
|
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
62
36
|
setSprite(key: string): void;
|
|
63
37
|
setAnimation(name: string, delta: number): void;
|
|
64
|
-
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>):
|
|
65
|
-
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>):
|
|
38
|
+
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): void;
|
|
39
|
+
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
|
|
66
40
|
buildInfo(): Record<string, any>;
|
|
67
41
|
}
|
|
68
42
|
type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
|
|
69
|
-
declare function
|
|
43
|
+
declare function createSprite(...args: Array<SpriteOptions>): ZylemSprite;
|
|
70
44
|
|
|
71
45
|
type ZylemSphereOptions = GameEntityOptions & {
|
|
72
46
|
radius?: number;
|
|
@@ -78,7 +52,7 @@ declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
|
|
|
78
52
|
buildInfo(): Record<string, any>;
|
|
79
53
|
}
|
|
80
54
|
type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
|
|
81
|
-
declare function
|
|
55
|
+
declare function createSphere(...args: Array<SphereOptions>): ZylemSphere;
|
|
82
56
|
|
|
83
57
|
type ZylemRectOptions = GameEntityOptions & {
|
|
84
58
|
width?: number;
|
|
@@ -122,8 +96,16 @@ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
|
122
96
|
constructor(options?: ZylemRectOptions);
|
|
123
97
|
private createSprite;
|
|
124
98
|
private redrawRect;
|
|
99
|
+
getWidth(): number;
|
|
100
|
+
getHeight(): number;
|
|
125
101
|
private roundedRectPath;
|
|
126
102
|
private toCssColor;
|
|
103
|
+
/**
|
|
104
|
+
* Get the viewport resolution from the renderer DOM element,
|
|
105
|
+
* falling back to the camera's screenResolution if the renderer
|
|
106
|
+
* is not available (e.g. when using the new RendererManager path).
|
|
107
|
+
*/
|
|
108
|
+
private getResolution;
|
|
127
109
|
private rectSetup;
|
|
128
110
|
private rectUpdate;
|
|
129
111
|
private updateStickyTransform;
|
|
@@ -133,7 +115,7 @@ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
|
133
115
|
buildInfo(): Record<string, any>;
|
|
134
116
|
}
|
|
135
117
|
type RectOptions = BaseNode | Partial<ZylemRectOptions>;
|
|
136
|
-
declare function
|
|
118
|
+
declare function createRect(...args: Array<RectOptions>): ZylemRect;
|
|
137
119
|
|
|
138
120
|
type ZylemTextOptions = GameEntityOptions & {
|
|
139
121
|
text?: string;
|
|
@@ -179,7 +161,7 @@ declare class ZylemText extends GameEntity<ZylemTextOptions> {
|
|
|
179
161
|
private textDestroy;
|
|
180
162
|
}
|
|
181
163
|
type TextOptions = BaseNode | Partial<ZylemTextOptions>;
|
|
182
|
-
declare function
|
|
164
|
+
declare function createText(...args: Array<TextOptions>): ZylemText;
|
|
183
165
|
|
|
184
166
|
type ZylemBoxOptions = GameEntityOptions;
|
|
185
167
|
declare const BOX_TYPE: unique symbol;
|
|
@@ -188,14 +170,17 @@ declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
|
|
|
188
170
|
constructor(options?: ZylemBoxOptions);
|
|
189
171
|
buildInfo(): Record<string, any>;
|
|
190
172
|
}
|
|
191
|
-
type BoxOptions = BaseNode | ZylemBoxOptions
|
|
192
|
-
declare function
|
|
173
|
+
type BoxOptions = BaseNode | Partial<ZylemBoxOptions>;
|
|
174
|
+
declare function createBox(...args: Array<BoxOptions>): ZylemBox;
|
|
193
175
|
|
|
194
176
|
type ZylemPlaneOptions = GameEntityOptions & {
|
|
195
177
|
tile?: Vector2;
|
|
196
178
|
repeat?: Vector2;
|
|
197
179
|
texture?: TexturePath;
|
|
198
180
|
subdivisions?: number;
|
|
181
|
+
randomizeHeight?: boolean;
|
|
182
|
+
heightMap?: number[];
|
|
183
|
+
heightScale?: number;
|
|
199
184
|
};
|
|
200
185
|
declare const PLANE_TYPE: unique symbol;
|
|
201
186
|
declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
@@ -203,7 +188,7 @@ declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
|
203
188
|
constructor(options?: ZylemPlaneOptions);
|
|
204
189
|
}
|
|
205
190
|
type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
|
|
206
|
-
declare function
|
|
191
|
+
declare function createPlane(...args: Array<PlaneOptions>): ZylemPlane;
|
|
207
192
|
|
|
208
193
|
type OnHeldParams = {
|
|
209
194
|
delta: number;
|
|
@@ -243,10 +228,12 @@ declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collisio
|
|
|
243
228
|
held(delta: number, other: any): void;
|
|
244
229
|
}
|
|
245
230
|
type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
|
|
246
|
-
declare function
|
|
231
|
+
declare function createZone(...args: Array<ZoneOptions>): ZylemZone;
|
|
247
232
|
|
|
248
233
|
interface EntityLoaderDelegate {
|
|
249
|
-
|
|
234
|
+
/** Initiates loading (may be async internally, but call returns immediately) */
|
|
235
|
+
load(): void;
|
|
236
|
+
/** Returns data synchronously (may be null if still loading) */
|
|
250
237
|
data(): any;
|
|
251
238
|
}
|
|
252
239
|
|
|
@@ -269,12 +256,14 @@ type AnimationObject = {
|
|
|
269
256
|
key?: string;
|
|
270
257
|
path: string;
|
|
271
258
|
};
|
|
259
|
+
type CollisionShapeType = 'capsule' | 'model';
|
|
272
260
|
type ZylemActorOptions = GameEntityOptions & {
|
|
273
261
|
static?: boolean;
|
|
274
262
|
animations?: AnimationObject[];
|
|
275
263
|
models?: string[];
|
|
276
264
|
scale?: Vec3;
|
|
277
265
|
material?: MaterialOptions;
|
|
266
|
+
collisionShape?: CollisionShapeType;
|
|
278
267
|
};
|
|
279
268
|
declare const ACTOR_TYPE: unique symbol;
|
|
280
269
|
declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
|
|
@@ -285,15 +274,32 @@ declare class ZylemActor extends GameEntity<ZylemActorOptions> implements Entity
|
|
|
285
274
|
private _assetLoader;
|
|
286
275
|
controlledRotation: boolean;
|
|
287
276
|
constructor(options?: ZylemActorOptions);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Initiates model and animation loading in background (deferred).
|
|
279
|
+
* Call returns immediately; assets will be ready on subsequent updates.
|
|
280
|
+
*/
|
|
281
|
+
load(): void;
|
|
282
|
+
/**
|
|
283
|
+
* Returns current data synchronously.
|
|
284
|
+
* May return null values if loading is still in progress.
|
|
285
|
+
*/
|
|
286
|
+
data(): any;
|
|
287
|
+
actorUpdate(params: UpdateContext<ZylemActorOptions>): void;
|
|
291
288
|
/**
|
|
292
289
|
* Clean up actor resources including animations, models, and groups
|
|
293
290
|
*/
|
|
294
291
|
actorDestroy(): void;
|
|
295
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Deferred loading - starts async load and updates entity when complete.
|
|
294
|
+
* Called by synchronous load() method.
|
|
295
|
+
*/
|
|
296
|
+
private loadModelsDeferred;
|
|
296
297
|
playAnimation(animationOptions: AnimationOptions): void;
|
|
298
|
+
/**
|
|
299
|
+
* Apply material overrides from options to all meshes in the loaded model.
|
|
300
|
+
* Only applies if material options are explicitly specified (not just defaults).
|
|
301
|
+
*/
|
|
302
|
+
private applyMaterialOverrides;
|
|
297
303
|
get object(): Object3D | null;
|
|
298
304
|
/**
|
|
299
305
|
* Provide custom debug information for the actor
|
|
@@ -302,6 +308,109 @@ declare class ZylemActor extends GameEntity<ZylemActorOptions> implements Entity
|
|
|
302
308
|
getDebugInfo(): Record<string, any>;
|
|
303
309
|
}
|
|
304
310
|
type ActorOptions = BaseNode | ZylemActorOptions;
|
|
305
|
-
declare function
|
|
311
|
+
declare function createActor(...args: Array<ActorOptions>): ZylemActor;
|
|
312
|
+
|
|
313
|
+
type ZylemConeOptions = GameEntityOptions & {
|
|
314
|
+
/** Base radius of the cone */
|
|
315
|
+
radius?: number;
|
|
316
|
+
/** Height of the cone */
|
|
317
|
+
height?: number;
|
|
318
|
+
/** Number of radial segments (higher = smoother) */
|
|
319
|
+
radialSegments?: number;
|
|
320
|
+
};
|
|
321
|
+
declare const CONE_TYPE: unique symbol;
|
|
322
|
+
/**
|
|
323
|
+
* A cone entity with configurable radius, height, and radial segments.
|
|
324
|
+
* Uses a Rapier cone collider for physics.
|
|
325
|
+
*/
|
|
326
|
+
declare class ZylemCone extends GameEntity<ZylemConeOptions> {
|
|
327
|
+
static type: symbol;
|
|
328
|
+
constructor(options?: ZylemConeOptions);
|
|
329
|
+
buildInfo(): Record<string, any>;
|
|
330
|
+
}
|
|
331
|
+
type ConeOptions = BaseNode | Partial<ZylemConeOptions>;
|
|
332
|
+
/**
|
|
333
|
+
* Create a cone entity.
|
|
334
|
+
* @param args Options or child nodes
|
|
335
|
+
*/
|
|
336
|
+
declare function createCone(...args: Array<ConeOptions>): ZylemCone;
|
|
337
|
+
|
|
338
|
+
type ZylemPyramidOptions = GameEntityOptions & {
|
|
339
|
+
/** Base radius of the pyramid */
|
|
340
|
+
radius?: number;
|
|
341
|
+
/** Height of the pyramid */
|
|
342
|
+
height?: number;
|
|
343
|
+
};
|
|
344
|
+
declare const PYRAMID_TYPE: unique symbol;
|
|
345
|
+
/**
|
|
346
|
+
* A pyramid entity (4-sided cone).
|
|
347
|
+
* Uses ConeGeometry with 4 radial segments for the visual mesh
|
|
348
|
+
* and a Rapier cone collider for physics.
|
|
349
|
+
*/
|
|
350
|
+
declare class ZylemPyramid extends GameEntity<ZylemPyramidOptions> {
|
|
351
|
+
static type: symbol;
|
|
352
|
+
constructor(options?: ZylemPyramidOptions);
|
|
353
|
+
buildInfo(): Record<string, any>;
|
|
354
|
+
}
|
|
355
|
+
type PyramidOptions = BaseNode | Partial<ZylemPyramidOptions>;
|
|
356
|
+
/**
|
|
357
|
+
* Create a pyramid entity.
|
|
358
|
+
* @param args Options or child nodes
|
|
359
|
+
*/
|
|
360
|
+
declare function createPyramid(...args: Array<PyramidOptions>): ZylemPyramid;
|
|
361
|
+
|
|
362
|
+
type ZylemCylinderOptions = GameEntityOptions & {
|
|
363
|
+
/** Top radius of the cylinder */
|
|
364
|
+
radiusTop?: number;
|
|
365
|
+
/** Bottom radius of the cylinder */
|
|
366
|
+
radiusBottom?: number;
|
|
367
|
+
/** Height of the cylinder */
|
|
368
|
+
height?: number;
|
|
369
|
+
/** Number of radial segments (higher = smoother) */
|
|
370
|
+
radialSegments?: number;
|
|
371
|
+
};
|
|
372
|
+
declare const CYLINDER_TYPE: unique symbol;
|
|
373
|
+
/**
|
|
374
|
+
* A cylinder entity with configurable top/bottom radii, height, and segments.
|
|
375
|
+
* Uses a Rapier cylinder collider for physics.
|
|
376
|
+
*/
|
|
377
|
+
declare class ZylemCylinder extends GameEntity<ZylemCylinderOptions> {
|
|
378
|
+
static type: symbol;
|
|
379
|
+
constructor(options?: ZylemCylinderOptions);
|
|
380
|
+
buildInfo(): Record<string, any>;
|
|
381
|
+
}
|
|
382
|
+
type CylinderOptions = BaseNode | Partial<ZylemCylinderOptions>;
|
|
383
|
+
/**
|
|
384
|
+
* Create a cylinder entity.
|
|
385
|
+
* @param args Options or child nodes
|
|
386
|
+
*/
|
|
387
|
+
declare function createCylinder(...args: Array<CylinderOptions>): ZylemCylinder;
|
|
388
|
+
|
|
389
|
+
type ZylemPillOptions = GameEntityOptions & {
|
|
390
|
+
/** Radius of the capsule hemispheres */
|
|
391
|
+
radius?: number;
|
|
392
|
+
/** Length of the cylindrical middle section */
|
|
393
|
+
length?: number;
|
|
394
|
+
/** Number of cap segments (higher = smoother) */
|
|
395
|
+
capSegments?: number;
|
|
396
|
+
/** Number of radial segments (higher = smoother) */
|
|
397
|
+
radialSegments?: number;
|
|
398
|
+
};
|
|
399
|
+
declare const PILL_TYPE: unique symbol;
|
|
400
|
+
/**
|
|
401
|
+
* A pill/capsule entity with configurable radius and cylindrical length.
|
|
402
|
+
* Uses Three.js CapsuleGeometry for rendering and Rapier capsule collider for physics.
|
|
403
|
+
*/
|
|
404
|
+
declare class ZylemPill extends GameEntity<ZylemPillOptions> {
|
|
405
|
+
static type: symbol;
|
|
406
|
+
constructor(options?: ZylemPillOptions);
|
|
407
|
+
buildInfo(): Record<string, any>;
|
|
408
|
+
}
|
|
409
|
+
type PillOptions = BaseNode | Partial<ZylemPillOptions>;
|
|
410
|
+
/**
|
|
411
|
+
* Create a pill (capsule) entity.
|
|
412
|
+
* @param args Options or child nodes
|
|
413
|
+
*/
|
|
414
|
+
declare function createPill(...args: Array<PillOptions>): ZylemPill;
|
|
306
415
|
|
|
307
|
-
export { ACTOR_TYPE as A, BOX_TYPE as B, PLANE_TYPE as P, RECT_TYPE as R, SPRITE_TYPE as S, TEXT_TYPE as T,
|
|
416
|
+
export { ACTOR_TYPE as A, BOX_TYPE as B, CONE_TYPE as C, createCylinder as D, createPill as E, PLANE_TYPE as P, RECT_TYPE as R, SPRITE_TYPE as S, TEXT_TYPE as T, ZylemSprite as Z, SPHERE_TYPE as a, ZylemSphere as b, ZylemRect as c, ZylemText as d, ZylemBox as e, ZylemPlane as f, ZONE_TYPE as g, ZylemZone as h, ZylemActor as i, ZylemCone as j, PYRAMID_TYPE as k, ZylemPyramid as l, CYLINDER_TYPE as m, ZylemCylinder as n, PILL_TYPE as o, ZylemPill as p, createBox as q, createSphere as r, createSprite as s, createPlane as t, createZone as u, createActor as v, createText as w, createRect as x, createCone as y, createPyramid as z };
|
package/dist/entities.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './entity-
|
|
1
|
+
export { e as ZylemBox, v as createActor, q as createBox, y as createCone, D as createCylinder, E as createPill, t as createPlane, z as createPyramid, x as createRect, r as createSphere, s as createSprite, w as createText, u as createZone } from './entities-DC9ce_vx.js';
|
|
2
|
+
import './entity-BpbZqg19.js';
|
|
3
3
|
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
5
|
import 'bitecs';
|
|
6
|
+
import 'mitt';
|
|
7
|
+
import './behavior-descriptor-BWNWmIjv.js';
|
|
8
|
+
import './world-Be5m1XC1.js';
|
|
6
9
|
import './entity-Bq_eNEDI.js';
|