@zylem/game-lib 0.6.0 → 0.6.2
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/behaviors.d.ts +834 -86
- package/dist/behaviors.js +1166 -355
- package/dist/behaviors.js.map +1 -1
- package/dist/{blueprints-BOCc3Wve.d.ts → blueprints-Cq3Ko6_G.d.ts} +2 -2
- package/dist/{camera-CpbDr4-V.d.ts → camera-CeJPAgGg.d.ts} +2 -2
- package/dist/camera.d.ts +1 -1
- package/dist/camera.js +126 -19
- package/dist/camera.js.map +1 -1
- package/dist/{core-CZhozNRH.d.ts → core-bO8TzV7u.d.ts} +40 -6
- package/dist/core.d.ts +8 -6
- package/dist/core.js +6554 -5033
- package/dist/core.js.map +1 -1
- package/dist/{entities-BAxfJOkk.d.ts → entities-DvByhMGU.d.ts} +43 -44
- package/dist/entities.d.ts +4 -3
- package/dist/entities.js +3236 -2013
- package/dist/entities.js.map +1 -1
- package/dist/entity-types-DAu8sGJH.d.ts +26 -0
- package/dist/main.d.ts +71 -31
- package/dist/main.js +9197 -6313
- package/dist/main.js.map +1 -1
- package/dist/{stage-types-CD21XoIU.d.ts → stage-types-Bd-KtcYT.d.ts} +65 -28
- package/dist/stage.d.ts +9 -7
- package/dist/stage.js +3993 -2453
- package/dist/stage.js.map +1 -1
- package/dist/world-C8tQ7Plj.d.ts +774 -0
- package/package.json +11 -10
- package/LICENSE +0 -21
- package/dist/entity-COvRtFNG.d.ts +0 -395
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
import { G as GameEntity,
|
|
1
|
+
import { G as GameEntity, g as GameEntityOptions, b as UpdateContext, c as DestroyContext, B as BaseNode, T as TexturePath, A as CollisionHandlerDelegate, V as Vec3, M as MaterialOptions } from './world-C8tQ7Plj.js';
|
|
2
2
|
import { Vector3, Sprite, Color, Vector2, Object3D } from 'three';
|
|
3
|
-
import RAPIER__default, { World } from '@dimforge/rapier3d-compat';
|
|
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
|
-
}
|
|
30
3
|
|
|
31
4
|
type SpriteImage = {
|
|
32
5
|
name: string;
|
|
@@ -61,12 +34,12 @@ declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
|
|
|
61
34
|
protected createAnimations(animations: SpriteAnimation[]): void;
|
|
62
35
|
setSprite(key: string): void;
|
|
63
36
|
setAnimation(name: string, delta: number): void;
|
|
64
|
-
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>):
|
|
65
|
-
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>):
|
|
37
|
+
spriteUpdate(params: UpdateContext<ZylemSpriteOptions>): void;
|
|
38
|
+
spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
|
|
66
39
|
buildInfo(): Record<string, any>;
|
|
67
40
|
}
|
|
68
41
|
type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
|
|
69
|
-
declare function
|
|
42
|
+
declare function createSprite(...args: Array<SpriteOptions>): ZylemSprite;
|
|
70
43
|
|
|
71
44
|
type ZylemSphereOptions = GameEntityOptions & {
|
|
72
45
|
radius?: number;
|
|
@@ -78,7 +51,7 @@ declare class ZylemSphere extends GameEntity<ZylemSphereOptions> {
|
|
|
78
51
|
buildInfo(): Record<string, any>;
|
|
79
52
|
}
|
|
80
53
|
type SphereOptions = BaseNode | Partial<ZylemSphereOptions>;
|
|
81
|
-
declare function
|
|
54
|
+
declare function createSphere(...args: Array<SphereOptions>): ZylemSphere;
|
|
82
55
|
|
|
83
56
|
type ZylemRectOptions = GameEntityOptions & {
|
|
84
57
|
width?: number;
|
|
@@ -122,6 +95,8 @@ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
|
122
95
|
constructor(options?: ZylemRectOptions);
|
|
123
96
|
private createSprite;
|
|
124
97
|
private redrawRect;
|
|
98
|
+
getWidth(): number;
|
|
99
|
+
getHeight(): number;
|
|
125
100
|
private roundedRectPath;
|
|
126
101
|
private toCssColor;
|
|
127
102
|
private rectSetup;
|
|
@@ -133,7 +108,7 @@ declare class ZylemRect extends GameEntity<ZylemRectOptions> {
|
|
|
133
108
|
buildInfo(): Record<string, any>;
|
|
134
109
|
}
|
|
135
110
|
type RectOptions = BaseNode | Partial<ZylemRectOptions>;
|
|
136
|
-
declare function
|
|
111
|
+
declare function createRect(...args: Array<RectOptions>): ZylemRect;
|
|
137
112
|
|
|
138
113
|
type ZylemTextOptions = GameEntityOptions & {
|
|
139
114
|
text?: string;
|
|
@@ -179,7 +154,7 @@ declare class ZylemText extends GameEntity<ZylemTextOptions> {
|
|
|
179
154
|
private textDestroy;
|
|
180
155
|
}
|
|
181
156
|
type TextOptions = BaseNode | Partial<ZylemTextOptions>;
|
|
182
|
-
declare function
|
|
157
|
+
declare function createText(...args: Array<TextOptions>): ZylemText;
|
|
183
158
|
|
|
184
159
|
type ZylemBoxOptions = GameEntityOptions;
|
|
185
160
|
declare const BOX_TYPE: unique symbol;
|
|
@@ -189,13 +164,16 @@ declare class ZylemBox extends GameEntity<ZylemBoxOptions> {
|
|
|
189
164
|
buildInfo(): Record<string, any>;
|
|
190
165
|
}
|
|
191
166
|
type BoxOptions = BaseNode | ZylemBoxOptions;
|
|
192
|
-
declare function
|
|
167
|
+
declare function createBox(...args: Array<BoxOptions>): ZylemBox;
|
|
193
168
|
|
|
194
169
|
type ZylemPlaneOptions = GameEntityOptions & {
|
|
195
170
|
tile?: Vector2;
|
|
196
171
|
repeat?: Vector2;
|
|
197
172
|
texture?: TexturePath;
|
|
198
173
|
subdivisions?: number;
|
|
174
|
+
randomizeHeight?: boolean;
|
|
175
|
+
heightMap?: number[];
|
|
176
|
+
heightScale?: number;
|
|
199
177
|
};
|
|
200
178
|
declare const PLANE_TYPE: unique symbol;
|
|
201
179
|
declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
@@ -203,7 +181,7 @@ declare class ZylemPlane extends GameEntity<ZylemPlaneOptions> {
|
|
|
203
181
|
constructor(options?: ZylemPlaneOptions);
|
|
204
182
|
}
|
|
205
183
|
type PlaneOptions = BaseNode | Partial<ZylemPlaneOptions>;
|
|
206
|
-
declare function
|
|
184
|
+
declare function createPlane(...args: Array<PlaneOptions>): ZylemPlane;
|
|
207
185
|
|
|
208
186
|
type OnHeldParams = {
|
|
209
187
|
delta: number;
|
|
@@ -243,10 +221,12 @@ declare class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collisio
|
|
|
243
221
|
held(delta: number, other: any): void;
|
|
244
222
|
}
|
|
245
223
|
type ZoneOptions = BaseNode | Partial<ZylemZoneOptions>;
|
|
246
|
-
declare function
|
|
224
|
+
declare function createZone(...args: Array<ZoneOptions>): ZylemZone;
|
|
247
225
|
|
|
248
226
|
interface EntityLoaderDelegate {
|
|
249
|
-
|
|
227
|
+
/** Initiates loading (may be async internally, but call returns immediately) */
|
|
228
|
+
load(): void;
|
|
229
|
+
/** Returns data synchronously (may be null if still loading) */
|
|
250
230
|
data(): any;
|
|
251
231
|
}
|
|
252
232
|
|
|
@@ -269,12 +249,14 @@ type AnimationObject = {
|
|
|
269
249
|
key?: string;
|
|
270
250
|
path: string;
|
|
271
251
|
};
|
|
252
|
+
type CollisionShapeType = 'capsule' | 'model';
|
|
272
253
|
type ZylemActorOptions = GameEntityOptions & {
|
|
273
254
|
static?: boolean;
|
|
274
255
|
animations?: AnimationObject[];
|
|
275
256
|
models?: string[];
|
|
276
257
|
scale?: Vec3;
|
|
277
258
|
material?: MaterialOptions;
|
|
259
|
+
collisionShape?: CollisionShapeType;
|
|
278
260
|
};
|
|
279
261
|
declare const ACTOR_TYPE: unique symbol;
|
|
280
262
|
declare class ZylemActor extends GameEntity<ZylemActorOptions> implements EntityLoaderDelegate, DebugInfoProvider {
|
|
@@ -285,15 +267,32 @@ declare class ZylemActor extends GameEntity<ZylemActorOptions> implements Entity
|
|
|
285
267
|
private _assetLoader;
|
|
286
268
|
controlledRotation: boolean;
|
|
287
269
|
constructor(options?: ZylemActorOptions);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Initiates model and animation loading in background (deferred).
|
|
272
|
+
* Call returns immediately; assets will be ready on subsequent updates.
|
|
273
|
+
*/
|
|
274
|
+
load(): void;
|
|
275
|
+
/**
|
|
276
|
+
* Returns current data synchronously.
|
|
277
|
+
* May return null values if loading is still in progress.
|
|
278
|
+
*/
|
|
279
|
+
data(): any;
|
|
280
|
+
actorUpdate(params: UpdateContext<ZylemActorOptions>): void;
|
|
291
281
|
/**
|
|
292
282
|
* Clean up actor resources including animations, models, and groups
|
|
293
283
|
*/
|
|
294
284
|
actorDestroy(): void;
|
|
295
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Deferred loading - starts async load and updates entity when complete.
|
|
287
|
+
* Called by synchronous load() method.
|
|
288
|
+
*/
|
|
289
|
+
private loadModelsDeferred;
|
|
296
290
|
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;
|
|
297
296
|
get object(): Object3D | null;
|
|
298
297
|
/**
|
|
299
298
|
* Provide custom debug information for the actor
|
|
@@ -302,6 +301,6 @@ declare class ZylemActor extends GameEntity<ZylemActorOptions> implements Entity
|
|
|
302
301
|
getDebugInfo(): Record<string, any>;
|
|
303
302
|
}
|
|
304
303
|
type ActorOptions = BaseNode | ZylemActorOptions;
|
|
305
|
-
declare function
|
|
304
|
+
declare function createActor(...args: Array<ActorOptions>): ZylemActor;
|
|
306
305
|
|
|
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,
|
|
306
|
+
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, 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, createBox as j, createSphere as k, createSprite as l, createPlane as m, createZone as n, createActor as o, createText as p, createRect as q };
|
package/dist/entities.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './
|
|
1
|
+
export { e as ZylemBox, o as createActor, j as createBox, m as createPlane, q as createRect, k as createSphere, l as createSprite, p as createText, n as createZone } from './entities-DvByhMGU.js';
|
|
2
|
+
import './world-C8tQ7Plj.js';
|
|
3
3
|
import 'three';
|
|
4
4
|
import '@dimforge/rapier3d-compat';
|
|
5
|
-
import 'bitecs';
|
|
6
5
|
import './entity-Bq_eNEDI.js';
|
|
6
|
+
import 'bitecs';
|
|
7
|
+
import 'mitt';
|