@zylem/behaviors 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/behavior-system-y8SGrGWy.d.ts +580 -0
- package/dist/{chunk-ARJWUNRE.js → chunk-27UPCP5B.js} +10 -10
- package/dist/{chunk-ARJWUNRE.js.map → chunk-27UPCP5B.js.map} +1 -1
- package/dist/{chunk-YUO6SKJD.js → chunk-4L36OPY2.js} +33 -23
- package/dist/chunk-4L36OPY2.js.map +1 -0
- package/dist/{chunk-DYLH6K7B.js → chunk-4WH2ZN7P.js} +1 -1
- package/dist/{chunk-DYLH6K7B.js.map → chunk-4WH2ZN7P.js.map} +1 -1
- package/dist/{chunk-ZPSAXX73.js → chunk-5SM5SH5O.js} +26 -26
- package/dist/chunk-5SM5SH5O.js.map +1 -0
- package/dist/{chunk-STCCNLPC.js → chunk-5XZWTFGF.js} +5 -3
- package/dist/chunk-5XZWTFGF.js.map +1 -0
- package/dist/{chunk-JAN34G6S.js → chunk-67XLJ26X.js} +152 -168
- package/dist/chunk-67XLJ26X.js.map +1 -0
- package/dist/{chunk-2CLT36VB.js → chunk-75FJIUIG.js} +22 -23
- package/dist/chunk-75FJIUIG.js.map +1 -0
- package/dist/{chunk-OYWFPIHF.js → chunk-A4CA35DQ.js} +20 -17
- package/dist/chunk-A4CA35DQ.js.map +1 -0
- package/dist/{chunk-SS7ELMJ7.js → chunk-F72WX4MH.js} +49 -33
- package/dist/chunk-F72WX4MH.js.map +1 -0
- package/dist/{chunk-RTRVBEIB.js → chunk-FTDZAKZW.js} +5 -18
- package/dist/chunk-FTDZAKZW.js.map +1 -0
- package/dist/{chunk-XIJNE67Y.js → chunk-GFARAJV2.js} +3 -5
- package/dist/{chunk-XIJNE67Y.js.map → chunk-GFARAJV2.js.map} +1 -1
- package/dist/{chunk-VAN4WW3F.js → chunk-H4TJ7X4O.js} +4 -7
- package/dist/chunk-H4TJ7X4O.js.map +1 -0
- package/dist/{chunk-KS72RZHX.js → chunk-IZJFUAXB.js} +1 -1
- package/dist/{chunk-KS72RZHX.js.map → chunk-IZJFUAXB.js.map} +1 -1
- package/dist/{chunk-SVLNF434.js → chunk-JXMF4NUI.js} +51 -3
- package/dist/chunk-JXMF4NUI.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-RTVRUNYR.js → chunk-OTLSUYQQ.js} +2 -2
- package/dist/chunk-OTLSUYQQ.js.map +1 -0
- package/dist/{chunk-Y6UJOUE5.js → chunk-Q75LKHDF.js} +14 -2
- package/dist/chunk-Q75LKHDF.js.map +1 -0
- package/dist/{chunk-KOZUNIIE.js → chunk-QDCJLJUV.js} +10 -10
- package/dist/{chunk-KOZUNIIE.js.map → chunk-QDCJLJUV.js.map} +1 -1
- package/dist/{chunk-LD5SMIB3.js → chunk-QVCMJ4Q2.js} +1 -1
- package/dist/{chunk-LD5SMIB3.js.map → chunk-QVCMJ4Q2.js.map} +1 -1
- package/dist/{chunk-F3KRX2V4.js → chunk-RDHSHEZM.js} +46 -24
- package/dist/chunk-RDHSHEZM.js.map +1 -0
- package/dist/chunk-UIG7MWS2.js +518 -0
- package/dist/chunk-UIG7MWS2.js.map +1 -0
- package/dist/{chunk-6C6NXNEW.js → chunk-UL6Q5HDP.js} +25 -3
- package/dist/chunk-UL6Q5HDP.js.map +1 -0
- package/dist/{chunk-XG2YMCJW.js → chunk-VMQHNJJI.js} +6 -8
- package/dist/{chunk-XG2YMCJW.js.map → chunk-VMQHNJJI.js.map} +1 -1
- package/dist/{chunk-GCNRXAKH.js → chunk-XP3ASVGJ.js} +13 -10
- package/dist/chunk-XP3ASVGJ.js.map +1 -0
- package/dist/{chunk-ID5QJYF5.js → chunk-Y7YIAWPW.js} +11 -1
- package/dist/chunk-Y7YIAWPW.js.map +1 -0
- package/dist/{chunk-4I6E6DGV.js → chunk-Z72F2ENM.js} +6 -8
- package/dist/{chunk-4I6E6DGV.js.map → chunk-Z72F2ENM.js.map} +1 -1
- package/dist/{chunk-FPTWVCPN.js → chunk-ZA43LPRM.js} +4 -24
- package/dist/chunk-ZA43LPRM.js.map +1 -0
- package/dist/{chunk-K3UNLQ7W.js → chunk-ZRQWSURL.js} +2 -2
- package/dist/chunk-ZRQWSURL.js.map +1 -0
- package/dist/cooldown.d.ts +2 -1
- package/dist/cooldown.js +1 -1
- package/dist/coordinators/boundary-ricochet-3d.d.ts +12 -5
- package/dist/coordinators/boundary-ricochet-3d.js +2 -1
- package/dist/coordinators/boundary-ricochet.d.ts +9 -7
- package/dist/coordinators/boundary-ricochet.js +2 -1
- package/dist/coordinators/first-person-shooter.d.ts +9 -8
- package/dist/coordinators/first-person-shooter.js +3 -3
- package/dist/coordinators/multidirectional-space-shooter.d.ts +12 -9
- package/dist/coordinators/multidirectional-space-shooter.js +4 -4
- package/dist/coordinators/top-down-shooter.d.ts +9 -8
- package/dist/coordinators/top-down-shooter.js +3 -3
- package/dist/core.d.ts +4 -4
- package/dist/core.js +17 -39
- package/dist/core.js.map +1 -1
- package/dist/destructible-3d.d.ts +2 -1
- package/dist/first-person.d.ts +12 -12
- package/dist/first-person.js +9 -8
- package/dist/index.d.ts +37 -14
- package/dist/index.js +73 -44
- package/dist/jumper-2d.d.ts +7 -6
- package/dist/jumper-2d.js +6 -5
- package/dist/jumper-3d.d.ts +12 -11
- package/dist/jumper-3d.js +7 -6
- package/dist/{moveable-BCRpjAQb.d.ts → moveable-Cl9h-_w7.d.ts} +2 -78
- package/dist/particle-emitter.d.ts +1 -1
- package/dist/particle-emitter.js +1 -1
- package/dist/platformer-2d.d.ts +306 -0
- package/dist/platformer-2d.js +24 -0
- package/dist/platformer-3d.d.ts +74 -87
- package/dist/platformer-3d.js +5 -4
- package/dist/ricochet-2d.d.ts +1 -1
- package/dist/ricochet-2d.js +2 -2
- package/dist/ricochet-3d.d.ts +1 -1
- package/dist/ricochet-3d.js +2 -2
- package/dist/runtime-2d.d.ts +93 -2
- package/dist/runtime-2d.js +145 -22
- package/dist/runtime-2d.js.map +1 -1
- package/dist/screen-visibility.d.ts +2 -1
- package/dist/screen-wrap.d.ts +2 -1
- package/dist/screen-wrap.js +1 -1
- package/dist/shooter-2d.d.ts +5 -3
- package/dist/shooter-2d.js +2 -2
- package/dist/shooter-fire-DGripl0z.d.ts +55 -0
- package/dist/thruster.d.ts +8 -18
- package/dist/thruster.js +6 -6
- package/dist/top-down-movement.d.ts +7 -4
- package/dist/top-down-movement.js +5 -5
- package/dist/{use-behavior-D_82jAL3.d.ts → use-behavior-B85d5u7-.d.ts} +1 -1
- package/dist/world-boundary-2d.d.ts +2 -1
- package/dist/world-boundary-2d.js +2 -2
- package/dist/world-boundary-3d.d.ts +2 -1
- package/dist/world-boundary-3d.js +2 -2
- package/package.json +7 -5
- package/dist/behavior-system-DYbx-x_-.d.ts +0 -307
- package/dist/chunk-2C3Z5GE7.js +0 -176
- package/dist/chunk-2C3Z5GE7.js.map +0 -1
- package/dist/chunk-2CLT36VB.js.map +0 -1
- package/dist/chunk-3PYGRHAL.js +0 -35
- package/dist/chunk-3PYGRHAL.js.map +0 -1
- package/dist/chunk-6C6NXNEW.js.map +0 -1
- package/dist/chunk-F3KRX2V4.js.map +0 -1
- package/dist/chunk-FPTWVCPN.js.map +0 -1
- package/dist/chunk-GCNRXAKH.js.map +0 -1
- package/dist/chunk-ID5QJYF5.js.map +0 -1
- package/dist/chunk-JAN34G6S.js.map +0 -1
- package/dist/chunk-K3UNLQ7W.js.map +0 -1
- package/dist/chunk-OYWFPIHF.js.map +0 -1
- package/dist/chunk-RTRVBEIB.js.map +0 -1
- package/dist/chunk-RTVRUNYR.js.map +0 -1
- package/dist/chunk-SS7ELMJ7.js.map +0 -1
- package/dist/chunk-STCCNLPC.js.map +0 -1
- package/dist/chunk-SVLNF434.js.map +0 -1
- package/dist/chunk-VAN4WW3F.js.map +0 -1
- package/dist/chunk-Y6UJOUE5.js.map +0 -1
- package/dist/chunk-YUO6SKJD.js.map +0 -1
- package/dist/chunk-ZPSAXX73.js.map +0 -1
- package/dist/runtime-pong.d.ts +0 -92
- package/dist/runtime-pong.js +0 -38
- /package/dist/{runtime-pong.js.map → platformer-2d.js.map} +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { a as TopDownMovementInputComponent } from '../components-XCpL6IYt.js';
|
|
2
2
|
import { Shooter2DSourceEntity, Shooter2DHandle, Shooter2DStageLike } from '../shooter-2d.js';
|
|
3
|
-
import '../
|
|
3
|
+
import { S as Shooter2DAimFireInput } from '../shooter-fire-DGripl0z.js';
|
|
4
|
+
import '../behavior-system-y8SGrGWy.js';
|
|
5
|
+
import '@dimforge/rapier3d-compat';
|
|
4
6
|
import '../vector-Bm65-FOG.js';
|
|
5
7
|
import 'three';
|
|
6
|
-
import '@dimforge/rapier3d-compat';
|
|
7
8
|
|
|
8
|
-
interface TopDownShooterInput {
|
|
9
|
+
interface TopDownShooterInput extends Shooter2DAimFireInput {
|
|
9
10
|
moveX: number;
|
|
10
11
|
moveY: number;
|
|
11
|
-
aimX: number;
|
|
12
|
-
aimY: number;
|
|
13
|
-
shootPressed: boolean;
|
|
14
|
-
shootHeld: boolean;
|
|
15
12
|
}
|
|
16
13
|
type TopDownShooterEntity = Shooter2DSourceEntity & {
|
|
17
14
|
$topDownMovement?: TopDownMovementInputComponent;
|
|
18
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Coordinator that fans a single input snapshot out to the top-down movement
|
|
18
|
+
* behavior (move + face axes) and the Shooter2D behavior (fire requests).
|
|
19
|
+
*/
|
|
19
20
|
declare class TopDownShooterCoordinator {
|
|
20
21
|
private entity;
|
|
21
22
|
private shooter;
|
|
@@ -24,4 +25,4 @@ declare class TopDownShooterCoordinator {
|
|
|
24
25
|
update(input: TopDownShooterInput): void;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export { TopDownShooterCoordinator, type TopDownShooterInput };
|
|
28
|
+
export { TopDownShooterCoordinator, type TopDownShooterEntity, type TopDownShooterInput };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TopDownShooterCoordinator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-ZA43LPRM.js";
|
|
4
|
+
import "../chunk-UL6Q5HDP.js";
|
|
5
5
|
import "../chunk-EIWQM6U3.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-Y7YIAWPW.js";
|
|
7
7
|
export {
|
|
8
8
|
TopDownShooterCoordinator
|
|
9
9
|
};
|
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export { u as
|
|
1
|
+
import { L as VelocityIntentMode, T as TransformState } from './behavior-system-y8SGrGWy.js';
|
|
2
|
+
export { B as BaseBehaviorHandle, a as BehaviorDescriptor, b as BehaviorEntityLink, c as BehaviorHandle, d as BehaviorRef, e as BehaviorSystem, f as BehaviorSystemContext, g as BehaviorSystemFactory, C as CreateEntityFn, D as DefineBehaviorConfig, G as GameEntity, h as GameEntityOptions, S as STAGE_INPUT_BUTTON_JUMP, i as STAGE_INPUT_BUTTON_RUN, j as StageBehaviorSnapshot, k as StageBodyKind, l as StageBoundaryDim, m as StageBoundaryDimValue, n as StageEventType, o as StageFirstPersonInput, p as StageFirstPersonOptions, q as StageJumper2DOptions, r as StageJumper3DOptions, s as StagePlatformer2DOptions, t as StagePlatformer3DOptions, u as StagePose, v as StageRicochetDim, w as StageRicochetDimValue, x as StageRicochetOptions, y as StageRicochetReflection, z as StageRicochetReflectionValue, A as StageScreenWrapOptions, E as StageShooter2DOptions, F as StageThrusterOptions, H as StageTopDownOptions, I as StageTopDownPlane, J as StageTopDownPlaneValue, K as StageWorldBoundaryOptions, V as VelocityIntent, W as WasmSnapshotBackref, M as WasmStageRuntime, N as WasmStageRuntimeOptions, O as createTransformStore, P as defineBehavior, Q as readBehaviorSnapshot } from './behavior-system-y8SGrGWy.js';
|
|
3
|
+
export { u as useBehavior } from './use-behavior-B85d5u7-.js';
|
|
3
4
|
export { P as PhysicsBodyComponent, T as TransformComponent, c as createPhysicsBodyComponent, a as createTransformComponent } from './components-BWG1GkZA.js';
|
|
4
|
-
|
|
5
|
-
export { E as EntityWithBody, M as MoveableEntity, V as VelocityIntent, c as createTransformStore, g as getPosition, b as getVelocity, m as makeMoveable, d as move, e as moveForwardXY, f as moveX, h as moveXY, i as moveXZ, j as moveY, k as moveZ, r as resetTransformStore, l as resetVelocity, s as setPosition, n as setPositionX, o as setPositionY, p as setPositionZ, w as wrapAround3D, q as wrapAroundXY } from './moveable-BCRpjAQb.js';
|
|
5
|
+
export { E as EntityWithBody, M as MoveableEntity, g as getPosition, a as getVelocity, m as makeMoveable, b as move, c as moveForwardXY, d as moveX, e as moveXY, f as moveXZ, h as moveY, i as moveZ, r as resetVelocity, s as setPosition, j as setPositionX, k as setPositionY, l as setPositionZ, w as wrapAround3D, n as wrapAroundXY } from './moveable-Cl9h-_w7.js';
|
|
6
6
|
export { V as VEC2_ONE, a as VEC2_ZERO, b as VEC3_ONE, c as VEC3_ZERO, d as Vec2, e as Vec2Components, f as Vec2Input, g as Vec3, h as Vec3Components, i as Vec3Input, j as isVec2Input, k as isVec3Input, n as normalizeVec2, l as normalizeVec3, t as toRapierVector3, m as toThreeVector2, o as toThreeVector3 } from './vector-Bm65-FOG.js';
|
|
7
7
|
export { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
8
8
|
export { F as FirstPersonPerspective } from './first-person-perspective-C9Mptl0-.js';
|
package/dist/core.js
CHANGED
|
@@ -3,14 +3,6 @@ import {
|
|
|
3
3
|
createTransformComponent,
|
|
4
4
|
useBehavior
|
|
5
5
|
} from "./chunk-UYFOLI2X.js";
|
|
6
|
-
import {
|
|
7
|
-
StageBodyKind,
|
|
8
|
-
StageBoundaryDim,
|
|
9
|
-
StageEventType,
|
|
10
|
-
StageRicochetDim,
|
|
11
|
-
StageRicochetReflection,
|
|
12
|
-
StageTopDownPlane
|
|
13
|
-
} from "./chunk-Y6UJOUE5.js";
|
|
14
6
|
import {
|
|
15
7
|
VEC2_ONE,
|
|
16
8
|
VEC2_ZERO,
|
|
@@ -27,16 +19,27 @@ import {
|
|
|
27
19
|
import {
|
|
28
20
|
clearVelocityIntent,
|
|
29
21
|
setVelocityIntent
|
|
30
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OTLSUYQQ.js";
|
|
31
23
|
import {
|
|
32
24
|
SyncStateMachine,
|
|
33
25
|
t
|
|
34
26
|
} from "./chunk-4URF65BR.js";
|
|
27
|
+
import {
|
|
28
|
+
STAGE_INPUT_BUTTON_JUMP,
|
|
29
|
+
STAGE_INPUT_BUTTON_RUN,
|
|
30
|
+
StageBodyKind,
|
|
31
|
+
StageBoundaryDim,
|
|
32
|
+
StageEventType,
|
|
33
|
+
StageRicochetDim,
|
|
34
|
+
StageRicochetReflection,
|
|
35
|
+
StageTopDownPlane,
|
|
36
|
+
readBehaviorSnapshot
|
|
37
|
+
} from "./chunk-Q75LKHDF.js";
|
|
35
38
|
import {
|
|
36
39
|
defineBehavior
|
|
37
40
|
} from "./chunk-EZNCCO4L.js";
|
|
38
41
|
|
|
39
|
-
// src/lib/
|
|
42
|
+
// src/lib/capabilities/transform-store.ts
|
|
40
43
|
import { proxy } from "valtio";
|
|
41
44
|
function createTransformStore(initial) {
|
|
42
45
|
const defaultState = {
|
|
@@ -48,7 +51,6 @@ function createTransformStore(initial) {
|
|
|
48
51
|
dirty: {
|
|
49
52
|
position: false,
|
|
50
53
|
rotation: false,
|
|
51
|
-
velocity: false,
|
|
52
54
|
velocityX: false,
|
|
53
55
|
velocityY: false,
|
|
54
56
|
velocityZ: false,
|
|
@@ -66,34 +68,8 @@ function createTransformStore(initial) {
|
|
|
66
68
|
}
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
|
-
function resetTransformStore(store) {
|
|
70
|
-
store.position.x = 0;
|
|
71
|
-
store.position.y = 0;
|
|
72
|
-
store.position.z = 0;
|
|
73
|
-
store.rotation.x = 0;
|
|
74
|
-
store.rotation.y = 0;
|
|
75
|
-
store.rotation.z = 0;
|
|
76
|
-
store.rotation.w = 1;
|
|
77
|
-
store.velocity.x = 0;
|
|
78
|
-
store.velocity.y = 0;
|
|
79
|
-
store.velocity.z = 0;
|
|
80
|
-
store.angularVelocity.x = 0;
|
|
81
|
-
store.angularVelocity.y = 0;
|
|
82
|
-
store.angularVelocity.z = 0;
|
|
83
|
-
for (const sourceId of Object.keys(store.velocityChannels)) {
|
|
84
|
-
delete store.velocityChannels[sourceId];
|
|
85
|
-
}
|
|
86
|
-
store.dirty.position = false;
|
|
87
|
-
store.dirty.rotation = false;
|
|
88
|
-
store.dirty.velocity = false;
|
|
89
|
-
store.dirty.velocityX = false;
|
|
90
|
-
store.dirty.velocityY = false;
|
|
91
|
-
store.dirty.velocityZ = false;
|
|
92
|
-
store.dirty.velocityChannels = false;
|
|
93
|
-
store.dirty.angularVelocity = false;
|
|
94
|
-
}
|
|
95
71
|
|
|
96
|
-
// src/lib/
|
|
72
|
+
// src/lib/capabilities/moveable.ts
|
|
97
73
|
import { Vector3 } from "three";
|
|
98
74
|
function moveX(entity, delta) {
|
|
99
75
|
if (!entity.transformStore) return;
|
|
@@ -279,6 +255,8 @@ var GameEntity = class {
|
|
|
279
255
|
};
|
|
280
256
|
export {
|
|
281
257
|
GameEntity,
|
|
258
|
+
STAGE_INPUT_BUTTON_JUMP,
|
|
259
|
+
STAGE_INPUT_BUTTON_RUN,
|
|
282
260
|
StageBodyKind,
|
|
283
261
|
StageBoundaryDim,
|
|
284
262
|
StageEventType,
|
|
@@ -309,7 +287,7 @@ export {
|
|
|
309
287
|
moveZ,
|
|
310
288
|
normalizeVec2,
|
|
311
289
|
normalizeVec3,
|
|
312
|
-
|
|
290
|
+
readBehaviorSnapshot,
|
|
313
291
|
resetVelocity,
|
|
314
292
|
setPosition,
|
|
315
293
|
setPositionX,
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/actions/capabilities/transform-store.ts","../src/lib/actions/capabilities/moveable.ts","../src/lib/entities/entity.ts"],"sourcesContent":["import { proxy } from 'valtio';\n\nexport type VelocityIntentMode = 'replace' | 'add';\n\nexport interface VelocityIntent {\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\tmode: VelocityIntentMode;\n\tpriority?: number;\n}\n\n/**\n * Transform state managed by Valtio for batched physics updates.\n * \n * This store accumulates transformation intents during the frame,\n * then applies them all at once after onUpdate() callbacks complete.\n * \n * Design decisions:\n * - Position: Accumulated deltas (additive)\n * - Rotation: Last value wins (replacement)\n * - Velocity: Accumulated deltas (additive)\n * - Angular velocity: Accumulated deltas (additive)\n */\nexport interface TransformState {\n\t/** Position deltas to be applied (accumulated) */\n\tposition: { x: number; y: number; z: number };\n\t\n\t/** Rotation quaternion (last value wins) */\n\trotation: { x: number; y: number; z: number; w: number };\n\t\n\t/** Linear velocity (accumulated) */\n\tvelocity: { x: number; y: number; z: number };\n\t\n\t/** Angular velocity (accumulated) */\n\tangularVelocity: { x: number; y: number; z: number };\n\n\t/** Per-source velocity intents composed once per frame */\n\tvelocityChannels: Record<string, VelocityIntent>;\n\t\n\t/** Dirty flags to track what needs to be applied */\n\tdirty: {\n\t\tposition: boolean;\n\t\trotation: boolean;\n\t\t/** @deprecated Use per-axis velocityX/Y/Z flags for new code */\n\t\tvelocity: boolean;\n\t\tvelocityX: boolean;\n\t\tvelocityY: boolean;\n\t\tvelocityZ: boolean;\n\t\tvelocityChannels: boolean;\n\t\tangularVelocity: boolean;\n\t};\n}\n\n/**\n * Create a new transform store with optional initial values.\n * The store is a Valtio proxy, making it reactive for debugging/visualization.\n * \n * @param initial Optional initial state values\n * @returns Reactive transform state\n */\nexport function createTransformStore(initial?: Partial<TransformState>): TransformState {\n\tconst defaultState: TransformState = {\n\t\tposition: { x: 0, y: 0, z: 0 },\n\t\trotation: { x: 0, y: 0, z: 0, w: 1 },\n\t\tvelocity: { x: 0, y: 0, z: 0 },\n\t\tangularVelocity: { x: 0, y: 0, z: 0 },\n\t\tvelocityChannels: {},\n\t\tdirty: {\n\t\t\tposition: false,\n\t\t\trotation: false,\n\t\t\tvelocity: false,\n\t\t\tvelocityX: false,\n\t\t\tvelocityY: false,\n\t\t\tvelocityZ: false,\n\t\t\tvelocityChannels: false,\n\t\t\tangularVelocity: false,\n\t\t},\n\t};\n\n\treturn proxy({\n\t\t...defaultState,\n\t\t...initial,\n\t\t// Ensure dirty flags are properly initialized even if partial initial state\n\t\tdirty: {\n\t\t\t...defaultState.dirty,\n\t\t\t...initial?.dirty,\n\t\t},\n\t});\n}\n\n/**\n * Reset a transform store to its initial clean state.\n * Called after applying changes to prepare for the next frame.\n * \n * @param store The transform store to reset\n */\nexport function resetTransformStore(store: TransformState): void {\n\t// Reset position deltas\n\tstore.position.x = 0;\n\tstore.position.y = 0;\n\tstore.position.z = 0;\n\n\t// Reset rotation to identity quaternion\n\tstore.rotation.x = 0;\n\tstore.rotation.y = 0;\n\tstore.rotation.z = 0;\n\tstore.rotation.w = 1;\n\n\t// Reset velocity\n\tstore.velocity.x = 0;\n\tstore.velocity.y = 0;\n\tstore.velocity.z = 0;\n\n\t// Reset angular velocity\n\tstore.angularVelocity.x = 0;\n\tstore.angularVelocity.y = 0;\n\tstore.angularVelocity.z = 0;\n\n\t// Reset per-source velocity intents\n\tfor (const sourceId of Object.keys(store.velocityChannels)) {\n\t\tdelete store.velocityChannels[sourceId];\n\t}\n\n\t// Clear all dirty flags\n\tstore.dirty.position = false;\n\tstore.dirty.rotation = false;\n\tstore.dirty.velocity = false;\n\tstore.dirty.velocityX = false;\n\tstore.dirty.velocityY = false;\n\tstore.dirty.velocityZ = false;\n\tstore.dirty.velocityChannels = false;\n\tstore.dirty.angularVelocity = false;\n}\n","import { Vector3 } from 'three';\nimport { RigidBody, Vector } from '@dimforge/rapier3d-compat';\nimport type { TransformState } from './transform-store';\nimport { createTransformStore } from './transform-store';\nimport { setVelocityIntent } from './velocity-intents';\n\nexport interface EntityWithBody {\n\tbody: RigidBody | null;\n\ttransformStore?: TransformState;\n}\n\n/**\n * Move an entity along the X axis, preserving other velocities.\n */\nexport function moveX(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { x: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the Y axis, preserving other velocities.\n */\nexport function moveY(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { y: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the Z axis, preserving other velocities.\n */\nexport function moveZ(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { z: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the X and Y axis, preserving Z velocity.\n */\nexport function moveXY(entity: EntityWithBody, deltaX: number, deltaY: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: deltaX, y: deltaY },\n\t\t{ mode: 'replace' },\n\t);\n}\n\n/**\n * Move an entity along the X and Z axis, preserving Y velocity.\n */\nexport function moveXZ(entity: EntityWithBody, deltaX: number, deltaZ: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: deltaX, z: deltaZ },\n\t\t{ mode: 'replace' },\n\t);\n}\n\n/**\n * Move entity based on a vector, adding to existing velocities.\n */\nexport function move(entity: EntityWithBody, vector: Vector3): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: vector.x, y: vector.y, z: vector.z },\n\t\t{ mode: 'add' },\n\t);\n}\n\n/**\n * Reset entity velocity\n */\nexport function resetVelocity(entity: EntityWithBody): void {\n\tif (!entity.body) return;\n\tentity.body.setLinvel(new Vector3(0, 0, 0), true);\n\tentity.body.setLinearDamping(5);\n}\n\n/**\n * Move entity forward in 2D space, preserving Z velocity\n */\nexport function moveForwardXY(entity: EntityWithBody, delta: number, rotation2DAngle: number): void {\n\tconst deltaX = Math.sin(-rotation2DAngle) * delta;\n\tconst deltaY = Math.cos(-rotation2DAngle) * delta;\n\tmoveXY(entity, deltaX, deltaY);\n}\n\n/**\n * Get entity position\n */\nexport function getPosition(entity: EntityWithBody): Vector | null {\n\tif (!entity.body) return null;\n\treturn entity.body.translation();\n}\n\n/**\n * Get entity velocity\n */\nexport function getVelocity(entity: EntityWithBody): Vector | null {\n\tif (!entity.body) return null;\n\treturn entity.body.linvel();\n}\n\n/**\n * Set entity position\n */\nexport function setPosition(entity: EntityWithBody, x: number, y: number, z: number): void {\n\tif (!entity.body) return;\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity X position\n */\nexport function setPositionX(entity: EntityWithBody, x: number): void {\n\tif (!entity.body) return;\n\tconst { y, z } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity Y position\n */\nexport function setPositionY(entity: EntityWithBody, y: number): void {\n\tif (!entity.body) return;\n\tconst { x, z } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity Z position\n */\nexport function setPositionZ(entity: EntityWithBody, z: number): void {\n\tif (!entity.body) return;\n\tconst { x, y } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Wrap entity around 2D bounds\n */\nexport function wrapAroundXY(entity: EntityWithBody, boundsX: number, boundsY: number): void {\n\tconst position = getPosition(entity);\n\tif (!position) return;\n\n\tconst { x, y } = position;\n\tconst newX = x > boundsX ? -boundsX : (x < -boundsX ? boundsX : x);\n\tconst newY = y > boundsY ? -boundsY : (y < -boundsY ? boundsY : y);\n\n\tif (newX !== x || newY !== y) {\n\t\tsetPosition(entity, newX, newY, 0);\n\t}\n}\n\n/**\n * Wrap entity around 3D bounds\n */\nexport function wrapAround3D(entity: EntityWithBody, boundsX: number, boundsY: number, boundsZ: number): void {\n\tconst position = getPosition(entity);\n\tif (!position) return;\n\n\tconst { x, y, z } = position;\n\tconst newX = x > boundsX ? -boundsX : (x < -boundsX ? boundsX : x);\n\tconst newY = y > boundsY ? -boundsY : (y < -boundsY ? boundsY : y);\n\tconst newZ = z > boundsZ ? -boundsZ : (z < -boundsZ ? boundsZ : z);\n\n\tif (newX !== x || newY !== y || newZ !== z) {\n\t\tsetPosition(entity, newX, newY, newZ);\n\t}\n}\n\n/**\n * Enhanced moveable entity with bound methods\n */\nexport interface MoveableEntity extends EntityWithBody {\n\tmoveX(delta: number): void;\n\tmoveY(delta: number): void;\n\tmoveZ(delta: number): void;\n\tmoveXY(deltaX: number, deltaY: number): void;\n\tmoveXZ(deltaX: number, deltaZ: number): void;\n\tmove(vector: Vector3): void;\n\tresetVelocity(): void;\n\tmoveForwardXY(delta: number, rotation2DAngle: number): void;\n\tgetPosition(): Vector | null;\n\tgetVelocity(): Vector | null;\n\tsetPosition(x: number, y: number, z: number): void;\n\tsetPositionX(x: number): void;\n\tsetPositionY(y: number): void;\n\tsetPositionZ(z: number): void;\n\twrapAroundXY(boundsX: number, boundsY: number): void;\n\twrapAround3D(boundsX: number, boundsY: number, boundsZ: number): void;\n}\n\n/**\n * Enhance an entity with additive movement methods.\n * Automatically creates a transform store if one doesn't exist.\n */\nexport function makeMoveable<T extends EntityWithBody>(entity: T): T & MoveableEntity {\n\tconst moveable = entity as T & MoveableEntity;\n\n\t// Create transform store if it doesn't exist\n\tif (!moveable.transformStore) {\n\t\tmoveable.transformStore = createTransformStore();\n\t}\n\n\tmoveable.moveX = (delta: number) => moveX(entity, delta);\n\tmoveable.moveY = (delta: number) => moveY(entity, delta);\n\tmoveable.moveZ = (delta: number) => moveZ(entity, delta);\n\tmoveable.moveXY = (deltaX: number, deltaY: number) => moveXY(entity, deltaX, deltaY);\n\tmoveable.moveXZ = (deltaX: number, deltaZ: number) => moveXZ(entity, deltaX, deltaZ);\n\tmoveable.move = (vector: Vector3) => move(entity, vector);\n\tmoveable.resetVelocity = () => resetVelocity(entity);\n\tmoveable.moveForwardXY = (delta: number, rotation2DAngle: number) => moveForwardXY(entity, delta, rotation2DAngle);\n\tmoveable.getPosition = () => getPosition(entity);\n\tmoveable.getVelocity = () => getVelocity(entity);\n\tmoveable.setPosition = (x: number, y: number, z: number) => setPosition(entity, x, y, z);\n\tmoveable.setPositionX = (x: number) => setPositionX(entity, x);\n\tmoveable.setPositionY = (y: number) => setPositionY(entity, y);\n\tmoveable.setPositionZ = (z: number) => setPositionZ(entity, z);\n\tmoveable.wrapAroundXY = (boundsX: number, boundsY: number) => wrapAroundXY(entity, boundsX, boundsY);\n\tmoveable.wrapAround3D = (boundsX: number, boundsY: number, boundsZ: number) => wrapAround3D(entity, boundsX, boundsY, boundsZ);\n\n\treturn moveable;\n}","import type {\n\tBehaviorDescriptor,\n\tBehaviorHandle,\n\tBehaviorRef,\n} from '../behaviors/behavior-descriptor';\n\n/**\n * Minimal, runtime-agnostic entity options contract.\n *\n * The full engine entity (in `@zylem/game-lib`) provides a richer options type,\n * but behaviors only rely on this loose shape.\n */\nexport interface GameEntityOptions {\n\t[key: string]: any;\n\tname?: string;\n}\n\n/**\n * Structural stand-in for the engine `GameEntity`.\n *\n * Behaviors annotate against this loose contract so that `@zylem/behaviors`\n * (and its `@zylem/behaviors/core` surface) never has to depend on the concrete\n * `@zylem/game-lib` entity implementation. The real engine entity is\n * structurally assignable to this type.\n */\nexport class GameEntity<TOptions = unknown> {\n\t[key: string]: any;\n\n\tuuid!: string;\n\tname!: string;\n\ttype!: string;\n\toptions?: TOptions & Record<string, unknown>;\n\tgroup: any = null;\n\tmesh?: any;\n\tmaterials?: any[];\n\tbody: any = null;\n\tcollider: any = null;\n\tcolliderDesc?: any;\n\tcolliderDescs: any[] = [];\n\tbodyDesc?: any;\n\tphysicsAttached = false;\n\truntimeHandle?: number;\n\ttransformStore?: any;\n\tnodeDestroy?: any;\n\tisInstanced?: boolean;\n\n\tprivate __behaviorRefs: BehaviorRef<any>[] = [];\n\n\tcreate(): this {\n\t\treturn this;\n\t}\n\n\tonCleanup(callback: () => void): this {\n\t\tvoid callback;\n\t\treturn this;\n\t}\n\n\tsetPosition(_x: number, _y: number, _z: number): void {}\n\tsetRotation(_x: number, _y: number, _z: number): void {}\n\tsetRotationZ(_z: number): void {}\n\tsetScale(_x: number, _y: number, _z: number): void {}\n\n\t/**\n\t * Attach a behavior to this entity. The real engine entity does substantially\n\t * more, but this functional stub stores the merged ref and builds the handle\n\t * so descriptor/handle logic (and tests that drive behaviors directly) work\n\t * without the full engine.\n\t */\n\tuse<\n\t\tO extends Record<string, any>,\n\t\tH extends Record<string, any> = Record<string, never>,\n\t>(\n\t\tdescriptor: BehaviorDescriptor<O, H>,\n\t\toptions?: Partial<O>,\n\t): BehaviorHandle<O, H> {\n\t\tconst mergedOptions = {\n\t\t\t...(descriptor.defaultOptions as O),\n\t\t\t...(options ?? {}),\n\t\t} as O;\n\t\tconst ref: BehaviorRef<O> = { descriptor, options: mergedOptions };\n\t\tthis.__behaviorRefs.push(ref as BehaviorRef<any>);\n\n\t\tconst baseHandle = {\n\t\t\tgetFSM: () => ref.fsm ?? null,\n\t\t\tgetOptions: () => ref.options,\n\t\t\tref,\n\t\t};\n\t\tconst extra = descriptor.createHandle\n\t\t\t? descriptor.createHandle(ref)\n\t\t\t: ({} as H);\n\t\treturn { ...baseHandle, ...extra } as BehaviorHandle<O, H>;\n\t}\n\n\t/** Live behavior refs attached via {@link use}. */\n\tgetBehaviorRefs(): BehaviorRef<any>[] {\n\t\treturn this.__behaviorRefs;\n\t}\n}\n\n/**\n * Factory contract injected into behavior systems via\n * {@link BehaviorSystemContext.createEntity}. The host engine supplies the real\n * entity factory at stage-construction time.\n */\nexport type CreateEntityFn = (\n\toptions?: Partial<GameEntityOptions>,\n) => GameEntity<GameEntityOptions>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AA6Df,SAAS,qBAAqB,SAAmD;AACvF,QAAM,eAA+B;AAAA,IACpC,UAAU,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,IAC7B,UAAU,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,IACnC,UAAU,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,IAC7B,iBAAiB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,IACpC,kBAAkB,CAAC;AAAA,IACnB,OAAO;AAAA,MACN,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB,iBAAiB;AAAA,IAClB;AAAA,EACD;AAEA,SAAO,MAAM;AAAA,IACZ,GAAG;AAAA,IACH,GAAG;AAAA;AAAA,IAEH,OAAO;AAAA,MACN,GAAG,aAAa;AAAA,MAChB,GAAG,SAAS;AAAA,IACb;AAAA,EACD,CAAC;AACF;AAQO,SAAS,oBAAoB,OAA6B;AAEhE,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AAGnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AAGnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AACnB,QAAM,SAAS,IAAI;AAGnB,QAAM,gBAAgB,IAAI;AAC1B,QAAM,gBAAgB,IAAI;AAC1B,QAAM,gBAAgB,IAAI;AAG1B,aAAW,YAAY,OAAO,KAAK,MAAM,gBAAgB,GAAG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;AAAA,EAChC,SAAS,IAAY,IAAY,IAAkB;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpD,IAIC,YACA,SACuB;AACvB,UAAM,gBAAgB;AAAA,MACrB,GAAI,WAAW;AAAA,MACf,GAAI,WAAW,CAAC;AAAA,IACjB;AACA,UAAM,MAAsB,EAAE,YAAY,SAAS,cAAc;AACjE,SAAK,eAAe,KAAK,GAAuB;AAEhD,UAAM,aAAa;AAAA,MAClB,QAAQ,MAAM,IAAI,OAAO;AAAA,MACzB,YAAY,MAAM,IAAI;AAAA,MACtB;AAAA,IACD;AACA,UAAM,QAAQ,WAAW,eACtB,WAAW,aAAa,GAAG,IAC1B,CAAC;AACL,WAAO,EAAE,GAAG,YAAY,GAAG,MAAM;AAAA,EAClC;AAAA;AAAA,EAGA,kBAAsC;AACrC,WAAO,KAAK;AAAA,EACb;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/capabilities/transform-store.ts","../src/lib/capabilities/moveable.ts","../src/lib/entities/entity.ts"],"sourcesContent":["import { proxy } from 'valtio';\n\nexport type VelocityIntentMode = 'replace' | 'add';\n\nexport interface VelocityIntent {\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\tmode: VelocityIntentMode;\n\tpriority?: number;\n}\n\n/**\n * Transform state managed by Valtio for batched physics updates.\n * \n * This store accumulates transformation intents during the frame,\n * then applies them all at once after onUpdate() callbacks complete.\n * \n * Design decisions:\n * - Position: Accumulated deltas (additive)\n * - Rotation: Last value wins (replacement)\n * - Velocity: Accumulated deltas (additive)\n * - Angular velocity: Accumulated deltas (additive)\n */\nexport interface TransformState {\n\t/** Position deltas to be applied (accumulated) */\n\tposition: { x: number; y: number; z: number };\n\t\n\t/** Rotation quaternion (last value wins) */\n\trotation: { x: number; y: number; z: number; w: number };\n\t\n\t/** Linear velocity (accumulated) */\n\tvelocity: { x: number; y: number; z: number };\n\t\n\t/** Angular velocity (accumulated) */\n\tangularVelocity: { x: number; y: number; z: number };\n\n\t/** Per-source velocity intents composed once per frame */\n\tvelocityChannels: Record<string, VelocityIntent>;\n\t\n\t/** Dirty flags to track what needs to be applied */\n\tdirty: {\n\t\tposition: boolean;\n\t\trotation: boolean;\n\t\tvelocityX: boolean;\n\t\tvelocityY: boolean;\n\t\tvelocityZ: boolean;\n\t\tvelocityChannels: boolean;\n\t\tangularVelocity: boolean;\n\t};\n}\n\n/**\n * Create a new transform store with optional initial values.\n * The store is a Valtio proxy, making it reactive for debugging/visualization.\n * \n * @param initial Optional initial state values\n * @returns Reactive transform state\n */\nexport function createTransformStore(initial?: Partial<TransformState>): TransformState {\n\tconst defaultState: TransformState = {\n\t\tposition: { x: 0, y: 0, z: 0 },\n\t\trotation: { x: 0, y: 0, z: 0, w: 1 },\n\t\tvelocity: { x: 0, y: 0, z: 0 },\n\t\tangularVelocity: { x: 0, y: 0, z: 0 },\n\t\tvelocityChannels: {},\n\t\tdirty: {\n\t\t\tposition: false,\n\t\t\trotation: false,\n\t\t\tvelocityX: false,\n\t\t\tvelocityY: false,\n\t\t\tvelocityZ: false,\n\t\t\tvelocityChannels: false,\n\t\t\tangularVelocity: false,\n\t\t},\n\t};\n\n\treturn proxy({\n\t\t...defaultState,\n\t\t...initial,\n\t\t// Ensure dirty flags are properly initialized even if partial initial state\n\t\tdirty: {\n\t\t\t...defaultState.dirty,\n\t\t\t...initial?.dirty,\n\t\t},\n\t});\n}\n\n","import { Vector3 } from 'three';\nimport { RigidBody, Vector } from '@dimforge/rapier3d-compat';\nimport type { TransformState } from './transform-store';\nimport { createTransformStore } from './transform-store';\nimport { setVelocityIntent } from './velocity-intents';\n\nexport interface EntityWithBody {\n\tbody: RigidBody | null;\n\ttransformStore?: TransformState;\n}\n\n/**\n * Move an entity along the X axis, preserving other velocities.\n */\nexport function moveX(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { x: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the Y axis, preserving other velocities.\n */\nexport function moveY(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { y: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the Z axis, preserving other velocities.\n */\nexport function moveZ(entity: EntityWithBody, delta: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(entity.transformStore, 'actions', { z: delta }, { mode: 'replace' });\n}\n\n/**\n * Move an entity along the X and Y axis, preserving Z velocity.\n */\nexport function moveXY(entity: EntityWithBody, deltaX: number, deltaY: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: deltaX, y: deltaY },\n\t\t{ mode: 'replace' },\n\t);\n}\n\n/**\n * Move an entity along the X and Z axis, preserving Y velocity.\n */\nexport function moveXZ(entity: EntityWithBody, deltaX: number, deltaZ: number): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: deltaX, z: deltaZ },\n\t\t{ mode: 'replace' },\n\t);\n}\n\n/**\n * Move entity based on a vector, adding to existing velocities.\n */\nexport function move(entity: EntityWithBody, vector: Vector3): void {\n\tif (!entity.transformStore) return;\n\tsetVelocityIntent(\n\t\tentity.transformStore,\n\t\t'actions',\n\t\t{ x: vector.x, y: vector.y, z: vector.z },\n\t\t{ mode: 'add' },\n\t);\n}\n\n/**\n * Reset entity velocity\n */\nexport function resetVelocity(entity: EntityWithBody): void {\n\tif (!entity.body) return;\n\tentity.body.setLinvel(new Vector3(0, 0, 0), true);\n\tentity.body.setLinearDamping(5);\n}\n\n/**\n * Move entity forward in 2D space, preserving Z velocity\n */\nexport function moveForwardXY(entity: EntityWithBody, delta: number, rotation2DAngle: number): void {\n\tconst deltaX = Math.sin(-rotation2DAngle) * delta;\n\tconst deltaY = Math.cos(-rotation2DAngle) * delta;\n\tmoveXY(entity, deltaX, deltaY);\n}\n\n/**\n * Get entity position\n */\nexport function getPosition(entity: EntityWithBody): Vector | null {\n\tif (!entity.body) return null;\n\treturn entity.body.translation();\n}\n\n/**\n * Get entity velocity\n */\nexport function getVelocity(entity: EntityWithBody): Vector | null {\n\tif (!entity.body) return null;\n\treturn entity.body.linvel();\n}\n\n/**\n * Set entity position\n */\nexport function setPosition(entity: EntityWithBody, x: number, y: number, z: number): void {\n\tif (!entity.body) return;\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity X position\n */\nexport function setPositionX(entity: EntityWithBody, x: number): void {\n\tif (!entity.body) return;\n\tconst { y, z } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity Y position\n */\nexport function setPositionY(entity: EntityWithBody, y: number): void {\n\tif (!entity.body) return;\n\tconst { x, z } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Set entity Z position\n */\nexport function setPositionZ(entity: EntityWithBody, z: number): void {\n\tif (!entity.body) return;\n\tconst { x, y } = entity.body.translation();\n\tentity.body.setTranslation({ x, y, z }, true);\n}\n\n/**\n * Wrap entity around 2D bounds\n */\nexport function wrapAroundXY(entity: EntityWithBody, boundsX: number, boundsY: number): void {\n\tconst position = getPosition(entity);\n\tif (!position) return;\n\n\tconst { x, y } = position;\n\tconst newX = x > boundsX ? -boundsX : (x < -boundsX ? boundsX : x);\n\tconst newY = y > boundsY ? -boundsY : (y < -boundsY ? boundsY : y);\n\n\tif (newX !== x || newY !== y) {\n\t\tsetPosition(entity, newX, newY, 0);\n\t}\n}\n\n/**\n * Wrap entity around 3D bounds\n */\nexport function wrapAround3D(entity: EntityWithBody, boundsX: number, boundsY: number, boundsZ: number): void {\n\tconst position = getPosition(entity);\n\tif (!position) return;\n\n\tconst { x, y, z } = position;\n\tconst newX = x > boundsX ? -boundsX : (x < -boundsX ? boundsX : x);\n\tconst newY = y > boundsY ? -boundsY : (y < -boundsY ? boundsY : y);\n\tconst newZ = z > boundsZ ? -boundsZ : (z < -boundsZ ? boundsZ : z);\n\n\tif (newX !== x || newY !== y || newZ !== z) {\n\t\tsetPosition(entity, newX, newY, newZ);\n\t}\n}\n\n/**\n * Enhanced moveable entity with bound methods\n */\nexport interface MoveableEntity extends EntityWithBody {\n\tmoveX(delta: number): void;\n\tmoveY(delta: number): void;\n\tmoveZ(delta: number): void;\n\tmoveXY(deltaX: number, deltaY: number): void;\n\tmoveXZ(deltaX: number, deltaZ: number): void;\n\tmove(vector: Vector3): void;\n\tresetVelocity(): void;\n\tmoveForwardXY(delta: number, rotation2DAngle: number): void;\n\tgetPosition(): Vector | null;\n\tgetVelocity(): Vector | null;\n\tsetPosition(x: number, y: number, z: number): void;\n\tsetPositionX(x: number): void;\n\tsetPositionY(y: number): void;\n\tsetPositionZ(z: number): void;\n\twrapAroundXY(boundsX: number, boundsY: number): void;\n\twrapAround3D(boundsX: number, boundsY: number, boundsZ: number): void;\n}\n\n/**\n * Enhance an entity with additive movement methods.\n * Automatically creates a transform store if one doesn't exist.\n */\nexport function makeMoveable<T extends EntityWithBody>(entity: T): T & MoveableEntity {\n\tconst moveable = entity as T & MoveableEntity;\n\n\t// Create transform store if it doesn't exist\n\tif (!moveable.transformStore) {\n\t\tmoveable.transformStore = createTransformStore();\n\t}\n\n\tmoveable.moveX = (delta: number) => moveX(entity, delta);\n\tmoveable.moveY = (delta: number) => moveY(entity, delta);\n\tmoveable.moveZ = (delta: number) => moveZ(entity, delta);\n\tmoveable.moveXY = (deltaX: number, deltaY: number) => moveXY(entity, deltaX, deltaY);\n\tmoveable.moveXZ = (deltaX: number, deltaZ: number) => moveXZ(entity, deltaX, deltaZ);\n\tmoveable.move = (vector: Vector3) => move(entity, vector);\n\tmoveable.resetVelocity = () => resetVelocity(entity);\n\tmoveable.moveForwardXY = (delta: number, rotation2DAngle: number) => moveForwardXY(entity, delta, rotation2DAngle);\n\tmoveable.getPosition = () => getPosition(entity);\n\tmoveable.getVelocity = () => getVelocity(entity);\n\tmoveable.setPosition = (x: number, y: number, z: number) => setPosition(entity, x, y, z);\n\tmoveable.setPositionX = (x: number) => setPositionX(entity, x);\n\tmoveable.setPositionY = (y: number) => setPositionY(entity, y);\n\tmoveable.setPositionZ = (z: number) => setPositionZ(entity, z);\n\tmoveable.wrapAroundXY = (boundsX: number, boundsY: number) => wrapAroundXY(entity, boundsX, boundsY);\n\tmoveable.wrapAround3D = (boundsX: number, boundsY: number, boundsZ: number) => wrapAround3D(entity, boundsX, boundsY, boundsZ);\n\n\treturn moveable;\n}","import type { Collider, RigidBody } from '@dimforge/rapier3d-compat';\nimport type {\n\tBehaviorDescriptor,\n\tBehaviorHandle,\n\tBehaviorRef,\n} from '../behaviors/behavior-descriptor';\nimport type { TransformState } from '../capabilities/transform-store';\n\n/**\n * Minimal, runtime-agnostic entity options contract.\n *\n * The full engine entity (in `@zylem/game-lib`) provides a richer options type,\n * but behaviors only rely on this loose shape.\n */\nexport interface GameEntityOptions {\n\t[key: string]: any;\n\tname?: string;\n}\n\n/**\n * Structural stand-in for the engine `GameEntity`.\n *\n * Behaviors annotate against this loose contract so that `@zylem/behaviors`\n * (and its `@zylem/behaviors/core` surface) never has to depend on the concrete\n * `@zylem/game-lib` entity implementation. The real engine entity is\n * structurally assignable to this type.\n */\nexport class GameEntity<TOptions = unknown> {\n\t[key: string]: any;\n\n\tuuid!: string;\n\tname!: string;\n\ttype!: string;\n\toptions?: TOptions & Record<string, unknown>;\n\tgroup: any = null;\n\tmesh?: any;\n\tmaterials?: any[];\n\tbody: RigidBody | null = null;\n\tcollider: Collider | null = null;\n\tcolliderDesc?: any;\n\tcolliderDescs: any[] = [];\n\tbodyDesc?: any;\n\tphysicsAttached = false;\n\truntimeHandle?: number;\n\ttransformStore?: TransformState;\n\tnodeDestroy?: any;\n\tisInstanced?: boolean;\n\n\tprivate __behaviorRefs: BehaviorRef<any>[] = [];\n\n\tcreate(): this {\n\t\treturn this;\n\t}\n\n\tonCleanup(callback: () => void): this {\n\t\tvoid callback;\n\t\treturn this;\n\t}\n\n\tsetPosition(_x: number, _y: number, _z: number): void {}\n\tsetRotation(_x: number, _y: number, _z: number): void {}\n\tsetRotationZ(_z: number): void {}\n\tsetScale(_x: number, _y: number, _z: number): void {}\n\n\t/**\n\t * Attach a behavior to this entity. The real engine entity does substantially\n\t * more, but this functional stub stores the merged ref and builds the handle\n\t * so descriptor/handle logic (and tests that drive behaviors directly) work\n\t * without the full engine.\n\t */\n\tuse<\n\t\tO extends Record<string, any>,\n\t\tH extends Record<string, any> = Record<string, never>,\n\t>(\n\t\tdescriptor: BehaviorDescriptor<O, H>,\n\t\toptions?: Partial<O>,\n\t): BehaviorHandle<O, H> {\n\t\tconst mergedOptions = {\n\t\t\t...(descriptor.defaultOptions as O),\n\t\t\t...(options ?? {}),\n\t\t} as O;\n\t\tconst ref: BehaviorRef<O> = { descriptor, options: mergedOptions };\n\t\tthis.__behaviorRefs.push(ref as BehaviorRef<any>);\n\n\t\tconst baseHandle = {\n\t\t\tgetFSM: () => ref.fsm ?? null,\n\t\t\tgetOptions: () => ref.options,\n\t\t\tref,\n\t\t};\n\t\tconst extra = descriptor.createHandle\n\t\t\t? descriptor.createHandle(ref)\n\t\t\t: ({} as H);\n\t\treturn { ...baseHandle, ...extra } as BehaviorHandle<O, H>;\n\t}\n\n\t/** Live behavior refs attached via {@link use}. */\n\tgetBehaviorRefs(): BehaviorRef<any>[] {\n\t\treturn this.__behaviorRefs;\n\t}\n}\n\n/**\n * Factory contract injected into behavior systems via\n * {@link BehaviorSystemContext.createEntity}. The host engine supplies the real\n * entity factory at stage-construction time.\n */\nexport type CreateEntityFn = (\n\toptions?: Partial<GameEntityOptions>,\n) => GameEntity<GameEntityOptions>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AA2Df,SAAS,qBAAqB,SAAmD;AACvF,QAAM,eAA+B;AAAA,IACpC,UAAU,EAAE,GAAG,GA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,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ,iBAAqC,CAAC;AAAA,EAE9C,SAAe;AACd,WAAO;AAAA,EACR;AAAA,EAEA,UAAU,UAA4B;AACrC,SAAK;AACL,WAAO;AAAA,EACR;AAAA,EAEA,YAAY,IAAY,IAAY,IAAkB;AAAA,EAAC;AAAA,EACvD,YAAY,IAAY,IAAY,IAAkB;AAAA,EAAC;AAAA,EACvD,aAAa,IAAkB;AAAA,EAAC;AAAA,EAChC,SAAS,IAAY,IAAY,IAAkB;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpD,IAIC,YACA,SACuB;AACvB,UAAM,gBAAgB;AAAA,MACrB,GAAI,WAAW;AAAA,MACf,GAAI,WAAW,CAAC;AAAA,IACjB;AACA,UAAM,MAAsB,EAAE,YAAY,SAAS,cAAc;AACjE,SAAK,eAAe,KAAK,GAAuB;AAEhD,UAAM,aAAa;AAAA,MAClB,QAAQ,MAAM,IAAI,OAAO;AAAA,MACzB,YAAY,MAAM,IAAI;AAAA,MACtB;AAAA,IACD;AACA,UAAM,QAAQ,WAAW,eACtB,WAAW,aAAa,GAAG,IAC1B,CAAC;AACL,WAAO,EAAE,GAAG,YAAY,GAAG,MAAM;AAAA,EAClC;AAAA;AAAA,EAGA,kBAAsC;AACrC,WAAO,KAAK;AAAA,EACb;AACD;","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as BehaviorDescriptor } from './behavior-system-
|
|
1
|
+
import { a as BehaviorDescriptor } from './behavior-system-y8SGrGWy.js';
|
|
2
2
|
import { Material } from 'three';
|
|
3
3
|
import { FractureOptions, DestructibleMesh } from '@dgreenheck/three-pinata';
|
|
4
4
|
export { DestructibleMesh, FractureOptions, VoronoiOptions } from '@dgreenheck/three-pinata';
|
|
5
5
|
export { D as DestructiblePrebakeWorkerAPI, P as PlainBufferGeometryPayload, a as PlainFractureOptions, c as PrebakeWorkerRequest, d as PrebakeWorkerResponse } from './payload-BQzu-oY_.js';
|
|
6
|
+
import '@dimforge/rapier3d-compat';
|
|
6
7
|
|
|
7
8
|
type FractureOptionsInput = NonNullable<ConstructorParameters<typeof FractureOptions>[0]>;
|
|
8
9
|
type Destructible3DFragmentColliderShape = 'convexHull' | 'cuboid' | 'trimesh';
|
package/dist/first-person.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { F as FirstPersonInputComponent, b as FirstPersonStateComponent, a as Fi
|
|
|
2
2
|
export { c as createFirstPersonInputComponent, d as createFirstPersonMovementComponent, e as createFirstPersonStateComponent } from './components-qWwOsvwh.js';
|
|
3
3
|
import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
4
4
|
import { Vector3, Euler } from 'three';
|
|
5
|
+
import { RigidBody } from '@dimforge/rapier3d-compat';
|
|
5
6
|
import { F as FirstPersonPerspective } from './first-person-perspective-C9Mptl0-.js';
|
|
6
|
-
import { a as BehaviorDescriptor } from './behavior-system-
|
|
7
|
+
import { T as TransformState, Z as ZylemWorld, a as BehaviorDescriptor } from './behavior-system-y8SGrGWy.js';
|
|
7
8
|
import { i as Vec3Input } from './vector-Bm65-FOG.js';
|
|
8
9
|
import 'typescript-fsm';
|
|
9
|
-
import '@dimforge/rapier3d-compat';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* First Person Controller Finite State Machine
|
|
@@ -89,8 +89,8 @@ interface ViewmodelConfig {
|
|
|
89
89
|
*/
|
|
90
90
|
interface FirstPersonEntity {
|
|
91
91
|
uuid: string;
|
|
92
|
-
body:
|
|
93
|
-
transformStore:
|
|
92
|
+
body: RigidBody | null;
|
|
93
|
+
transformStore: TransformState;
|
|
94
94
|
firstPerson: FirstPersonMovementComponent;
|
|
95
95
|
$fps: FirstPersonInputComponent;
|
|
96
96
|
firstPersonState: FirstPersonStateComponent;
|
|
@@ -101,11 +101,11 @@ interface FirstPersonEntity {
|
|
|
101
101
|
* Core movement + look system for first-person cameras.
|
|
102
102
|
* Reads from entity.$fps input component and drives a FirstPersonPerspective.
|
|
103
103
|
*/
|
|
104
|
-
declare class
|
|
104
|
+
declare class FirstPersonSystem {
|
|
105
105
|
private world;
|
|
106
106
|
private perspectives;
|
|
107
107
|
private viewmodels;
|
|
108
|
-
constructor(world:
|
|
108
|
+
constructor(world: ZylemWorld | null);
|
|
109
109
|
/**
|
|
110
110
|
* Associate a FirstPersonPerspective with an entity (by uuid).
|
|
111
111
|
* Called once by the descriptor system when the behavior is initialized.
|
|
@@ -140,7 +140,7 @@ declare class FirstPersonControllerBehavior {
|
|
|
140
140
|
/**
|
|
141
141
|
* First-person controller behavior options (typed for entity.use() autocomplete).
|
|
142
142
|
*/
|
|
143
|
-
interface
|
|
143
|
+
interface FirstPersonBehaviorOptions {
|
|
144
144
|
/** Base walking speed (default: 8) */
|
|
145
145
|
walkSpeed?: number;
|
|
146
146
|
/** Sprint/run speed (default: 16) */
|
|
@@ -159,7 +159,7 @@ interface FirstPersonControllerOptions {
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* FirstPersonBehavior - typed descriptor for first-person movement and camera control.
|
|
163
163
|
*
|
|
164
164
|
* Provides complete first-person controller including:
|
|
165
165
|
* - WASD movement relative to camera yaw
|
|
@@ -169,7 +169,7 @@ interface FirstPersonControllerOptions {
|
|
|
169
169
|
*
|
|
170
170
|
* @example
|
|
171
171
|
* ```typescript
|
|
172
|
-
* import {
|
|
172
|
+
* import { FirstPersonBehavior } from "@zylem/game-lib/behavior";
|
|
173
173
|
* import { createCamera, Perspectives, FirstPersonPerspective } from "@zylem/game-lib/core";
|
|
174
174
|
* import { createActor } from "@zylem/game-lib/entity";
|
|
175
175
|
*
|
|
@@ -177,7 +177,7 @@ interface FirstPersonControllerOptions {
|
|
|
177
177
|
* const fps = fpsCamera.getPerspective<FirstPersonPerspective>();
|
|
178
178
|
*
|
|
179
179
|
* const player = createActor({ name: 'player', ... });
|
|
180
|
-
* const controller = player.use(
|
|
180
|
+
* const controller = player.use(FirstPersonBehavior, {
|
|
181
181
|
* perspective: fps,
|
|
182
182
|
* walkSpeed: 8,
|
|
183
183
|
* runSpeed: 16,
|
|
@@ -194,11 +194,11 @@ interface FirstPersonControllerOptions {
|
|
|
194
194
|
* });
|
|
195
195
|
* ```
|
|
196
196
|
*/
|
|
197
|
-
declare const
|
|
197
|
+
declare const FirstPersonBehavior: BehaviorDescriptor<FirstPersonBehaviorOptions, {
|
|
198
198
|
getState: () => FirstPersonState;
|
|
199
199
|
getYaw: () => number;
|
|
200
200
|
getPitch: () => number;
|
|
201
201
|
attachViewmodel: (entity: any, offset: Vec3Input) => void;
|
|
202
202
|
}, FirstPersonEntity>;
|
|
203
203
|
|
|
204
|
-
export {
|
|
204
|
+
export { FirstPersonBehavior, type FirstPersonBehaviorOptions, type FirstPersonContext, type FirstPersonEntity, FirstPersonEvent, FirstPersonFSM, FirstPersonInputComponent, FirstPersonMovementComponent, FirstPersonState, FirstPersonStateComponent, FirstPersonSystem, type ViewmodelConfig };
|
package/dist/first-person.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
FirstPersonControllerBehavior,
|
|
2
|
+
FirstPersonBehavior,
|
|
4
3
|
FirstPersonEvent,
|
|
5
4
|
FirstPersonFSM,
|
|
6
|
-
FirstPersonState
|
|
7
|
-
|
|
5
|
+
FirstPersonState,
|
|
6
|
+
FirstPersonSystem
|
|
7
|
+
} from "./chunk-4L36OPY2.js";
|
|
8
8
|
import {
|
|
9
9
|
createFirstPersonInputComponent,
|
|
10
10
|
createFirstPersonMovementComponent,
|
|
11
11
|
createFirstPersonStateComponent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QVCMJ4Q2.js";
|
|
13
13
|
import "./chunk-WWVD5DR5.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-OTLSUYQQ.js";
|
|
15
15
|
import "./chunk-4URF65BR.js";
|
|
16
|
+
import "./chunk-Q75LKHDF.js";
|
|
16
17
|
import "./chunk-EZNCCO4L.js";
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
-
FirstPersonControllerBehavior,
|
|
19
|
+
FirstPersonBehavior,
|
|
20
20
|
FirstPersonEvent,
|
|
21
21
|
FirstPersonFSM,
|
|
22
22
|
FirstPersonState,
|
|
23
|
+
FirstPersonSystem,
|
|
23
24
|
createFirstPersonInputComponent,
|
|
24
25
|
createFirstPersonMovementComponent,
|
|
25
26
|
createFirstPersonStateComponent
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { a as BehaviorDescriptor,
|
|
2
|
-
export { u as useBehavior } from './use-behavior-
|
|
1
|
+
export { a as BehaviorDescriptor, c as BehaviorHandle, d as BehaviorRef, e as BehaviorSystem, g as BehaviorSystemFactory, D as DefineBehaviorConfig, P as defineBehavior } from './behavior-system-y8SGrGWy.js';
|
|
2
|
+
export { u as useBehavior } from './use-behavior-B85d5u7-.js';
|
|
3
3
|
export { P as PhysicsBodyComponent, T as TransformComponent, c as createPhysicsBodyComponent, a as createTransformComponent } from './components-BWG1GkZA.js';
|
|
4
4
|
export { T as ThrusterInputComponent, a as ThrusterMovementComponent, b as ThrusterStateComponent, c as createThrusterInputComponent, d as createThrusterMovementComponent, e as createThrusterStateComponent } from './components-B29WHGQN.js';
|
|
5
|
-
export {
|
|
5
|
+
export { PlayerInput, ThrusterBehavior, ThrusterBehaviorOptions, ThrusterEntity, ThrusterEvent, ThrusterFSM, ThrusterFSMContext, ThrusterState, ThrusterSystem } from './thruster.js';
|
|
6
6
|
export { T as TopDownMovementComponent, a as TopDownMovementInputComponent, b as TopDownMovementStateComponent, c as createTopDownMovementComponent, d as createTopDownMovementInputComponent, e as createTopDownMovementStateComponent } from './components-XCpL6IYt.js';
|
|
7
|
-
export { TopDownMovementBehavior, TopDownMovementBehaviorOptions, TopDownMovementEntity, TopDownMovementHandle,
|
|
7
|
+
export { TopDownMovementBehavior, TopDownMovementBehaviorOptions, TopDownMovementEntity, TopDownMovementHandle, TopDownMovementSystem } from './top-down-movement.js';
|
|
8
8
|
export { Shooter2DBehavior, Shooter2DBehaviorOptions, Shooter2DFireArgs, Shooter2DHandle, Shooter2DProjectileFactory, Shooter2DSourceEntity, Shooter2DStageLike, Shooter2DStateComponent, Shooter2DTarget, createShooter2DStateComponent } from './shooter-2d.js';
|
|
9
9
|
export { ScreenWrapBehavior, ScreenWrapEvent, ScreenWrapFSM, ScreenWrapOptions, ScreenWrapState } from './screen-wrap.js';
|
|
10
10
|
export { ScreenVisibilityBehavior, ScreenVisibilityChangeContext, ScreenVisibilityFSM, ScreenVisibilityHandle, ScreenVisibilityOptions, ScreenVisibilitySize, ScreenVisibilitySnapshot } from './screen-visibility.js';
|
|
@@ -12,22 +12,24 @@ export { WorldBoundary2DBehavior, WorldBoundary2DBounds, WorldBoundary2DEvent, W
|
|
|
12
12
|
export { WorldBoundary3DBehavior, WorldBoundary3DBounds, WorldBoundary3DEvent, WorldBoundary3DFSM, WorldBoundary3DHandle, WorldBoundary3DHit, WorldBoundary3DHits, WorldBoundary3DOptions, WorldBoundary3DPosition, WorldBoundary3DState, computeWorldBoundary3DHits, hasAnyWorldBoundary3DHit } from './world-boundary-3d.js';
|
|
13
13
|
export { Ricochet2DBehavior, Ricochet2DCollisionContext, Ricochet2DEvent, Ricochet2DFSM, Ricochet2DHandle, Ricochet2DOptions, Ricochet2DResult, Ricochet2DState, RicochetCallback } from './ricochet-2d.js';
|
|
14
14
|
export { Ricochet3DBehavior, Ricochet3DCallback, Ricochet3DCollisionContext, Ricochet3DEvent, Ricochet3DFSM, Ricochet3DHandle, Ricochet3DOptions, Ricochet3DResult, Ricochet3DState } from './ricochet-3d.js';
|
|
15
|
-
export {
|
|
15
|
+
export { Platformer2DBehavior, Platformer2DBehaviorOptions, Platformer2DCollisionContext, Platformer2DContext, Platformer2DEntity, Platformer2DEvent, Platformer2DFSM, Platformer2DInputComponent, Platformer2DMovementComponent, Platformer2DState, Platformer2DStateComponent, Platformer2DSystem, createPlatformer2DInputComponent, createPlatformer2DMovementComponent, createPlatformer2DStateComponent } from './platformer-2d.js';
|
|
16
|
+
export { Platformer3DBehavior, Platformer3DBehaviorOptions, Platformer3DContext, Platformer3DEntity, Platformer3DEvent, Platformer3DFSM, Platformer3DInputComponent, Platformer3DMovementComponent, Platformer3DState, Platformer3DStateComponent, Platformer3DSystem, PlatformerCollisionContext, createPlatformer3DInputComponent, createPlatformer3DMovementComponent, createPlatformer3DStateComponent } from './platformer-3d.js';
|
|
16
17
|
export { F as FirstPersonInputComponent, a as FirstPersonMovementComponent, b as FirstPersonStateComponent, c as createFirstPersonInputComponent, d as createFirstPersonMovementComponent, e as createFirstPersonStateComponent } from './components-qWwOsvwh.js';
|
|
17
|
-
export {
|
|
18
|
+
export { FirstPersonBehavior, FirstPersonBehaviorOptions, FirstPersonContext, FirstPersonEntity, FirstPersonEvent, FirstPersonFSM, FirstPersonState, FirstPersonSystem, ViewmodelConfig } from './first-person.js';
|
|
18
19
|
export { J as JumpConfig3D, a as JumpContext3D, b as JumpInput3D, c as JumpState3D, V as Vec3Like, d as createJumpConfig3D, e as createJumpInput3D, f as createJumpState3D } from './components--hjBMTnz.js';
|
|
19
|
-
export {
|
|
20
|
-
export { JumpConfig2D, JumpContext2D, JumpInput2D, JumpState2D,
|
|
20
|
+
export { Jumper3DBehavior, Jumper3DBehaviorOptions, Jumper3DEntity, Jumper3DEvent, Jumper3DFSM, Jumper3DState, Jumper3DSystem, JumperTickEvent, JumperTickResult } from './jumper-3d.js';
|
|
21
|
+
export { JumpConfig2D, JumpContext2D, JumpInput2D, JumpState2D, Jumper2DBehavior, Jumper2DBehaviorOptions, Jumper2DEntity, Jumper2DEvent, Jumper2DFSM, Jumper2DState, Jumper2DSystem, Jumper2DTickEvent, Jumper2DTickResult, createJumpConfig2D, createJumpInput2D, createJumpState2D } from './jumper-2d.js';
|
|
21
22
|
export { CooldownBehavior, CooldownConfig, CooldownEntry, CooldownHandle, CooldownOptions, fireCooldown, getCooldown, getCooldownStore, registerCooldown, resetCooldown, tickCooldowns } from './cooldown.js';
|
|
22
23
|
export { Destructible3DBehavior, Destructible3DBehaviorOptions, Destructible3DColliderOptions, Destructible3DFragmentColliderShape, Destructible3DFragmentPhysicsOptions, Destructible3DHandle, FractureOptionsInput } from './destructible-3d.js';
|
|
23
24
|
export { DestructibleMesh, FractureOptions, VoronoiOptions } from '@dgreenheck/three-pinata';
|
|
24
25
|
export { D as DestructiblePrebakeWorkerAPI, P as PlainBufferGeometryPayload, a as PlainFractureOptions, c as PrebakeWorkerRequest, d as PrebakeWorkerResponse } from './payload-BQzu-oY_.js';
|
|
25
26
|
export { BurstParticlePresetOptions, ParticleEmitterBehavior, ParticleEmitterBehaviorOptions, ParticleEmitterHandle, particlePresets } from './particle-emitter.js';
|
|
26
|
-
export { BoundaryRicochetCoordinator } from './coordinators/boundary-ricochet.js';
|
|
27
|
-
export { BoundaryRicochet3DCoordinator } from './coordinators/boundary-ricochet-3d.js';
|
|
28
|
-
export { FirstPersonShooterCoordinator, FirstPersonShooterInput } from './coordinators/first-person-shooter.js';
|
|
29
|
-
export { TopDownShooterCoordinator, TopDownShooterInput } from './coordinators/top-down-shooter.js';
|
|
30
|
-
export { MultidirectionalSpaceShooterCoordinator, MultidirectionalSpaceShooterInput } from './coordinators/multidirectional-space-shooter.js';
|
|
27
|
+
export { BoundaryRicochetCoordinator, BoundaryRicochetEntity } from './coordinators/boundary-ricochet.js';
|
|
28
|
+
export { BoundaryRicochet3DCoordinator, BoundaryRicochet3DEntity } from './coordinators/boundary-ricochet-3d.js';
|
|
29
|
+
export { FirstPersonShooterCoordinator, FirstPersonShooterEntity, FirstPersonShooterInput } from './coordinators/first-person-shooter.js';
|
|
30
|
+
export { TopDownShooterCoordinator, TopDownShooterEntity, TopDownShooterInput } from './coordinators/top-down-shooter.js';
|
|
31
|
+
export { MultidirectionalSpaceShooterCoordinator, MultidirectionalSpaceShooterEntity, MultidirectionalSpaceShooterInput } from './coordinators/multidirectional-space-shooter.js';
|
|
32
|
+
export { F as FacingAngle2DEntity, R as ResolvedAim2D, S as Shooter2DAimFireInput, f as fireShooter2DIfRequested, g as getEntityFacingAngle2D, r as resolveAim2D } from './shooter-fire-DGripl0z.js';
|
|
31
33
|
export { P as ParticleEffectDefinition, a as ParticleMagicAgency, b as ParticleMagicAlignment, c as ParticleMagicModifierInput, d as ParticleMagicModifierOptions, e as ParticleMagicOrder, f as ParticleMagicRealityEffect, g as ParticleMagicTemperament, h as ParticlePresetMaterialOptions, S as SemanticParticlePresetOptions, v as particleEffect } from './spark-Dx3cJbTW.js';
|
|
32
34
|
import '@dimforge/rapier3d-compat';
|
|
33
35
|
import 'three';
|
|
@@ -36,5 +38,26 @@ import 'typescript-fsm';
|
|
|
36
38
|
import './vector-Bm65-FOG.js';
|
|
37
39
|
import './entity-types-CmtQ-IBp.js';
|
|
38
40
|
import './first-person-perspective-C9Mptl0-.js';
|
|
39
|
-
import './moveable-
|
|
41
|
+
import './moveable-Cl9h-_w7.js';
|
|
40
42
|
import 'three/webgpu';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Shared boundary→ricochet glue used by the 2D and 3D boundary-ricochet
|
|
46
|
+
* coordinators. Reads the boundary behavior's last hits, optionally snaps the
|
|
47
|
+
* body back inside the bounds, and applies the ricochet reflection.
|
|
48
|
+
*/
|
|
49
|
+
interface BoundaryRicochetUpdate<THits, TNormal> {
|
|
50
|
+
/** Boundary behavior handle (or any source of last-frame hits). */
|
|
51
|
+
getLastHits(): THits | null;
|
|
52
|
+
/** Whether any boundary face was hit this frame. */
|
|
53
|
+
hasAnyHit(hits: THits): boolean;
|
|
54
|
+
/** Convert hits into a reflection normal. */
|
|
55
|
+
getNormal(hits: THits): TNormal;
|
|
56
|
+
/** Optional pre-reflection snap (e.g. clamp the body back inside bounds). */
|
|
57
|
+
snapToClamped?(): void;
|
|
58
|
+
/** Apply the reflection; returns true when a ricochet occurred. */
|
|
59
|
+
applyRicochet(normal: TNormal): boolean;
|
|
60
|
+
}
|
|
61
|
+
declare function updateBoundaryRicochet<THits, TNormal>(update: BoundaryRicochetUpdate<THits, TNormal>): boolean;
|
|
62
|
+
|
|
63
|
+
export { type BoundaryRicochetUpdate, updateBoundaryRicochet };
|