@zylem/behaviors 0.3.0 → 0.4.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.
- package/LICENSE +21 -0
- package/dist/{behavior-system-DYbx-x_-.d.ts → behavior-system-DSNek0W9.d.ts} +205 -29
- package/dist/{chunk-RER2IDPW.js → chunk-4URF65BR.js} +1 -0
- package/dist/chunk-4URF65BR.js.map +1 -0
- package/dist/{chunk-YYJP62QD.js → chunk-4V7TIRO2.js} +1 -0
- package/dist/chunk-4V7TIRO2.js.map +1 -0
- package/dist/{chunk-F7E23E26.js → chunk-4WH2ZN7P.js} +1 -0
- package/dist/chunk-4WH2ZN7P.js.map +1 -0
- package/dist/{chunk-VPZ32CCD.js → chunk-5SM5SH5O.js} +29 -28
- package/dist/chunk-5SM5SH5O.js.map +1 -0
- package/dist/{chunk-L76JG73P.js → chunk-5XZWTFGF.js} +7 -4
- package/dist/chunk-5XZWTFGF.js.map +1 -0
- package/dist/{chunk-HIBJDA5Z.js → chunk-64HKCSXD.js} +21 -17
- package/dist/chunk-64HKCSXD.js.map +1 -0
- package/dist/{chunk-WSKD7GY3.js → chunk-7JJEIADR.js} +1 -0
- package/dist/chunk-7JJEIADR.js.map +1 -0
- package/dist/{chunk-F6LFX4V3.js → chunk-BXP4K7RF.js} +3 -2
- package/dist/chunk-BXP4K7RF.js.map +1 -0
- package/dist/{chunk-2HKY6WF7.js → chunk-EIWQM6U3.js} +1 -0
- package/dist/chunk-EIWQM6U3.js.map +1 -0
- package/dist/{chunk-YDLO5M7S.js → chunk-EZNCCO4L.js} +1 -0
- package/dist/chunk-EZNCCO4L.js.map +1 -0
- package/dist/{chunk-T2P4JTQN.js → chunk-FRJDQM23.js} +110 -155
- package/dist/chunk-FRJDQM23.js.map +1 -0
- package/dist/{chunk-FHDYJ5WP.js → chunk-FTDZAKZW.js} +5 -17
- package/dist/chunk-FTDZAKZW.js.map +1 -0
- package/dist/{chunk-D53GNZXP.js → chunk-GFARAJV2.js} +6 -7
- package/dist/chunk-GFARAJV2.js.map +1 -0
- package/dist/{chunk-IQRG5BAZ.js → chunk-GTLA6LOJ.js} +18 -23
- package/dist/chunk-GTLA6LOJ.js.map +1 -0
- package/dist/{chunk-VO5J64DG.js → chunk-H4TJ7X4O.js} +4 -6
- package/dist/chunk-H4TJ7X4O.js.map +1 -0
- package/dist/{chunk-6UMC6BB5.js → chunk-HNESASBB.js} +7 -8
- package/dist/chunk-HNESASBB.js.map +1 -0
- package/dist/{chunk-4DVDFCVY.js → chunk-HZMY3TT4.js} +1 -0
- package/dist/chunk-HZMY3TT4.js.map +1 -0
- package/dist/{chunk-2HLZBWGD.js → chunk-IZJFUAXB.js} +1 -0
- package/dist/chunk-IZJFUAXB.js.map +1 -0
- package/dist/{chunk-UFHYR2LV.js → chunk-JXMF4NUI.js} +51 -2
- package/dist/chunk-JXMF4NUI.js.map +1 -0
- package/dist/{chunk-ZHBD65AZ.js → chunk-KDY5N6J4.js} +1 -0
- package/dist/chunk-KDY5N6J4.js.map +1 -0
- package/dist/chunk-KFFETUAL.js +40 -0
- package/dist/chunk-KFFETUAL.js.map +1 -0
- package/dist/chunk-LL4FLHIY.js +12 -0
- package/dist/chunk-LL4FLHIY.js.map +1 -0
- package/dist/{chunk-BC3IJYS7.js → chunk-MJFMNRMZ.js} +15 -15
- package/dist/chunk-MJFMNRMZ.js.map +1 -0
- package/dist/{chunk-WHKPWIQO.js → chunk-OHCPV2NT.js} +1 -0
- package/dist/chunk-OHCPV2NT.js.map +1 -0
- package/dist/{chunk-RQWWUML4.js → chunk-OTLSUYQQ.js} +2 -1
- package/dist/chunk-OTLSUYQQ.js.map +1 -0
- package/dist/{chunk-E4HTCQPK.js → chunk-PWF757B6.js} +7 -8
- package/dist/chunk-PWF757B6.js.map +1 -0
- package/dist/{chunk-4EWASZHB.js → chunk-QVCMJ4Q2.js} +1 -0
- package/dist/chunk-QVCMJ4Q2.js.map +1 -0
- package/dist/{chunk-FOOM42MK.js → chunk-RONH2KDI.js} +12 -13
- package/dist/chunk-RONH2KDI.js.map +1 -0
- package/dist/chunk-RTRFJVCZ.js +454 -0
- package/dist/chunk-RTRFJVCZ.js.map +1 -0
- package/dist/{chunk-IEA7F73P.js → chunk-UL6Q5HDP.js} +25 -2
- package/dist/chunk-UL6Q5HDP.js.map +1 -0
- package/dist/{chunk-K6CWKFHL.js → chunk-UYFOLI2X.js} +1 -0
- package/dist/chunk-UYFOLI2X.js.map +1 -0
- package/dist/{chunk-RD2YTTXY.js → chunk-V74N7D6Q.js} +9 -8
- package/dist/chunk-V74N7D6Q.js.map +1 -0
- package/dist/{chunk-ERS6SNA5.js → chunk-WOMHL23C.js} +2 -1
- package/dist/chunk-WOMHL23C.js.map +1 -0
- package/dist/{chunk-RHW3IDQX.js → chunk-WWVD5DR5.js} +1 -0
- package/dist/chunk-WWVD5DR5.js.map +1 -0
- package/dist/{chunk-SBACY5SU.js → chunk-WXXXJ22R.js} +14 -15
- package/dist/chunk-WXXXJ22R.js.map +1 -0
- package/dist/{chunk-6Y3GB76J.js → chunk-XLUJDKCT.js} +9 -8
- package/dist/chunk-XLUJDKCT.js.map +1 -0
- package/dist/{chunk-7Y6JVZ5H.js → chunk-XP3ASVGJ.js} +14 -10
- package/dist/chunk-XP3ASVGJ.js.map +1 -0
- package/dist/{chunk-7U4WFBWM.js → chunk-Y7YIAWPW.js} +11 -0
- package/dist/chunk-Y7YIAWPW.js.map +1 -0
- package/dist/{chunk-7IZ36Y5G.js → chunk-ZA43LPRM.js} +5 -24
- package/dist/chunk-ZA43LPRM.js.map +1 -0
- package/dist/{chunk-J5XLB24H.js → chunk-ZRQWSURL.js} +3 -2
- package/dist/chunk-ZRQWSURL.js.map +1 -0
- package/dist/cooldown.d.ts +2 -1
- package/dist/cooldown.js +3 -2
- package/dist/cooldown.js.map +1 -0
- package/dist/coordinators/boundary-ricochet-3d.d.ts +12 -5
- package/dist/coordinators/boundary-ricochet-3d.js +4 -2
- package/dist/coordinators/boundary-ricochet-3d.js.map +1 -0
- package/dist/coordinators/boundary-ricochet.d.ts +9 -7
- package/dist/coordinators/boundary-ricochet.js +4 -2
- package/dist/coordinators/boundary-ricochet.js.map +1 -0
- package/dist/coordinators/first-person-shooter.d.ts +9 -8
- package/dist/coordinators/first-person-shooter.js +4 -3
- package/dist/coordinators/first-person-shooter.js.map +1 -0
- package/dist/coordinators/multidirectional-space-shooter.d.ts +12 -9
- package/dist/coordinators/multidirectional-space-shooter.js +5 -4
- package/dist/coordinators/multidirectional-space-shooter.js.map +1 -0
- package/dist/coordinators/top-down-shooter.d.ts +9 -8
- package/dist/coordinators/top-down-shooter.js +5 -4
- package/dist/coordinators/top-down-shooter.js.map +1 -0
- package/dist/core.d.ts +4 -4
- package/dist/core.js +9 -36
- package/dist/core.js.map +1 -0
- package/dist/destructible-3d.d.ts +2 -1
- package/dist/destructible-3d.js +4 -3
- package/dist/destructible-3d.js.map +1 -0
- package/dist/destructible-prebake.js +2 -1
- package/dist/destructible-prebake.js.map +1 -0
- package/dist/first-person.d.ts +12 -12
- package/dist/first-person.js +12 -11
- package/dist/first-person.js.map +1 -0
- package/dist/index.d.ts +37 -14
- package/dist/index.js +85 -55
- package/dist/index.js.map +1 -0
- package/dist/jumper-2d.d.ts +7 -6
- package/dist/jumper-2d.js +8 -7
- package/dist/jumper-2d.js.map +1 -0
- package/dist/jumper-3d.d.ts +12 -11
- package/dist/jumper-3d.js +9 -8
- package/dist/jumper-3d.js.map +1 -0
- package/dist/{moveable-BCRpjAQb.d.ts → moveable-BLTHO7Jq.d.ts} +2 -78
- package/dist/particle-emitter/presets.js +2 -1
- package/dist/particle-emitter/presets.js.map +1 -0
- package/dist/particle-emitter.d.ts +1 -1
- package/dist/particle-emitter.js +5 -4
- package/dist/particle-emitter.js.map +1 -0
- package/dist/platformer-2d.d.ts +306 -0
- package/dist/platformer-2d.js +23 -0
- package/dist/platformer-2d.js.map +1 -0
- package/dist/platformer-3d.d.ts +74 -87
- package/dist/platformer-3d.js +7 -6
- package/dist/platformer-3d.js.map +1 -0
- package/dist/ricochet-2d.d.ts +1 -1
- package/dist/ricochet-2d.js +5 -4
- package/dist/ricochet-2d.js.map +1 -0
- package/dist/ricochet-3d.d.ts +1 -1
- package/dist/ricochet-3d.js +5 -4
- package/dist/ricochet-3d.js.map +1 -0
- package/dist/runtime-2d.d.ts +93 -2
- package/dist/runtime-2d.js +146 -22
- package/dist/runtime-2d.js.map +1 -0
- package/dist/screen-visibility.d.ts +2 -1
- package/dist/screen-visibility.js +3 -2
- package/dist/screen-visibility.js.map +1 -0
- package/dist/screen-wrap.d.ts +2 -1
- package/dist/screen-wrap.js +5 -4
- package/dist/screen-wrap.js.map +1 -0
- package/dist/shooter-2d.d.ts +5 -3
- package/dist/shooter-2d.js +5 -4
- package/dist/shooter-2d.js.map +1 -0
- package/dist/shooter-fire-DGripl0z.d.ts +55 -0
- package/dist/thruster.d.ts +8 -18
- package/dist/thruster.js +9 -8
- package/dist/thruster.js.map +1 -0
- package/dist/top-down-movement.d.ts +7 -4
- package/dist/top-down-movement.js +8 -7
- package/dist/top-down-movement.js.map +1 -0
- package/dist/{use-behavior-D_82jAL3.d.ts → use-behavior-h9-T5FSv.d.ts} +1 -1
- package/dist/world-boundary-2d.d.ts +2 -1
- package/dist/world-boundary-2d.js +6 -5
- package/dist/world-boundary-2d.js.map +1 -0
- package/dist/world-boundary-3d.d.ts +2 -1
- package/dist/world-boundary-3d.js +6 -5
- package/dist/world-boundary-3d.js.map +1 -0
- package/package.json +8 -7
- package/dist/chunk-23HQH3GJ.js +0 -34
- package/dist/chunk-K4UBXSZL.js +0 -175
- package/dist/runtime-pong.d.ts +0 -92
- package/dist/runtime-pong.js +0 -37
package/dist/jumper-3d.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { J as JumpConfig3D, b as JumpInput3D, a as JumpContext3D, c as JumpState3D } from './components--hjBMTnz.js';
|
|
2
2
|
export { V as Vec3Like, d as createJumpConfig3D, e as createJumpInput3D, f as createJumpState3D } from './components--hjBMTnz.js';
|
|
3
3
|
import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
4
|
-
import
|
|
4
|
+
import * as _dimforge_rapier3d_compat from '@dimforge/rapier3d-compat';
|
|
5
|
+
import { a as BehaviorDescriptor, T as TransformState } from './behavior-system-DSNek0W9.js';
|
|
5
6
|
import 'typescript-fsm';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -15,7 +16,7 @@ import 'typescript-fsm';
|
|
|
15
16
|
* is configured; otherwise the movement controller owns X/Z.
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
declare class
|
|
19
|
+
declare class Jumper3DSystem {
|
|
19
20
|
/**
|
|
20
21
|
* Advance the jump system by one frame.
|
|
21
22
|
*
|
|
@@ -116,26 +117,26 @@ interface Jumper3DBehaviorOptions {
|
|
|
116
117
|
}
|
|
117
118
|
interface Jumper3DEntity {
|
|
118
119
|
uuid: string;
|
|
119
|
-
body:
|
|
120
|
-
transformStore:
|
|
120
|
+
body: _dimforge_rapier3d_compat.RigidBody | null;
|
|
121
|
+
transformStore: TransformState;
|
|
121
122
|
jumper: JumpConfig3D;
|
|
122
123
|
$jumper: JumpInput3D;
|
|
123
124
|
jumperState: JumpState3D;
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
+
* Jumper3DBehavior — composable 3D jump behavior.
|
|
127
128
|
*
|
|
128
129
|
* Provides height-based jumping, multi-jump, coyote time, jump buffering,
|
|
129
130
|
* variable jump height, configurable fall gravity, and optional air control.
|
|
130
131
|
*
|
|
131
|
-
* Designed to compose with any movement controller (e.g.
|
|
132
|
-
* — the controller writes X/Z velocity and
|
|
132
|
+
* Designed to compose with any movement controller (e.g. FirstPersonBehavior)
|
|
133
|
+
* — the controller writes X/Z velocity and Jumper3DBehavior writes Y velocity.
|
|
133
134
|
*
|
|
134
135
|
* @example
|
|
135
136
|
* ```typescript
|
|
136
|
-
* import {
|
|
137
|
+
* import { Jumper3DBehavior } from "@zylem/game-lib/behavior";
|
|
137
138
|
*
|
|
138
|
-
* const jumper = player.use(
|
|
139
|
+
* const jumper = player.use(Jumper3DBehavior, {
|
|
139
140
|
* jumpHeight: 2.5,
|
|
140
141
|
* gravity: 20,
|
|
141
142
|
* maxJumps: 2,
|
|
@@ -154,11 +155,11 @@ interface Jumper3DEntity {
|
|
|
154
155
|
* });
|
|
155
156
|
* ```
|
|
156
157
|
*/
|
|
157
|
-
declare const
|
|
158
|
+
declare const Jumper3DBehavior: BehaviorDescriptor<Jumper3DBehaviorOptions, {
|
|
158
159
|
getState: () => Jumper3DState;
|
|
159
160
|
isJumping: () => boolean;
|
|
160
161
|
getJumpsUsed: () => number;
|
|
161
162
|
getJumpsRemaining: () => number;
|
|
162
163
|
}, Jumper3DEntity>;
|
|
163
164
|
|
|
164
|
-
export { JumpConfig3D, JumpContext3D, JumpInput3D, JumpState3D,
|
|
165
|
+
export { JumpConfig3D, JumpContext3D, JumpInput3D, JumpState3D, Jumper3DBehavior, type Jumper3DBehaviorOptions, type Jumper3DEntity, Jumper3DEvent, Jumper3DFSM, Jumper3DState, Jumper3DSystem, JumperTickEvent, type JumperTickResult };
|
package/dist/jumper-3d.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Jumper3D,
|
|
3
2
|
Jumper3DBehavior,
|
|
4
3
|
Jumper3DEvent,
|
|
5
4
|
Jumper3DFSM,
|
|
6
5
|
Jumper3DState,
|
|
6
|
+
Jumper3DSystem,
|
|
7
7
|
JumperTickEvent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RONH2KDI.js";
|
|
9
9
|
import {
|
|
10
10
|
createJumpConfig3D,
|
|
11
11
|
createJumpInput3D,
|
|
12
12
|
createJumpState3D
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-4WH2ZN7P.js";
|
|
14
|
+
import "./chunk-JXMF4NUI.js";
|
|
15
|
+
import "./chunk-OTLSUYQQ.js";
|
|
16
|
+
import "./chunk-4URF65BR.js";
|
|
17
|
+
import "./chunk-EZNCCO4L.js";
|
|
18
18
|
export {
|
|
19
|
-
Jumper3D,
|
|
20
19
|
Jumper3DBehavior,
|
|
21
20
|
Jumper3DEvent,
|
|
22
21
|
Jumper3DFSM,
|
|
23
22
|
Jumper3DState,
|
|
23
|
+
Jumper3DSystem,
|
|
24
24
|
JumperTickEvent,
|
|
25
25
|
createJumpConfig3D,
|
|
26
26
|
createJumpInput3D,
|
|
27
27
|
createJumpState3D
|
|
28
28
|
};
|
|
29
|
+
//# sourceMappingURL=jumper-3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,82 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from 'three';
|
|
2
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;
|
|
3
|
+
import { T as TransformState } from './behavior-system-DSNek0W9.js';
|
|
80
4
|
|
|
81
5
|
interface EntityWithBody {
|
|
82
6
|
body: RigidBody | null;
|
|
@@ -173,4 +97,4 @@ interface MoveableEntity extends EntityWithBody {
|
|
|
173
97
|
*/
|
|
174
98
|
declare function makeMoveable<T extends EntityWithBody>(entity: T): T & MoveableEntity;
|
|
175
99
|
|
|
176
|
-
export { type EntityWithBody as E, type MoveableEntity as M,
|
|
100
|
+
export { type EntityWithBody as E, type MoveableEntity as M, getVelocity as a, move as b, moveForwardXY as c, moveX as d, moveXY as e, moveXZ as f, getPosition as g, moveY as h, moveZ as i, setPositionX as j, setPositionY as k, setPositionZ as l, makeMoveable as m, wrapAroundXY as n, resetVelocity as r, setPosition as s, wrapAround3D as w };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
gasPresets,
|
|
5
5
|
magicPresets,
|
|
6
6
|
waterPresets
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-7JJEIADR.js";
|
|
8
8
|
export {
|
|
9
9
|
electricityPresets,
|
|
10
10
|
firePresets,
|
|
@@ -12,3 +12,4 @@ export {
|
|
|
12
12
|
magicPresets,
|
|
13
13
|
waterPresets
|
|
14
14
|
};
|
|
15
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BehaviorDescriptor } from './behavior-system-
|
|
1
|
+
import { a as BehaviorDescriptor } from './behavior-system-DSNek0W9.js';
|
|
2
2
|
import { i as Vec3Input } from './vector-Bm65-FOG.js';
|
|
3
3
|
import { h as ParticlePresetMaterialOptions, P as ParticleEffectDefinition, C as spark, o as ember, p as flamelet, l as blaze, A as smolder, t as mist, E as spray, D as splash, n as drizzle, H as torrent, I as vapor, z as smoke, q as haze, w as plume, s as miasma, B as spark$1, j as arc, G as surge, y as pulse, F as storm, k as arcane, r as holy, m as corrupted, u as nature, J as voidMagic, x as psychic, i as Particles } from './spark-Dx3cJbTW.js';
|
|
4
4
|
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, v as particleEffect } from './spark-Dx3cJbTW.js';
|
package/dist/particle-emitter.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ParticleEmitterBehavior,
|
|
3
3
|
particlePresets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5SM5SH5O.js";
|
|
5
5
|
import {
|
|
6
6
|
particleEffect
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-7JJEIADR.js";
|
|
8
|
+
import "./chunk-WWVD5DR5.js";
|
|
9
|
+
import "./chunk-EZNCCO4L.js";
|
|
10
10
|
export {
|
|
11
11
|
ParticleEmitterBehavior,
|
|
12
12
|
particleEffect,
|
|
13
13
|
particlePresets
|
|
14
14
|
};
|
|
15
|
+
//# sourceMappingURL=particle-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
2
|
+
import { RigidBody, Collider } from '@dimforge/rapier3d-compat';
|
|
3
|
+
import { Z as ZylemWorld, a as BehaviorDescriptor } from './behavior-system-DSNek0W9.js';
|
|
4
|
+
import 'typescript-fsm';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Platformer 2D Components
|
|
8
|
+
*
|
|
9
|
+
* Components for 2D platformer movement on the X/Y plane: walking/running on
|
|
10
|
+
* X, jumping with multi-jump support, and falling/landing states.
|
|
11
|
+
*/
|
|
12
|
+
interface Platformer2DMovementComponent {
|
|
13
|
+
/** Base walking speed */
|
|
14
|
+
walkSpeed: number;
|
|
15
|
+
/** Sprint/run speed */
|
|
16
|
+
runSpeed: number;
|
|
17
|
+
/** Initial jump force/velocity */
|
|
18
|
+
jumpForce: number;
|
|
19
|
+
/** Maximum number of jumps (1 = single jump, 2 = double jump, etc.) */
|
|
20
|
+
maxJumps: number;
|
|
21
|
+
/** Gravity force */
|
|
22
|
+
gravity: number;
|
|
23
|
+
/** Coyote time in seconds (grace period after leaving ground) */
|
|
24
|
+
coyoteTime: number;
|
|
25
|
+
/** Jump buffer time in seconds (queue jump input before landing) */
|
|
26
|
+
jumpBufferTime: number;
|
|
27
|
+
/** Velocity multiplier when releasing jump button early (0-1) */
|
|
28
|
+
jumpCutMultiplier: number;
|
|
29
|
+
/** Time in seconds before multi-jump becomes available (0 = after button release) */
|
|
30
|
+
multiJumpWindowTime: number;
|
|
31
|
+
/** Maximum slope angle (degrees) the character can walk up */
|
|
32
|
+
slopeClimbAngle: number;
|
|
33
|
+
/** Slope angle (degrees) past which the character slides down */
|
|
34
|
+
slopeSlideAngle: number;
|
|
35
|
+
/** Autostep configuration for SNES-style step-ups, or false to disable */
|
|
36
|
+
autostep: {
|
|
37
|
+
maxHeight: number;
|
|
38
|
+
minWidth: number;
|
|
39
|
+
} | false;
|
|
40
|
+
/** Snap-to-ground distance (keeps the character glued going downhill) */
|
|
41
|
+
snapToGroundDistance: number;
|
|
42
|
+
/** Character controller offset (small gap kept between collider and environment) */
|
|
43
|
+
characterOffset: number;
|
|
44
|
+
}
|
|
45
|
+
declare function createPlatformer2DMovementComponent(options?: Partial<Platformer2DMovementComponent>): Platformer2DMovementComponent;
|
|
46
|
+
interface Platformer2DInputComponent {
|
|
47
|
+
/** Horizontal movement input (-1 to 1) */
|
|
48
|
+
moveX: number;
|
|
49
|
+
/** Jump button pressed */
|
|
50
|
+
jump: boolean;
|
|
51
|
+
/** Run/sprint button held */
|
|
52
|
+
run: boolean;
|
|
53
|
+
}
|
|
54
|
+
declare function createPlatformer2DInputComponent(): Platformer2DInputComponent;
|
|
55
|
+
interface Platformer2DStateComponent {
|
|
56
|
+
/** Is the entity on the ground */
|
|
57
|
+
grounded: boolean;
|
|
58
|
+
/** Is currently in a jump arc */
|
|
59
|
+
jumping: boolean;
|
|
60
|
+
/** Is falling (not jumping) */
|
|
61
|
+
falling: boolean;
|
|
62
|
+
/** Current jump count (for multi-jump) */
|
|
63
|
+
jumpCount: number;
|
|
64
|
+
/** Y position when jump started */
|
|
65
|
+
jumpStartHeight: number;
|
|
66
|
+
/** Current movement speed being applied */
|
|
67
|
+
currentSpeed: number;
|
|
68
|
+
/** Last known ground Y position */
|
|
69
|
+
lastGroundedY: number;
|
|
70
|
+
/** Was jump button pressed last frame (for edge detection) */
|
|
71
|
+
jumpPressedLastFrame: boolean;
|
|
72
|
+
/** Time in seconds since last grounded */
|
|
73
|
+
timeSinceGrounded: number;
|
|
74
|
+
/** Is a jump allowed due to buffer? */
|
|
75
|
+
jumpBuffered: boolean;
|
|
76
|
+
/** Time remaining in jump buffer */
|
|
77
|
+
jumpBufferTimer: number;
|
|
78
|
+
/** Is jump button currently held */
|
|
79
|
+
jumpHeld: boolean;
|
|
80
|
+
/** Has the jump cut been applied for this jump? */
|
|
81
|
+
jumpCutApplied: boolean;
|
|
82
|
+
/** Has jump button been released since last jump (required for multi-jump) */
|
|
83
|
+
jumpReleasedSinceLastJump: boolean;
|
|
84
|
+
/** Time since current jump started (for multi-jump window) */
|
|
85
|
+
timeSinceJump: number;
|
|
86
|
+
/** True for the single frame on which a jump impulse was applied; prevents gravity from clobbering jump velocity. */
|
|
87
|
+
jumpedThisFrame: boolean;
|
|
88
|
+
/** Remaining seconds of jump-cut velocity ramp; while > 0, verticalVelocity lerps toward verticalVelocity * jumpCutMultiplier. */
|
|
89
|
+
jumpCutRampTimer: number;
|
|
90
|
+
/**
|
|
91
|
+
* Controller-owned vertical velocity (units/second).
|
|
92
|
+
* The body is kinematic, so `linvel()` is meaningless — this field is the
|
|
93
|
+
* single source of truth for jump/gravity motion on the Y axis.
|
|
94
|
+
*/
|
|
95
|
+
verticalVelocity: number;
|
|
96
|
+
}
|
|
97
|
+
declare function createPlatformer2DStateComponent(): Platformer2DStateComponent;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Platformer 2D Finite State Machine
|
|
101
|
+
*
|
|
102
|
+
* Manages state transitions for 2D platformer movement:
|
|
103
|
+
* - Idle: Standing still on ground
|
|
104
|
+
* - Walking: Moving on ground (slow)
|
|
105
|
+
* - Running: Moving on ground (fast)
|
|
106
|
+
* - Jumping: Ascending from jump
|
|
107
|
+
* - Falling: Descending (gravity)
|
|
108
|
+
* - Landing: Just touched ground
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Simplified collision context (normal in the X/Y plane).
|
|
113
|
+
*/
|
|
114
|
+
interface Platformer2DCollisionContext {
|
|
115
|
+
contact: {
|
|
116
|
+
normal: {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
declare enum Platformer2DState {
|
|
123
|
+
Idle = "idle",
|
|
124
|
+
Walking = "walking",
|
|
125
|
+
Running = "running",
|
|
126
|
+
Jumping = "jumping",
|
|
127
|
+
Falling = "falling",
|
|
128
|
+
Landing = "landing"
|
|
129
|
+
}
|
|
130
|
+
declare enum Platformer2DEvent {
|
|
131
|
+
Walk = "walk",
|
|
132
|
+
Run = "run",
|
|
133
|
+
Jump = "jump",
|
|
134
|
+
Fall = "fall",
|
|
135
|
+
Land = "land",
|
|
136
|
+
Stop = "stop"
|
|
137
|
+
}
|
|
138
|
+
interface Platformer2DContext {
|
|
139
|
+
input: Platformer2DInputComponent;
|
|
140
|
+
state: Platformer2DStateComponent;
|
|
141
|
+
}
|
|
142
|
+
declare class Platformer2DFSM {
|
|
143
|
+
private ctx;
|
|
144
|
+
machine: SyncStateMachine<Platformer2DState, Platformer2DEvent, never>;
|
|
145
|
+
constructor(ctx: Platformer2DContext);
|
|
146
|
+
getState(): Platformer2DState;
|
|
147
|
+
dispatch(event: Platformer2DEvent): void;
|
|
148
|
+
isGrounded(): boolean;
|
|
149
|
+
getJumpCount(): number;
|
|
150
|
+
/**
|
|
151
|
+
* Update FSM based on current component state.
|
|
152
|
+
*/
|
|
153
|
+
update(input: Platformer2DInputComponent, state: Platformer2DStateComponent): void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Platformer 2D System
|
|
158
|
+
*
|
|
159
|
+
* Kinematic character controller (SNES-style) on the X/Y plane: the
|
|
160
|
+
* controller owns all motion and physics is only a collision database.
|
|
161
|
+
*
|
|
162
|
+
* - The entity's body is converted to `KinematicPositionBased` on first
|
|
163
|
+
* update; Rapier never applies forces to it.
|
|
164
|
+
* - Each tick, desired displacement (X input + integrated vertical velocity,
|
|
165
|
+
* z locked to 0) is run through Rapier's `KinematicCharacterController`
|
|
166
|
+
* (collide-and-slide with autostep, slope limits, and snap-to-ground) and
|
|
167
|
+
* the corrected movement is applied via `setNextKinematicTranslation`. The
|
|
168
|
+
* z coordinate is re-pinned to its first-seen value every tick so slide
|
|
169
|
+
* resolution can never drift the entity off the 2D plane.
|
|
170
|
+
* - Grounded comes from `controller.computedGrounded()` — no contact-pair or
|
|
171
|
+
* raycast probing.
|
|
172
|
+
* - Vertical velocity lives in `state.verticalVelocity` (`linvel()` is
|
|
173
|
+
* meaningless on kinematic bodies). Jump buffering, coyote time,
|
|
174
|
+
* multi-jump, and the jump-cut ramp all operate on that field.
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Entity with 2D platformer components
|
|
179
|
+
*/
|
|
180
|
+
interface Platformer2DEntity {
|
|
181
|
+
uuid: string;
|
|
182
|
+
body: RigidBody;
|
|
183
|
+
collider?: Collider | null;
|
|
184
|
+
platformer2D: Platformer2DMovementComponent;
|
|
185
|
+
$platformer2D: Platformer2DInputComponent;
|
|
186
|
+
platformer2DState: Platformer2DStateComponent;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Platformer 2D movement system.
|
|
190
|
+
*
|
|
191
|
+
* Core kinematic controller for 2D platformer movement. Requires a live
|
|
192
|
+
* `ZylemWorld` with the raw Rapier `World` exposed on `.world` — without it
|
|
193
|
+
* the system is a no-op.
|
|
194
|
+
*/
|
|
195
|
+
declare class Platformer2DSystem {
|
|
196
|
+
private world;
|
|
197
|
+
/** Per-entity character controllers, keyed by entity uuid. */
|
|
198
|
+
private controllers;
|
|
199
|
+
/** Spawn-time z per entity; re-pinned every tick to hold the 2D plane. */
|
|
200
|
+
private planeZ;
|
|
201
|
+
constructor(world: ZylemWorld | null);
|
|
202
|
+
/**
|
|
203
|
+
* One-time per-entity physics setup: convert the body to a
|
|
204
|
+
* position-based kinematic body, record the plane z, and create the
|
|
205
|
+
* entity's character controller. Done lazily on the first update because
|
|
206
|
+
* the body isn't always available at construction time.
|
|
207
|
+
*/
|
|
208
|
+
private ensurePhysicsConfigured;
|
|
209
|
+
/**
|
|
210
|
+
* Handle jump logic with multi-jump, coyote time, buffering, and jump-cut
|
|
211
|
+
* ramp. All vertical motion is written to `state.verticalVelocity`.
|
|
212
|
+
*/
|
|
213
|
+
private handleJump;
|
|
214
|
+
/**
|
|
215
|
+
* Integrate gravity into `state.verticalVelocity`.
|
|
216
|
+
*
|
|
217
|
+
* While grounded (and not on the jump frame) vertical velocity is held at
|
|
218
|
+
* a small constant downward speed so the controller stays pressed into
|
|
219
|
+
* the ground. Skipped entirely on the frame a jump was applied — the
|
|
220
|
+
* grounded flag is still stale-true then and would clobber the jump.
|
|
221
|
+
*/
|
|
222
|
+
private applyGravity;
|
|
223
|
+
/**
|
|
224
|
+
* Update entity state from the controller's grounded result.
|
|
225
|
+
*/
|
|
226
|
+
private updateState;
|
|
227
|
+
/**
|
|
228
|
+
* Update one platformer entity. Invoked per linked entity by the
|
|
229
|
+
* Platformer2DBehaviorSystem adapter.
|
|
230
|
+
*/
|
|
231
|
+
updateEntity(entity: Platformer2DEntity, delta: number): void;
|
|
232
|
+
destroy(): void;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Platformer 2D behavior options (typed for entity.use() autocomplete)
|
|
237
|
+
*/
|
|
238
|
+
interface Platformer2DBehaviorOptions {
|
|
239
|
+
/** Base walking speed (default: 8) */
|
|
240
|
+
walkSpeed?: number;
|
|
241
|
+
/** Sprint/run speed (default: 14) */
|
|
242
|
+
runSpeed?: number;
|
|
243
|
+
/** Initial jump force (default: 12) */
|
|
244
|
+
jumpForce?: number;
|
|
245
|
+
/** Maximum number of jumps (default: 1) */
|
|
246
|
+
maxJumps?: number;
|
|
247
|
+
/** Gravity force (default: 20) */
|
|
248
|
+
gravity?: number;
|
|
249
|
+
/** Coyote time in seconds (default: 0.1) */
|
|
250
|
+
coyoteTime?: number;
|
|
251
|
+
/** Jump buffer time in seconds (default: 0.1) */
|
|
252
|
+
jumpBufferTime?: number;
|
|
253
|
+
/** Velocity multiplier when releasing jump early (default: 0.5) */
|
|
254
|
+
jumpCutMultiplier?: number;
|
|
255
|
+
/** Maximum slope angle in degrees the character can walk up (default: 50) */
|
|
256
|
+
slopeClimbAngle?: number;
|
|
257
|
+
/** Slope angle in degrees past which the character slides (default: 40) */
|
|
258
|
+
slopeSlideAngle?: number;
|
|
259
|
+
/** Autostep over small step-ups, or false to disable (default: { maxHeight: 0.25, minWidth: 0.05 }) */
|
|
260
|
+
autostep?: {
|
|
261
|
+
maxHeight: number;
|
|
262
|
+
minWidth: number;
|
|
263
|
+
} | false;
|
|
264
|
+
/** Snap-to-ground distance for downhill/step-down stability (default: 0.2) */
|
|
265
|
+
snapToGroundDistance?: number;
|
|
266
|
+
/** Character controller collision offset (default: 0.05) */
|
|
267
|
+
characterOffset?: number;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Platformer2DBehavior - typed descriptor for 2D platformer movement
|
|
271
|
+
*
|
|
272
|
+
* Provides complete 2D platformer physics on the X/Y plane including:
|
|
273
|
+
* - Walking and running on X
|
|
274
|
+
* - Jumping with buffer, coyote time, multi-jump, and jump-cut
|
|
275
|
+
* - Gravity ownership and falling
|
|
276
|
+
* - Kinematic character controller (collide-and-slide, autostep, snap-to-ground)
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* import { Platformer2DBehavior } from "@zylem/behaviors/platformer-2d";
|
|
281
|
+
*
|
|
282
|
+
* const platformer = player.use(Platformer2DBehavior, {
|
|
283
|
+
* walkSpeed: 8,
|
|
284
|
+
* runSpeed: 14,
|
|
285
|
+
* jumpForce: 12,
|
|
286
|
+
* maxJumps: 2, // Double jump!
|
|
287
|
+
* });
|
|
288
|
+
*
|
|
289
|
+
* // In update loop
|
|
290
|
+
* player.onUpdate(({ inputs }) => {
|
|
291
|
+
* player.$platformer2D.moveX = inputs.p1.axes.Horizontal.value;
|
|
292
|
+
* player.$platformer2D.jump = inputs.p1.buttons.A.held > 0;
|
|
293
|
+
* player.$platformer2D.run = inputs.p1.shoulders.LTrigger.held > 0;
|
|
294
|
+
*
|
|
295
|
+
* const state = platformer.getState();
|
|
296
|
+
* const grounded = platformer.isGrounded();
|
|
297
|
+
* });
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
declare const Platformer2DBehavior: BehaviorDescriptor<Platformer2DBehaviorOptions, {
|
|
301
|
+
getState: () => Platformer2DState;
|
|
302
|
+
isGrounded: () => boolean;
|
|
303
|
+
getJumpCount: () => number;
|
|
304
|
+
}, Platformer2DEntity>;
|
|
305
|
+
|
|
306
|
+
export { Platformer2DBehavior, type Platformer2DBehaviorOptions, type Platformer2DCollisionContext, type Platformer2DContext, type Platformer2DEntity, Platformer2DEvent, Platformer2DFSM, type Platformer2DInputComponent, type Platformer2DMovementComponent, Platformer2DState, type Platformer2DStateComponent, Platformer2DSystem, createPlatformer2DInputComponent, createPlatformer2DMovementComponent, createPlatformer2DStateComponent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Platformer2DBehavior,
|
|
3
|
+
Platformer2DEvent,
|
|
4
|
+
Platformer2DFSM,
|
|
5
|
+
Platformer2DState,
|
|
6
|
+
Platformer2DSystem,
|
|
7
|
+
createPlatformer2DInputComponent,
|
|
8
|
+
createPlatformer2DMovementComponent,
|
|
9
|
+
createPlatformer2DStateComponent
|
|
10
|
+
} from "./chunk-RTRFJVCZ.js";
|
|
11
|
+
import "./chunk-4URF65BR.js";
|
|
12
|
+
import "./chunk-EZNCCO4L.js";
|
|
13
|
+
export {
|
|
14
|
+
Platformer2DBehavior,
|
|
15
|
+
Platformer2DEvent,
|
|
16
|
+
Platformer2DFSM,
|
|
17
|
+
Platformer2DState,
|
|
18
|
+
Platformer2DSystem,
|
|
19
|
+
createPlatformer2DInputComponent,
|
|
20
|
+
createPlatformer2DMovementComponent,
|
|
21
|
+
createPlatformer2DStateComponent
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=platformer-2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|