@zylem/behaviors 0.8.9 → 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 (168) 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-CTSYM56P.js → chunk-2QCCLHJC.js} +10 -6
  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-LLDLVVG4.js → chunk-7HGDADLB.js} +25 -9
  25. package/dist/chunk-7IOQEXYR.js +92 -0
  26. package/dist/{chunk-OU2SW4U5.js → chunk-APAM55J3.js} +10 -6
  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-OBF6BIA2.js → chunk-CBQSC6W3.js} +2 -2
  32. package/dist/chunk-DDLZLJ7W.js +8 -0
  33. package/dist/chunk-DRIXFB4C.js +132 -0
  34. package/dist/{chunk-7CE6OHLW.js → chunk-DTLUKSX2.js} +6 -2
  35. package/dist/{chunk-TK3AXXXI.js → chunk-EMEA45JQ.js} +10 -6
  36. package/dist/chunk-EQFLPRF7.js +130 -0
  37. package/dist/{chunk-M25QJBDN.js → chunk-GNRMH7D3.js} +18 -6
  38. package/dist/chunk-GYEKT5AY.js +102 -0
  39. package/dist/{chunk-SHZZ2QRV.js → chunk-HCWLIPXP.js} +5 -1
  40. package/dist/{chunk-WHKPWIQO.js → chunk-HMVEQB2T.js} +1 -0
  41. package/dist/chunk-HQ2UFI3S.js +116 -0
  42. package/dist/chunk-I52PC5IU.js +128 -0
  43. package/dist/{chunk-CB3C7CRD.js → chunk-IAIJG2PB.js} +10 -6
  44. package/dist/{chunk-NDJO56BB.js → chunk-IJILTFEL.js} +5 -1
  45. package/dist/{chunk-7GGR26YA.js → chunk-IRNU4JGV.js} +10 -6
  46. package/dist/chunk-IRPBFVAK.js +141 -0
  47. package/dist/chunk-JFBR4FNX.js +140 -0
  48. package/dist/{chunk-ERS6SNA5.js → chunk-K34N2CBL.js} +5 -1
  49. package/dist/chunk-LMMF7KXF.js +178 -0
  50. package/dist/chunk-LWGJ3QQZ.js +107 -0
  51. package/dist/chunk-MPNGQLHZ.js +132 -0
  52. package/dist/chunk-OH5LJAEJ.js +135 -0
  53. package/dist/{chunk-57GLKGEX.js → chunk-P6TMZSWF.js} +32 -7
  54. package/dist/chunk-PDHHOVVQ.js +126 -0
  55. package/dist/{chunk-7TIIRJKF.js → chunk-RUBKGAPS.js} +5 -1
  56. package/dist/chunk-S44ZHYE6.js +1912 -0
  57. package/dist/chunk-SFMJNAW3.js +128 -0
  58. package/dist/{chunk-E2MOFIDH.js → chunk-SKKVOH6D.js} +13 -7
  59. package/dist/{chunk-RR3XNDKG.js → chunk-T2LAQQDS.js} +1 -1
  60. package/dist/chunk-TSYXRRS4.js +125 -0
  61. package/dist/chunk-TZHO6P22.js +150 -0
  62. package/dist/chunk-V26L6MY6.js +127 -0
  63. package/dist/chunk-V4M46BF6.js +105 -0
  64. package/dist/chunk-VSFWETXS.js +127 -0
  65. package/dist/chunk-VU4LTE2X.js +147 -0
  66. package/dist/chunk-WF6HC5U3.js +8 -0
  67. package/dist/chunk-WG5NCDS4.js +99 -0
  68. package/dist/{chunk-7LHXAEOZ.js → chunk-WUYHS6JZ.js} +6 -2
  69. package/dist/chunk-XNRY6NOC.js +120 -0
  70. package/dist/{chunk-55CFXXZH.js → chunk-XT47QZQ6.js} +32 -7
  71. package/dist/chunk-Y5CCNMJI.js +58 -0
  72. package/dist/chunk-YVVB6YMG.js +133 -0
  73. package/dist/chunk-ZZXTGVGN.js +131 -0
  74. package/dist/combat-ai.d.ts +21 -0
  75. package/dist/combat-ai.js +41 -0
  76. package/dist/{components--RTwuT4S.d.ts → components-ClmBORMP.d.ts} +1 -1
  77. package/dist/cooldown.d.ts +2 -8
  78. package/dist/cooldown.js +3 -2
  79. package/dist/coordinators/boundary-ricochet-3d.d.ts +3 -2
  80. package/dist/coordinators/boundary-ricochet-3d.js +2 -2
  81. package/dist/coordinators/boundary-ricochet.d.ts +3 -2
  82. package/dist/coordinators/boundary-ricochet.js +2 -2
  83. package/dist/coordinators/multidirectional-space-shooter.d.ts +3 -2
  84. package/dist/coordinators/multidirectional-space-shooter.js +2 -2
  85. package/dist/coordinators/top-down-shooter.d.ts +3 -2
  86. package/dist/coordinators/top-down-shooter.js +2 -2
  87. package/dist/core.d.ts +387 -26
  88. package/dist/core.js +1583 -6
  89. package/dist/destructible-3d.d.ts +3 -2
  90. package/dist/destructible-3d.js +3 -2
  91. package/dist/destructible-prebake.d.ts +1 -1
  92. package/dist/environmental-locomotion.d.ts +23 -0
  93. package/dist/environmental-locomotion.js +35 -0
  94. package/dist/first-person.d.ts +3 -2
  95. package/dist/first-person.js +25 -4
  96. package/dist/golf-racket.d.ts +21 -0
  97. package/dist/golf-racket.js +37 -0
  98. package/dist/index.d.ts +28 -6
  99. package/dist/index.js +766 -82
  100. package/dist/jumper-2d.d.ts +2 -1
  101. package/dist/jumper-2d.js +25 -4
  102. package/dist/jumper-3d.d.ts +2 -1
  103. package/dist/jumper-3d.js +25 -4
  104. package/dist/lane-defense.d.ts +21 -0
  105. package/dist/lane-defense.js +39 -0
  106. package/dist/life-simulation.d.ts +21 -0
  107. package/dist/life-simulation.js +39 -0
  108. package/dist/matching-pinball.d.ts +21 -0
  109. package/dist/matching-pinball.js +39 -0
  110. package/dist/melee-combat.d.ts +22 -0
  111. package/dist/melee-combat.js +45 -0
  112. package/dist/{moveable-CFOHmblC.d.ts → moveable-CXK2wEZL.d.ts} +2 -2
  113. package/dist/particle-emitter/presets.d.ts +1 -1
  114. package/dist/particle-emitter.d.ts +5 -4
  115. package/dist/particle-emitter.js +3 -2
  116. package/dist/{payload-BQzu-oY_.d.ts → payload-WEzfgjSL.d.ts} +1 -1
  117. package/dist/platformer-2d.d.ts +2 -1
  118. package/dist/platformer-2d.js +25 -4
  119. package/dist/platformer-3d.d.ts +2 -1
  120. package/dist/platformer-3d.js +25 -4
  121. package/dist/racing-vehicles.d.ts +21 -0
  122. package/dist/racing-vehicles.js +37 -0
  123. package/dist/rhythm-performance.d.ts +21 -0
  124. package/dist/rhythm-performance.js +39 -0
  125. package/dist/ricochet-2d.d.ts +2 -1
  126. package/dist/ricochet-2d.js +25 -4
  127. package/dist/ricochet-3d.d.ts +2 -1
  128. package/dist/ricochet-3d.js +25 -4
  129. package/dist/runtime-2d.d.ts +2 -1
  130. package/dist/runtime-2d.js +10 -1
  131. package/dist/screen-visibility.d.ts +2 -1
  132. package/dist/screen-visibility.js +3 -2
  133. package/dist/screen-wrap.d.ts +2 -7
  134. package/dist/screen-wrap.js +4 -3
  135. package/dist/shooter-2d.d.ts +3 -2
  136. package/dist/shooter-2d.js +3 -2
  137. package/dist/skate-snowboard.d.ts +21 -0
  138. package/dist/skate-snowboard.js +37 -0
  139. package/dist/{spark-C4Tp-52_.d.ts → spark-VoQoemz_.d.ts} +1 -1
  140. package/dist/spatial-puzzles.d.ts +21 -0
  141. package/dist/spatial-puzzles.js +35 -0
  142. package/dist/squad-rts.d.ts +21 -0
  143. package/dist/squad-rts.js +39 -0
  144. package/dist/stealth-city.d.ts +21 -0
  145. package/dist/stealth-city.js +41 -0
  146. package/dist/survival-resources.d.ts +21 -0
  147. package/dist/survival-resources.js +37 -0
  148. package/dist/tactical-grid.d.ts +21 -0
  149. package/dist/tactical-grid.js +39 -0
  150. package/dist/thruster.d.ts +2 -1
  151. package/dist/thruster.js +4 -3
  152. package/dist/top-down-movement.d.ts +2 -1
  153. package/dist/top-down-movement.js +24 -3
  154. package/dist/turn-based-rpg.d.ts +21 -0
  155. package/dist/turn-based-rpg.js +39 -0
  156. package/dist/{vector-DjhLUrak.d.ts → vector-s7GbCrVn.d.ts} +1 -1
  157. package/dist/weapon-systems.d.ts +22 -0
  158. package/dist/weapon-systems.js +45 -0
  159. package/dist/world-boundary-2d.d.ts +2 -1
  160. package/dist/world-boundary-2d.js +25 -4
  161. package/dist/world-boundary-3d.d.ts +2 -1
  162. package/dist/world-boundary-3d.js +26 -5
  163. package/package.json +90 -5
  164. package/dist/behavior-system-DkFAwLb_.d.ts +0 -914
  165. package/dist/chunk-GZ3DQIIZ.js +0 -888
  166. package/dist/{chunk-OSPQFWQF.js → chunk-4K37UL53.js} +3 -3
  167. package/dist/{chunk-DD4U42FG.js → chunk-AQB246W5.js} +3 -3
  168. package/dist/{chunk-UKGBQTHL.js → chunk-CXDNR4R4.js} +3 -3
@@ -0,0 +1,116 @@
1
+ import {
2
+ SKATE_ABILITIES
3
+ } from "./chunk-3J3ISPFQ.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/skate-snowboard/index.ts
12
+ var SkateSystem = 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.skateState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachSkate(slot, this.abilities, link.ref.options)) {
38
+ throw new Error(
39
+ "Skate attachment requires valid options and an available skate 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.skateState = this.runtime?.querySkate(slot) ?? null;
49
+ }
50
+ detach(link) {
51
+ const slot = this.attached.get(link.entity)?.slot;
52
+ if (slot !== void 0 && this.runtime && !this.runtime.detachSkate(slot) && this.runtime.querySkate(slot))
53
+ throw new Error("Failed to detach skate policy.");
54
+ this.attached.delete(link.entity);
55
+ link.entity.skateState = 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
+ supportDistance: 0.4,
67
+ snapDistance: 0.8
68
+ },
69
+ systemFactory: (ctx) => new SkateSystem(
70
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
71
+ abilities,
72
+ ctx.wasmStage ?? null,
73
+ ctx.getBehaviorLinks
74
+ )
75
+ });
76
+ }
77
+ var SkateSnowboardBehavior = descriptor("skate-snowboard", SKATE_ABILITIES);
78
+ var RailGrindBalanceBehavior = descriptor("rail-grind-balance", [
79
+ "rail-grind-balance"
80
+ ]);
81
+ var WallRideBehavior = descriptor("wall-ride", ["wall-ride"]);
82
+ var ManualBalanceBehavior = descriptor("manual-balance", [
83
+ "manual-balance"
84
+ ]);
85
+ var RampLipLaunchBehavior = descriptor("ramp-lip-launch", [
86
+ "ramp-lip-launch"
87
+ ]);
88
+ var UnbankedTrickComboBehavior = descriptor("unbanked-trick-combo", [
89
+ "unbanked-trick-combo"
90
+ ]);
91
+ var RepeatedTrickDevaluationBehavior = descriptor(
92
+ "repeated-trick-devaluation",
93
+ ["repeated-trick-devaluation"]
94
+ );
95
+ var AirGrabTrickBehavior = descriptor("air-grab-trick", ["air-grab-trick"]);
96
+ var PrewoundSpinBehavior = descriptor("prewound-spin", ["prewound-spin"]);
97
+ var LandingAlignmentBailBehavior = descriptor("landing-alignment-bail", [
98
+ "landing-alignment-bail"
99
+ ]);
100
+ var TrickEarnedBoostMeterBehavior = descriptor("trick-earned-boost-meter", [
101
+ "trick-earned-boost-meter"
102
+ ]);
103
+
104
+ export {
105
+ SkateSnowboardBehavior,
106
+ RailGrindBalanceBehavior,
107
+ WallRideBehavior,
108
+ ManualBalanceBehavior,
109
+ RampLipLaunchBehavior,
110
+ UnbankedTrickComboBehavior,
111
+ RepeatedTrickDevaluationBehavior,
112
+ AirGrabTrickBehavior,
113
+ PrewoundSpinBehavior,
114
+ LandingAlignmentBailBehavior,
115
+ TrickEarnedBoostMeterBehavior
116
+ };
@@ -0,0 +1,128 @@
1
+ import {
2
+ LIFE_ABILITIES
3
+ } from "./chunk-TZHO6P22.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/life-simulation/index.ts
12
+ var LifeSystem = 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.lifeState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachLife(slot, this.abilities, link.ref.options)) {
38
+ throw new Error(
39
+ "Life attachment requires valid options and an available life 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.lifeState = this.runtime?.queryLife(slot) ?? null;
49
+ }
50
+ detach(link) {
51
+ const slot = this.attached.get(link.entity)?.slot;
52
+ if (slot !== void 0 && this.runtime && !this.runtime.detachLife(slot) && this.runtime.queryLife(slot))
53
+ throw new Error("Failed to detach life policy.");
54
+ this.attached.delete(link.entity);
55
+ link.entity.lifeState = 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
+ seasonLength: 30,
67
+ reach: 5
68
+ },
69
+ systemFactory: (ctx) => new LifeSystem(
70
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
71
+ abilities,
72
+ ctx.wasmStage ?? null,
73
+ ctx.getBehaviorLinks
74
+ )
75
+ });
76
+ }
77
+ var LifeSimulationBehavior = descriptor(
78
+ "life-simulation",
79
+ LIFE_ABILITIES
80
+ );
81
+ var CropGrowthStagesBehavior = descriptor("crop-growth-stages", [
82
+ "crop-growth-stages"
83
+ ]);
84
+ var SoilMoistureCycleBehavior = descriptor("soil-moisture-cycle", [
85
+ "soil-moisture-cycle"
86
+ ]);
87
+ var SeasonalCropEligibilityBehavior = descriptor(
88
+ "seasonal-crop-eligibility",
89
+ ["seasonal-crop-eligibility"]
90
+ );
91
+ var ExertionAndFatigueBehavior = descriptor("exertion-and-fatigue", [
92
+ "exertion-and-fatigue"
93
+ ]);
94
+ var LivestockDailyCareBehavior = descriptor("livestock-daily-care", [
95
+ "livestock-daily-care"
96
+ ]);
97
+ var CalendarNpcRoutineBehavior = descriptor("calendar-npc-routine", [
98
+ "calendar-npc-routine"
99
+ ]);
100
+ var RelationshipEventMemoryBehavior = descriptor(
101
+ "relationship-event-memory",
102
+ ["relationship-event-memory"]
103
+ );
104
+ var FishingBiteAndHookBehavior = descriptor("fishing-bite-and-hook", [
105
+ "fishing-bite-and-hook"
106
+ ]);
107
+ var HarvestableFruitRegrowthBehavior = descriptor(
108
+ "harvestable-fruit-regrowth",
109
+ ["harvestable-fruit-regrowth"]
110
+ );
111
+ var RoomFurniturePlacementBehavior = descriptor(
112
+ "room-furniture-placement",
113
+ ["room-furniture-placement"]
114
+ );
115
+
116
+ export {
117
+ LifeSimulationBehavior,
118
+ CropGrowthStagesBehavior,
119
+ SoilMoistureCycleBehavior,
120
+ SeasonalCropEligibilityBehavior,
121
+ ExertionAndFatigueBehavior,
122
+ LivestockDailyCareBehavior,
123
+ CalendarNpcRoutineBehavior,
124
+ RelationshipEventMemoryBehavior,
125
+ FishingBiteAndHookBehavior,
126
+ HarvestableFruitRegrowthBehavior,
127
+ RoomFurniturePlacementBehavior
128
+ };
@@ -1,17 +1,20 @@
1
1
  import {
2
2
  createJumpInput3D
3
3
  } from "./chunk-F7E23E26.js";
4
- import {
5
- SyncStateMachine,
6
- import_typescript_fsm
7
- } from "./chunk-OBF6BIA2.js";
8
4
  import {
9
5
  STAGE_INPUT_BUTTON_JUMP,
10
6
  readBehaviorSnapshot
11
- } from "./chunk-GZ3DQIIZ.js";
7
+ } from "./chunk-BR33KT4Z.js";
8
+ import {
9
+ SyncStateMachine,
10
+ import_typescript_fsm
11
+ } from "./chunk-CBQSC6W3.js";
12
12
  import {
13
13
  defineBehavior
14
- } from "./chunk-YDLO5M7S.js";
14
+ } from "./chunk-5SMXQ6AU.js";
15
+ import {
16
+ BUILTIN_BEHAVIORS
17
+ } from "./chunk-S44ZHYE6.js";
15
18
 
16
19
  // src/lib/behaviors/jumper-3d/jumper-3d-fsm.ts
17
20
  var Jumper3DState = /* @__PURE__ */ ((Jumper3DState2) => {
@@ -156,6 +159,7 @@ var Jumper3DBehaviorSystem = class {
156
159
  };
157
160
  var Jumper3DBehavior = defineBehavior({
158
161
  name: "jumper-3d",
162
+ metadata: BUILTIN_BEHAVIORS["jumper-3d"],
159
163
  defaultOptions,
160
164
  systemFactory: (ctx) => new Jumper3DBehaviorSystem(
161
165
  ctx.wasmStage ?? null,
@@ -13,7 +13,10 @@ import {
13
13
  } from "./chunk-LWM346FW.js";
14
14
  import {
15
15
  defineBehavior
16
- } from "./chunk-YDLO5M7S.js";
16
+ } from "./chunk-5SMXQ6AU.js";
17
+ import {
18
+ BUILTIN_BEHAVIORS
19
+ } from "./chunk-S44ZHYE6.js";
17
20
 
18
21
  // src/lib/behaviors/particle-emitter/particle-emitter.descriptor.ts
19
22
  import { Group, Quaternion, Vector3 } from "three";
@@ -320,6 +323,7 @@ var ParticleEmitterBehaviorSystem = class {
320
323
  };
321
324
  var ParticleEmitterBehavior = defineBehavior({
322
325
  name: "particle-emitter",
326
+ metadata: BUILTIN_BEHAVIORS["particle-emitter"],
323
327
  defaultOptions,
324
328
  systemFactory: (ctx) => new ParticleEmitterBehaviorSystem(ctx.scene, ctx.getBehaviorLinks, ctx.getGlobals),
325
329
  createHandle: createParticleEmitterHandle
@@ -1,14 +1,17 @@
1
- import {
2
- SyncStateMachine,
3
- import_typescript_fsm
4
- } from "./chunk-OBF6BIA2.js";
5
1
  import {
6
2
  StageRicochetDim,
7
3
  StageRicochetReflection
8
- } from "./chunk-GZ3DQIIZ.js";
4
+ } from "./chunk-BR33KT4Z.js";
5
+ import {
6
+ SyncStateMachine,
7
+ import_typescript_fsm
8
+ } from "./chunk-CBQSC6W3.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-3d/ricochet-3d-fsm.ts
14
17
  var Ricochet3DState = /* @__PURE__ */ ((Ricochet3DState2) => {
@@ -426,6 +429,7 @@ var Ricochet3DSystem = class {
426
429
  };
427
430
  var Ricochet3DBehavior = defineBehavior({
428
431
  name: "ricochet-3d",
432
+ metadata: BUILTIN_BEHAVIORS["ricochet-3d"],
429
433
  defaultOptions,
430
434
  systemFactory: (ctx) => new Ricochet3DSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
431
435
  createHandle: createRicochet3DHandle
@@ -0,0 +1,141 @@
1
+ import {
2
+ ADVENTURE_ABILITIES
3
+ } from "./chunk-Y5CCNMJI.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/adventure-tools/index.ts
12
+ var AdventureSystem = 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.$adventure ??= {};
36
+ entity.adventureState ??= null;
37
+ const slot = entity.runtimeHandle;
38
+ if (!Number.isInteger(slot) || slot < 0) continue;
39
+ if (!this.attached.has(entity)) {
40
+ if (!this.runtime.attachAdventure(
41
+ slot,
42
+ this.abilities,
43
+ link.ref.options
44
+ )) {
45
+ throw new Error(
46
+ "Adventureal locomotion requires exclusive motion ownership, a dynamic solid body with gravityScale=0, and compatible rotation locks."
47
+ );
48
+ }
49
+ this.attached.set(entity, { slot, ref: link.ref });
50
+ }
51
+ this.runtime.writeAdventureInput(slot, entity.$adventure);
52
+ }
53
+ }
54
+ postUpdate() {
55
+ for (const [entity, { slot }] of this.attached)
56
+ entity.adventureState = this.runtime?.queryAdventure(slot) ?? null;
57
+ }
58
+ detach(link) {
59
+ const slot = this.attached.get(link.entity)?.slot;
60
+ if (slot !== void 0 && this.runtime && !this.runtime.detachAdventure(slot) && this.runtime.queryAdventure(slot))
61
+ throw new Error(
62
+ "Cannot detach a morphed controller until its upright shape has clearance."
63
+ );
64
+ this.attached.delete(link.entity);
65
+ link.entity.adventureState = null;
66
+ }
67
+ destroy() {
68
+ for (const [entity, { ref }] of this.attached)
69
+ this.detach({ entity, ref });
70
+ }
71
+ };
72
+ function descriptor(name, abilities) {
73
+ return defineBehavior({
74
+ name,
75
+ metadata: BUILTIN_BEHAVIORS[name],
76
+ defaultOptions: {
77
+ gravity: 9.81,
78
+ speed: 6,
79
+ range: 12,
80
+ scanDuration: 1,
81
+ maxCarryMass: 10
82
+ },
83
+ systemFactory: (ctx) => new AdventureSystem(
84
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
85
+ abilities,
86
+ ctx.wasmStage ?? null,
87
+ ctx.getBehaviorLinks
88
+ )
89
+ });
90
+ }
91
+ var AdventureToolsBehavior = descriptor(
92
+ "adventure-tools",
93
+ ADVENTURE_ABILITIES
94
+ );
95
+ var CombatLockOnBehavior = descriptor("combat-lock-on", [
96
+ "combat-lock-on"
97
+ ]);
98
+ var HookshotPullBehavior = descriptor("hookshot-pull", [
99
+ "hookshot-pull"
100
+ ]);
101
+ var GrappleSwingBehavior = descriptor("grapple-swing", [
102
+ "grapple-swing"
103
+ ]);
104
+ var MorphBallTransitionBehavior = descriptor("morph-ball-transition", [
105
+ "morph-ball-transition"
106
+ ]);
107
+ var MagneticTrackAdhesionBehavior = descriptor(
108
+ "magnetic-track-adhesion",
109
+ ["magnetic-track-adhesion"]
110
+ );
111
+ var ScanningAndDiscoveryBehavior = descriptor(
112
+ "scanning-and-discovery",
113
+ ["scanning-and-discovery"]
114
+ );
115
+ var FusedCarryableBombBehavior = descriptor("fused-carryable-bomb", [
116
+ "fused-carryable-bomb"
117
+ ]);
118
+ var ReturningBoomerangBehavior = descriptor("returning-boomerang", [
119
+ "returning-boomerang"
120
+ ]);
121
+ var KeyedInteractionGateBehavior = descriptor(
122
+ "keyed-interaction-gate",
123
+ ["keyed-interaction-gate"]
124
+ );
125
+ var CarryAimAndThrowBehavior = descriptor("carry-aim-and-throw", [
126
+ "carry-aim-and-throw"
127
+ ]);
128
+
129
+ export {
130
+ AdventureToolsBehavior,
131
+ CombatLockOnBehavior,
132
+ HookshotPullBehavior,
133
+ GrappleSwingBehavior,
134
+ MorphBallTransitionBehavior,
135
+ MagneticTrackAdhesionBehavior,
136
+ ScanningAndDiscoveryBehavior,
137
+ FusedCarryableBombBehavior,
138
+ ReturningBoomerangBehavior,
139
+ KeyedInteractionGateBehavior,
140
+ CarryAimAndThrowBehavior
141
+ };
@@ -0,0 +1,140 @@
1
+ import {
2
+ WEAPON_ABILITIES
3
+ } from "./chunk-GYEKT5AY.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/weapon-systems/index.ts
12
+ var WeaponSystem = 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.$weapon ??= {};
36
+ entity.weaponState ??= null;
37
+ const slot = entity.runtimeHandle;
38
+ if (!Number.isInteger(slot) || slot < 0) continue;
39
+ if (!this.attached.has(entity)) {
40
+ if (!this.runtime.attachWeapons(
41
+ slot,
42
+ this.abilities,
43
+ link.ref.options
44
+ )) {
45
+ throw new Error(
46
+ "Weapon requires exclusive motion ownership, a dynamic solid body with gravityScale=0, and compatible rotation locks."
47
+ );
48
+ }
49
+ this.attached.set(entity, { slot, ref: link.ref });
50
+ }
51
+ this.runtime.weaponInput(slot, entity.$weapon);
52
+ }
53
+ }
54
+ postUpdate() {
55
+ for (const [entity, { slot }] of this.attached)
56
+ entity.weaponState = this.runtime?.queryWeapons(slot) ?? null;
57
+ }
58
+ detach(link) {
59
+ const slot = this.attached.get(link.entity)?.slot;
60
+ if (slot !== void 0 && this.runtime && !this.runtime.detachWeapons(slot) && this.runtime.queryWeapons(slot))
61
+ throw new Error("Failed to release weapon ownership.");
62
+ this.attached.delete(link.entity);
63
+ link.entity.weaponState = null;
64
+ }
65
+ destroy() {
66
+ for (const [entity, { ref }] of this.attached)
67
+ this.detach({ entity, ref });
68
+ }
69
+ };
70
+ function descriptor(name, abilities) {
71
+ return defineBehavior({
72
+ name,
73
+ metadata: BUILTIN_BEHAVIORS[name],
74
+ defaultOptions: {
75
+ gravity: 18,
76
+ speed: 5
77
+ },
78
+ systemFactory: (ctx) => new WeaponSystem(
79
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
80
+ abilities,
81
+ ctx.wasmStage ?? null,
82
+ ctx.getBehaviorLinks
83
+ )
84
+ });
85
+ }
86
+ var WeaponSystemsBehavior = descriptor(
87
+ "weapon-systems",
88
+ WEAPON_ABILITIES
89
+ );
90
+ var DelayedShieldRegenerationBehavior = descriptor(
91
+ "delayed-shield-regeneration",
92
+ ["delayed-shield-regeneration"]
93
+ );
94
+ var WeaponHeatAndVentBehavior = descriptor("weapon-heat-and-vent", [
95
+ "weapon-heat-and-vent"
96
+ ]);
97
+ var InterruptibleMagazineReloadBehavior = descriptor(
98
+ "interruptible-magazine-reload",
99
+ ["interruptible-magazine-reload"]
100
+ );
101
+ var StickyGrenadeAttachmentBehavior = descriptor(
102
+ "sticky-grenade-attachment",
103
+ ["sticky-grenade-attachment"]
104
+ );
105
+ var AlternateWeaponModeBehavior = descriptor("alternate-weapon-mode", [
106
+ "alternate-weapon-mode"
107
+ ]);
108
+ var RemoteGuidedProjectileBehavior = descriptor(
109
+ "remote-guided-projectile",
110
+ ["remote-guided-projectile"]
111
+ );
112
+ var ChargeAndReleaseShotBehavior = descriptor(
113
+ "charge-and-release-shot",
114
+ ["charge-and-release-shot"]
115
+ );
116
+ var MaterialPenetratingShotBehavior = descriptor(
117
+ "material-penetrating-shot",
118
+ ["material-penetrating-shot"]
119
+ );
120
+ var BeamMissileCombinationBehavior = descriptor(
121
+ "beam-missile-combination",
122
+ ["beam-missile-combination"]
123
+ );
124
+ var StationaryAimModeBehavior = descriptor("stationary-aim-mode", [
125
+ "stationary-aim-mode"
126
+ ]);
127
+
128
+ export {
129
+ WeaponSystemsBehavior,
130
+ DelayedShieldRegenerationBehavior,
131
+ WeaponHeatAndVentBehavior,
132
+ InterruptibleMagazineReloadBehavior,
133
+ StickyGrenadeAttachmentBehavior,
134
+ AlternateWeaponModeBehavior,
135
+ RemoteGuidedProjectileBehavior,
136
+ ChargeAndReleaseShotBehavior,
137
+ MaterialPenetratingShotBehavior,
138
+ BeamMissileCombinationBehavior,
139
+ StationaryAimModeBehavior
140
+ };
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  defineBehavior
3
- } from "./chunk-YDLO5M7S.js";
3
+ } from "./chunk-5SMXQ6AU.js";
4
+ import {
5
+ BUILTIN_BEHAVIORS
6
+ } from "./chunk-S44ZHYE6.js";
4
7
 
5
8
  // src/lib/behaviors/screen-visibility/screen-visibility.descriptor.ts
6
9
  import {
@@ -357,6 +360,7 @@ function createScreenVisibilityHandle(ref) {
357
360
  }
358
361
  var ScreenVisibilityBehavior = defineBehavior({
359
362
  name: "screen-visibility",
363
+ metadata: BUILTIN_BEHAVIORS["screen-visibility"],
360
364
  defaultOptions,
361
365
  systemFactory: (ctx) => new ScreenVisibilitySystem(ctx.scene, ctx.getBehaviorLinks),
362
366
  createHandle: createScreenVisibilityHandle