@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.
- 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-CTSYM56P.js → chunk-2QCCLHJC.js} +10 -6
- 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-LLDLVVG4.js → chunk-7HGDADLB.js} +25 -9
- package/dist/chunk-7IOQEXYR.js +92 -0
- package/dist/{chunk-OU2SW4U5.js → chunk-APAM55J3.js} +10 -6
- 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-OBF6BIA2.js → chunk-CBQSC6W3.js} +2 -2
- package/dist/chunk-DDLZLJ7W.js +8 -0
- package/dist/chunk-DRIXFB4C.js +132 -0
- package/dist/{chunk-7CE6OHLW.js → chunk-DTLUKSX2.js} +6 -2
- package/dist/{chunk-TK3AXXXI.js → chunk-EMEA45JQ.js} +10 -6
- package/dist/chunk-EQFLPRF7.js +130 -0
- package/dist/{chunk-M25QJBDN.js → chunk-GNRMH7D3.js} +18 -6
- package/dist/chunk-GYEKT5AY.js +102 -0
- package/dist/{chunk-SHZZ2QRV.js → chunk-HCWLIPXP.js} +5 -1
- package/dist/{chunk-WHKPWIQO.js → chunk-HMVEQB2T.js} +1 -0
- package/dist/chunk-HQ2UFI3S.js +116 -0
- package/dist/chunk-I52PC5IU.js +128 -0
- package/dist/{chunk-CB3C7CRD.js → chunk-IAIJG2PB.js} +10 -6
- package/dist/{chunk-NDJO56BB.js → chunk-IJILTFEL.js} +5 -1
- package/dist/{chunk-7GGR26YA.js → chunk-IRNU4JGV.js} +10 -6
- 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-57GLKGEX.js → chunk-P6TMZSWF.js} +32 -7
- 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-E2MOFIDH.js → chunk-SKKVOH6D.js} +13 -7
- package/dist/{chunk-RR3XNDKG.js → chunk-T2LAQQDS.js} +1 -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-55CFXXZH.js → chunk-XT47QZQ6.js} +32 -7
- 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--RTwuT4S.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-3d.js +2 -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 +3 -2
- package/dist/coordinators/multidirectional-space-shooter.js +2 -2
- package/dist/coordinators/top-down-shooter.d.ts +3 -2
- package/dist/coordinators/top-down-shooter.js +2 -2
- package/dist/core.d.ts +387 -26
- package/dist/core.js +1583 -6
- package/dist/destructible-3d.d.ts +3 -2
- package/dist/destructible-3d.js +3 -2
- package/dist/destructible-prebake.d.ts +1 -1
- package/dist/environmental-locomotion.d.ts +23 -0
- package/dist/environmental-locomotion.js +35 -0
- package/dist/first-person.d.ts +3 -2
- package/dist/first-person.js +25 -4
- package/dist/golf-racket.d.ts +21 -0
- package/dist/golf-racket.js +37 -0
- package/dist/index.d.ts +28 -6
- package/dist/index.js +766 -82
- package/dist/jumper-2d.d.ts +2 -1
- package/dist/jumper-2d.js +25 -4
- package/dist/jumper-3d.d.ts +2 -1
- package/dist/jumper-3d.js +25 -4
- 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-CFOHmblC.d.ts → moveable-CXK2wEZL.d.ts} +2 -2
- package/dist/particle-emitter/presets.d.ts +1 -1
- package/dist/particle-emitter.d.ts +5 -4
- package/dist/particle-emitter.js +3 -2
- package/dist/{payload-BQzu-oY_.d.ts → payload-WEzfgjSL.d.ts} +1 -1
- package/dist/platformer-2d.d.ts +2 -1
- package/dist/platformer-2d.js +25 -4
- package/dist/platformer-3d.d.ts +2 -1
- package/dist/platformer-3d.js +25 -4
- 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 +25 -4
- package/dist/ricochet-3d.d.ts +2 -1
- package/dist/ricochet-3d.js +25 -4
- 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 +4 -3
- package/dist/shooter-2d.d.ts +3 -2
- package/dist/shooter-2d.js +3 -2
- package/dist/skate-snowboard.d.ts +21 -0
- package/dist/skate-snowboard.js +37 -0
- package/dist/{spark-C4Tp-52_.d.ts → spark-VoQoemz_.d.ts} +1 -1
- 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 +4 -3
- 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/{vector-DjhLUrak.d.ts → vector-s7GbCrVn.d.ts} +1 -1
- 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 +25 -4
- package/dist/world-boundary-3d.d.ts +2 -1
- package/dist/world-boundary-3d.js +26 -5
- package/package.json +90 -5
- package/dist/behavior-system-DkFAwLb_.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,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
|
+
};
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
__toESM
|
|
4
4
|
} from "./chunk-JSBRDJBE.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/typescript-fsm@1.6.0/node_modules/typescript-fsm/dist/stateMachine.js
|
|
6
|
+
// ../../node_modules/.pnpm/typescript-fsm@1.6.0/node_modules/typescript-fsm/dist/stateMachine.js
|
|
7
7
|
var require_stateMachine = __commonJS({
|
|
8
|
-
"node_modules/.pnpm/typescript-fsm@1.6.0/node_modules/typescript-fsm/dist/stateMachine.js"(exports) {
|
|
8
|
+
"../../node_modules/.pnpm/typescript-fsm@1.6.0/node_modules/typescript-fsm/dist/stateMachine.js"(exports) {
|
|
9
9
|
"use strict";
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.SyncStateMachine = exports.StateMachine = void 0;
|
|
@@ -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
|
+
};
|
|
@@ -4,10 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
SyncStateMachine,
|
|
6
6
|
import_typescript_fsm
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CBQSC6W3.js";
|
|
8
8
|
import {
|
|
9
9
|
defineBehavior
|
|
10
|
-
} from "./chunk-
|
|
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
|
-
SyncStateMachine,
|
|
3
|
-
import_typescript_fsm
|
|
4
|
-
} from "./chunk-OBF6BIA2.js";
|
|
5
1
|
import {
|
|
6
2
|
StageRicochetDim,
|
|
7
3
|
StageRicochetReflection
|
|
8
|
-
} from "./chunk-
|
|
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-
|
|
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
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
StageBoundaryDim
|
|
12
|
-
} from "./chunk-GZ3DQIIZ.js";
|
|
12
|
+
} from "./chunk-CBQSC6W3.js";
|
|
13
13
|
import {
|
|
14
14
|
defineBehavior
|
|
15
|
-
} from "./chunk-
|
|
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) => {
|
|
@@ -129,6 +132,14 @@ function createWorldBoundary2DHandle(ref) {
|
|
|
129
132
|
}
|
|
130
133
|
};
|
|
131
134
|
}
|
|
135
|
+
function runtimeBounds(bounds) {
|
|
136
|
+
return {
|
|
137
|
+
top: Math.fround(bounds.top),
|
|
138
|
+
bottom: Math.fround(bounds.bottom),
|
|
139
|
+
left: Math.fround(bounds.left),
|
|
140
|
+
right: Math.fround(bounds.right)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
132
143
|
var WorldBoundary2DSystem = class {
|
|
133
144
|
constructor(wasmStage, getBehaviorLinks) {
|
|
134
145
|
this.wasmStage = wasmStage;
|
|
@@ -154,7 +165,7 @@ var WorldBoundary2DSystem = class {
|
|
|
154
165
|
if (query) {
|
|
155
166
|
boundaryRef.fsm.update(
|
|
156
167
|
{ x: query.clamped[0], y: query.clamped[1] },
|
|
157
|
-
options.boundaries
|
|
168
|
+
runtimeBounds(options.boundaries)
|
|
158
169
|
);
|
|
159
170
|
}
|
|
160
171
|
}
|
|
@@ -177,6 +188,7 @@ var WorldBoundary2DSystem = class {
|
|
|
177
188
|
};
|
|
178
189
|
var WorldBoundary2DBehavior = defineBehavior({
|
|
179
190
|
name: "world-boundary-2d",
|
|
191
|
+
metadata: BUILTIN_BEHAVIORS["world-boundary-2d"],
|
|
180
192
|
defaultOptions,
|
|
181
193
|
systemFactory: (ctx) => new WorldBoundary2DSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
|
|
182
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-
|
|
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,
|