@zylem/game-lib 0.6.3 → 0.7.0

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 (97) hide show
  1. package/README.md +3 -1
  2. package/dist/actions.d.ts +255 -8
  3. package/dist/actions.js +1 -772
  4. package/dist/audio.d.ts +13 -0
  5. package/dist/audio.js +1 -0
  6. package/dist/base-node-life-cycle-CnJ-7zX-.d.ts +143 -0
  7. package/dist/behavior.d.ts +3 -0
  8. package/dist/behavior.js +1 -0
  9. package/dist/chunk-4QLJUQSJ.js +1 -0
  10. package/dist/chunk-73VZQZUL.js +1 -0
  11. package/dist/chunk-A34ZG3L4.js +1 -0
  12. package/dist/chunk-CDPY4VOQ.js +1 -0
  13. package/dist/chunk-DR6XXZE7.js +19 -0
  14. package/dist/chunk-FM5TBEPO.js +1 -0
  15. package/dist/chunk-G2IIMSUH.js +1 -0
  16. package/dist/chunk-MSC2BEO5.js +1 -0
  17. package/dist/chunk-NIH5CONO.js +1 -0
  18. package/dist/chunk-ONWXGBWB.js +1 -0
  19. package/dist/chunk-QEDQDR27.js +1 -0
  20. package/dist/chunk-QXVH6POE.js +1 -0
  21. package/dist/chunk-RXDTAWI2.js +29 -0
  22. package/dist/chunk-WKHW2QO2.js +1 -0
  23. package/dist/chunk-XRP4JJXL.js +1 -0
  24. package/dist/chunk-YHEWKN7N.js +1 -0
  25. package/dist/chunk-YHKXQ2ZN.js +1 -0
  26. package/dist/core.d.ts +206 -13
  27. package/dist/core.js +24 -9160
  28. package/dist/debug.d.ts +24 -0
  29. package/dist/debug.js +1 -0
  30. package/dist/default-controls-BGc61yYl.d.ts +111 -0
  31. package/dist/entity-DNkYKfdp.d.ts +1043 -0
  32. package/dist/entity-type-map-C94h2TDW.d.ts +781 -0
  33. package/dist/entity.d.ts +265 -0
  34. package/dist/entity.js +1 -0
  35. package/dist/events.d.ts +172 -0
  36. package/dist/events.js +1 -0
  37. package/dist/game-Cuj5gy7U.d.ts +1590 -0
  38. package/dist/game-default-PZLLHYL7.js +1 -0
  39. package/dist/game-interfaces-tfpM5NBk.d.ts +90 -0
  40. package/dist/globals.d.ts +104 -0
  41. package/dist/globals.js +1 -0
  42. package/dist/graphics.d.ts +83 -0
  43. package/dist/graphics.js +1 -0
  44. package/dist/input-ui.d.ts +34 -0
  45. package/dist/input-ui.js +1 -0
  46. package/dist/input.d.ts +72 -0
  47. package/dist/input.js +1 -0
  48. package/dist/material-Wz83vTTp.d.ts +151 -0
  49. package/dist/runtime.d.ts +433 -0
  50. package/dist/runtime.js +1 -0
  51. package/dist/web-components.d.ts +67 -0
  52. package/dist/web-components.js +9 -0
  53. package/dist/world-C9zdyl5d.d.ts +103 -0
  54. package/dist/zylem-stage-runtime-Cs-UDEVU.d.ts +777 -0
  55. package/package.json +54 -41
  56. package/dist/actions.js.map +0 -1
  57. package/dist/behavior/platformer-3d.d.ts +0 -296
  58. package/dist/behavior/platformer-3d.js +0 -518
  59. package/dist/behavior/platformer-3d.js.map +0 -1
  60. package/dist/behavior/ricochet-2d.d.ts +0 -274
  61. package/dist/behavior/ricochet-2d.js +0 -394
  62. package/dist/behavior/ricochet-2d.js.map +0 -1
  63. package/dist/behavior/screen-wrap.d.ts +0 -86
  64. package/dist/behavior/screen-wrap.js +0 -195
  65. package/dist/behavior/screen-wrap.js.map +0 -1
  66. package/dist/behavior/thruster.d.ts +0 -10
  67. package/dist/behavior/thruster.js +0 -234
  68. package/dist/behavior/thruster.js.map +0 -1
  69. package/dist/behavior/world-boundary-2d.d.ts +0 -141
  70. package/dist/behavior/world-boundary-2d.js +0 -181
  71. package/dist/behavior/world-boundary-2d.js.map +0 -1
  72. package/dist/behavior-descriptor-BWNWmIjv.d.ts +0 -142
  73. package/dist/blueprints-BWGz8fII.d.ts +0 -26
  74. package/dist/camera-B5e4c78l.d.ts +0 -468
  75. package/dist/camera.d.ts +0 -6
  76. package/dist/camera.js +0 -1406
  77. package/dist/camera.js.map +0 -1
  78. package/dist/composition-DrzFrbqI.d.ts +0 -218
  79. package/dist/core-DAkskq6Y.d.ts +0 -498
  80. package/dist/core.js.map +0 -1
  81. package/dist/entities-DC9ce_vx.d.ts +0 -416
  82. package/dist/entities.d.ts +0 -9
  83. package/dist/entities.js +0 -4069
  84. package/dist/entities.js.map +0 -1
  85. package/dist/entity-BpbZqg19.d.ts +0 -1100
  86. package/dist/entity-Bq_eNEDI.d.ts +0 -28
  87. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  88. package/dist/global-change-Dc8uCKi2.d.ts +0 -25
  89. package/dist/main.d.ts +0 -654
  90. package/dist/main.js +0 -13355
  91. package/dist/main.js.map +0 -1
  92. package/dist/stage-types-BFsm3qsZ.d.ts +0 -567
  93. package/dist/stage.d.ts +0 -51
  94. package/dist/stage.js +0 -5738
  95. package/dist/stage.js.map +0 -1
  96. package/dist/thruster-DhRaJnoL.d.ts +0 -172
  97. package/dist/world-Be5m1XC1.d.ts +0 -31
@@ -1,172 +0,0 @@
1
- import { StateMachine } from 'typescript-fsm';
2
- import { Z as ZylemWorld } from './world-Be5m1XC1.js';
3
- import { RigidBody } from '@dimforge/rapier3d-compat';
4
- import { Vector3, Quaternion } from 'three';
5
- import { b as BehaviorDescriptor } from './behavior-descriptor-BWNWmIjv.js';
6
-
7
- /**
8
- * Core ECS Components
9
- *
10
- * These are pure data interfaces with no logic.
11
- * They work alongside the existing bitecs components in transformable.system.ts
12
- */
13
-
14
- interface TransformComponent {
15
- position: Vector3;
16
- rotation: Quaternion;
17
- }
18
- declare function createTransformComponent(): TransformComponent;
19
- interface PhysicsBodyComponent {
20
- body: RigidBody;
21
- }
22
- declare function createPhysicsBodyComponent(body: RigidBody): PhysicsBodyComponent;
23
-
24
- /**
25
- * Thruster-specific ECS Components
26
- *
27
- * These components are specific to the thruster movement system.
28
- */
29
- interface ThrusterMovementComponent {
30
- /** Linear thrust force in Newtons (or scaled units) */
31
- linearThrust: number;
32
- /** Angular thrust torque scalar */
33
- angularThrust: number;
34
- /** Optional linear damping override */
35
- linearDamping?: number;
36
- /** Optional angular damping override */
37
- angularDamping?: number;
38
- }
39
- declare function createThrusterMovementComponent(linearThrust: number, angularThrust: number, options?: {
40
- linearDamping?: number;
41
- angularDamping?: number;
42
- }): ThrusterMovementComponent;
43
- interface ThrusterInputComponent {
44
- /** Forward thrust intent: 0..1 */
45
- thrust: number;
46
- /** Rotation intent: -1..1 */
47
- rotate: number;
48
- }
49
- declare function createThrusterInputComponent(): ThrusterInputComponent;
50
- interface ThrusterStateComponent {
51
- /** Whether the thruster is enabled */
52
- enabled: boolean;
53
- /** Current thrust after FSM/gating */
54
- currentThrust: number;
55
- }
56
- declare function createThrusterStateComponent(): ThrusterStateComponent;
57
-
58
- /**
59
- * ThrusterFSM
60
- *
61
- * State machine controller for thruster behavior.
62
- * FSM does NOT touch physics or ThrusterMovementBehavior - it only writes ThrusterInputComponent.
63
- */
64
-
65
- declare enum ThrusterState {
66
- Idle = "idle",
67
- Active = "active",
68
- Boosting = "boosting",
69
- Disabled = "disabled",
70
- Docked = "docked"
71
- }
72
- declare enum ThrusterEvent {
73
- Activate = "activate",
74
- Deactivate = "deactivate",
75
- Boost = "boost",
76
- EndBoost = "endBoost",
77
- Disable = "disable",
78
- Enable = "enable",
79
- Dock = "dock",
80
- Undock = "undock"
81
- }
82
- interface ThrusterFSMContext {
83
- input: ThrusterInputComponent;
84
- }
85
- interface PlayerInput {
86
- thrust: number;
87
- rotate: number;
88
- }
89
- declare class ThrusterFSM {
90
- private ctx;
91
- machine: StateMachine<ThrusterState, ThrusterEvent, never>;
92
- constructor(ctx: ThrusterFSMContext);
93
- /**
94
- * Get current state
95
- */
96
- getState(): ThrusterState;
97
- /**
98
- * Dispatch an event to transition state
99
- */
100
- dispatch(event: ThrusterEvent): void;
101
- /**
102
- * Update FSM state based on player input.
103
- * Auto-transitions between Idle/Active to report current state.
104
- * Does NOT modify input - just observes and reports.
105
- */
106
- update(playerInput: PlayerInput): void;
107
- }
108
-
109
- /**
110
- * ThrusterMovementBehavior
111
- *
112
- * This is the heart of the thruster movement system - a pure, stateless force generator.
113
- * Works identically for player, AI, and replay.
114
- */
115
-
116
- /**
117
- * Zylem-style Behavior interface
118
- */
119
- interface Behavior {
120
- update(dt: number): void;
121
- }
122
- /**
123
- * Entity with thruster components
124
- */
125
- interface ThrusterEntity {
126
- physics: PhysicsBodyComponent;
127
- thruster: ThrusterMovementComponent;
128
- $thruster: ThrusterInputComponent;
129
- }
130
- /**
131
- * ThrusterMovementBehavior - Force generator for thruster-equipped entities
132
- *
133
- * Responsibilities:
134
- * - Query entities with PhysicsBody, ThrusterMovement, and ThrusterInput components
135
- * - Apply velocities based on thrust input (2D mode)
136
- * - Apply angular velocity based on rotation input
137
- */
138
- declare class ThrusterMovementBehavior implements Behavior {
139
- private world;
140
- constructor(world: ZylemWorld);
141
- /**
142
- * Query function - returns entities with required thruster components
143
- */
144
- private queryEntities;
145
- update(_dt: number): void;
146
- }
147
-
148
- /**
149
- * Thruster behavior options (typed for entity.use() autocomplete)
150
- */
151
- interface ThrusterBehaviorOptions {
152
- /** Forward thrust force (default: 10) */
153
- linearThrust: number;
154
- /** Rotation torque (default: 5) */
155
- angularThrust: number;
156
- }
157
- /**
158
- * ThrusterBehavior - typed descriptor for thruster movement.
159
- *
160
- * Uses the existing ThrusterMovementBehavior under the hood.
161
- *
162
- * @example
163
- * ```typescript
164
- * import { ThrusterBehavior } from "@zylem/game-lib";
165
- *
166
- * const ship = createSprite({ ... });
167
- * ship.use(ThrusterBehavior, { linearThrust: 15, angularThrust: 8 });
168
- * ```
169
- */
170
- declare const ThrusterBehavior: BehaviorDescriptor<ThrusterBehaviorOptions, Record<string, never>, ThrusterEntity>;
171
-
172
- export { type Behavior as B, type PhysicsBodyComponent as P, type TransformComponent as T, createPhysicsBodyComponent as a, type ThrusterMovementComponent as b, createTransformComponent as c, type ThrusterInputComponent as d, type ThrusterStateComponent as e, createThrusterMovementComponent as f, createThrusterInputComponent as g, createThrusterStateComponent as h, ThrusterState as i, ThrusterEvent as j, ThrusterFSM as k, type ThrusterFSMContext as l, type PlayerInput as m, ThrusterMovementBehavior as n, type ThrusterEntity as o, ThrusterBehavior as p, type ThrusterBehaviorOptions as q };
@@ -1,31 +0,0 @@
1
- import { Vector3 } from 'three';
2
- import RAPIER__default, { World } from '@dimforge/rapier3d-compat';
3
- import { E as Entity } from './entity-Bq_eNEDI.js';
4
- import { I as GameEntity, U as UpdateContext } from './entity-BpbZqg19.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
-
31
- export { type CollisionHandlerDelegate as C, ZylemWorld as Z };