@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.
- package/dist/acrobatics-2d.d.ts +25 -0
- package/dist/acrobatics-2d.js +37 -0
- package/dist/action-rpg.d.ts +21 -0
- package/dist/action-rpg.js +39 -0
- package/dist/adventure-tools.d.ts +22 -0
- package/dist/adventure-tools.js +39 -0
- package/dist/behavior-descriptor-NS_qnzzp.d.ts +4527 -0
- package/dist/behavior-metadata-Drm1zxI2.d.ts +13 -0
- package/dist/catalog.d.ts +2143 -0
- package/dist/catalog.js +9 -0
- package/dist/chunk-2BE5BW7D.js +130 -0
- package/dist/{chunk-VNQLMRWC.js → chunk-2QCCLHJC.js} +9 -5
- package/dist/chunk-2UGT4MIF.js +94 -0
- package/dist/chunk-3J3ISPFQ.js +99 -0
- package/dist/chunk-3LBGEWT6.js +124 -0
- package/dist/{chunk-UUMH3DC3.js → chunk-3QBNWT7B.js} +5 -1
- package/dist/chunk-3T44EDXU.js +114 -0
- package/dist/chunk-5AJJ44QK.js +129 -0
- package/dist/{chunk-YDLO5M7S.js → chunk-5SMXQ6AU.js} +1 -0
- package/dist/chunk-5VJIP535.js +71 -0
- package/dist/chunk-6DTIJB7B.js +166 -0
- package/dist/chunk-73MHJY6R.js +78 -0
- package/dist/chunk-73YASAYS.js +137 -0
- package/dist/{chunk-NZM5YQBW.js → chunk-7HGDADLB.js} +8 -4
- package/dist/chunk-7IOQEXYR.js +92 -0
- package/dist/{chunk-G5S5U6WI.js → chunk-APAM55J3.js} +9 -5
- package/dist/chunk-BLTBZJPG.js +126 -0
- package/dist/chunk-BN6QZDR5.js +90 -0
- package/dist/chunk-BR33KT4Z.js +3186 -0
- package/dist/chunk-C5AYL42A.js +138 -0
- package/dist/chunk-DDLZLJ7W.js +8 -0
- package/dist/chunk-DRIXFB4C.js +132 -0
- package/dist/{chunk-U2BSZJ3S.js → chunk-DTLUKSX2.js} +5 -1
- package/dist/{chunk-VB4GYWTE.js → chunk-EMEA45JQ.js} +9 -5
- package/dist/chunk-EQFLPRF7.js +130 -0
- package/dist/{chunk-X45KOKUF.js → chunk-GNRMH7D3.js} +8 -4
- package/dist/chunk-GYEKT5AY.js +102 -0
- package/dist/{chunk-SHZZ2QRV.js → chunk-HCWLIPXP.js} +5 -1
- package/dist/chunk-HQ2UFI3S.js +116 -0
- package/dist/chunk-I52PC5IU.js +128 -0
- package/dist/{chunk-T7ST62OT.js → chunk-IAIJG2PB.js} +9 -5
- package/dist/{chunk-NDJO56BB.js → chunk-IJILTFEL.js} +5 -1
- package/dist/{chunk-6RIS4MGM.js → chunk-IRNU4JGV.js} +9 -5
- package/dist/chunk-IRPBFVAK.js +141 -0
- package/dist/chunk-JFBR4FNX.js +140 -0
- package/dist/{chunk-ERS6SNA5.js → chunk-K34N2CBL.js} +5 -1
- package/dist/chunk-LMMF7KXF.js +178 -0
- package/dist/chunk-LWGJ3QQZ.js +107 -0
- package/dist/chunk-MPNGQLHZ.js +132 -0
- package/dist/chunk-OH5LJAEJ.js +135 -0
- package/dist/{chunk-HZMC4LGW.js → chunk-P6TMZSWF.js} +10 -6
- package/dist/chunk-PDHHOVVQ.js +126 -0
- package/dist/{chunk-7TIIRJKF.js → chunk-RUBKGAPS.js} +5 -1
- package/dist/chunk-S44ZHYE6.js +1912 -0
- package/dist/chunk-SFMJNAW3.js +128 -0
- package/dist/{chunk-IU7Y3L7Y.js → chunk-SKKVOH6D.js} +5 -1
- package/dist/chunk-TSYXRRS4.js +125 -0
- package/dist/chunk-TZHO6P22.js +150 -0
- package/dist/chunk-V26L6MY6.js +127 -0
- package/dist/chunk-V4M46BF6.js +105 -0
- package/dist/chunk-VSFWETXS.js +127 -0
- package/dist/chunk-VU4LTE2X.js +147 -0
- package/dist/chunk-WF6HC5U3.js +8 -0
- package/dist/chunk-WG5NCDS4.js +99 -0
- package/dist/{chunk-7LHXAEOZ.js → chunk-WUYHS6JZ.js} +6 -2
- package/dist/chunk-XNRY6NOC.js +120 -0
- package/dist/{chunk-57JGBNCS.js → chunk-XT47QZQ6.js} +10 -6
- package/dist/chunk-Y5CCNMJI.js +58 -0
- package/dist/chunk-YVVB6YMG.js +133 -0
- package/dist/chunk-ZZXTGVGN.js +131 -0
- package/dist/combat-ai.d.ts +21 -0
- package/dist/combat-ai.js +41 -0
- package/dist/{components-tct075-p.d.ts → components-ClmBORMP.d.ts} +1 -1
- package/dist/cooldown.d.ts +2 -8
- package/dist/cooldown.js +3 -2
- package/dist/coordinators/boundary-ricochet-3d.d.ts +3 -2
- package/dist/coordinators/boundary-ricochet.d.ts +3 -2
- package/dist/coordinators/boundary-ricochet.js +2 -2
- package/dist/coordinators/multidirectional-space-shooter.d.ts +2 -1
- package/dist/coordinators/multidirectional-space-shooter.js +2 -2
- package/dist/coordinators/top-down-shooter.d.ts +2 -1
- package/dist/coordinators/top-down-shooter.js +2 -2
- package/dist/core.d.ts +386 -25
- package/dist/core.js +1583 -6
- package/dist/destructible-3d.d.ts +2 -1
- package/dist/destructible-3d.js +3 -2
- package/dist/environmental-locomotion.d.ts +23 -0
- package/dist/environmental-locomotion.js +35 -0
- package/dist/first-person.d.ts +2 -1
- package/dist/first-person.js +24 -3
- package/dist/golf-racket.d.ts +21 -0
- package/dist/golf-racket.js +37 -0
- package/dist/index.d.ts +25 -3
- package/dist/index.js +763 -79
- package/dist/jumper-2d.d.ts +2 -1
- package/dist/jumper-2d.js +24 -3
- package/dist/jumper-3d.d.ts +2 -1
- package/dist/jumper-3d.js +24 -3
- package/dist/lane-defense.d.ts +21 -0
- package/dist/lane-defense.js +39 -0
- package/dist/life-simulation.d.ts +21 -0
- package/dist/life-simulation.js +39 -0
- package/dist/matching-pinball.d.ts +21 -0
- package/dist/matching-pinball.js +39 -0
- package/dist/melee-combat.d.ts +22 -0
- package/dist/melee-combat.js +45 -0
- package/dist/{moveable-tkFsn7mE.d.ts → moveable-CXK2wEZL.d.ts} +1 -1
- package/dist/particle-emitter.d.ts +2 -1
- package/dist/particle-emitter.js +3 -2
- package/dist/platformer-2d.d.ts +2 -1
- package/dist/platformer-2d.js +24 -3
- package/dist/platformer-3d.d.ts +2 -1
- package/dist/platformer-3d.js +24 -3
- package/dist/racing-vehicles.d.ts +21 -0
- package/dist/racing-vehicles.js +37 -0
- package/dist/rhythm-performance.d.ts +21 -0
- package/dist/rhythm-performance.js +39 -0
- package/dist/ricochet-2d.d.ts +2 -1
- package/dist/ricochet-2d.js +24 -3
- package/dist/ricochet-3d.d.ts +2 -1
- package/dist/ricochet-3d.js +24 -3
- package/dist/runtime-2d.d.ts +2 -1
- package/dist/runtime-2d.js +10 -1
- package/dist/screen-visibility.d.ts +2 -1
- package/dist/screen-visibility.js +3 -2
- package/dist/screen-wrap.d.ts +2 -7
- package/dist/screen-wrap.js +3 -2
- package/dist/shooter-2d.d.ts +2 -1
- package/dist/shooter-2d.js +3 -2
- package/dist/skate-snowboard.d.ts +21 -0
- package/dist/skate-snowboard.js +37 -0
- package/dist/spatial-puzzles.d.ts +21 -0
- package/dist/spatial-puzzles.js +35 -0
- package/dist/squad-rts.d.ts +21 -0
- package/dist/squad-rts.js +39 -0
- package/dist/stealth-city.d.ts +21 -0
- package/dist/stealth-city.js +41 -0
- package/dist/survival-resources.d.ts +21 -0
- package/dist/survival-resources.js +37 -0
- package/dist/tactical-grid.d.ts +21 -0
- package/dist/tactical-grid.js +39 -0
- package/dist/thruster.d.ts +2 -1
- package/dist/thruster.js +3 -2
- package/dist/top-down-movement.d.ts +2 -1
- package/dist/top-down-movement.js +24 -3
- package/dist/turn-based-rpg.d.ts +21 -0
- package/dist/turn-based-rpg.js +39 -0
- package/dist/weapon-systems.d.ts +22 -0
- package/dist/weapon-systems.js +45 -0
- package/dist/world-boundary-2d.d.ts +2 -1
- package/dist/world-boundary-2d.js +24 -3
- package/dist/world-boundary-3d.d.ts +2 -1
- package/dist/world-boundary-3d.js +24 -3
- package/package.json +87 -3
- package/dist/behavior-descriptor-Dr8qmQ20.d.ts +0 -914
- package/dist/chunk-GZ3DQIIZ.js +0 -888
- package/dist/{chunk-OSPQFWQF.js → chunk-4K37UL53.js} +3 -3
- package/dist/{chunk-DD4U42FG.js → chunk-AQB246W5.js} +3 -3
- 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
|
+
STAGE_INPUT_BUTTON_JUMP,
|
|
6
|
+
readBehaviorSnapshot
|
|
7
|
+
} from "./chunk-BR33KT4Z.js";
|
|
4
8
|
import {
|
|
5
9
|
SyncStateMachine,
|
|
6
10
|
import_typescript_fsm
|
|
7
11
|
} from "./chunk-CBQSC6W3.js";
|
|
8
|
-
import {
|
|
9
|
-
STAGE_INPUT_BUTTON_JUMP,
|
|
10
|
-
readBehaviorSnapshot
|
|
11
|
-
} from "./chunk-GZ3DQIIZ.js";
|
|
12
12
|
import {
|
|
13
13
|
defineBehavior
|
|
14
|
-
} from "./chunk-
|
|
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-
|
|
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
|
+
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-
|
|
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-
|
|
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
|