@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
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BATTLE_ABILITIES
|
|
3
|
+
} from "./chunk-LMMF7KXF.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/turn-based-rpg/index.ts
|
|
12
|
+
var BattleSystem = 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.battleState ??= null;
|
|
34
|
+
const slot = entity.runtimeHandle;
|
|
35
|
+
if (!Number.isInteger(slot) || slot < 0) continue;
|
|
36
|
+
if (!this.attached.has(entity)) {
|
|
37
|
+
if (!this.runtime.attachBattle(
|
|
38
|
+
slot,
|
|
39
|
+
this.abilities,
|
|
40
|
+
link.ref.options
|
|
41
|
+
)) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
"Battle attachment requires valid options and an available battle component slot."
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
this.attached.set(entity, { slot, ref: link.ref });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
postUpdate() {
|
|
51
|
+
for (const [entity, { slot }] of this.attached)
|
|
52
|
+
entity.battleState = this.runtime?.queryBattle(slot) ?? null;
|
|
53
|
+
}
|
|
54
|
+
detach(link) {
|
|
55
|
+
const slot = this.attached.get(link.entity)?.slot;
|
|
56
|
+
if (slot !== void 0 && this.runtime && !this.runtime.detachBattle(slot) && this.runtime.queryBattle(slot))
|
|
57
|
+
throw new Error("Failed to detach battle policy.");
|
|
58
|
+
this.attached.delete(link.entity);
|
|
59
|
+
link.entity.battleState = 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: {
|
|
70
|
+
actionPoints: 3,
|
|
71
|
+
passiveBudget: 6
|
|
72
|
+
},
|
|
73
|
+
systemFactory: (ctx) => new BattleSystem(
|
|
74
|
+
/* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
|
|
75
|
+
abilities,
|
|
76
|
+
ctx.wasmStage ?? null,
|
|
77
|
+
ctx.getBehaviorLinks
|
|
78
|
+
)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
var TurnBasedRpgBehavior = descriptor("turn-based-rpg", BATTLE_ABILITIES);
|
|
82
|
+
var PrioritySpeedTurnOrderBehavior = descriptor(
|
|
83
|
+
"priority-speed-turn-order",
|
|
84
|
+
["priority-speed-turn-order"]
|
|
85
|
+
);
|
|
86
|
+
var TypeEffectivenessMatrixBehavior = descriptor(
|
|
87
|
+
"type-effectiveness-matrix",
|
|
88
|
+
["type-effectiveness-matrix"]
|
|
89
|
+
);
|
|
90
|
+
var TurnDurationStatusBehavior = descriptor("turn-duration-status", [
|
|
91
|
+
"turn-duration-status"
|
|
92
|
+
]);
|
|
93
|
+
var CaptureAttemptResolutionBehavior = descriptor(
|
|
94
|
+
"capture-attempt-resolution",
|
|
95
|
+
["capture-attempt-resolution"]
|
|
96
|
+
);
|
|
97
|
+
var ConditionalEvolutionBehavior = descriptor("conditional-evolution", [
|
|
98
|
+
"conditional-evolution"
|
|
99
|
+
]);
|
|
100
|
+
var TimedBattleActionCommandBehavior = descriptor(
|
|
101
|
+
"timed-battle-action-command",
|
|
102
|
+
["timed-battle-action-command"]
|
|
103
|
+
);
|
|
104
|
+
var ActivePartnerSwapBehavior = descriptor("active-partner-swap", [
|
|
105
|
+
"active-partner-swap"
|
|
106
|
+
]);
|
|
107
|
+
var BudgetedPassiveLoadoutBehavior = descriptor(
|
|
108
|
+
"budgeted-passive-loadout",
|
|
109
|
+
["budgeted-passive-loadout"]
|
|
110
|
+
);
|
|
111
|
+
var FieldFirstStrikeBehavior = descriptor("field-first-strike", [
|
|
112
|
+
"field-first-strike"
|
|
113
|
+
]);
|
|
114
|
+
var EscapeAttemptBehavior = descriptor("escape-attempt", [
|
|
115
|
+
"escape-attempt"
|
|
116
|
+
]);
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
TurnBasedRpgBehavior,
|
|
120
|
+
PrioritySpeedTurnOrderBehavior,
|
|
121
|
+
TypeEffectivenessMatrixBehavior,
|
|
122
|
+
TurnDurationStatusBehavior,
|
|
123
|
+
CaptureAttemptResolutionBehavior,
|
|
124
|
+
ConditionalEvolutionBehavior,
|
|
125
|
+
TimedBattleActionCommandBehavior,
|
|
126
|
+
ActivePartnerSwapBehavior,
|
|
127
|
+
BudgetedPassiveLoadoutBehavior,
|
|
128
|
+
FieldFirstStrikeBehavior,
|
|
129
|
+
EscapeAttemptBehavior
|
|
130
|
+
};
|
|
@@ -7,17 +7,20 @@ import {
|
|
|
7
7
|
VEC3_ZERO,
|
|
8
8
|
toThreeVector3
|
|
9
9
|
} from "./chunk-LWM346FW.js";
|
|
10
|
+
import {
|
|
11
|
+
STAGE_INPUT_BUTTON_RUN,
|
|
12
|
+
readBehaviorSnapshot
|
|
13
|
+
} from "./chunk-BR33KT4Z.js";
|
|
10
14
|
import {
|
|
11
15
|
SyncStateMachine,
|
|
12
16
|
import_typescript_fsm
|
|
13
17
|
} from "./chunk-CBQSC6W3.js";
|
|
14
|
-
import {
|
|
15
|
-
STAGE_INPUT_BUTTON_RUN,
|
|
16
|
-
readBehaviorSnapshot
|
|
17
|
-
} from "./chunk-GZ3DQIIZ.js";
|
|
18
18
|
import {
|
|
19
19
|
defineBehavior
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5SMXQ6AU.js";
|
|
21
|
+
import {
|
|
22
|
+
BUILTIN_BEHAVIORS
|
|
23
|
+
} from "./chunk-S44ZHYE6.js";
|
|
21
24
|
|
|
22
25
|
// src/lib/behaviors/first-person/first-person-fsm.ts
|
|
23
26
|
var FirstPersonState = /* @__PURE__ */ ((FirstPersonState2) => {
|
|
@@ -291,6 +294,7 @@ var FirstPersonBehaviorSystem = class {
|
|
|
291
294
|
};
|
|
292
295
|
var FirstPersonBehavior = defineBehavior({
|
|
293
296
|
name: "first-person-controller",
|
|
297
|
+
metadata: BUILTIN_BEHAVIORS["first-person-controller"],
|
|
294
298
|
defaultOptions,
|
|
295
299
|
systemFactory: (ctx) => new FirstPersonBehaviorSystem(ctx.wasmStage ?? null, ctx.getBehaviorLinks),
|
|
296
300
|
// Handles read the runtime snapshot buffer (previous-step values). The
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/lib/behaviors/racing-vehicles/types.ts
|
|
2
|
+
var RACING_ABILITIES = [
|
|
3
|
+
"drift-charge-boost",
|
|
4
|
+
"slipstream-drafting",
|
|
5
|
+
"position-weighted-race-items",
|
|
6
|
+
"track-following-homing-item",
|
|
7
|
+
"ordered-lap-checkpoints",
|
|
8
|
+
"hover-track-suspension",
|
|
9
|
+
"energy-funded-race-boost",
|
|
10
|
+
"vehicle-side-attack",
|
|
11
|
+
"vehicle-damage-progression",
|
|
12
|
+
"vehicle-seat-entry-exit"
|
|
13
|
+
];
|
|
14
|
+
function racingData(o) {
|
|
15
|
+
return [
|
|
16
|
+
o.driftTierTime ?? 0.6,
|
|
17
|
+
o.boostDuration ?? 1,
|
|
18
|
+
o.minimumSpeed ?? 2,
|
|
19
|
+
o.draftRange ?? 12,
|
|
20
|
+
o.draftDwell ?? 1,
|
|
21
|
+
o.rideHeight ?? 1.5,
|
|
22
|
+
o.spring ?? 20,
|
|
23
|
+
o.damping ?? 4,
|
|
24
|
+
o.maxAcceleration ?? 30,
|
|
25
|
+
o.energyCapacity ?? 100,
|
|
26
|
+
o.boostDrain ?? 20,
|
|
27
|
+
o.rechargeRate ?? 15,
|
|
28
|
+
o.attackDuration ?? 0.3,
|
|
29
|
+
o.attackCooldown ?? 1,
|
|
30
|
+
o.burnDuration ?? 3,
|
|
31
|
+
o.seatRange ?? 3
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function racingOperation(a) {
|
|
35
|
+
switch (a.type) {
|
|
36
|
+
case "drift-input":
|
|
37
|
+
return {
|
|
38
|
+
op: 0,
|
|
39
|
+
data: [+a.held, +a.supported, a.slipAngle, a.steering]
|
|
40
|
+
};
|
|
41
|
+
case "draft-target":
|
|
42
|
+
return { op: 4, data: [] };
|
|
43
|
+
case "clear-draft":
|
|
44
|
+
return { op: 5, data: [] };
|
|
45
|
+
case "item-weight":
|
|
46
|
+
return { op: 8, data: [a.firstRank, a.lastRank, a.item, a.weight] };
|
|
47
|
+
case "draw-item":
|
|
48
|
+
return { op: 9, data: [a.rank, a.racers, a.seed] };
|
|
49
|
+
case "use-item":
|
|
50
|
+
return { op: 10, data: [] };
|
|
51
|
+
case "route-point":
|
|
52
|
+
return { op: 12, data: [...a.position] };
|
|
53
|
+
case "launch-item":
|
|
54
|
+
return { op: 13, data: [] };
|
|
55
|
+
case "cancel-item":
|
|
56
|
+
return { op: 14, data: [] };
|
|
57
|
+
case "checkpoint":
|
|
58
|
+
return { op: 16, data: [...a.position, ...a.normal, a.radius] };
|
|
59
|
+
case "start-race":
|
|
60
|
+
return { op: 17, data: [a.laps] };
|
|
61
|
+
case "hover-track":
|
|
62
|
+
return { op: 20, data: [] };
|
|
63
|
+
case "clear-hover":
|
|
64
|
+
return { op: 21, data: [] };
|
|
65
|
+
case "boost-input":
|
|
66
|
+
return { op: 24, data: [+a.held] };
|
|
67
|
+
case "recharge-zone":
|
|
68
|
+
return { op: 25, data: [a.radius] };
|
|
69
|
+
case "energy-damage":
|
|
70
|
+
return { op: 26, data: [a.amount] };
|
|
71
|
+
case "side-attack":
|
|
72
|
+
return { op: 28, data: [a.direction] };
|
|
73
|
+
case "attack-contact":
|
|
74
|
+
return { op: 29, data: [] };
|
|
75
|
+
case "vehicle-damage":
|
|
76
|
+
return { op: 32, data: [a.amount] };
|
|
77
|
+
case "repair":
|
|
78
|
+
return { op: 33, data: [a.amount] };
|
|
79
|
+
case "reserve-seat":
|
|
80
|
+
return { op: 36, data: [a.seat, ...a.local] };
|
|
81
|
+
case "complete-entry":
|
|
82
|
+
return { op: 37, data: [] };
|
|
83
|
+
case "exit-seat":
|
|
84
|
+
return { op: 38, data: [...a.position] };
|
|
85
|
+
case "release-seat":
|
|
86
|
+
return { op: 39, data: [] };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
RACING_ABILITIES,
|
|
92
|
+
racingData,
|
|
93
|
+
racingOperation
|
|
94
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// src/lib/behaviors/skate-snowboard/types.ts
|
|
2
|
+
var SKATE_ABILITIES = [
|
|
3
|
+
"rail-grind-balance",
|
|
4
|
+
"wall-ride",
|
|
5
|
+
"manual-balance",
|
|
6
|
+
"ramp-lip-launch",
|
|
7
|
+
"unbanked-trick-combo",
|
|
8
|
+
"repeated-trick-devaluation",
|
|
9
|
+
"air-grab-trick",
|
|
10
|
+
"prewound-spin",
|
|
11
|
+
"landing-alignment-bail",
|
|
12
|
+
"trick-earned-boost-meter"
|
|
13
|
+
];
|
|
14
|
+
function skateData(o) {
|
|
15
|
+
return [
|
|
16
|
+
o.supportDistance ?? 0.4,
|
|
17
|
+
o.snapDistance ?? 0.8,
|
|
18
|
+
o.minimumSpeed ?? 2,
|
|
19
|
+
o.wallDuration ?? 1,
|
|
20
|
+
o.lipWindow ?? 0.2,
|
|
21
|
+
o.grabReleaseLead ?? 0.15,
|
|
22
|
+
o.minimumUpDot ?? 0.85,
|
|
23
|
+
o.minimumTravelDot ?? 0.8,
|
|
24
|
+
o.maximumImpactSpeed ?? 12,
|
|
25
|
+
o.minimumGrabTime ?? 0.2,
|
|
26
|
+
o.maximumSpinRate ?? 8,
|
|
27
|
+
o.maximumSpinAngle ?? 12.566371,
|
|
28
|
+
o.boostCapacity ?? 100,
|
|
29
|
+
o.boostDrain ?? 20,
|
|
30
|
+
o.boostPerPoint ?? 0.05,
|
|
31
|
+
o.jumpSpeed ?? 4
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function skateOperation(a) {
|
|
35
|
+
switch (a.type) {
|
|
36
|
+
case "grind":
|
|
37
|
+
return { op: 0, data: [...a.start, ...a.end] };
|
|
38
|
+
case "grind-balance":
|
|
39
|
+
return { op: 1, data: [a.correction] };
|
|
40
|
+
case "dismount":
|
|
41
|
+
return { op: 2, data: [...a.position] };
|
|
42
|
+
case "wall-attach":
|
|
43
|
+
return { op: 4, data: [...a.direction] };
|
|
44
|
+
case "wall-exit":
|
|
45
|
+
return { op: 5, data: [...a.direction] };
|
|
46
|
+
case "manual":
|
|
47
|
+
return { op: 8, data: [] };
|
|
48
|
+
case "manual-balance":
|
|
49
|
+
return { op: 9, data: [a.correction] };
|
|
50
|
+
case "end-manual":
|
|
51
|
+
return { op: 10, data: [] };
|
|
52
|
+
case "ramp-sample":
|
|
53
|
+
return { op: 12, data: [...a.tangent, +a.jump] };
|
|
54
|
+
case "trick":
|
|
55
|
+
return { op: 16, data: [a.trick, a.points] };
|
|
56
|
+
case "begin-combo":
|
|
57
|
+
return { op: 17, data: [] };
|
|
58
|
+
case "land-combo":
|
|
59
|
+
return { op: 18, data: [] };
|
|
60
|
+
case "bail-combo":
|
|
61
|
+
return { op: 19, data: [] };
|
|
62
|
+
case "preview-repeat":
|
|
63
|
+
return { op: 20, data: [a.trick] };
|
|
64
|
+
case "practice-repeat":
|
|
65
|
+
return { op: 21, data: [a.trick] };
|
|
66
|
+
case "reset-history":
|
|
67
|
+
return { op: 22, data: [] };
|
|
68
|
+
case "grab":
|
|
69
|
+
return { op: 24, data: [a.trick] };
|
|
70
|
+
case "release-grab":
|
|
71
|
+
return { op: 25, data: [] };
|
|
72
|
+
case "land-grab":
|
|
73
|
+
return { op: 26, data: [] };
|
|
74
|
+
case "wind":
|
|
75
|
+
return { op: 28, data: [a.direction] };
|
|
76
|
+
case "spin-takeoff":
|
|
77
|
+
return { op: 29, data: [] };
|
|
78
|
+
case "land-spin":
|
|
79
|
+
return { op: 30, data: [] };
|
|
80
|
+
case "begin-landing":
|
|
81
|
+
return { op: 32, data: [] };
|
|
82
|
+
case "resolve-landing":
|
|
83
|
+
return { op: 33, data: [] };
|
|
84
|
+
case "boost-trick":
|
|
85
|
+
return { op: 36, data: [a.trick, a.points] };
|
|
86
|
+
case "boost-input":
|
|
87
|
+
return { op: 37, data: [+a.held] };
|
|
88
|
+
case "land-boost":
|
|
89
|
+
return { op: 38, data: [] };
|
|
90
|
+
case "bail-boost":
|
|
91
|
+
return { op: 39, data: [] };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
SKATE_ABILITIES,
|
|
97
|
+
skateData,
|
|
98
|
+
skateOperation
|
|
99
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RPG_ABILITIES
|
|
3
|
+
} from "./chunk-VU4LTE2X.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/action-rpg/index.ts
|
|
12
|
+
var RpgSystem = 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.rpgState ??= null;
|
|
34
|
+
const slot = entity.runtimeHandle;
|
|
35
|
+
if (!Number.isInteger(slot) || slot < 0) continue;
|
|
36
|
+
if (!this.attached.has(entity)) {
|
|
37
|
+
if (!this.runtime.attachRpg(slot, this.abilities, link.ref.options)) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Rpg attachment requires valid options and an available rpg 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.rpgState = this.runtime?.queryRpg(slot) ?? null;
|
|
49
|
+
}
|
|
50
|
+
detach(link) {
|
|
51
|
+
const slot = this.attached.get(link.entity)?.slot;
|
|
52
|
+
if (slot !== void 0 && this.runtime && !this.runtime.detachRpg(slot) && this.runtime.queryRpg(slot))
|
|
53
|
+
throw new Error("Failed to detach rpg policy.");
|
|
54
|
+
this.attached.delete(link.entity);
|
|
55
|
+
link.entity.rpgState = 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
|
+
maximumHealth: 100,
|
|
67
|
+
maximumMana: 50
|
|
68
|
+
},
|
|
69
|
+
systemFactory: (ctx) => new RpgSystem(
|
|
70
|
+
/* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
|
|
71
|
+
abilities,
|
|
72
|
+
ctx.wasmStage ?? null,
|
|
73
|
+
ctx.getBehaviorLinks
|
|
74
|
+
)
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
var ActionRpgBehavior = descriptor("action-rpg", RPG_ABILITIES);
|
|
78
|
+
var EquipmentStatAggregationBehavior = descriptor(
|
|
79
|
+
"equipment-stat-aggregation",
|
|
80
|
+
["equipment-stat-aggregation"]
|
|
81
|
+
);
|
|
82
|
+
var DurabilityAndRepairBehavior = descriptor("durability-and-repair", [
|
|
83
|
+
"durability-and-repair"
|
|
84
|
+
]);
|
|
85
|
+
var AffixBudgetGenerationBehavior = descriptor("affix-budget-generation", [
|
|
86
|
+
"affix-budget-generation"
|
|
87
|
+
]);
|
|
88
|
+
var DeathDropOwnershipBehavior = descriptor("death-drop-ownership", [
|
|
89
|
+
"death-drop-ownership"
|
|
90
|
+
]);
|
|
91
|
+
var ConsumableBeltSlotsBehavior = descriptor("consumable-belt-slots", [
|
|
92
|
+
"consumable-belt-slots"
|
|
93
|
+
]);
|
|
94
|
+
var SeededLootTableBehavior = descriptor("seeded-loot-table", [
|
|
95
|
+
"seeded-loot-table"
|
|
96
|
+
]);
|
|
97
|
+
var DamageToResourceLeechBehavior = descriptor("damage-to-resource-leech", [
|
|
98
|
+
"damage-to-resource-leech"
|
|
99
|
+
]);
|
|
100
|
+
var TypedResistanceResolutionBehavior = descriptor(
|
|
101
|
+
"typed-resistance-resolution",
|
|
102
|
+
["typed-resistance-resolution"]
|
|
103
|
+
);
|
|
104
|
+
var AutonomousFamiliarBehavior = descriptor("autonomous-familiar", [
|
|
105
|
+
"autonomous-familiar"
|
|
106
|
+
]);
|
|
107
|
+
var ResourceDrainingTransformationBehavior = descriptor(
|
|
108
|
+
"resource-draining-transformation",
|
|
109
|
+
["resource-draining-transformation"]
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
ActionRpgBehavior,
|
|
114
|
+
EquipmentStatAggregationBehavior,
|
|
115
|
+
DurabilityAndRepairBehavior,
|
|
116
|
+
AffixBudgetGenerationBehavior,
|
|
117
|
+
DeathDropOwnershipBehavior,
|
|
118
|
+
ConsumableBeltSlotsBehavior,
|
|
119
|
+
SeededLootTableBehavior,
|
|
120
|
+
DamageToResourceLeechBehavior,
|
|
121
|
+
TypedResistanceResolutionBehavior,
|
|
122
|
+
AutonomousFamiliarBehavior,
|
|
123
|
+
ResourceDrainingTransformationBehavior
|
|
124
|
+
};
|
|
@@ -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/cooldown/cooldown-store.ts
|
|
6
9
|
import { proxy } from "valtio/vanilla";
|
|
@@ -101,6 +104,7 @@ function ensureCooldownEntriesRegistered(ref) {
|
|
|
101
104
|
}
|
|
102
105
|
var CooldownBehavior = defineBehavior({
|
|
103
106
|
name: "cooldown",
|
|
107
|
+
metadata: BUILTIN_BEHAVIORS["cooldown"],
|
|
104
108
|
defaultOptions: { cooldowns: {} },
|
|
105
109
|
systemFactory: (ctx) => new CooldownSystem(ctx.getBehaviorLinks),
|
|
106
110
|
createHandle: createCooldownHandle
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineBehavior
|
|
3
|
+
} from "./chunk-5SMXQ6AU.js";
|
|
4
|
+
import {
|
|
5
|
+
BUILTIN_BEHAVIORS
|
|
6
|
+
} from "./chunk-S44ZHYE6.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/behaviors/spatial-puzzles/index.ts
|
|
9
|
+
var PuzzleSystem = class {
|
|
10
|
+
constructor(key, ability, runtime, links) {
|
|
11
|
+
this.key = key;
|
|
12
|
+
this.ability = ability;
|
|
13
|
+
this.runtime = runtime;
|
|
14
|
+
this.links = links;
|
|
15
|
+
}
|
|
16
|
+
key;
|
|
17
|
+
ability;
|
|
18
|
+
runtime;
|
|
19
|
+
links;
|
|
20
|
+
attached = /* @__PURE__ */ new Map();
|
|
21
|
+
update() {
|
|
22
|
+
if (!this.runtime) return;
|
|
23
|
+
const links = [...this.links?.(this.key) ?? []];
|
|
24
|
+
for (const [entity, { slot, ref }] of this.attached)
|
|
25
|
+
if (!links.some((l) => l.entity === entity && l.ref === ref) || entity.runtimeHandle !== slot)
|
|
26
|
+
this.detach({ entity, ref });
|
|
27
|
+
for (const link of links) {
|
|
28
|
+
const e = link.entity, slot = e.runtimeHandle;
|
|
29
|
+
e.$puzzle ??= [];
|
|
30
|
+
e.puzzleState ??= null;
|
|
31
|
+
if (!Number.isInteger(slot) || slot < 0) continue;
|
|
32
|
+
if (!this.attached.has(e)) {
|
|
33
|
+
if (!this.runtime.attachPuzzle(
|
|
34
|
+
slot,
|
|
35
|
+
this.ability,
|
|
36
|
+
link.ref.options
|
|
37
|
+
))
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Puzzle requires a compatible body and exclusive ownership."
|
|
40
|
+
);
|
|
41
|
+
this.attached.set(e, { slot, ref: link.ref });
|
|
42
|
+
}
|
|
43
|
+
while (e.$puzzle.length) {
|
|
44
|
+
if (!this.runtime.puzzleCommand(slot, e.$puzzle[0])) break;
|
|
45
|
+
e.$puzzle.shift();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
postUpdate() {
|
|
50
|
+
for (const [e, { slot }] of this.attached)
|
|
51
|
+
e.puzzleState = this.runtime?.queryPuzzle(slot) ?? null;
|
|
52
|
+
}
|
|
53
|
+
detach(link) {
|
|
54
|
+
const slot = this.attached.get(link.entity)?.slot;
|
|
55
|
+
if (slot !== void 0 && this.runtime && !this.runtime.detachPuzzle(slot) && this.runtime.queryPuzzle(slot))
|
|
56
|
+
throw new Error(
|
|
57
|
+
"Platform needs clearance before restoring collision and detaching."
|
|
58
|
+
);
|
|
59
|
+
this.attached.delete(link.entity);
|
|
60
|
+
link.entity.puzzleState = null;
|
|
61
|
+
}
|
|
62
|
+
destroy() {
|
|
63
|
+
for (const [entity, { ref }] of this.attached)
|
|
64
|
+
this.detach({ entity, ref });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
function descriptor(name) {
|
|
68
|
+
return defineBehavior({
|
|
69
|
+
name,
|
|
70
|
+
metadata: BUILTIN_BEHAVIORS[name],
|
|
71
|
+
defaultOptions: {},
|
|
72
|
+
systemFactory: (ctx) => new PuzzleSystem(
|
|
73
|
+
/* @__PURE__ */ Symbol.for(`zylem:behavior:${name}`),
|
|
74
|
+
name,
|
|
75
|
+
ctx.wasmStage ?? null,
|
|
76
|
+
ctx.getBehaviorLinks
|
|
77
|
+
)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var WeightedPressureSwitchBehavior = descriptor(
|
|
81
|
+
"weighted-pressure-switch"
|
|
82
|
+
);
|
|
83
|
+
var GridConstrainedPushBlockBehavior = descriptor(
|
|
84
|
+
"grid-constrained-push-block"
|
|
85
|
+
);
|
|
86
|
+
var MirrorBeamRoutingBehavior = descriptor("mirror-beam-routing");
|
|
87
|
+
var ConductiveContactNetworkBehavior = descriptor(
|
|
88
|
+
"conductive-contact-network"
|
|
89
|
+
);
|
|
90
|
+
var MaterialIgnitionSpreadBehavior = descriptor(
|
|
91
|
+
"material-ignition-spread"
|
|
92
|
+
);
|
|
93
|
+
var FreezeAndShatterBehavior = descriptor("freeze-and-shatter");
|
|
94
|
+
var StasisImpulseStorageBehavior = descriptor(
|
|
95
|
+
"stasis-impulse-storage"
|
|
96
|
+
);
|
|
97
|
+
var MagneticObjectManipulationBehavior = descriptor(
|
|
98
|
+
"magnetic-object-manipulation"
|
|
99
|
+
);
|
|
100
|
+
var WaterLevelMechanismBehavior = descriptor("water-level-mechanism");
|
|
101
|
+
var TimedSolidPlatformBehavior = descriptor("timed-solid-platform");
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
WeightedPressureSwitchBehavior,
|
|
105
|
+
GridConstrainedPushBlockBehavior,
|
|
106
|
+
MirrorBeamRoutingBehavior,
|
|
107
|
+
ConductiveContactNetworkBehavior,
|
|
108
|
+
MaterialIgnitionSpreadBehavior,
|
|
109
|
+
FreezeAndShatterBehavior,
|
|
110
|
+
StasisImpulseStorageBehavior,
|
|
111
|
+
MagneticObjectManipulationBehavior,
|
|
112
|
+
WaterLevelMechanismBehavior,
|
|
113
|
+
TimedSolidPlatformBehavior
|
|
114
|
+
};
|