@zylem/behaviors 0.2.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 (175) hide show
  1. package/README.md +26 -0
  2. package/dist/behavior-system-DYbx-x_-.d.ts +307 -0
  3. package/dist/chunk-2C3Z5GE7.js +176 -0
  4. package/dist/chunk-2C3Z5GE7.js.map +1 -0
  5. package/dist/chunk-2CLT36VB.js +241 -0
  6. package/dist/chunk-2CLT36VB.js.map +1 -0
  7. package/dist/chunk-3PYGRHAL.js +35 -0
  8. package/dist/chunk-3PYGRHAL.js.map +1 -0
  9. package/dist/chunk-4I6E6DGV.js +212 -0
  10. package/dist/chunk-4I6E6DGV.js.map +1 -0
  11. package/dist/chunk-4URF65BR.js +44 -0
  12. package/dist/chunk-4URF65BR.js.map +1 -0
  13. package/dist/chunk-6C6NXNEW.js +38 -0
  14. package/dist/chunk-6C6NXNEW.js.map +1 -0
  15. package/dist/chunk-ARJWUNRE.js +431 -0
  16. package/dist/chunk-ARJWUNRE.js.map +1 -0
  17. package/dist/chunk-BXP4K7RF.js +1205 -0
  18. package/dist/chunk-BXP4K7RF.js.map +1 -0
  19. package/dist/chunk-DYLH6K7B.js +44 -0
  20. package/dist/chunk-DYLH6K7B.js.map +1 -0
  21. package/dist/chunk-EIWQM6U3.js +27 -0
  22. package/dist/chunk-EIWQM6U3.js.map +1 -0
  23. package/dist/chunk-EZNCCO4L.js +14 -0
  24. package/dist/chunk-EZNCCO4L.js.map +1 -0
  25. package/dist/chunk-F3KRX2V4.js +457 -0
  26. package/dist/chunk-F3KRX2V4.js.map +1 -0
  27. package/dist/chunk-FPTWVCPN.js +53 -0
  28. package/dist/chunk-FPTWVCPN.js.map +1 -0
  29. package/dist/chunk-GCNRXAKH.js +37 -0
  30. package/dist/chunk-GCNRXAKH.js.map +1 -0
  31. package/dist/chunk-GYURWCIQ.js +1985 -0
  32. package/dist/chunk-GYURWCIQ.js.map +1 -0
  33. package/dist/chunk-HZMY3TT4.js +244 -0
  34. package/dist/chunk-HZMY3TT4.js.map +1 -0
  35. package/dist/chunk-ID5QJYF5.js +50 -0
  36. package/dist/chunk-ID5QJYF5.js.map +1 -0
  37. package/dist/chunk-JAN34G6S.js +552 -0
  38. package/dist/chunk-JAN34G6S.js.map +1 -0
  39. package/dist/chunk-K3UNLQ7W.js +118 -0
  40. package/dist/chunk-K3UNLQ7W.js.map +1 -0
  41. package/dist/chunk-KDY5N6J4.js +82 -0
  42. package/dist/chunk-KDY5N6J4.js.map +1 -0
  43. package/dist/chunk-KOZUNIIE.js +413 -0
  44. package/dist/chunk-KOZUNIIE.js.map +1 -0
  45. package/dist/chunk-KS72RZHX.js +30 -0
  46. package/dist/chunk-KS72RZHX.js.map +1 -0
  47. package/dist/chunk-LD5SMIB3.js +32 -0
  48. package/dist/chunk-LD5SMIB3.js.map +1 -0
  49. package/dist/chunk-OHCPV2NT.js +86 -0
  50. package/dist/chunk-OHCPV2NT.js.map +1 -0
  51. package/dist/chunk-OYWFPIHF.js +115 -0
  52. package/dist/chunk-OYWFPIHF.js.map +1 -0
  53. package/dist/chunk-POZER3MQ.js +407 -0
  54. package/dist/chunk-POZER3MQ.js.map +1 -0
  55. package/dist/chunk-RTRVBEIB.js +56 -0
  56. package/dist/chunk-RTRVBEIB.js.map +1 -0
  57. package/dist/chunk-RTVRUNYR.js +29 -0
  58. package/dist/chunk-RTVRUNYR.js.map +1 -0
  59. package/dist/chunk-SS7ELMJ7.js +406 -0
  60. package/dist/chunk-SS7ELMJ7.js.map +1 -0
  61. package/dist/chunk-STCCNLPC.js +160 -0
  62. package/dist/chunk-STCCNLPC.js.map +1 -0
  63. package/dist/chunk-SVLNF434.js +261 -0
  64. package/dist/chunk-SVLNF434.js.map +1 -0
  65. package/dist/chunk-UYFOLI2X.js +24 -0
  66. package/dist/chunk-UYFOLI2X.js.map +1 -0
  67. package/dist/chunk-VAN4WW3F.js +67 -0
  68. package/dist/chunk-VAN4WW3F.js.map +1 -0
  69. package/dist/chunk-WOMHL23C.js +369 -0
  70. package/dist/chunk-WOMHL23C.js.map +1 -0
  71. package/dist/chunk-WWVD5DR5.js +120 -0
  72. package/dist/chunk-WWVD5DR5.js.map +1 -0
  73. package/dist/chunk-XG2YMCJW.js +201 -0
  74. package/dist/chunk-XG2YMCJW.js.map +1 -0
  75. package/dist/chunk-XIJNE67Y.js +210 -0
  76. package/dist/chunk-XIJNE67Y.js.map +1 -0
  77. package/dist/chunk-Y6UJOUE5.js +44 -0
  78. package/dist/chunk-Y6UJOUE5.js.map +1 -0
  79. package/dist/chunk-YUO6SKJD.js +348 -0
  80. package/dist/chunk-YUO6SKJD.js.map +1 -0
  81. package/dist/components--hjBMTnz.d.ts +120 -0
  82. package/dist/components-B29WHGQN.d.ts +39 -0
  83. package/dist/components-BWG1GkZA.d.ts +20 -0
  84. package/dist/components-XCpL6IYt.d.ts +18 -0
  85. package/dist/components-qWwOsvwh.d.ts +43 -0
  86. package/dist/cooldown.d.ts +116 -0
  87. package/dist/cooldown.js +20 -0
  88. package/dist/cooldown.js.map +1 -0
  89. package/dist/coordinators/boundary-ricochet-3d.d.ts +19 -0
  90. package/dist/coordinators/boundary-ricochet-3d.js +8 -0
  91. package/dist/coordinators/boundary-ricochet-3d.js.map +1 -0
  92. package/dist/coordinators/boundary-ricochet.d.ts +34 -0
  93. package/dist/coordinators/boundary-ricochet.js +8 -0
  94. package/dist/coordinators/boundary-ricochet.js.map +1 -0
  95. package/dist/coordinators/first-person-shooter.d.ts +35 -0
  96. package/dist/coordinators/first-person-shooter.js +9 -0
  97. package/dist/coordinators/first-person-shooter.js.map +1 -0
  98. package/dist/coordinators/multidirectional-space-shooter.d.ts +27 -0
  99. package/dist/coordinators/multidirectional-space-shooter.js +10 -0
  100. package/dist/coordinators/multidirectional-space-shooter.js.map +1 -0
  101. package/dist/coordinators/top-down-shooter.d.ts +27 -0
  102. package/dist/coordinators/top-down-shooter.js +10 -0
  103. package/dist/coordinators/top-down-shooter.js.map +1 -0
  104. package/dist/core.d.ts +25 -0
  105. package/dist/core.js +327 -0
  106. package/dist/core.js.map +1 -0
  107. package/dist/destructible-3d.d.ts +42 -0
  108. package/dist/destructible-3d.js +13 -0
  109. package/dist/destructible-3d.js.map +1 -0
  110. package/dist/destructible-prebake.d.ts +28 -0
  111. package/dist/destructible-prebake.js +23 -0
  112. package/dist/destructible-prebake.js.map +1 -0
  113. package/dist/entity-types-CmtQ-IBp.d.ts +15 -0
  114. package/dist/first-person-perspective-C9Mptl0-.d.ts +23 -0
  115. package/dist/first-person.d.ts +204 -0
  116. package/dist/first-person.js +27 -0
  117. package/dist/first-person.js.map +1 -0
  118. package/dist/index.d.ts +40 -0
  119. package/dist/index.js +263 -0
  120. package/dist/index.js.map +1 -0
  121. package/dist/jumper-2d.d.ts +113 -0
  122. package/dist/jumper-2d.js +27 -0
  123. package/dist/jumper-2d.js.map +1 -0
  124. package/dist/jumper-3d.d.ts +164 -0
  125. package/dist/jumper-3d.js +29 -0
  126. package/dist/jumper-3d.js.map +1 -0
  127. package/dist/moveable-BCRpjAQb.d.ts +176 -0
  128. package/dist/particle-emitter/presets.d.ts +46 -0
  129. package/dist/particle-emitter/presets.js +15 -0
  130. package/dist/particle-emitter/presets.js.map +1 -0
  131. package/dist/particle-emitter.d.ts +78 -0
  132. package/dist/particle-emitter.js +15 -0
  133. package/dist/particle-emitter.js.map +1 -0
  134. package/dist/payload-BQzu-oY_.d.ts +89 -0
  135. package/dist/platformer-3d.d.ts +347 -0
  136. package/dist/platformer-3d.js +23 -0
  137. package/dist/platformer-3d.js.map +1 -0
  138. package/dist/ricochet-2d.d.ts +274 -0
  139. package/dist/ricochet-2d.js +16 -0
  140. package/dist/ricochet-2d.js.map +1 -0
  141. package/dist/ricochet-3d.d.ts +116 -0
  142. package/dist/ricochet-3d.js +16 -0
  143. package/dist/ricochet-3d.js.map +1 -0
  144. package/dist/runtime-2d.d.ts +2 -0
  145. package/dist/runtime-2d.js +32 -0
  146. package/dist/runtime-2d.js.map +1 -0
  147. package/dist/runtime-pong.d.ts +92 -0
  148. package/dist/runtime-pong.js +38 -0
  149. package/dist/runtime-pong.js.map +1 -0
  150. package/dist/screen-visibility.d.ts +74 -0
  151. package/dist/screen-visibility.js +10 -0
  152. package/dist/screen-visibility.js.map +1 -0
  153. package/dist/screen-wrap.d.ts +86 -0
  154. package/dist/screen-wrap.js +16 -0
  155. package/dist/screen-wrap.js.map +1 -0
  156. package/dist/shooter-2d.d.ts +77 -0
  157. package/dist/shooter-2d.js +12 -0
  158. package/dist/shooter-2d.js.map +1 -0
  159. package/dist/spark-DDlIg1nM.d.ts +148 -0
  160. package/dist/sync-state-machine-CZyspBpj.d.ts +16 -0
  161. package/dist/thruster.d.ts +132 -0
  162. package/dist/thruster.js +26 -0
  163. package/dist/thruster.js.map +1 -0
  164. package/dist/top-down-movement.d.ts +40 -0
  165. package/dist/top-down-movement.js +20 -0
  166. package/dist/top-down-movement.js.map +1 -0
  167. package/dist/use-behavior-D_82jAL3.d.ts +13 -0
  168. package/dist/vector-Bm65-FOG.d.ts +45 -0
  169. package/dist/world-boundary-2d.d.ts +141 -0
  170. package/dist/world-boundary-2d.js +21 -0
  171. package/dist/world-boundary-2d.js.map +1 -0
  172. package/dist/world-boundary-3d.d.ts +75 -0
  173. package/dist/world-boundary-3d.js +21 -0
  174. package/dist/world-boundary-3d.js.map +1 -0
  175. package/package.json +161 -0
@@ -0,0 +1,164 @@
1
+ import { J as JumpConfig3D, b as JumpInput3D, a as JumpContext3D, c as JumpState3D } from './components--hjBMTnz.js';
2
+ export { V as Vec3Like, d as createJumpConfig3D, e as createJumpInput3D, f as createJumpState3D } from './components--hjBMTnz.js';
3
+ import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
4
+ import { a as BehaviorDescriptor } from './behavior-system-DYbx-x_-.js';
5
+ import 'typescript-fsm';
6
+
7
+ /**
8
+ * Jumper 3D Behavior — Pure Jump Physics
9
+ *
10
+ * A stateless tick function that receives configuration, input, context, and
11
+ * state, then applies jump physics through the context's velocity helpers.
12
+ *
13
+ * Vertical velocity (Y) is owned exclusively by this behavior.
14
+ * Horizontal velocity (X/Z) is only touched when airborne planar control
15
+ * is configured; otherwise the movement controller owns X/Z.
16
+ */
17
+
18
+ declare class Jumper3DBehavior {
19
+ /**
20
+ * Advance the jump system by one frame.
21
+ *
22
+ * Call order within a frame:
23
+ * 1. Movement controller writes X/Z via transformStore.dirty.velocityX/Z.
24
+ * 2. `tick()` writes Y via ctx.setVerticalVelocity().
25
+ * (Optionally writes X/Z when airborne planar control is active.)
26
+ */
27
+ tick(config: JumpConfig3D, input: JumpInput3D, ctx: JumpContext3D, state: JumpState3D): JumperTickResult;
28
+ }
29
+ /** Events emitted by a single tick (used by FSM). */
30
+ declare enum JumperTickEvent {
31
+ None = "none",
32
+ Jump = "jump",
33
+ Fall = "fall",
34
+ Land = "land"
35
+ }
36
+ interface JumperTickResult {
37
+ event: JumperTickEvent;
38
+ }
39
+
40
+ /**
41
+ * Jumper 3D Finite State Machine
42
+ *
43
+ * Three high-level states driven by events emitted from the behavior tick:
44
+ * Grounded ──Jump──▶ Jumping
45
+ * Grounded ──Fall──▶ Falling (walked off a ledge)
46
+ * Jumping ──Fall──▶ Falling (apex / descending)
47
+ * Jumping ──Jump──▶ Jumping (multi-jump)
48
+ * Jumping ──Land──▶ Grounded (rare — very short hop)
49
+ * Falling ──Land──▶ Grounded
50
+ * Falling ──Jump──▶ Jumping (air-jump while falling)
51
+ */
52
+
53
+ declare enum Jumper3DState {
54
+ Grounded = "grounded",
55
+ Jumping = "jumping",
56
+ Falling = "falling"
57
+ }
58
+ declare enum Jumper3DEvent {
59
+ Jump = "jump",
60
+ Fall = "fall",
61
+ Land = "land"
62
+ }
63
+ interface Jumper3DFSMContext {
64
+ state: JumpState3D;
65
+ }
66
+ declare class Jumper3DFSM {
67
+ private ctx;
68
+ machine: SyncStateMachine<Jumper3DState, Jumper3DEvent, never>;
69
+ constructor(ctx: Jumper3DFSMContext);
70
+ getState(): Jumper3DState;
71
+ dispatch(event: Jumper3DEvent): void;
72
+ isJumping(): boolean;
73
+ isFalling(): boolean;
74
+ isGrounded(): boolean;
75
+ getJumpsUsed(): number;
76
+ /**
77
+ * Translate a tick event into an FSM dispatch.
78
+ * Also handles the implicit Grounded→Falling transition when the entity
79
+ * is no longer grounded but no explicit event was emitted (e.g. walked
80
+ * off a ledge without jumping).
81
+ */
82
+ applyTickEvent(tickEvent: string, isGrounded: boolean): void;
83
+ }
84
+
85
+ interface Jumper3DBehaviorOptions {
86
+ /** Desired peak height in world units (default: 2.5) */
87
+ jumpHeight?: number;
88
+ /** Gravity magnitude applied by the behavior (default: 20) */
89
+ gravity?: number;
90
+ /** Terminal fall speed (optional) */
91
+ maxFallSpeed?: number;
92
+ /** Max concurrent jumps, 1 = single, 2 = double, etc. (default: 1) */
93
+ maxJumps?: number;
94
+ /** Reset jump counter on ground (default: true) */
95
+ resetJumpsOnGround?: boolean;
96
+ /** Reset jump counter on wall contact (default: undefined) */
97
+ resetJumpsOnWall?: boolean;
98
+ /** Coyote time in ms (default: 100) */
99
+ coyoteTimeMs?: number;
100
+ /** Jump buffer in ms (default: 80) */
101
+ jumpBufferMs?: number;
102
+ /** Min cooldown between jumps in ms (optional) */
103
+ minTimeBetweenJumpsMs?: number;
104
+ /** Variable jump height config (optional) */
105
+ variableJump?: JumpConfig3D['variableJump'];
106
+ /** Planar control config (optional) */
107
+ planar?: JumpConfig3D['planar'];
108
+ /** Fall tuning (optional) */
109
+ fall?: JumpConfig3D['fall'];
110
+ /** Ground-detection ray length (default: 1.0) */
111
+ groundRayLength?: number;
112
+ /** Max support distance that counts as grounded and can snap to ground */
113
+ snapToGroundDistance?: number;
114
+ /** Enable debug visualization for ground probe rays (default: false) */
115
+ debugGroundProbe?: boolean;
116
+ }
117
+ interface Jumper3DEntity {
118
+ uuid: string;
119
+ body: any;
120
+ transformStore: any;
121
+ jumper: JumpConfig3D;
122
+ $jumper: JumpInput3D;
123
+ jumperState: JumpState3D;
124
+ }
125
+ /**
126
+ * Jumper3D — composable 3D jump behavior.
127
+ *
128
+ * Provides height-based jumping, multi-jump, coyote time, jump buffering,
129
+ * variable jump height, configurable fall gravity, and optional air control.
130
+ *
131
+ * Designed to compose with any movement controller (e.g. FirstPersonController)
132
+ * — the controller writes X/Z velocity and Jumper3D writes Y velocity.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * import { Jumper3D } from "@zylem/game-lib/behavior";
137
+ *
138
+ * const jumper = player.use(Jumper3D, {
139
+ * jumpHeight: 2.5,
140
+ * gravity: 20,
141
+ * maxJumps: 2,
142
+ * coyoteTimeMs: 100,
143
+ * jumpBufferMs: 80,
144
+ * variableJump: { enabled: true, cutGravityMultiplier: 3 },
145
+ * fall: { fallGravityMultiplier: 1.5 },
146
+ * });
147
+ *
148
+ * player.onUpdate(({ inputs }) => {
149
+ * player.$jumper.jumpPressed = inputs.p1.buttons.A.pressed;
150
+ * player.$jumper.jumpHeld = inputs.p1.buttons.A.held > 0;
151
+ * player.$jumper.jumpReleased = inputs.p1.buttons.A.released;
152
+ *
153
+ * const state = jumper.getState(); // Grounded | Jumping | Falling
154
+ * });
155
+ * ```
156
+ */
157
+ declare const Jumper3D: BehaviorDescriptor<Jumper3DBehaviorOptions, {
158
+ getState: () => Jumper3DState;
159
+ isJumping: () => boolean;
160
+ getJumpsUsed: () => number;
161
+ getJumpsRemaining: () => number;
162
+ }, Jumper3DEntity>;
163
+
164
+ export { JumpConfig3D, JumpContext3D, JumpInput3D, JumpState3D, Jumper3D, Jumper3DBehavior, type Jumper3DBehaviorOptions, type Jumper3DEntity, Jumper3DEvent, Jumper3DFSM, Jumper3DState, JumperTickEvent, type JumperTickResult };
@@ -0,0 +1,29 @@
1
+ import {
2
+ Jumper3D,
3
+ Jumper3DBehavior,
4
+ Jumper3DEvent,
5
+ Jumper3DFSM,
6
+ Jumper3DState,
7
+ JumperTickEvent
8
+ } from "./chunk-F3KRX2V4.js";
9
+ import {
10
+ createJumpConfig3D,
11
+ createJumpInput3D,
12
+ createJumpState3D
13
+ } from "./chunk-DYLH6K7B.js";
14
+ import "./chunk-SVLNF434.js";
15
+ import "./chunk-RTVRUNYR.js";
16
+ import "./chunk-4URF65BR.js";
17
+ import "./chunk-EZNCCO4L.js";
18
+ export {
19
+ Jumper3D,
20
+ Jumper3DBehavior,
21
+ Jumper3DEvent,
22
+ Jumper3DFSM,
23
+ Jumper3DState,
24
+ JumperTickEvent,
25
+ createJumpConfig3D,
26
+ createJumpInput3D,
27
+ createJumpState3D
28
+ };
29
+ //# sourceMappingURL=jumper-3d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,176 @@
1
+ import { Vector3 } from 'three';
2
+ import { RigidBody, Vector } from '@dimforge/rapier3d-compat';
3
+
4
+ type VelocityIntentMode = 'replace' | 'add';
5
+ interface VelocityIntent {
6
+ x?: number;
7
+ y?: number;
8
+ z?: number;
9
+ mode: VelocityIntentMode;
10
+ priority?: number;
11
+ }
12
+ /**
13
+ * Transform state managed by Valtio for batched physics updates.
14
+ *
15
+ * This store accumulates transformation intents during the frame,
16
+ * then applies them all at once after onUpdate() callbacks complete.
17
+ *
18
+ * Design decisions:
19
+ * - Position: Accumulated deltas (additive)
20
+ * - Rotation: Last value wins (replacement)
21
+ * - Velocity: Accumulated deltas (additive)
22
+ * - Angular velocity: Accumulated deltas (additive)
23
+ */
24
+ interface TransformState {
25
+ /** Position deltas to be applied (accumulated) */
26
+ position: {
27
+ x: number;
28
+ y: number;
29
+ z: number;
30
+ };
31
+ /** Rotation quaternion (last value wins) */
32
+ rotation: {
33
+ x: number;
34
+ y: number;
35
+ z: number;
36
+ w: number;
37
+ };
38
+ /** Linear velocity (accumulated) */
39
+ velocity: {
40
+ x: number;
41
+ y: number;
42
+ z: number;
43
+ };
44
+ /** Angular velocity (accumulated) */
45
+ angularVelocity: {
46
+ x: number;
47
+ y: number;
48
+ z: number;
49
+ };
50
+ /** Per-source velocity intents composed once per frame */
51
+ velocityChannels: Record<string, VelocityIntent>;
52
+ /** Dirty flags to track what needs to be applied */
53
+ dirty: {
54
+ position: boolean;
55
+ rotation: boolean;
56
+ /** @deprecated Use per-axis velocityX/Y/Z flags for new code */
57
+ velocity: boolean;
58
+ velocityX: boolean;
59
+ velocityY: boolean;
60
+ velocityZ: boolean;
61
+ velocityChannels: boolean;
62
+ angularVelocity: boolean;
63
+ };
64
+ }
65
+ /**
66
+ * Create a new transform store with optional initial values.
67
+ * The store is a Valtio proxy, making it reactive for debugging/visualization.
68
+ *
69
+ * @param initial Optional initial state values
70
+ * @returns Reactive transform state
71
+ */
72
+ declare function createTransformStore(initial?: Partial<TransformState>): TransformState;
73
+ /**
74
+ * Reset a transform store to its initial clean state.
75
+ * Called after applying changes to prepare for the next frame.
76
+ *
77
+ * @param store The transform store to reset
78
+ */
79
+ declare function resetTransformStore(store: TransformState): void;
80
+
81
+ interface EntityWithBody {
82
+ body: RigidBody | null;
83
+ transformStore?: TransformState;
84
+ }
85
+ /**
86
+ * Move an entity along the X axis, preserving other velocities.
87
+ */
88
+ declare function moveX(entity: EntityWithBody, delta: number): void;
89
+ /**
90
+ * Move an entity along the Y axis, preserving other velocities.
91
+ */
92
+ declare function moveY(entity: EntityWithBody, delta: number): void;
93
+ /**
94
+ * Move an entity along the Z axis, preserving other velocities.
95
+ */
96
+ declare function moveZ(entity: EntityWithBody, delta: number): void;
97
+ /**
98
+ * Move an entity along the X and Y axis, preserving Z velocity.
99
+ */
100
+ declare function moveXY(entity: EntityWithBody, deltaX: number, deltaY: number): void;
101
+ /**
102
+ * Move an entity along the X and Z axis, preserving Y velocity.
103
+ */
104
+ declare function moveXZ(entity: EntityWithBody, deltaX: number, deltaZ: number): void;
105
+ /**
106
+ * Move entity based on a vector, adding to existing velocities.
107
+ */
108
+ declare function move(entity: EntityWithBody, vector: Vector3): void;
109
+ /**
110
+ * Reset entity velocity
111
+ */
112
+ declare function resetVelocity(entity: EntityWithBody): void;
113
+ /**
114
+ * Move entity forward in 2D space, preserving Z velocity
115
+ */
116
+ declare function moveForwardXY(entity: EntityWithBody, delta: number, rotation2DAngle: number): void;
117
+ /**
118
+ * Get entity position
119
+ */
120
+ declare function getPosition(entity: EntityWithBody): Vector | null;
121
+ /**
122
+ * Get entity velocity
123
+ */
124
+ declare function getVelocity(entity: EntityWithBody): Vector | null;
125
+ /**
126
+ * Set entity position
127
+ */
128
+ declare function setPosition(entity: EntityWithBody, x: number, y: number, z: number): void;
129
+ /**
130
+ * Set entity X position
131
+ */
132
+ declare function setPositionX(entity: EntityWithBody, x: number): void;
133
+ /**
134
+ * Set entity Y position
135
+ */
136
+ declare function setPositionY(entity: EntityWithBody, y: number): void;
137
+ /**
138
+ * Set entity Z position
139
+ */
140
+ declare function setPositionZ(entity: EntityWithBody, z: number): void;
141
+ /**
142
+ * Wrap entity around 2D bounds
143
+ */
144
+ declare function wrapAroundXY(entity: EntityWithBody, boundsX: number, boundsY: number): void;
145
+ /**
146
+ * Wrap entity around 3D bounds
147
+ */
148
+ declare function wrapAround3D(entity: EntityWithBody, boundsX: number, boundsY: number, boundsZ: number): void;
149
+ /**
150
+ * Enhanced moveable entity with bound methods
151
+ */
152
+ interface MoveableEntity extends EntityWithBody {
153
+ moveX(delta: number): void;
154
+ moveY(delta: number): void;
155
+ moveZ(delta: number): void;
156
+ moveXY(deltaX: number, deltaY: number): void;
157
+ moveXZ(deltaX: number, deltaZ: number): void;
158
+ move(vector: Vector3): void;
159
+ resetVelocity(): void;
160
+ moveForwardXY(delta: number, rotation2DAngle: number): void;
161
+ getPosition(): Vector | null;
162
+ getVelocity(): Vector | null;
163
+ setPosition(x: number, y: number, z: number): void;
164
+ setPositionX(x: number): void;
165
+ setPositionY(y: number): void;
166
+ setPositionZ(z: number): void;
167
+ wrapAroundXY(boundsX: number, boundsY: number): void;
168
+ wrapAround3D(boundsX: number, boundsY: number, boundsZ: number): void;
169
+ }
170
+ /**
171
+ * Enhance an entity with additive movement methods.
172
+ * Automatically creates a transform store if one doesn't exist.
173
+ */
174
+ declare function makeMoveable<T extends EntityWithBody>(entity: T): T & MoveableEntity;
175
+
176
+ export { type EntityWithBody as E, type MoveableEntity as M, type TransformState as T, type VelocityIntent as V, type VelocityIntentMode as a, getVelocity as b, createTransformStore as c, move as d, moveForwardXY as e, moveX as f, getPosition as g, moveXY as h, moveXZ as i, moveY as j, moveZ as k, resetVelocity as l, makeMoveable as m, setPositionX as n, setPositionY as o, setPositionZ as p, wrapAroundXY as q, resetTransformStore as r, setPosition as s, wrapAround3D as w };
@@ -0,0 +1,46 @@
1
+ import { j as arcane, q as holy, l as corrupted, t as nature, I as voidMagic, w as psychic, A as spark, i as arc, F as surge, x as pulse, E as storm, H as vapor, y as smoke, p as haze, v as plume, r as miasma, s as mist, D as spray, C as splash, m as drizzle, G as torrent, B as spark$1, n as ember, o as flamelet, k as blaze, z as smolder } from '../spark-DDlIg1nM.js';
2
+ import 'three';
3
+ import 'three.quarks';
4
+
5
+ declare const magicPresets: {
6
+ readonly arcane: typeof arcane;
7
+ readonly holy: typeof holy;
8
+ readonly corrupted: typeof corrupted;
9
+ readonly nature: typeof nature;
10
+ readonly void: typeof voidMagic;
11
+ readonly psychic: typeof psychic;
12
+ };
13
+
14
+ declare const electricityPresets: {
15
+ readonly spark: typeof spark;
16
+ readonly arc: typeof arc;
17
+ readonly surge: typeof surge;
18
+ readonly pulse: typeof pulse;
19
+ readonly storm: typeof storm;
20
+ };
21
+
22
+ declare const gasPresets: {
23
+ readonly vapor: typeof vapor;
24
+ readonly smoke: typeof smoke;
25
+ readonly haze: typeof haze;
26
+ readonly plume: typeof plume;
27
+ readonly miasma: typeof miasma;
28
+ };
29
+
30
+ declare const waterPresets: {
31
+ readonly mist: typeof mist;
32
+ readonly spray: typeof spray;
33
+ readonly splash: typeof splash;
34
+ readonly drizzle: typeof drizzle;
35
+ readonly torrent: typeof torrent;
36
+ };
37
+
38
+ declare const firePresets: {
39
+ readonly spark: typeof spark$1;
40
+ readonly ember: typeof ember;
41
+ readonly flamelet: typeof flamelet;
42
+ readonly blaze: typeof blaze;
43
+ readonly smolder: typeof smolder;
44
+ };
45
+
46
+ export { electricityPresets, firePresets, gasPresets, magicPresets, waterPresets };
@@ -0,0 +1,15 @@
1
+ import {
2
+ electricityPresets,
3
+ firePresets,
4
+ gasPresets,
5
+ magicPresets,
6
+ waterPresets
7
+ } from "../chunk-GYURWCIQ.js";
8
+ export {
9
+ electricityPresets,
10
+ firePresets,
11
+ gasPresets,
12
+ magicPresets,
13
+ waterPresets
14
+ };
15
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,78 @@
1
+ import { a as BehaviorDescriptor } from './behavior-system-DYbx-x_-.js';
2
+ import { i as Vec3Input } from './vector-Bm65-FOG.js';
3
+ import { ParticleSystem } from 'three.quarks';
4
+ import { h as ParticlePresetMaterialOptions, P as ParticleEffectDefinition, B as spark, n as ember, o as flamelet, k as blaze, z as smolder, s as mist, D as spray, C as splash, m as drizzle, G as torrent, H as vapor, y as smoke, p as haze, v as plume, r as miasma, A as spark$1, i as arc, F as surge, x as pulse, E as storm, j as arcane, q as holy, l as corrupted, t as nature, I as voidMagic, w as psychic } from './spark-DDlIg1nM.js';
5
+ export { a as ParticleMagicAgency, b as ParticleMagicAlignment, c as ParticleMagicModifierInput, d as ParticleMagicModifierOptions, e as ParticleMagicOrder, f as ParticleMagicRealityEffect, g as ParticleMagicTemperament, S as SemanticParticlePresetOptions, u as particleEffect } from './spark-DDlIg1nM.js';
6
+ import { ColorRepresentation } from 'three';
7
+ import '@dimforge/rapier3d-compat';
8
+
9
+ interface BurstParticlePresetOptions extends ParticlePresetMaterialOptions {
10
+ color?: ColorRepresentation;
11
+ count?: number;
12
+ duration?: number;
13
+ life?: number | readonly [number, number];
14
+ size?: number | readonly [number, number];
15
+ speed?: number | readonly [number, number];
16
+ worldSpace?: boolean;
17
+ }
18
+ declare const particlePresets: {
19
+ readonly burst: (options?: BurstParticlePresetOptions) => ParticleEffectDefinition;
20
+ readonly smoke: (options?: BurstParticlePresetOptions) => ParticleEffectDefinition;
21
+ readonly fire: {
22
+ readonly spark: typeof spark;
23
+ readonly ember: typeof ember;
24
+ readonly flamelet: typeof flamelet;
25
+ readonly blaze: typeof blaze;
26
+ readonly smolder: typeof smolder;
27
+ };
28
+ readonly water: {
29
+ readonly mist: typeof mist;
30
+ readonly spray: typeof spray;
31
+ readonly splash: typeof splash;
32
+ readonly drizzle: typeof drizzle;
33
+ readonly torrent: typeof torrent;
34
+ };
35
+ readonly gas: {
36
+ readonly vapor: typeof vapor;
37
+ readonly smoke: typeof smoke;
38
+ readonly haze: typeof haze;
39
+ readonly plume: typeof plume;
40
+ readonly miasma: typeof miasma;
41
+ };
42
+ readonly electricity: {
43
+ readonly spark: typeof spark$1;
44
+ readonly arc: typeof arc;
45
+ readonly surge: typeof surge;
46
+ readonly pulse: typeof pulse;
47
+ readonly storm: typeof storm;
48
+ };
49
+ readonly magic: {
50
+ readonly arcane: typeof arcane;
51
+ readonly holy: typeof holy;
52
+ readonly corrupted: typeof corrupted;
53
+ readonly nature: typeof nature;
54
+ readonly void: typeof voidMagic;
55
+ readonly psychic: typeof psychic;
56
+ };
57
+ };
58
+
59
+ interface ParticleEmitterBehaviorOptions {
60
+ effect: ParticleEffectDefinition;
61
+ autoplay: boolean;
62
+ localOffset?: Vec3Input;
63
+ followPosition: boolean;
64
+ followRotation: boolean;
65
+ autoDestroy: boolean;
66
+ }
67
+ interface ParticleEmitterHandle {
68
+ play(): void;
69
+ stop(): void;
70
+ pause(): void;
71
+ restart(): void;
72
+ burst(): void;
73
+ isPlaying(): boolean;
74
+ getSystem(): ParticleSystem | null;
75
+ }
76
+ declare const ParticleEmitterBehavior: BehaviorDescriptor<ParticleEmitterBehaviorOptions, ParticleEmitterHandle, unknown>;
77
+
78
+ export { type BurstParticlePresetOptions, ParticleEffectDefinition, ParticleEmitterBehavior, type ParticleEmitterBehaviorOptions, type ParticleEmitterHandle, ParticlePresetMaterialOptions, particlePresets };
@@ -0,0 +1,15 @@
1
+ import {
2
+ ParticleEmitterBehavior,
3
+ particlePresets
4
+ } from "./chunk-POZER3MQ.js";
5
+ import {
6
+ particleEffect
7
+ } from "./chunk-GYURWCIQ.js";
8
+ import "./chunk-WWVD5DR5.js";
9
+ import "./chunk-EZNCCO4L.js";
10
+ export {
11
+ ParticleEmitterBehavior,
12
+ particleEffect,
13
+ particlePresets
14
+ };
15
+ //# sourceMappingURL=particle-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,89 @@
1
+ import { DestructibleMesh, FractureOptions } from '@dgreenheck/three-pinata';
2
+ import { BufferGeometry, Vector3, Quaternion } from 'three';
3
+
4
+ /**
5
+ * Serializable payloads for destructible Voronoi prebake in a Web Worker.
6
+ */
7
+
8
+ interface PlainBufferGeometryPayload {
9
+ attributes: Record<string, {
10
+ array: ArrayBuffer;
11
+ itemSize: number;
12
+ normalized?: boolean;
13
+ }>;
14
+ }
15
+ type PlainFractureOptions = {
16
+ fractureMethod: 'voronoi' | 'simple';
17
+ fragmentCount: number;
18
+ fracturePlanes: {
19
+ x: boolean;
20
+ y: boolean;
21
+ z: boolean;
22
+ };
23
+ textureScale: [number, number];
24
+ textureOffset: [number, number];
25
+ seed?: number;
26
+ voronoiOptions?: {
27
+ mode: '3D' | '2.5D';
28
+ seedPoints?: [number, number, number][];
29
+ impactPoint?: [number, number, number];
30
+ impactRadius?: number;
31
+ projectionAxis?: 'x' | 'y' | 'z' | 'auto' | null;
32
+ projectionNormal?: [number, number, number];
33
+ useApproximation: boolean;
34
+ approximationNeighborCount: number;
35
+ };
36
+ };
37
+ type PlainWorkerFragmentPayload = {
38
+ attributes: PlainBufferGeometryPayload['attributes'];
39
+ position: [number, number, number];
40
+ quaternion: [number, number, number, number];
41
+ scale: [number, number, number];
42
+ };
43
+ type PrebakeWorkerRequest = {
44
+ geometry: PlainBufferGeometryPayload;
45
+ options: PlainFractureOptions;
46
+ };
47
+ type PrebakeWorkerResponse = {
48
+ fragments: PlainWorkerFragmentPayload[];
49
+ };
50
+ interface DestructiblePrebakeWorkerAPI {
51
+ prebake(request: PrebakeWorkerRequest): Promise<PrebakeWorkerResponse>;
52
+ }
53
+ /**
54
+ * Copies a buffer geometry into detached ArrayBuffers suitable for postMessage transfer.
55
+ */
56
+ declare function bufferGeometryToPlain(geometry: BufferGeometry): {
57
+ payload: PlainBufferGeometryPayload;
58
+ transferables: ArrayBuffer[];
59
+ };
60
+ /**
61
+ * Rebuilds a BufferGeometry from a plain payload (e.g. in a worker).
62
+ */
63
+ declare function plainToBufferGeometry(payload: PlainBufferGeometryPayload): BufferGeometry;
64
+ /**
65
+ * Serializes {@link FractureOptions} for structured clone / worker transfer.
66
+ */
67
+ declare function pinataFractureOptionsToPlain(options: FractureOptions): PlainFractureOptions;
68
+ /**
69
+ * Reconstructs {@link FractureOptions} from a plain payload.
70
+ */
71
+ declare function plainFractureOptionsToPinata(plain: PlainFractureOptions): FractureOptions;
72
+ /**
73
+ * Converts worker response fragments into template parts for the main-thread cache.
74
+ */
75
+ declare function plainWorkerResultToTemplateParts(response: PrebakeWorkerResponse): Array<{
76
+ geometry: BufferGeometry;
77
+ position: Vector3;
78
+ quaternion: Quaternion;
79
+ scale: Vector3;
80
+ }>;
81
+ /**
82
+ * Serializes fracture fragments for Comlink.transfer (used in the worker).
83
+ */
84
+ declare function destructibleFragmentsToPlainResponse(fragments: readonly DestructibleMesh[]): {
85
+ response: PrebakeWorkerResponse;
86
+ transferables: ArrayBuffer[];
87
+ };
88
+
89
+ export { type DestructiblePrebakeWorkerAPI as D, type PlainBufferGeometryPayload as P, type PlainFractureOptions as a, type PlainWorkerFragmentPayload as b, type PrebakeWorkerRequest as c, type PrebakeWorkerResponse as d, bufferGeometryToPlain as e, destructibleFragmentsToPlainResponse as f, plainFractureOptionsToPinata as g, plainToBufferGeometry as h, plainWorkerResultToTemplateParts as i, pinataFractureOptionsToPlain as p };