@zylem/game-lib 0.8.3 → 0.8.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.
Files changed (41) hide show
  1. package/dist/actions.d.ts +5 -5
  2. package/dist/api/game-lib.api.json +454 -195
  3. package/dist/api/game-lib.api.md +28 -12
  4. package/dist/api/game-lib.d.ts +66 -3
  5. package/dist/api/game-lib.typedoc.json +29076 -28454
  6. package/dist/bridge.d.ts +18 -4
  7. package/dist/bridge.js +1 -1
  8. package/dist/{chunk-WVSYUWTT.js → chunk-4CHZUWLF.js} +1 -1
  9. package/dist/{chunk-Q27ULMXY.js → chunk-6B5JP7T5.js} +2 -2
  10. package/dist/chunk-D3JO4HW2.js +1 -0
  11. package/dist/{chunk-CV75NSES.js → chunk-OAWK2UUY.js} +1 -1
  12. package/dist/chunk-PNLNC3FA.js +1 -0
  13. package/dist/chunk-VIPINV7V.js +19 -0
  14. package/dist/{chunk-YAOXFYOD.js → chunk-WBQ5TNRZ.js} +1 -1
  15. package/dist/{collision-builder-B_tm8OVy.d.ts → collision-builder-4TVDzXsp.d.ts} +1 -1
  16. package/dist/core.d.ts +11 -11
  17. package/dist/core.js +1 -1
  18. package/dist/{debug-state-Dp9CQQZ4.d.ts → debug-state-s0s-qndj.d.ts} +1 -1
  19. package/dist/debug.d.ts +11 -5
  20. package/dist/debug.js +1 -1
  21. package/dist/{entity-BGEq1yfC.d.ts → entity-BI7cSlK8.d.ts} +3 -3
  22. package/dist/{entity-B9yZeBm4.d.ts → entity-DDks47JB.d.ts} +1 -1
  23. package/dist/{entity-type-map-CW6RHQkx.d.ts → entity-type-map-COHu4fkW.d.ts} +41 -7
  24. package/dist/entity.d.ts +7 -7
  25. package/dist/entity.js +1 -1
  26. package/dist/{game-NHkubIfI.d.ts → game-4fsy55uN.d.ts} +6 -6
  27. package/dist/{game-default-5TB3T5N7.js → game-default-4PPYYGAR.js} +1 -1
  28. package/dist/graphics.d.ts +5 -5
  29. package/dist/{material-DbSuZBbP.d.ts → material-BKPYeBC6.d.ts} +1 -1
  30. package/dist/public.d.ts +9 -9
  31. package/dist/public.js +1 -1
  32. package/dist/runtime.d.ts +3 -3
  33. package/dist/runtime.js +1 -1
  34. package/dist/{vector-DN6zlPoE.d.ts → vector-DPbwlzgG.d.ts} +10 -2
  35. package/dist/web-components.d.ts +9 -9
  36. package/dist/{zylem-camera-Du2UPW9O.d.ts → zylem-camera-B73ZNcgs.d.ts} +1 -1
  37. package/package.json +16 -15
  38. package/LICENSE +0 -21
  39. package/dist/chunk-2VSVOPQN.js +0 -19
  40. package/dist/chunk-GKHAJ3MW.js +0 -1
  41. package/dist/chunk-LGS5N5M4.js +0 -1
@@ -1438,7 +1438,6 @@ export class GameBridge {
1438
1438
  paused?: boolean;
1439
1439
  debug?: boolean;
1440
1440
  }): void;
1441
- // (undocumented)
1442
1441
  publishVariable(payload: GameVariablePayload): void;
1443
1442
  queueEntityRemoved(uuids: string[]): void;
1444
1443
  queueEntityUpsert(entities: EntitySummaryPayload[]): void;
@@ -3134,6 +3133,7 @@ export class SimulationBody implements PhysicsRenderPoseProvider {
3134
3133
  linvel(): PhysicsVector3;
3135
3134
  lockRotations(locked: boolean, _wakeUp?: boolean): void;
3136
3135
  lockTranslations(locked: boolean, _wakeUp?: boolean): void;
3136
+ markPoseDiscontinuity(): void;
3137
3137
  // (undocumented)
3138
3138
  mass(): number;
3139
3139
  // Warning: (ae-forgotten-export) The symbol "PhysicsQuaternion" needs to be exported by the entry point public.d.ts
@@ -3240,6 +3240,15 @@ export type SpriteImage = {
3240
3240
  file: string;
3241
3241
  };
3242
3242
 
3243
+ // @public
3244
+ export type SpriteSheet = {
3245
+ file: string;
3246
+ columns: number;
3247
+ rows: number;
3248
+ frames: Array<string | null>;
3249
+ filter?: 'nearest' | 'linear';
3250
+ };
3251
+
3243
3252
  // @public
3244
3253
  export const STAGE_STATE_CHANGE = "STAGE_STATE_CHANGE";
3245
3254
 
@@ -4534,9 +4543,11 @@ export class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
4534
4543
  // (undocumented)
4535
4544
  protected createAnimations(animations: SpriteAnimation[]): void;
4536
4545
  // (undocumented)
4546
+ protected createSpriteFromSheet(sheet: SpriteSheet): void;
4547
+ // (undocumented)
4537
4548
  protected createSpritesFromImages(images: SpriteImage[]): void;
4538
4549
  // (undocumented)
4539
- protected currentAnimation: any;
4550
+ protected currentAnimation: string | null;
4540
4551
  // (undocumented)
4541
4552
  protected currentAnimationFrame: string;
4542
4553
  // (undocumented)
@@ -4546,9 +4557,14 @@ export class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
4546
4557
  // (undocumented)
4547
4558
  protected currentSpriteIndex: number;
4548
4559
  // (undocumented)
4560
+ protected flippedX: boolean;
4561
+ // (undocumented)
4562
+ isFlippedX(): boolean;
4549
4563
  setAnimation(name: string, delta: number): void;
4564
+ setFlipX(flip: boolean): void;
4550
4565
  // (undocumented)
4551
4566
  setSprite(key: string): void;
4567
+ protected sheetTexture: Texture | null;
4552
4568
  // (undocumented)
4553
4569
  spriteDestroy(params: DestroyContext<ZylemSpriteOptions>): void;
4554
4570
  // (undocumented)
@@ -4629,16 +4645,16 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
4629
4645
 
4630
4646
  // Warnings were encountered during analysis:
4631
4647
  //
4632
- // dist/entity-BGEq1yfC.d.ts:423:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4633
- // dist/entity-BGEq1yfC.d.ts:424:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4634
- // dist/entity-BGEq1yfC.d.ts:425:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4635
- // dist/entity-BGEq1yfC.d.ts:426:5 - (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
4636
- // dist/entity-BGEq1yfC.d.ts:434:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4637
- // dist/entity-BGEq1yfC.d.ts:434:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4638
- // dist/entity-BGEq1yfC.d.ts:435:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4639
- // dist/entity-BGEq1yfC.d.ts:436:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4640
- // dist/game-NHkubIfI.d.ts:951:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4641
- // dist/game-NHkubIfI.d.ts:1563:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4648
+ // dist/entity-BI7cSlK8.d.ts:423:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
4649
+ // dist/entity-BI7cSlK8.d.ts:424:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
4650
+ // dist/entity-BI7cSlK8.d.ts:425:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
4651
+ // dist/entity-BI7cSlK8.d.ts:426:5 - (ae-forgotten-export) The symbol "MaterialOptions" needs to be exported by the entry point public.d.ts
4652
+ // dist/entity-BI7cSlK8.d.ts:434:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
4653
+ // dist/entity-BI7cSlK8.d.ts:434:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
4654
+ // dist/entity-BI7cSlK8.d.ts:435:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
4655
+ // dist/entity-BI7cSlK8.d.ts:436:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
4656
+ // dist/game-4fsy55uN.d.ts:951:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
4657
+ // dist/game-4fsy55uN.d.ts:1563:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
4642
4658
 
4643
4659
  // (No @packageDocumentation comment for this package)
4644
4660
 
@@ -2055,6 +2055,12 @@ export { EntitySummaryPayload }
2055
2055
  /**
2056
2056
  * Generates and caches entity thumbnail previews for the editor entity list.
2057
2057
  * Renders a cloned Object3D into an offscreen RenderTarget on the shared WebGPU renderer.
2058
+ *
2059
+ * A rendered URL leaves this cache the moment it is read, and the editor holds
2060
+ * it for as long as the entity is listed. Dropping an entry here therefore
2061
+ * must not revoke its blob URL — the consumer owns that lifetime and releases
2062
+ * it when the thumbnail is replaced, the entity is removed, or the stage
2063
+ * changes.
2058
2064
  */
2059
2065
  export declare class EntityThumbnailCache {
2060
2066
  private cache;
@@ -2542,6 +2548,12 @@ export declare class GameBridge {
2542
2548
  * Run a callback when an editor first subscribes to entity data, so the
2543
2549
  * game can backfill state produced while nothing was listening.
2544
2550
  *
2551
+ * An editor takes out both entity subscriptions as it mounts, and each is
2552
+ * a first-subscriber transition. Backfilling on both would republish the
2553
+ * config, the whole stage snapshot, and every thumbnail twice per mount,
2554
+ * so a signal is ignored while the other entity type still has a
2555
+ * listener — that is the same editor finishing its setup, not a new one.
2556
+ *
2545
2557
  * @returns An unsubscribe function.
2546
2558
  */
2547
2559
  onEditorAttached(callback: () => void): () => void;
@@ -2551,6 +2563,14 @@ export declare class GameBridge {
2551
2563
  paused?: boolean;
2552
2564
  debug?: boolean;
2553
2565
  }): void;
2566
+ /**
2567
+ * Publish a global's new value.
2568
+ *
2569
+ * Sent rather than queued: a queued payload is merged into the pending one
2570
+ * for its type, and since each message names a single `path`, two globals
2571
+ * changing in the same frame would collapse into one and the first
2572
+ * variable's update would never reach the editor.
2573
+ */
2554
2574
  publishVariable(payload: GameVariablePayload): void;
2555
2575
  /** Surface a diagnostic message in the editor console. */
2556
2576
  publishNotice(level: GameNoticePayload['level'], message: string): void;
@@ -5338,8 +5358,16 @@ export declare class SimulationBody implements PhysicsRenderPoseProvider {
5338
5358
  */
5339
5359
  private interpolationValidAfterStep;
5340
5360
  constructor(simulation: Simulation, handle: EntityHandle, clock: SimulationStepClock);
5341
- /** Suppress interpolation until the render buffers catch up. */
5342
- private markPoseDiscontinuity;
5361
+ /**
5362
+ * Suppress interpolation until the render buffers catch up.
5363
+ *
5364
+ * Called automatically by the pose setters below. Wasm-side behaviors that
5365
+ * teleport a body during a step (e.g. `screen_wrap`) bypass those setters,
5366
+ * so their host systems must call this after the step and before render
5367
+ * poses are synced — otherwise the render buffers straddle the teleport and
5368
+ * the body is drawn sweeping between the two poses.
5369
+ */
5370
+ markPoseDiscontinuity(): void;
5343
5371
  private isInterpolationStale;
5344
5372
  translation(): PhysicsVector3;
5345
5373
  rotation(): PhysicsQuaternion;
@@ -5497,6 +5525,21 @@ export declare type SpriteImage = {
5497
5525
 
5498
5526
  declare type SpriteOptions = BaseNode | Partial<ZylemSpriteOptions>;
5499
5527
 
5528
+ /**
5529
+ * A single texture divided into a uniform grid of frames, addressed by UV
5530
+ * offset. Prefer this over {@link SpriteImage} lists for character sheets: one
5531
+ * texture and one draw call instead of one per frame.
5532
+ */
5533
+ export declare type SpriteSheet = {
5534
+ file: string;
5535
+ columns: number;
5536
+ rows: number;
5537
+ /** Frame names in row-major order. `null` marks an unused cell. */
5538
+ frames: Array<string | null>;
5539
+ /** Texture filtering. Defaults to `nearest`, which keeps pixel art crisp. */
5540
+ filter?: 'nearest' | 'linear';
5541
+ };
5542
+
5500
5543
  declare class Stage {
5501
5544
  wrappedStage: ZylemStage | null;
5502
5545
  options: StageOptionItem[];
@@ -8255,15 +8298,34 @@ export declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
8255
8298
  protected spriteMap: Map<string, number>;
8256
8299
  protected currentSpriteIndex: number;
8257
8300
  protected animations: Map<string, any>;
8258
- protected currentAnimation: any;
8301
+ protected currentAnimation: string | null;
8259
8302
  protected currentAnimationFrame: string;
8260
8303
  protected currentAnimationIndex: number;
8261
8304
  protected currentAnimationTime: number;
8305
+ /** Set only in sheet mode; the shared texture whose UV window we shift. */
8306
+ protected sheetTexture: Texture | null;
8307
+ protected flippedX: boolean;
8262
8308
  constructor(options?: ZylemSpriteOptions);
8263
8309
  create(): this;
8264
8310
  protected createSpritesFromImages(images: SpriteImage[]): void;
8311
+ protected createSpriteFromSheet(sheet: SpriteSheet): void;
8265
8312
  protected createAnimations(animations: SpriteAnimation[]): void;
8266
8313
  setSprite(key: string): void;
8314
+ /**
8315
+ * Mirror the sprite horizontally, for characters whose sheet only contains
8316
+ * one facing direction.
8317
+ *
8318
+ * In sheet mode this flips the UV window rather than the sprite scale,
8319
+ * because {@link syncSpriteMaterials} rewrites scale from `options.size`
8320
+ * every frame and would immediately undo a negative scale.
8321
+ */
8322
+ setFlipX(flip: boolean): void;
8323
+ isFlippedX(): boolean;
8324
+ private applySheetFrame;
8325
+ /**
8326
+ * Advance a named clip. Call once per frame from an update loop; `delta` is
8327
+ * seconds, so scaling it scales playback rate.
8328
+ */
8267
8329
  setAnimation(name: string, delta: number): void;
8268
8330
  private getCurrentRotationQuaternion;
8269
8331
  private syncSpriteMaterials;
@@ -8275,6 +8337,7 @@ export declare class ZylemSprite extends GameEntity<ZylemSpriteOptions> {
8275
8337
 
8276
8338
  declare type ZylemSpriteOptions = GameEntityOptions & {
8277
8339
  images?: SpriteImage[];
8340
+ sheet?: SpriteSheet;
8278
8341
  animations?: SpriteAnimation[];
8279
8342
  size?: Vec3Input;
8280
8343
  collisionSize?: Vec3Input;