@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,127 @@
1
+ import {
2
+ SQUAD_ABILITIES
3
+ } from "./chunk-TSYXRRS4.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/squad-rts/index.ts
12
+ var SquadSystem = 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.squadState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachSquad(slot, this.abilities, link.ref.options)) {
38
+ throw new Error(
39
+ "Squad attachment requires valid options and an available squad 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.squadState = this.runtime?.querySquad(slot) ?? null;
49
+ }
50
+ detach(link) {
51
+ const slot = this.attached.get(link.entity)?.slot;
52
+ if (slot !== void 0 && this.runtime && !this.runtime.detachSquad(slot) && this.runtime.querySquad(slot))
53
+ throw new Error("Failed to detach squad policy.");
54
+ this.attached.delete(link.entity);
55
+ link.entity.squadState = 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.5
68
+ },
69
+ systemFactory: (ctx) => new SquadSystem(
70
+ /* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
71
+ abilities,
72
+ ctx.wasmStage ?? null,
73
+ ctx.getBehaviorLinks
74
+ )
75
+ });
76
+ }
77
+ var SquadRtsBehavior = descriptor("squad-rts", SQUAD_ABILITIES);
78
+ var WhistleRecallBehavior = descriptor("whistle-recall", [
79
+ "whistle-recall"
80
+ ]);
81
+ var SquadFormationFollowBehavior = descriptor(
82
+ "squad-formation-follow",
83
+ ["squad-formation-follow"]
84
+ );
85
+ var ThrownWorkerDeploymentBehavior = descriptor(
86
+ "thrown-worker-deployment",
87
+ ["thrown-worker-deployment"]
88
+ );
89
+ var CooperativeObjectTransportBehavior = descriptor(
90
+ "cooperative-object-transport",
91
+ ["cooperative-object-transport"]
92
+ );
93
+ var CooperativeConstructionWorkBehavior = descriptor(
94
+ "cooperative-construction-work",
95
+ ["cooperative-construction-work"]
96
+ );
97
+ var SurfaceLatchAttackBehavior = descriptor("surface-latch-attack", [
98
+ "surface-latch-attack"
99
+ ]);
100
+ var SpeciesHazardAffinityBehavior = descriptor(
101
+ "species-hazard-affinity",
102
+ ["species-hazard-affinity"]
103
+ );
104
+ var GrowthStageMobilityBehavior = descriptor("growth-stage-mobility", [
105
+ "growth-stage-mobility"
106
+ ]);
107
+ var DeliveredResourceConversionBehavior = descriptor(
108
+ "delivered-resource-conversion",
109
+ ["delivered-resource-conversion"]
110
+ );
111
+ var DayEndUnitRecallBehavior = descriptor("day-end-unit-recall", [
112
+ "day-end-unit-recall"
113
+ ]);
114
+
115
+ export {
116
+ SquadRtsBehavior,
117
+ WhistleRecallBehavior,
118
+ SquadFormationFollowBehavior,
119
+ ThrownWorkerDeploymentBehavior,
120
+ CooperativeObjectTransportBehavior,
121
+ CooperativeConstructionWorkBehavior,
122
+ SurfaceLatchAttackBehavior,
123
+ SpeciesHazardAffinityBehavior,
124
+ GrowthStageMobilityBehavior,
125
+ DeliveredResourceConversionBehavior,
126
+ DayEndUnitRecallBehavior
127
+ };
@@ -0,0 +1,147 @@
1
+ // src/lib/behaviors/action-rpg/types.ts
2
+ var RPG_ABILITIES = [
3
+ "equipment-stat-aggregation",
4
+ "durability-and-repair",
5
+ "affix-budget-generation",
6
+ "death-drop-ownership",
7
+ "consumable-belt-slots",
8
+ "seeded-loot-table",
9
+ "damage-to-resource-leech",
10
+ "typed-resistance-resolution",
11
+ "autonomous-familiar",
12
+ "resource-draining-transformation"
13
+ ];
14
+ var RPG_EVENTS = [
15
+ ...RPG_ABILITIES,
16
+ "familiar-attack",
17
+ "familiar-support"
18
+ ];
19
+ function rpgData(o) {
20
+ return [
21
+ o.strength ?? 10,
22
+ o.defense ?? 5,
23
+ o.speed ?? 3,
24
+ o.maximumHealth ?? 100,
25
+ o.maximumMana ?? 50,
26
+ o.currency ?? 100,
27
+ o.repairUnitCost ?? 2,
28
+ o.pickupRange ?? 2,
29
+ o.reservationSeconds ?? 3,
30
+ o.followDistance ?? 1,
31
+ o.familiarSpeed ?? 3,
32
+ o.actionRange ?? 1.5,
33
+ o.actionCooldown ?? 1,
34
+ o.leashRange ?? 10,
35
+ o.maximumDrain ?? 100,
36
+ o.maximumRadius ?? 3
37
+ ];
38
+ }
39
+ function rpgOperation(a) {
40
+ switch (a.type) {
41
+ case "equipment-register":
42
+ return {
43
+ op: 0,
44
+ data: [a.slotMask, a.requiredStrength, ...a.flat, ...a.percent]
45
+ };
46
+ case "equip":
47
+ return { op: 1, data: [a.slot] };
48
+ case "unequip":
49
+ return { op: 2, data: [a.slot] };
50
+ case "base-stats":
51
+ return { op: 3, data: [...a.values] };
52
+ case "durability-register":
53
+ return { op: 4, data: [a.current, a.maximum] };
54
+ case "wear":
55
+ return { op: 5, data: [a.amount, a.useSerial] };
56
+ case "repair":
57
+ return { op: 6, data: [a.amount] };
58
+ case "wallet":
59
+ return { op: 7, data: [a.currency] };
60
+ case "affix-row":
61
+ return {
62
+ op: 8,
63
+ data: [
64
+ a.row,
65
+ a.id,
66
+ a.cost,
67
+ a.level,
68
+ a.classMask,
69
+ a.group,
70
+ a.stat,
71
+ a.amount,
72
+ a.weight
73
+ ]
74
+ };
75
+ case "affix-roll":
76
+ return {
77
+ op: 9,
78
+ data: [a.seed, a.level, a.itemClass, a.budget, a.count]
79
+ };
80
+ case "affix-clear":
81
+ return { op: 10, data: [] };
82
+ case "drop-public":
83
+ case "drop-reserve":
84
+ return { op: 12, data: [a.itemType, a.rarity] };
85
+ case "death-drop":
86
+ return { op: 13, data: [a.deathSerial, a.lootSerial, a.affixSerial] };
87
+ case "drop-pickup":
88
+ return { op: 14, data: [] };
89
+ case "belt-stock":
90
+ return { op: 16, data: [a.slot, a.count, a.kind, a.potency] };
91
+ case "belt-use":
92
+ return { op: 17, data: [a.slot] };
93
+ case "belt-move":
94
+ return { op: 18, data: [a.from, a.to] };
95
+ case "belt-resources":
96
+ return { op: 19, data: [a.health, a.mana] };
97
+ case "loot-row":
98
+ return {
99
+ op: 20,
100
+ data: [a.row, a.itemType, a.weight, a.level, a.rarity]
101
+ };
102
+ case "loot-roll":
103
+ return { op: 21, data: [a.seed, a.level] };
104
+ case "loot-clear":
105
+ return { op: 22, data: [] };
106
+ case "leech-rates":
107
+ return { op: 24, data: [a.health, a.mana] };
108
+ case "leech":
109
+ return { op: 25, data: [a.damage, a.damageSerial, a.flags] };
110
+ case "leech-resources":
111
+ return { op: 26, data: [a.health, a.mana] };
112
+ case "resistance":
113
+ return { op: 28, data: [a.damageType, a.resistance, Number(a.immune)] };
114
+ case "resolve-damage":
115
+ return {
116
+ op: 29,
117
+ data: [
118
+ a.raw,
119
+ a.damageType,
120
+ a.damageSerial,
121
+ a.flags,
122
+ a.availableHealth
123
+ ]
124
+ };
125
+ case "familiar-bind":
126
+ return { op: 32, data: [a.role] };
127
+ case "familiar-candidate":
128
+ return { op: 33, data: [] };
129
+ case "familiar-stop":
130
+ return { op: 34, data: [] };
131
+ case "familiar-remove":
132
+ return { op: 35, data: [] };
133
+ case "transform":
134
+ return { op: 36, data: [a.form, a.radius, a.drain, a.speed] };
135
+ case "revert":
136
+ return { op: 37, data: [] };
137
+ case "form-mana":
138
+ return { op: 38, data: [a.mana] };
139
+ }
140
+ }
141
+
142
+ export {
143
+ RPG_ABILITIES,
144
+ RPG_EVENTS,
145
+ rpgData,
146
+ rpgOperation
147
+ };
@@ -0,0 +1,8 @@
1
+ // src/lib/behaviors/acrobatics-2d/types.ts
2
+ var TRAVERSAL_ABILITIES = ["running-long-jump", "chained-jump", "crouch-backflip", "wall-kick", "ledge-hang-and-mantle", "pole-climb", "ceiling-hang-traverse", "ground-pound-impact", "dive-to-belly-slide", "temporary-actor-possession"];
3
+ var ACROBATICS_ACTIONS = ["grounded", "jump", "long jump", "double jump", "triple jump", "backflip", "falling", "wall kick", "ledge hang", "pole climb", "ceiling hang", "pound windup", "pound descent", "impact recovery", "dive", "belly slide", "possessing", "mantle"];
4
+
5
+ export {
6
+ TRAVERSAL_ABILITIES,
7
+ ACROBATICS_ACTIONS
8
+ };
@@ -0,0 +1,99 @@
1
+ import {
2
+ TRAVERSAL_ABILITIES
3
+ } from "./chunk-WF6HC5U3.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/acrobatics-2d/index.ts
12
+ var AcrobaticsSystem = 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) this.detach({ entity, ref });
29
+ }
30
+ for (const link of links) {
31
+ const entity = link.entity;
32
+ entity.$acrobatics ??= { moveX: 0, jump: false, crouch: false };
33
+ entity.acrobaticsState ??= null;
34
+ const slot = entity.runtimeHandle;
35
+ if (!Number.isInteger(slot) || slot < 0) continue;
36
+ if (!this.attached.has(entity)) {
37
+ if (!this.runtime.attachAcrobatics(slot, this.abilities, link.ref.options)) {
38
+ throw new Error("Acrobatics requires exclusive motion ownership and a dynamic body with gravityScale=0 and a solid collider.");
39
+ }
40
+ this.attached.set(entity, { slot, ref: link.ref });
41
+ }
42
+ const input = entity.$acrobatics;
43
+ this.runtime.writeInputAxes(slot, input.moveX, input.moveY ?? 0);
44
+ this.runtime.writeInputButton(slot, 1, input.jump);
45
+ this.runtime.writeInputButton(slot, 4, input.crouch);
46
+ this.runtime.writeInputLook(slot, input.moveZ ?? 0, 0);
47
+ this.runtime.writeInputButton(slot, 8, input.action ?? false);
48
+ this.runtime.writeInputButton(slot, 16, input.grab ?? false);
49
+ this.runtime.writeInputButton(slot, 32, input.release ?? false);
50
+ }
51
+ }
52
+ postUpdate() {
53
+ for (const [entity, { slot }] of this.attached) entity.acrobaticsState = this.runtime?.queryAcrobatics(slot) ?? null;
54
+ }
55
+ detach(link) {
56
+ const slot = this.attached.get(link.entity)?.slot;
57
+ if (slot !== void 0) this.runtime?.detachAcrobatics(slot);
58
+ this.attached.delete(link.entity);
59
+ link.entity.acrobaticsState = null;
60
+ }
61
+ destroy() {
62
+ for (const [entity, { ref }] of this.attached) this.detach({ entity, ref });
63
+ }
64
+ };
65
+ function descriptor(name, abilities) {
66
+ return defineBehavior({
67
+ name,
68
+ metadata: BUILTIN_BEHAVIORS[name],
69
+ defaultOptions: { moveSpeed: 6, jumpSpeed: 10, gravity: 24, chainWindow: 0.25 },
70
+ systemFactory: (ctx) => new AcrobaticsSystem(/* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`), abilities, ctx.wasmStage ?? null, ctx.getBehaviorLinks)
71
+ });
72
+ }
73
+ var AcrobaticMovement2DBehavior = descriptor("acrobatics-2d", ["running-long-jump", "chained-jump", "crouch-backflip"]);
74
+ var RunningLongJumpBehavior = descriptor("running-long-jump", ["running-long-jump"]);
75
+ var ChainedJumpBehavior = descriptor("chained-jump", ["chained-jump"]);
76
+ var CrouchBackflipBehavior = descriptor("crouch-backflip", ["crouch-backflip"]);
77
+ var PlatformerTraversalBehavior = descriptor("platformer-traversal", TRAVERSAL_ABILITIES);
78
+ var WallKickBehavior = descriptor("wall-kick", ["wall-kick"]);
79
+ var LedgeHangAndMantleBehavior = descriptor("ledge-hang-and-mantle", ["ledge-hang-and-mantle"]);
80
+ var PoleClimbBehavior = descriptor("pole-climb", ["pole-climb"]);
81
+ var CeilingHangTraverseBehavior = descriptor("ceiling-hang-traverse", ["ceiling-hang-traverse"]);
82
+ var GroundPoundImpactBehavior = descriptor("ground-pound-impact", ["ground-pound-impact"]);
83
+ var DiveToBellySlideBehavior = descriptor("dive-to-belly-slide", ["dive-to-belly-slide"]);
84
+ var TemporaryActorPossessionBehavior = descriptor("temporary-actor-possession", ["temporary-actor-possession"]);
85
+
86
+ export {
87
+ AcrobaticMovement2DBehavior,
88
+ RunningLongJumpBehavior,
89
+ ChainedJumpBehavior,
90
+ CrouchBackflipBehavior,
91
+ PlatformerTraversalBehavior,
92
+ WallKickBehavior,
93
+ LedgeHangAndMantleBehavior,
94
+ PoleClimbBehavior,
95
+ CeilingHangTraverseBehavior,
96
+ GroundPoundImpactBehavior,
97
+ DiveToBellySlideBehavior,
98
+ TemporaryActorPossessionBehavior
99
+ };
@@ -8,10 +8,13 @@ import {
8
8
  } from "./chunk-VJ3UA6OD.js";
9
9
  import {
10
10
  StageTopDownPlane
11
- } from "./chunk-GZ3DQIIZ.js";
11
+ } from "./chunk-BR33KT4Z.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/top-down-movement/top-down-movement.descriptor.ts
17
20
  var defaultOptions = {
@@ -87,6 +90,7 @@ var TopDownMovementBehaviorSystem = class {
87
90
  };
88
91
  var TopDownMovementBehavior = defineBehavior({
89
92
  name: "top-down-movement",
93
+ metadata: BUILTIN_BEHAVIORS["top-down-movement"],
90
94
  defaultOptions,
91
95
  systemFactory: (ctx) => new TopDownMovementBehaviorSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
92
96
  createHandle: createTopDownMovementHandle
@@ -0,0 +1,120 @@
1
+ // src/lib/behaviors/spatial-puzzles/types.ts
2
+ var PUZZLE_ABILITIES = [
3
+ "weighted-pressure-switch",
4
+ "grid-constrained-push-block",
5
+ "mirror-beam-routing",
6
+ "conductive-contact-network",
7
+ "material-ignition-spread",
8
+ "freeze-and-shatter",
9
+ "stasis-impulse-storage",
10
+ "magnetic-object-manipulation",
11
+ "water-level-mechanism",
12
+ "timed-solid-platform"
13
+ ];
14
+ function puzzleData(a, o) {
15
+ let data;
16
+ switch (a) {
17
+ case "weighted-pressure-switch":
18
+ data = [
19
+ o.threshold ?? 1,
20
+ o.releaseDelay ?? 0.2,
21
+ o.occupancy ? 1 : 0
22
+ ];
23
+ break;
24
+ case "grid-constrained-push-block":
25
+ data = [o.cellSize ?? 1];
26
+ break;
27
+ case "mirror-beam-routing":
28
+ data = [
29
+ ["emitter", "mirror", "receiver"].indexOf(
30
+ o.beamRole ?? "emitter"
31
+ ),
32
+ o.range ?? 20,
33
+ o.maxSegments ?? 8,
34
+ ...o.direction ?? [1, 0, 0]
35
+ ];
36
+ break;
37
+ case "conductive-contact-network":
38
+ data = [o.source ? 1 : 0, o.contactGap ?? 0.02];
39
+ break;
40
+ case "material-ignition-spread":
41
+ data = [
42
+ o.ignition ?? 1,
43
+ o.fuel ?? 5,
44
+ o.heatRate ?? 3,
45
+ o.cooling ?? 0.2,
46
+ o.spreadRadius ?? 2,
47
+ o.wetness ?? 0
48
+ ];
49
+ break;
50
+ case "freeze-and-shatter":
51
+ data = [
52
+ o.duration ?? 2,
53
+ o.coldThreshold ?? 1,
54
+ o.shatterThreshold ?? 2,
55
+ o.resistance ?? 0
56
+ ];
57
+ break;
58
+ case "stasis-impulse-storage":
59
+ data = [o.duration ?? 2, o.maxImpulse ?? 10];
60
+ break;
61
+ case "magnetic-object-manipulation":
62
+ data = [
63
+ o.range ?? 8,
64
+ o.stiffness ?? 12,
65
+ o.damping ?? 5,
66
+ o.maxForce ?? 50
67
+ ];
68
+ break;
69
+ case "water-level-mechanism":
70
+ data = [
71
+ o.low ?? 0,
72
+ o.high ?? 3,
73
+ o.speed ?? 1,
74
+ o.halfWidth ?? 5,
75
+ o.bottom ?? -3,
76
+ o.halfDepth ?? 5
77
+ ];
78
+ break;
79
+ case "timed-solid-platform":
80
+ data = [
81
+ o.solidDuration ?? 2,
82
+ o.warningDuration ?? 0.5,
83
+ o.absentDuration ?? 1
84
+ ];
85
+ break;
86
+ }
87
+ return [...data, ...Array(16 - data.length).fill(0)];
88
+ }
89
+ function puzzleCommandData(c) {
90
+ switch (c.type) {
91
+ case "push":
92
+ return [1, ...c.direction];
93
+ case "aim":
94
+ return [2, ...c.direction];
95
+ case "power":
96
+ return [3, c.enabled ? 1 : 0, 0, 0];
97
+ case "heat":
98
+ return [4, c.amount, 0, 0];
99
+ case "wetness":
100
+ return [5, c.value, 0, 0];
101
+ case "cold":
102
+ return [6, c.amount, 0, 0];
103
+ case "impact":
104
+ return [7, ...c.impulse];
105
+ case "activate":
106
+ return [8, 0, 0, 0];
107
+ case "release":
108
+ return [9, 0, 0, 0];
109
+ case "target":
110
+ return [10, ...c.position];
111
+ case "level":
112
+ return [11, c.high ? 1 : 0, 0, 0];
113
+ }
114
+ }
115
+
116
+ export {
117
+ PUZZLE_ABILITIES,
118
+ puzzleData,
119
+ puzzleCommandData
120
+ };
@@ -1,16 +1,19 @@
1
- import {
2
- SyncStateMachine,
3
- import_typescript_fsm
4
- } from "./chunk-CBQSC6W3.js";
5
1
  import {
6
2
  STAGE_INPUT_BUTTON_JUMP,
7
3
  STAGE_INPUT_BUTTON_RUN,
8
4
  StagePlatformerShapeSource,
9
5
  readBehaviorSnapshot
10
- } from "./chunk-GZ3DQIIZ.js";
6
+ } from "./chunk-BR33KT4Z.js";
7
+ import {
8
+ SyncStateMachine,
9
+ import_typescript_fsm
10
+ } from "./chunk-CBQSC6W3.js";
11
11
  import {
12
12
  defineBehavior
13
- } from "./chunk-YDLO5M7S.js";
13
+ } from "./chunk-5SMXQ6AU.js";
14
+ import {
15
+ BUILTIN_BEHAVIORS
16
+ } from "./chunk-S44ZHYE6.js";
14
17
 
15
18
  // src/lib/behaviors/platformer-3d/components.ts
16
19
  function createPlatformer3DMovementComponent(options = {}) {
@@ -332,6 +335,7 @@ var Platformer3DBehaviorSystem = class {
332
335
  };
333
336
  var Platformer3DBehavior = defineBehavior({
334
337
  name: "platformer-3d",
338
+ metadata: BUILTIN_BEHAVIORS["platformer-3d"],
335
339
  defaultOptions,
336
340
  systemFactory: (ctx) => new Platformer3DBehaviorSystem(
337
341
  ctx.wasmStage ?? null,
@@ -0,0 +1,58 @@
1
+ // src/lib/behaviors/adventure-tools/types.ts
2
+ var ADVENTURE_ABILITIES = [
3
+ "combat-lock-on",
4
+ "hookshot-pull",
5
+ "grapple-swing",
6
+ "morph-ball-transition",
7
+ "magnetic-track-adhesion",
8
+ "scanning-and-discovery",
9
+ "fused-carryable-bomb",
10
+ "returning-boomerang",
11
+ "keyed-interaction-gate",
12
+ "carry-aim-and-throw"
13
+ ];
14
+ var ADVENTURE_BUTTONS = [
15
+ "lock",
16
+ "cycle",
17
+ "hook",
18
+ "grapple",
19
+ "morph",
20
+ "magnet",
21
+ "scan",
22
+ "armBomb",
23
+ "boomerang",
24
+ "interact",
25
+ "carry",
26
+ "throw",
27
+ "release"
28
+ ];
29
+ var ADVENTURE_FLAGS = {
30
+ target: 1,
31
+ hookAnchor: 2,
32
+ pullable: 4,
33
+ grappleAnchor: 8,
34
+ scannable: 16,
35
+ carryable: 32,
36
+ bomb: 64,
37
+ gate: 128,
38
+ magneticTrack: 256,
39
+ hittable: 512
40
+ };
41
+ var ADVENTURE_EVENT_KINDS = [
42
+ "unknown",
43
+ "lockChanged",
44
+ "discovered",
45
+ "detonated",
46
+ "toolHit",
47
+ "unlocked",
48
+ "pickedUp",
49
+ "released",
50
+ "formChanged"
51
+ ];
52
+
53
+ export {
54
+ ADVENTURE_ABILITIES,
55
+ ADVENTURE_BUTTONS,
56
+ ADVENTURE_FLAGS,
57
+ ADVENTURE_EVENT_KINDS
58
+ };