@zylem/game-lib 0.6.2 → 0.6.4
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/LICENSE +21 -0
- package/README.md +9 -16
- package/dist/actions.d.ts +30 -21
- package/dist/actions.js +793 -146
- package/dist/actions.js.map +1 -1
- package/dist/behavior/jumper-2d.d.ts +114 -0
- package/dist/behavior/jumper-2d.js +711 -0
- package/dist/behavior/jumper-2d.js.map +1 -0
- package/dist/behavior/platformer-3d.d.ts +296 -0
- package/dist/behavior/platformer-3d.js +761 -0
- package/dist/behavior/platformer-3d.js.map +1 -0
- package/dist/behavior/ricochet-2d.d.ts +275 -0
- package/dist/behavior/ricochet-2d.js +425 -0
- package/dist/behavior/ricochet-2d.js.map +1 -0
- package/dist/behavior/ricochet-3d.d.ts +117 -0
- package/dist/behavior/ricochet-3d.js +443 -0
- package/dist/behavior/ricochet-3d.js.map +1 -0
- package/dist/behavior/screen-visibility.d.ts +79 -0
- package/dist/behavior/screen-visibility.js +358 -0
- package/dist/behavior/screen-visibility.js.map +1 -0
- package/dist/behavior/screen-wrap.d.ts +87 -0
- package/dist/behavior/screen-wrap.js +246 -0
- package/dist/behavior/screen-wrap.js.map +1 -0
- package/dist/behavior/shooter-2d.d.ts +79 -0
- package/dist/behavior/shooter-2d.js +180 -0
- package/dist/behavior/shooter-2d.js.map +1 -0
- package/dist/behavior/thruster.d.ts +11 -0
- package/dist/behavior/thruster.js +292 -0
- package/dist/behavior/thruster.js.map +1 -0
- package/dist/behavior/top-down-movement.d.ts +56 -0
- package/dist/behavior/top-down-movement.js +125 -0
- package/dist/behavior/top-down-movement.js.map +1 -0
- package/dist/behavior/world-boundary-2d.d.ts +142 -0
- package/dist/behavior/world-boundary-2d.js +235 -0
- package/dist/behavior/world-boundary-2d.js.map +1 -0
- package/dist/behavior/world-boundary-3d.d.ts +76 -0
- package/dist/behavior/world-boundary-3d.js +274 -0
- package/dist/behavior/world-boundary-3d.js.map +1 -0
- package/dist/behavior-descriptor-BXnVR8Ki.d.ts +159 -0
- package/dist/{blueprints-Cq3Ko6_G.d.ts → blueprints-DmbK2dki.d.ts} +2 -2
- package/dist/camera-4XO5gbQH.d.ts +905 -0
- package/dist/camera.d.ts +3 -2
- package/dist/camera.js +1653 -377
- package/dist/camera.js.map +1 -1
- package/dist/composition-BASvMKrW.d.ts +218 -0
- package/dist/{core-bO8TzV7u.d.ts → core-CARRaS55.d.ts} +110 -69
- package/dist/core.d.ts +11 -6
- package/dist/core.js +10766 -5626
- package/dist/core.js.map +1 -1
- package/dist/{entities-DvByhMGU.d.ts → entities-ChFirVL9.d.ts} +133 -29
- package/dist/entities.d.ts +5 -3
- package/dist/entities.js +4679 -3202
- package/dist/entities.js.map +1 -1
- package/dist/entity-vj-HTjzU.d.ts +1169 -0
- package/dist/global-change-2JvMaz44.d.ts +25 -0
- package/dist/main.d.ts +1118 -16
- package/dist/main.js +17538 -8499
- package/dist/main.js.map +1 -1
- package/dist/physics-pose-DCc4oE44.d.ts +25 -0
- package/dist/physics-protocol-BDD3P5W2.d.ts +200 -0
- package/dist/physics-worker.d.ts +21 -0
- package/dist/physics-worker.js +306 -0
- package/dist/physics-worker.js.map +1 -0
- package/dist/physics.d.ts +205 -0
- package/dist/physics.js +577 -0
- package/dist/physics.js.map +1 -0
- package/dist/stage-types-C19IhuzA.d.ts +731 -0
- package/dist/stage.d.ts +11 -7
- package/dist/stage.js +8024 -3852
- package/dist/stage.js.map +1 -1
- package/dist/sync-state-machine-CZyspBpj.d.ts +16 -0
- package/dist/thruster-23lzoPZd.d.ts +180 -0
- package/dist/world-DfgxoNMt.d.ts +105 -0
- package/package.json +53 -13
- package/dist/behaviors.d.ts +0 -854
- package/dist/behaviors.js +0 -1209
- package/dist/behaviors.js.map +0 -1
- package/dist/camera-CeJPAgGg.d.ts +0 -116
- package/dist/moveable-B_vyA6cw.d.ts +0 -67
- package/dist/stage-types-Bd-KtcYT.d.ts +0 -375
- package/dist/transformable-CUhvyuYO.d.ts +0 -67
- package/dist/world-C8tQ7Plj.d.ts +0 -774
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as GameEntity, P as GameEntityOptions, L as SetupContext, U as UpdateContext, M as DestroyContext, O as BaseNode, as as TexturePath, V as Vec3, R as MaterialOptions, aq as CleanupContext } from './entity-vj-HTjzU.js';
|
|
2
2
|
import { Vector3, Sprite, Color, Vector2, Object3D } from 'three';
|
|
3
|
+
import { C as CollisionHandlerDelegate } from './world-DfgxoNMt.js';
|
|
3
4
|
|
|
4
5
|
type SpriteImage = {
|
|
5
6
|
name: string;
|
|
@@ -34,6 +35,9 @@ declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
|
34
35
|
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
35
36
|
setSprite(key: string): void;
|
|
36
37
|
setAnimation(name: string, delta: number): void;
|
|
38
|
+
private getCurrentRotationQuaternion;
|
|
39
|
+
private syncSpriteMaterials;
|
|
40
|
+
spriteSetup(_params: SetupContext<ZylemSpriteOptions>): void;
|
|
37
41
|
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): void;
|
|
38
42
|
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
|
|
39
43
|
buildInfo(): Record<string, any>;
|
|
@@ -99,6 +103,12 @@ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
|
99
103
|
getHeight(): number;
|
|
100
104
|
private roundedRectPath;
|
|
101
105
|
private toCssColor;
|
|
106
|
+
/**
|
|
107
|
+
* Get the viewport resolution from the renderer DOM element,
|
|
108
|
+
* falling back to the camera's screenResolution if the renderer
|
|
109
|
+
* is not available (e.g. when using the new RendererManager path).
|
|
110
|
+
*/
|
|
111
|
+
private getResolution;
|
|
102
112
|
private rectSetup;
|
|
103
113
|
private rectUpdate;
|
|
104
114
|
private updateStickyTransform;
|
|
@@ -163,7 +173,7 @@ declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
|
|
|
163
173
|
constructor(options?: ZylemBoxOptions);
|
|
164
174
|
buildInfo(): Record<string, any>;
|
|
165
175
|
}
|
|
166
|
-
type BoxOptions = BaseNode | ZylemBoxOptions
|
|
176
|
+
type BoxOptions = BaseNode | Partial<ZylemBoxOptions>;
|
|
167
177
|
declare function createBox(...args: Array<BoxOptions>): ZylemBox;
|
|
168
178
|
|
|
169
179
|
type ZylemPlaneOptions = GameEntityOptions & {
|
|
@@ -249,7 +259,7 @@ type AnimationObject = {
|
|
|
249
259
|
key?: string;
|
|
250
260
|
path: string;
|
|
251
261
|
};
|
|
252
|
-
type CollisionShapeType = 'capsule' | 'model';
|
|
262
|
+
type CollisionShapeType = 'capsule' | 'bounds' | 'trimesh' | 'model';
|
|
253
263
|
type ZylemActorOptions = GameEntityOptions & {
|
|
254
264
|
static?: boolean;
|
|
255
265
|
animations?: AnimationObject[];
|
|
@@ -262,45 +272,139 @@ declare const ACTOR_TYPE: unique symbol;
|
|
|
262
272
|
declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
|
|
263
273
|
static type: symbol;
|
|
264
274
|
private _object;
|
|
275
|
+
private _collisionSource;
|
|
265
276
|
private _animationDelegate;
|
|
266
277
|
private _modelFileNames;
|
|
267
278
|
private _assetLoader;
|
|
279
|
+
private _loadGeneration;
|
|
280
|
+
private _loadStatus;
|
|
268
281
|
controlledRotation: boolean;
|
|
282
|
+
hasWarnedDynamicTrimesh: boolean;
|
|
269
283
|
constructor(options?: ZylemActorOptions);
|
|
270
|
-
|
|
271
|
-
* Initiates model and animation loading in background (deferred).
|
|
272
|
-
* Call returns immediately; assets will be ready on subsequent updates.
|
|
273
|
-
*/
|
|
284
|
+
create(): this;
|
|
274
285
|
load(): void;
|
|
275
|
-
/**
|
|
276
|
-
* Returns current data synchronously.
|
|
277
|
-
* May return null values if loading is still in progress.
|
|
278
|
-
*/
|
|
279
286
|
data(): any;
|
|
287
|
+
needsDeferredModelCollision(): boolean;
|
|
288
|
+
synchronizeRuntimeCollider(): void;
|
|
280
289
|
actorUpdate(params: UpdateContext<ZylemActorOptions>): void;
|
|
281
|
-
/**
|
|
282
|
-
* Clean up actor resources including animations, models, and groups
|
|
283
|
-
*/
|
|
284
290
|
actorDestroy(): void;
|
|
285
|
-
|
|
286
|
-
* Deferred loading - starts async load and updates entity when complete.
|
|
287
|
-
* Called by synchronous load() method.
|
|
288
|
-
*/
|
|
289
|
-
private loadModelsDeferred;
|
|
291
|
+
_cleanup(params: CleanupContext<this>): void;
|
|
290
292
|
playAnimation(animationOptions: AnimationOptions): void;
|
|
291
|
-
/**
|
|
292
|
-
* Apply material overrides from options to all meshes in the loaded model.
|
|
293
|
-
* Only applies if material options are explicitly specified (not just defaults).
|
|
294
|
-
*/
|
|
295
|
-
private applyMaterialOverrides;
|
|
296
293
|
get object(): Object3D | null;
|
|
297
|
-
|
|
298
|
-
* Provide custom debug information for the actor
|
|
299
|
-
* This will be merged with the default debug information
|
|
300
|
-
*/
|
|
294
|
+
get collisionSource(): Object3D | null;
|
|
301
295
|
getDebugInfo(): Record<string, any>;
|
|
296
|
+
private getResolvedCollisionShape;
|
|
297
|
+
private requiresLoadedCollisionSource;
|
|
298
|
+
private getRuntimeCollisionSource;
|
|
299
|
+
private getCollisionSourceSelection;
|
|
300
|
+
private disposeRuntimeState;
|
|
301
|
+
private loadModelsDeferred;
|
|
302
|
+
private applyMaterialOverrides;
|
|
302
303
|
}
|
|
303
304
|
type ActorOptions = BaseNode | ZylemActorOptions;
|
|
304
305
|
declare function createActor(...args: Array<ActorOptions>): ZylemActor;
|
|
305
306
|
|
|
306
|
-
|
|
307
|
+
type ZylemConeOptions = GameEntityOptions & {
|
|
308
|
+
/** Base radius of the cone */
|
|
309
|
+
radius?: number;
|
|
310
|
+
/** Height of the cone */
|
|
311
|
+
height?: number;
|
|
312
|
+
/** Number of radial segments (higher = smoother) */
|
|
313
|
+
radialSegments?: number;
|
|
314
|
+
};
|
|
315
|
+
declare const CONE_TYPE: unique symbol;
|
|
316
|
+
/**
|
|
317
|
+
* A cone entity with configurable radius, height, and radial segments.
|
|
318
|
+
* Uses a Rapier cone collider for physics.
|
|
319
|
+
*/
|
|
320
|
+
declare class ZylemCone extends GameEntity<ZylemConeOptions> {
|
|
321
|
+
static type: symbol;
|
|
322
|
+
constructor(options?: ZylemConeOptions);
|
|
323
|
+
buildInfo(): Record<string, any>;
|
|
324
|
+
}
|
|
325
|
+
type ConeOptions = BaseNode | Partial<ZylemConeOptions>;
|
|
326
|
+
/**
|
|
327
|
+
* Create a cone entity.
|
|
328
|
+
* @param args Options or child nodes
|
|
329
|
+
*/
|
|
330
|
+
declare function createCone(...args: Array<ConeOptions>): ZylemCone;
|
|
331
|
+
|
|
332
|
+
type ZylemPyramidOptions = GameEntityOptions & {
|
|
333
|
+
/** Base radius of the pyramid */
|
|
334
|
+
radius?: number;
|
|
335
|
+
/** Height of the pyramid */
|
|
336
|
+
height?: number;
|
|
337
|
+
};
|
|
338
|
+
declare const PYRAMID_TYPE: unique symbol;
|
|
339
|
+
/**
|
|
340
|
+
* A pyramid entity (4-sided cone).
|
|
341
|
+
* Uses ConeGeometry with 4 radial segments for the visual mesh
|
|
342
|
+
* and a Rapier cone collider for physics.
|
|
343
|
+
*/
|
|
344
|
+
declare class ZylemPyramid extends GameEntity<ZylemPyramidOptions> {
|
|
345
|
+
static type: symbol;
|
|
346
|
+
constructor(options?: ZylemPyramidOptions);
|
|
347
|
+
buildInfo(): Record<string, any>;
|
|
348
|
+
}
|
|
349
|
+
type PyramidOptions = BaseNode | Partial<ZylemPyramidOptions>;
|
|
350
|
+
/**
|
|
351
|
+
* Create a pyramid entity.
|
|
352
|
+
* @param args Options or child nodes
|
|
353
|
+
*/
|
|
354
|
+
declare function createPyramid(...args: Array<PyramidOptions>): ZylemPyramid;
|
|
355
|
+
|
|
356
|
+
type ZylemCylinderOptions = GameEntityOptions & {
|
|
357
|
+
/** Top radius of the cylinder */
|
|
358
|
+
radiusTop?: number;
|
|
359
|
+
/** Bottom radius of the cylinder */
|
|
360
|
+
radiusBottom?: number;
|
|
361
|
+
/** Height of the cylinder */
|
|
362
|
+
height?: number;
|
|
363
|
+
/** Number of radial segments (higher = smoother) */
|
|
364
|
+
radialSegments?: number;
|
|
365
|
+
};
|
|
366
|
+
declare const CYLINDER_TYPE: unique symbol;
|
|
367
|
+
/**
|
|
368
|
+
* A cylinder entity with configurable top/bottom radii, height, and segments.
|
|
369
|
+
* Uses a Rapier cylinder collider for physics.
|
|
370
|
+
*/
|
|
371
|
+
declare class ZylemCylinder extends GameEntity<ZylemCylinderOptions> {
|
|
372
|
+
static type: symbol;
|
|
373
|
+
constructor(options?: ZylemCylinderOptions);
|
|
374
|
+
buildInfo(): Record<string, any>;
|
|
375
|
+
}
|
|
376
|
+
type CylinderOptions = BaseNode | Partial<ZylemCylinderOptions>;
|
|
377
|
+
/**
|
|
378
|
+
* Create a cylinder entity.
|
|
379
|
+
* @param args Options or child nodes
|
|
380
|
+
*/
|
|
381
|
+
declare function createCylinder(...args: Array<CylinderOptions>): ZylemCylinder;
|
|
382
|
+
|
|
383
|
+
type ZylemPillOptions = GameEntityOptions & {
|
|
384
|
+
/** Radius of the capsule hemispheres */
|
|
385
|
+
radius?: number;
|
|
386
|
+
/** Length of the cylindrical middle section */
|
|
387
|
+
length?: number;
|
|
388
|
+
/** Number of cap segments (higher = smoother) */
|
|
389
|
+
capSegments?: number;
|
|
390
|
+
/** Number of radial segments (higher = smoother) */
|
|
391
|
+
radialSegments?: number;
|
|
392
|
+
};
|
|
393
|
+
declare const PILL_TYPE: unique symbol;
|
|
394
|
+
/**
|
|
395
|
+
* A pill/capsule entity with configurable radius and cylindrical length.
|
|
396
|
+
* Uses Three.js CapsuleGeometry for rendering and Rapier capsule collider for physics.
|
|
397
|
+
*/
|
|
398
|
+
declare class ZylemPill extends GameEntity<ZylemPillOptions> {
|
|
399
|
+
static type: symbol;
|
|
400
|
+
constructor(options?: ZylemPillOptions);
|
|
401
|
+
buildInfo(): Record<string, any>;
|
|
402
|
+
}
|
|
403
|
+
type PillOptions = BaseNode | Partial<ZylemPillOptions>;
|
|
404
|
+
/**
|
|
405
|
+
* Create a pill (capsule) entity.
|
|
406
|
+
* @param args Options or child nodes
|
|
407
|
+
*/
|
|
408
|
+
declare function createPill(...args: Array<PillOptions>): ZylemPill;
|
|
409
|
+
|
|
410
|
+
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,7 +1,9 @@
|
|
|
1
|
-
export { e as ZylemBox,
|
|
2
|
-
import './
|
|
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-ChFirVL9.js';
|
|
2
|
+
import './entity-vj-HTjzU.js';
|
|
3
3
|
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
|
-
import './entity-Bq_eNEDI.js';
|
|
6
5
|
import 'bitecs';
|
|
7
6
|
import 'mitt';
|
|
7
|
+
import './behavior-descriptor-BXnVR8Ki.js';
|
|
8
|
+
import './world-DfgxoNMt.js';
|
|
9
|
+
import './entity-Bq_eNEDI.js';
|