@zylem/behaviors 0.8.10 → 0.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/acrobatics-2d.d.ts +25 -0
  2. package/dist/acrobatics-2d.js +37 -0
  3. package/dist/action-rpg.d.ts +21 -0
  4. package/dist/action-rpg.js +39 -0
  5. package/dist/adventure-tools.d.ts +22 -0
  6. package/dist/adventure-tools.js +39 -0
  7. package/dist/behavior-descriptor-NS_qnzzp.d.ts +4527 -0
  8. package/dist/behavior-metadata-Drm1zxI2.d.ts +13 -0
  9. package/dist/catalog.d.ts +2143 -0
  10. package/dist/catalog.js +9 -0
  11. package/dist/chunk-2BE5BW7D.js +130 -0
  12. package/dist/{chunk-VNQLMRWC.js → chunk-2QCCLHJC.js} +9 -5
  13. package/dist/chunk-2UGT4MIF.js +94 -0
  14. package/dist/chunk-3J3ISPFQ.js +99 -0
  15. package/dist/chunk-3LBGEWT6.js +124 -0
  16. package/dist/{chunk-UUMH3DC3.js → chunk-3QBNWT7B.js} +5 -1
  17. package/dist/chunk-3T44EDXU.js +114 -0
  18. package/dist/chunk-5AJJ44QK.js +129 -0
  19. package/dist/{chunk-YDLO5M7S.js → chunk-5SMXQ6AU.js} +1 -0
  20. package/dist/chunk-5VJIP535.js +71 -0
  21. package/dist/chunk-6DTIJB7B.js +166 -0
  22. package/dist/chunk-73MHJY6R.js +78 -0
  23. package/dist/chunk-73YASAYS.js +137 -0
  24. package/dist/{chunk-NZM5YQBW.js → chunk-7HGDADLB.js} +8 -4
  25. package/dist/chunk-7IOQEXYR.js +92 -0
  26. package/dist/{chunk-G5S5U6WI.js → chunk-APAM55J3.js} +9 -5
  27. package/dist/chunk-BLTBZJPG.js +126 -0
  28. package/dist/chunk-BN6QZDR5.js +90 -0
  29. package/dist/chunk-BR33KT4Z.js +3186 -0
  30. package/dist/chunk-C5AYL42A.js +138 -0
  31. package/dist/chunk-DDLZLJ7W.js +8 -0
  32. package/dist/chunk-DRIXFB4C.js +132 -0
  33. package/dist/{chunk-U2BSZJ3S.js → chunk-DTLUKSX2.js} +5 -1
  34. package/dist/{chunk-VB4GYWTE.js → chunk-EMEA45JQ.js} +9 -5
  35. package/dist/chunk-EQFLPRF7.js +130 -0
  36. package/dist/{chunk-X45KOKUF.js → chunk-GNRMH7D3.js} +8 -4
  37. package/dist/chunk-GYEKT5AY.js +102 -0
  38. package/dist/{chunk-SHZZ2QRV.js → chunk-HCWLIPXP.js} +5 -1
  39. package/dist/chunk-HQ2UFI3S.js +116 -0
  40. package/dist/chunk-I52PC5IU.js +128 -0
  41. package/dist/{chunk-T7ST62OT.js → chunk-IAIJG2PB.js} +9 -5
  42. package/dist/{chunk-NDJO56BB.js → chunk-IJILTFEL.js} +5 -1
  43. package/dist/{chunk-6RIS4MGM.js → chunk-IRNU4JGV.js} +9 -5
  44. package/dist/chunk-IRPBFVAK.js +141 -0
  45. package/dist/chunk-JFBR4FNX.js +140 -0
  46. package/dist/{chunk-ERS6SNA5.js → chunk-K34N2CBL.js} +5 -1
  47. package/dist/chunk-LMMF7KXF.js +178 -0
  48. package/dist/chunk-LWGJ3QQZ.js +107 -0
  49. package/dist/chunk-MPNGQLHZ.js +132 -0
  50. package/dist/chunk-OH5LJAEJ.js +135 -0
  51. package/dist/{chunk-HZMC4LGW.js → chunk-P6TMZSWF.js} +10 -6
  52. package/dist/chunk-PDHHOVVQ.js +126 -0
  53. package/dist/{chunk-7TIIRJKF.js → chunk-RUBKGAPS.js} +5 -1
  54. package/dist/chunk-S44ZHYE6.js +1912 -0
  55. package/dist/chunk-SFMJNAW3.js +128 -0
  56. package/dist/{chunk-IU7Y3L7Y.js → chunk-SKKVOH6D.js} +5 -1
  57. package/dist/chunk-TSYXRRS4.js +125 -0
  58. package/dist/chunk-TZHO6P22.js +150 -0
  59. package/dist/chunk-V26L6MY6.js +127 -0
  60. package/dist/chunk-V4M46BF6.js +105 -0
  61. package/dist/chunk-VSFWETXS.js +127 -0
  62. package/dist/chunk-VU4LTE2X.js +147 -0
  63. package/dist/chunk-WF6HC5U3.js +8 -0
  64. package/dist/chunk-WG5NCDS4.js +99 -0
  65. package/dist/{chunk-7LHXAEOZ.js → chunk-WUYHS6JZ.js} +6 -2
  66. package/dist/chunk-XNRY6NOC.js +120 -0
  67. package/dist/{chunk-57JGBNCS.js → chunk-XT47QZQ6.js} +10 -6
  68. package/dist/chunk-Y5CCNMJI.js +58 -0
  69. package/dist/chunk-YVVB6YMG.js +133 -0
  70. package/dist/chunk-ZZXTGVGN.js +131 -0
  71. package/dist/combat-ai.d.ts +21 -0
  72. package/dist/combat-ai.js +41 -0
  73. package/dist/{components-tct075-p.d.ts → components-ClmBORMP.d.ts} +1 -1
  74. package/dist/cooldown.d.ts +2 -8
  75. package/dist/cooldown.js +3 -2
  76. package/dist/coordinators/boundary-ricochet-3d.d.ts +3 -2
  77. package/dist/coordinators/boundary-ricochet.d.ts +3 -2
  78. package/dist/coordinators/boundary-ricochet.js +2 -2
  79. package/dist/coordinators/multidirectional-space-shooter.d.ts +2 -1
  80. package/dist/coordinators/multidirectional-space-shooter.js +2 -2
  81. package/dist/coordinators/top-down-shooter.d.ts +2 -1
  82. package/dist/coordinators/top-down-shooter.js +2 -2
  83. package/dist/core.d.ts +386 -25
  84. package/dist/core.js +1583 -6
  85. package/dist/destructible-3d.d.ts +2 -1
  86. package/dist/destructible-3d.js +3 -2
  87. package/dist/environmental-locomotion.d.ts +23 -0
  88. package/dist/environmental-locomotion.js +35 -0
  89. package/dist/first-person.d.ts +2 -1
  90. package/dist/first-person.js +24 -3
  91. package/dist/golf-racket.d.ts +21 -0
  92. package/dist/golf-racket.js +37 -0
  93. package/dist/index.d.ts +25 -3
  94. package/dist/index.js +763 -79
  95. package/dist/jumper-2d.d.ts +2 -1
  96. package/dist/jumper-2d.js +24 -3
  97. package/dist/jumper-3d.d.ts +2 -1
  98. package/dist/jumper-3d.js +24 -3
  99. package/dist/lane-defense.d.ts +21 -0
  100. package/dist/lane-defense.js +39 -0
  101. package/dist/life-simulation.d.ts +21 -0
  102. package/dist/life-simulation.js +39 -0
  103. package/dist/matching-pinball.d.ts +21 -0
  104. package/dist/matching-pinball.js +39 -0
  105. package/dist/melee-combat.d.ts +22 -0
  106. package/dist/melee-combat.js +45 -0
  107. package/dist/{moveable-tkFsn7mE.d.ts → moveable-CXK2wEZL.d.ts} +1 -1
  108. package/dist/particle-emitter.d.ts +2 -1
  109. package/dist/particle-emitter.js +3 -2
  110. package/dist/platformer-2d.d.ts +2 -1
  111. package/dist/platformer-2d.js +24 -3
  112. package/dist/platformer-3d.d.ts +2 -1
  113. package/dist/platformer-3d.js +24 -3
  114. package/dist/racing-vehicles.d.ts +21 -0
  115. package/dist/racing-vehicles.js +37 -0
  116. package/dist/rhythm-performance.d.ts +21 -0
  117. package/dist/rhythm-performance.js +39 -0
  118. package/dist/ricochet-2d.d.ts +2 -1
  119. package/dist/ricochet-2d.js +24 -3
  120. package/dist/ricochet-3d.d.ts +2 -1
  121. package/dist/ricochet-3d.js +24 -3
  122. package/dist/runtime-2d.d.ts +2 -1
  123. package/dist/runtime-2d.js +10 -1
  124. package/dist/screen-visibility.d.ts +2 -1
  125. package/dist/screen-visibility.js +3 -2
  126. package/dist/screen-wrap.d.ts +2 -7
  127. package/dist/screen-wrap.js +3 -2
  128. package/dist/shooter-2d.d.ts +2 -1
  129. package/dist/shooter-2d.js +3 -2
  130. package/dist/skate-snowboard.d.ts +21 -0
  131. package/dist/skate-snowboard.js +37 -0
  132. package/dist/spatial-puzzles.d.ts +21 -0
  133. package/dist/spatial-puzzles.js +35 -0
  134. package/dist/squad-rts.d.ts +21 -0
  135. package/dist/squad-rts.js +39 -0
  136. package/dist/stealth-city.d.ts +21 -0
  137. package/dist/stealth-city.js +41 -0
  138. package/dist/survival-resources.d.ts +21 -0
  139. package/dist/survival-resources.js +37 -0
  140. package/dist/tactical-grid.d.ts +21 -0
  141. package/dist/tactical-grid.js +39 -0
  142. package/dist/thruster.d.ts +2 -1
  143. package/dist/thruster.js +3 -2
  144. package/dist/top-down-movement.d.ts +2 -1
  145. package/dist/top-down-movement.js +24 -3
  146. package/dist/turn-based-rpg.d.ts +21 -0
  147. package/dist/turn-based-rpg.js +39 -0
  148. package/dist/weapon-systems.d.ts +22 -0
  149. package/dist/weapon-systems.js +45 -0
  150. package/dist/world-boundary-2d.d.ts +2 -1
  151. package/dist/world-boundary-2d.js +24 -3
  152. package/dist/world-boundary-3d.d.ts +2 -1
  153. package/dist/world-boundary-3d.js +24 -3
  154. package/package.json +87 -3
  155. package/dist/behavior-descriptor-Dr8qmQ20.d.ts +0 -914
  156. package/dist/chunk-GZ3DQIIZ.js +0 -888
  157. package/dist/{chunk-OSPQFWQF.js → chunk-4K37UL53.js} +3 -3
  158. package/dist/{chunk-DD4U42FG.js → chunk-AQB246W5.js} +3 -3
  159. package/dist/{chunk-UKGBQTHL.js → chunk-CXDNR4R4.js} +3 -3
@@ -0,0 +1,138 @@
1
+ import {
2
+ RACING_ABILITIES
3
+ } from "./chunk-2UGT4MIF.js";
4
+ import {
5
+ defineBehavior
6
+ } from "./chunk-5SMXQ6AU.js";
7
+ import {
8
+ BUILTIN_BEHAVIORS
9
+ } from "./chunk-S44ZHYE6.js";
10
+
11
+ // src/lib/behaviors/racing-vehicles/index.ts
12
+ var RacingSystem = class {
13
+ constructor(key, abilities, runtime, links) {
14
+ this.key = key;
15
+ this.abilities = abilities;
16
+ this.runtime = runtime;
17
+ this.links = links;
18
+ }
19
+ key;
20
+ abilities;
21
+ runtime;
22
+ links;
23
+ attached = /* @__PURE__ */ new Map();
24
+ update() {
25
+ if (!this.runtime) return;
26
+ const links = [...this.links?.(this.key) ?? []];
27
+ for (const [entity, { slot, ref }] of this.attached) {
28
+ if (!links.some(
29
+ (link) => link.entity === entity && link.ref === ref
30
+ ) || entity.runtimeHandle !== slot)
31
+ this.detach({ entity, ref });
32
+ }
33
+ for (const link of links) {
34
+ const entity = link.entity;
35
+ entity.racingState ??= null;
36
+ const slot = entity.runtimeHandle;
37
+ if (!Number.isInteger(slot) || slot < 0) continue;
38
+ if (!this.attached.has(entity)) {
39
+ if (!this.runtime.attachRacing(
40
+ slot,
41
+ this.abilities,
42
+ link.ref.options
43
+ )) {
44
+ throw new Error(
45
+ "Racing attachment requires valid options and an available racing component slot."
46
+ );
47
+ }
48
+ this.attached.set(entity, { slot, ref: link.ref });
49
+ }
50
+ }
51
+ }
52
+ postUpdate() {
53
+ for (const [entity, { slot }] of this.attached)
54
+ entity.racingState = this.runtime?.queryRacing(slot) ?? null;
55
+ }
56
+ detach(link) {
57
+ const slot = this.attached.get(link.entity)?.slot;
58
+ if (slot !== void 0 && this.runtime && !this.runtime.detachRacing(slot) && this.runtime.queryRacing(slot))
59
+ throw new Error("Failed to detach racing policy.");
60
+ this.attached.delete(link.entity);
61
+ link.entity.racingState = null;
62
+ }
63
+ destroy() {
64
+ for (const [entity, { ref }] of this.attached)
65
+ this.detach({ entity, ref });
66
+ }
67
+ };
68
+ function descriptor(name, abilities) {
69
+ return defineBehavior({
70
+ name,
71
+ metadata: BUILTIN_BEHAVIORS[name],
72
+ defaultOptions: {
73
+ driftTierTime: 0.6,
74
+ rideHeight: 1.5
75
+ },
76
+ systemFactory: (ctx) => new RacingSystem(
77
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
78
+ abilities,
79
+ ctx.wasmStage ?? null,
80
+ ctx.getBehaviorLinks
81
+ )
82
+ });
83
+ }
84
+ var RacingVehiclesBehavior = descriptor(
85
+ "racing-vehicles",
86
+ RACING_ABILITIES
87
+ );
88
+ var DriftChargeBoostBehavior = descriptor("drift-charge-boost", [
89
+ "drift-charge-boost"
90
+ ]);
91
+ var SlipstreamDraftingBehavior = descriptor("slipstream-drafting", [
92
+ "slipstream-drafting"
93
+ ]);
94
+ var PositionWeightedRaceItemsBehavior = descriptor(
95
+ "position-weighted-race-items",
96
+ ["position-weighted-race-items"]
97
+ );
98
+ var TrackFollowingHomingItemBehavior = descriptor(
99
+ "track-following-homing-item",
100
+ ["track-following-homing-item"]
101
+ );
102
+ var OrderedLapCheckpointsBehavior = descriptor(
103
+ "ordered-lap-checkpoints",
104
+ ["ordered-lap-checkpoints"]
105
+ );
106
+ var HoverTrackSuspensionBehavior = descriptor(
107
+ "hover-track-suspension",
108
+ ["hover-track-suspension"]
109
+ );
110
+ var EnergyFundedRaceBoostBehavior = descriptor(
111
+ "energy-funded-race-boost",
112
+ ["energy-funded-race-boost"]
113
+ );
114
+ var VehicleSideAttackBehavior = descriptor("vehicle-side-attack", [
115
+ "vehicle-side-attack"
116
+ ]);
117
+ var VehicleDamageProgressionBehavior = descriptor(
118
+ "vehicle-damage-progression",
119
+ ["vehicle-damage-progression"]
120
+ );
121
+ var VehicleSeatEntryExitBehavior = descriptor(
122
+ "vehicle-seat-entry-exit",
123
+ ["vehicle-seat-entry-exit"]
124
+ );
125
+
126
+ export {
127
+ RacingVehiclesBehavior,
128
+ DriftChargeBoostBehavior,
129
+ SlipstreamDraftingBehavior,
130
+ PositionWeightedRaceItemsBehavior,
131
+ TrackFollowingHomingItemBehavior,
132
+ OrderedLapCheckpointsBehavior,
133
+ HoverTrackSuspensionBehavior,
134
+ EnergyFundedRaceBoostBehavior,
135
+ VehicleSideAttackBehavior,
136
+ VehicleDamageProgressionBehavior,
137
+ VehicleSeatEntryExitBehavior
138
+ };
@@ -0,0 +1,8 @@
1
+ // src/lib/behaviors/environmental-locomotion/types.ts
2
+ var ENVIRONMENT_ABILITIES = ["local-gravity-field", "gravity-frame-transition", "volume-buoyancy", "stroke-swimming", "surface-breach-jump", "breath-and-drowning", "water-current-advection", "wind-driven-sailing", "stamina-glide-and-updraft", "tube-slide-steering"];
3
+ var ENVIRONMENT_MODES = ["air", "water", "stroke", "breach", "sailing", "gliding", "tube slide"];
4
+
5
+ export {
6
+ ENVIRONMENT_ABILITIES,
7
+ ENVIRONMENT_MODES
8
+ };
@@ -0,0 +1,132 @@
1
+ import {
2
+ DEFENSE_ABILITIES
3
+ } from "./chunk-SFMJNAW3.js";
4
+ import {
5
+ defineBehavior
6
+ } from "./chunk-5SMXQ6AU.js";
7
+ import {
8
+ BUILTIN_BEHAVIORS
9
+ } from "./chunk-S44ZHYE6.js";
10
+
11
+ // src/lib/behaviors/lane-defense/index.ts
12
+ var DefenseSystem = class {
13
+ constructor(key, abilities, runtime, links) {
14
+ this.key = key;
15
+ this.abilities = abilities;
16
+ this.runtime = runtime;
17
+ this.links = links;
18
+ }
19
+ key;
20
+ abilities;
21
+ runtime;
22
+ links;
23
+ attached = /* @__PURE__ */ new Map();
24
+ update() {
25
+ if (!this.runtime) return;
26
+ const links = [...this.links?.(this.key) ?? []];
27
+ for (const [entity, { slot, ref }] of this.attached) {
28
+ if (!links.some((link) => link.entity === entity && link.ref === ref) || entity.runtimeHandle !== slot)
29
+ this.detach({ entity, ref });
30
+ }
31
+ for (const link of links) {
32
+ const entity = link.entity;
33
+ entity.defenseState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachDefense(slot, this.abilities, link.ref.options)) {
38
+ throw new Error(
39
+ "Defense attachment requires valid options and an available defense component slot."
40
+ );
41
+ }
42
+ this.attached.set(entity, { slot, ref: link.ref });
43
+ }
44
+ }
45
+ }
46
+ postUpdate() {
47
+ for (const [entity, { slot }] of this.attached)
48
+ entity.defenseState = this.runtime?.queryDefense(slot) ?? null;
49
+ }
50
+ detach(link) {
51
+ const slot = this.attached.get(link.entity)?.slot;
52
+ if (slot !== void 0 && this.runtime && !this.runtime.detachDefense(slot) && this.runtime.queryDefense(slot))
53
+ throw new Error("Failed to detach defense policy.");
54
+ this.attached.delete(link.entity);
55
+ link.entity.defenseState = null;
56
+ }
57
+ destroy() {
58
+ for (const [entity, { ref }] of this.attached) this.detach({ entity, ref });
59
+ }
60
+ };
61
+ function descriptor(name, abilities) {
62
+ return defineBehavior({
63
+ name,
64
+ metadata: BUILTIN_BEHAVIORS[name],
65
+ defaultOptions: {
66
+ speed: 2,
67
+ reach: 1.2
68
+ },
69
+ systemFactory: (ctx) => new DefenseSystem(
70
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
71
+ abilities,
72
+ ctx.wasmStage ?? null,
73
+ ctx.getBehaviorLinks
74
+ )
75
+ });
76
+ }
77
+ var LaneDefenseBehavior = descriptor(
78
+ "lane-defense",
79
+ DEFENSE_ABILITIES
80
+ );
81
+ var LaneTargetAcquisitionBehavior = descriptor(
82
+ "lane-target-acquisition",
83
+ ["lane-target-acquisition"]
84
+ );
85
+ var BlockerChewTransitionBehavior = descriptor(
86
+ "blocker-chew-transition",
87
+ ["blocker-chew-transition"]
88
+ );
89
+ var LayeredBreakawayArmorBehavior = descriptor(
90
+ "layered-breakaway-armor",
91
+ ["layered-breakaway-armor"]
92
+ );
93
+ var ArmingProximityMineBehavior = descriptor("arming-proximity-mine", [
94
+ "arming-proximity-mine"
95
+ ]);
96
+ var PeriodicResourceProductionBehavior = descriptor(
97
+ "periodic-resource-production",
98
+ ["periodic-resource-production"]
99
+ );
100
+ var BudgetedWaveSchedulerBehavior = descriptor(
101
+ "budgeted-wave-scheduler",
102
+ ["budgeted-wave-scheduler"]
103
+ );
104
+ var SingleUseObstacleVaultBehavior = descriptor(
105
+ "single-use-obstacle-vault",
106
+ ["single-use-obstacle-vault"]
107
+ );
108
+ var BurrowToBacklineBehavior = descriptor("burrow-to-backline", [
109
+ "burrow-to-backline"
110
+ ]);
111
+ var CostedGridDeploymentBehavior = descriptor(
112
+ "costed-grid-deployment",
113
+ ["costed-grid-deployment"]
114
+ );
115
+ var LastChanceLaneSweeperBehavior = descriptor(
116
+ "last-chance-lane-sweeper",
117
+ ["last-chance-lane-sweeper"]
118
+ );
119
+
120
+ export {
121
+ LaneDefenseBehavior,
122
+ LaneTargetAcquisitionBehavior,
123
+ BlockerChewTransitionBehavior,
124
+ LayeredBreakawayArmorBehavior,
125
+ ArmingProximityMineBehavior,
126
+ PeriodicResourceProductionBehavior,
127
+ BudgetedWaveSchedulerBehavior,
128
+ SingleUseObstacleVaultBehavior,
129
+ BurrowToBacklineBehavior,
130
+ CostedGridDeploymentBehavior,
131
+ LastChanceLaneSweeperBehavior
132
+ };
@@ -7,7 +7,10 @@ import {
7
7
  } from "./chunk-CBQSC6W3.js";
8
8
  import {
9
9
  defineBehavior
10
- } from "./chunk-YDLO5M7S.js";
10
+ } from "./chunk-5SMXQ6AU.js";
11
+ import {
12
+ BUILTIN_BEHAVIORS
13
+ } from "./chunk-S44ZHYE6.js";
11
14
 
12
15
  // src/lib/behaviors/screen-wrap/screen-wrap-fsm.ts
13
16
  var ScreenWrapState = /* @__PURE__ */ ((ScreenWrapState2) => {
@@ -193,6 +196,7 @@ var ScreenWrapSystem = class {
193
196
  };
194
197
  var ScreenWrapBehavior = defineBehavior({
195
198
  name: "screen-wrap",
199
+ metadata: BUILTIN_BEHAVIORS["screen-wrap"],
196
200
  defaultOptions,
197
201
  systemFactory: (ctx) => new ScreenWrapSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks)
198
202
  });
@@ -1,14 +1,17 @@
1
+ import {
2
+ StageRicochetDim,
3
+ StageRicochetReflection
4
+ } from "./chunk-BR33KT4Z.js";
1
5
  import {
2
6
  SyncStateMachine,
3
7
  import_typescript_fsm
4
8
  } from "./chunk-CBQSC6W3.js";
5
- import {
6
- StageRicochetDim,
7
- StageRicochetReflection
8
- } from "./chunk-GZ3DQIIZ.js";
9
9
  import {
10
10
  defineBehavior
11
- } from "./chunk-YDLO5M7S.js";
11
+ } from "./chunk-5SMXQ6AU.js";
12
+ import {
13
+ BUILTIN_BEHAVIORS
14
+ } from "./chunk-S44ZHYE6.js";
12
15
 
13
16
  // src/lib/behaviors/ricochet-2d/ricochet-2d-fsm.ts
14
17
  function bodyOf(entity) {
@@ -408,6 +411,7 @@ var Ricochet2DSystem = class {
408
411
  };
409
412
  var Ricochet2DBehavior = defineBehavior({
410
413
  name: "ricochet-2d",
414
+ metadata: BUILTIN_BEHAVIORS["ricochet-2d"],
411
415
  defaultOptions,
412
416
  systemFactory: (ctx) => new Ricochet2DSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
413
417
  createHandle: createRicochet2DHandle
@@ -0,0 +1,130 @@
1
+ import {
2
+ MATCHING_ABILITIES
3
+ } from "./chunk-5AJJ44QK.js";
4
+ import {
5
+ defineBehavior
6
+ } from "./chunk-5SMXQ6AU.js";
7
+ import {
8
+ BUILTIN_BEHAVIORS
9
+ } from "./chunk-S44ZHYE6.js";
10
+
11
+ // src/lib/behaviors/matching-pinball/index.ts
12
+ var MatchingSystem = class {
13
+ constructor(key, abilities, runtime, links) {
14
+ this.key = key;
15
+ this.abilities = abilities;
16
+ this.runtime = runtime;
17
+ this.links = links;
18
+ }
19
+ key;
20
+ abilities;
21
+ runtime;
22
+ links;
23
+ attached = /* @__PURE__ */ new Map();
24
+ update() {
25
+ if (!this.runtime) return;
26
+ const links = [...this.links?.(this.key) ?? []];
27
+ for (const [entity, { slot, ref }] of this.attached) {
28
+ if (!links.some((link) => link.entity === entity && link.ref === ref) || entity.runtimeHandle !== slot)
29
+ this.detach({ entity, ref });
30
+ }
31
+ for (const link of links) {
32
+ const entity = link.entity;
33
+ entity.matchingState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachMatching(slot, this.abilities, link.ref.options)) {
38
+ throw new Error(
39
+ "Matching attachment requires valid options and an available matching component slot."
40
+ );
41
+ }
42
+ this.attached.set(entity, { slot, ref: link.ref });
43
+ }
44
+ }
45
+ }
46
+ postUpdate() {
47
+ for (const [entity, { slot }] of this.attached)
48
+ entity.matchingState = this.runtime?.queryMatching(slot) ?? null;
49
+ }
50
+ detach(link) {
51
+ const slot = this.attached.get(link.entity)?.slot;
52
+ if (slot !== void 0 && this.runtime && !this.runtime.detachMatching(slot) && this.runtime.queryMatching(slot))
53
+ throw new Error("Failed to detach matching policy.");
54
+ this.attached.delete(link.entity);
55
+ link.entity.matchingState = null;
56
+ }
57
+ destroy() {
58
+ for (const [entity, { ref }] of this.attached) this.detach({ entity, ref });
59
+ }
60
+ };
61
+ function descriptor(name, abilities) {
62
+ return defineBehavior(
63
+ {
64
+ name,
65
+ metadata: BUILTIN_BEHAVIORS[name],
66
+ defaultOptions: {
67
+ width: 6,
68
+ height: 8
69
+ },
70
+ systemFactory: (ctx) => new MatchingSystem(
71
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
72
+ abilities,
73
+ ctx.wasmStage ?? null,
74
+ ctx.getBehaviorLinks
75
+ )
76
+ }
77
+ );
78
+ }
79
+ var MatchingPinballBehavior = descriptor(
80
+ "matching-pinball",
81
+ MATCHING_ABILITIES
82
+ );
83
+ var AdjacentPanelSwapBehavior = descriptor("adjacent-panel-swap", [
84
+ "adjacent-panel-swap"
85
+ ]);
86
+ var SimultaneousMatchClearBehavior = descriptor(
87
+ "simultaneous-match-clear",
88
+ ["simultaneous-match-clear"]
89
+ );
90
+ var ColumnCollapseBehavior = descriptor("column-collapse", [
91
+ "column-collapse"
92
+ ]);
93
+ var CascadeChainCreditBehavior = descriptor("cascade-chain-credit", [
94
+ "cascade-chain-credit"
95
+ ]);
96
+ var RisingStackPressureBehavior = descriptor("rising-stack-pressure", [
97
+ "rising-stack-pressure"
98
+ ]);
99
+ var GarbageBlockConversionBehavior = descriptor(
100
+ "garbage-block-conversion",
101
+ ["garbage-block-conversion"]
102
+ );
103
+ var PoweredPinballFlipperBehavior = descriptor(
104
+ "powered-pinball-flipper",
105
+ ["powered-pinball-flipper"]
106
+ );
107
+ var SpringPlungerLaunchBehavior = descriptor("spring-plunger-launch", [
108
+ "spring-plunger-launch"
109
+ ]);
110
+ var ActiveBumperKickBehavior = descriptor("active-bumper-kick", [
111
+ "active-bumper-kick"
112
+ ]);
113
+ var PinballModeObjectivesBehavior = descriptor(
114
+ "pinball-mode-objectives",
115
+ ["pinball-mode-objectives"]
116
+ );
117
+
118
+ export {
119
+ MatchingPinballBehavior,
120
+ AdjacentPanelSwapBehavior,
121
+ SimultaneousMatchClearBehavior,
122
+ ColumnCollapseBehavior,
123
+ CascadeChainCreditBehavior,
124
+ RisingStackPressureBehavior,
125
+ GarbageBlockConversionBehavior,
126
+ PoweredPinballFlipperBehavior,
127
+ SpringPlungerLaunchBehavior,
128
+ ActiveBumperKickBehavior,
129
+ PinballModeObjectivesBehavior
130
+ };
@@ -3,16 +3,19 @@ import {
3
3
  constrainMovementToBounds2D,
4
4
  hasAnyBounds2DHit
5
5
  } from "./chunk-TZQQYJYK.js";
6
+ import {
7
+ StageBoundaryDim
8
+ } from "./chunk-BR33KT4Z.js";
6
9
  import {
7
10
  SyncStateMachine,
8
11
  import_typescript_fsm
9
12
  } from "./chunk-CBQSC6W3.js";
10
- import {
11
- StageBoundaryDim
12
- } from "./chunk-GZ3DQIIZ.js";
13
13
  import {
14
14
  defineBehavior
15
- } from "./chunk-YDLO5M7S.js";
15
+ } from "./chunk-5SMXQ6AU.js";
16
+ import {
17
+ BUILTIN_BEHAVIORS
18
+ } from "./chunk-S44ZHYE6.js";
16
19
 
17
20
  // src/lib/behaviors/world-boundary-2d/world-boundary-2d-fsm.ts
18
21
  var WorldBoundary2DState = /* @__PURE__ */ ((WorldBoundary2DState2) => {
@@ -185,6 +188,7 @@ var WorldBoundary2DSystem = class {
185
188
  };
186
189
  var WorldBoundary2DBehavior = defineBehavior({
187
190
  name: "world-boundary-2d",
191
+ metadata: BUILTIN_BEHAVIORS["world-boundary-2d"],
188
192
  defaultOptions,
189
193
  systemFactory: (ctx) => new WorldBoundary2DSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
190
194
  createHandle: createWorldBoundary2DHandle
@@ -0,0 +1,102 @@
1
+ // src/lib/behaviors/weapon-systems/types.ts
2
+ var WEAPON_ABILITIES = [
3
+ "delayed-shield-regeneration",
4
+ "weapon-heat-and-vent",
5
+ "interruptible-magazine-reload",
6
+ "sticky-grenade-attachment",
7
+ "alternate-weapon-mode",
8
+ "remote-guided-projectile",
9
+ "charge-and-release-shot",
10
+ "material-penetrating-shot",
11
+ "beam-missile-combination",
12
+ "stationary-aim-mode"
13
+ ];
14
+ var WEAPON_PHASES = [
15
+ "idle",
16
+ "cooldown",
17
+ "reloading",
18
+ "venting",
19
+ "switching",
20
+ "charging",
21
+ "overheated",
22
+ "guiding",
23
+ "dead"
24
+ ];
25
+ var WEAPON_EVENTS = [
26
+ "none",
27
+ "damage",
28
+ "shot",
29
+ "recharge-start",
30
+ "shield-full",
31
+ "vent-start",
32
+ "vent-end",
33
+ "reload-start",
34
+ "reload-commit",
35
+ "reload-cancel",
36
+ "attached",
37
+ "detonated",
38
+ "control-returned",
39
+ "mode-changed"
40
+ ];
41
+ function weaponData(o) {
42
+ return [
43
+ o.speed ?? 5,
44
+ o.gravity ?? 18,
45
+ o.health ?? 100,
46
+ o.shieldCapacity ?? 40,
47
+ o.rechargeDelay ?? 2,
48
+ o.rechargeRate ?? 12,
49
+ o.heatCapacity ?? 1,
50
+ o.coolingRate ?? 0.2,
51
+ o.resumeHeat ?? 0.2,
52
+ o.ventDuration ?? 0.6,
53
+ o.reloadDuration ?? 1,
54
+ o.reloadCommit ?? 0.6,
55
+ o.magazineSize ?? 6,
56
+ o.reserve ?? 18,
57
+ o.chargeDuration ?? 1,
58
+ o.turnRate ?? 3
59
+ ];
60
+ }
61
+ function weaponModeData(o) {
62
+ return [
63
+ o.damage ?? 10,
64
+ o.interval ?? 0.2,
65
+ o.roundsPerShot ?? 1,
66
+ o.heatPerShot ?? 0.3,
67
+ o.range ?? 30,
68
+ o.penetrationBudget ?? 4,
69
+ o.chargeMultiplier ?? 3,
70
+ o.comboCost ?? 2,
71
+ o.comboMultiplier ?? 4,
72
+ o.comboCompatible === false ? 0 : 1,
73
+ o.switchDuration ?? 0.2,
74
+ o.minimumCharge ?? 0.15,
75
+ 0,
76
+ 0,
77
+ 0,
78
+ 0
79
+ ];
80
+ }
81
+ function weaponProjectileData(o) {
82
+ return [
83
+ o.speed ?? 12,
84
+ o.lifetime ?? 2,
85
+ o.turnRate ?? 2,
86
+ o.blastRadius ?? 2,
87
+ o.damage ?? 25
88
+ ];
89
+ }
90
+ function weaponButtons(i) {
91
+ return (i.fire ? 1 : 0) | (i.reload ? 2 : 0) | (i.vent ? 4 : 0) | (i.switchMode ? 8 : 0) | (i.cancelGuide ? 16 : 0) | (i.combo ? 32 : 0) | (i.aim ? 64 : 0) | (i.cancelReload ? 128 : 0);
92
+ }
93
+
94
+ export {
95
+ WEAPON_ABILITIES,
96
+ WEAPON_PHASES,
97
+ WEAPON_EVENTS,
98
+ weaponData,
99
+ weaponModeData,
100
+ weaponProjectileData,
101
+ weaponButtons
102
+ };
@@ -7,7 +7,10 @@ import {
7
7
  } from "./chunk-4DVDFCVY.js";
8
8
  import {
9
9
  defineBehavior
10
- } from "./chunk-YDLO5M7S.js";
10
+ } from "./chunk-5SMXQ6AU.js";
11
+ import {
12
+ BUILTIN_BEHAVIORS
13
+ } from "./chunk-S44ZHYE6.js";
11
14
 
12
15
  // src/lib/behaviors/destructible-3d/destructible-3d.descriptor.ts
13
16
  import {
@@ -1051,6 +1054,7 @@ var Destructible3DSystem = class {
1051
1054
  };
1052
1055
  var Destructible3DBehavior = defineBehavior({
1053
1056
  name: "destructible-3d",
1057
+ metadata: BUILTIN_BEHAVIORS["destructible-3d"],
1054
1058
  defaultOptions,
1055
1059
  systemFactory: (ctx) => new Destructible3DSystem(
1056
1060
  ctx.world,