@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,4527 @@
|
|
|
1
|
+
import { B as BehaviorMetadata } from './behavior-metadata-Drm1zxI2.js';
|
|
2
|
+
import { StageWasmExports, RuntimeCompatibility, RuntimeBehaviorName } from '@zylem/runtime';
|
|
3
|
+
|
|
4
|
+
type VelocityIntentMode = 'replace' | 'add';
|
|
5
|
+
interface VelocityIntent {
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
z?: number;
|
|
9
|
+
mode: VelocityIntentMode;
|
|
10
|
+
priority?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Transform state managed by Valtio for per-frame physics intent accumulation.
|
|
14
|
+
*
|
|
15
|
+
* This store accumulates transformation intents during the frame,
|
|
16
|
+
* then applies them all at once after onUpdate() callbacks complete.
|
|
17
|
+
*
|
|
18
|
+
* Design decisions:
|
|
19
|
+
* - Position: Accumulated deltas (additive)
|
|
20
|
+
* - Rotation: Last value wins (replacement)
|
|
21
|
+
* - Velocity: Accumulated deltas (additive)
|
|
22
|
+
* - Angular velocity: Accumulated deltas (additive)
|
|
23
|
+
*/
|
|
24
|
+
interface TransformState {
|
|
25
|
+
/** Position deltas to be applied (accumulated) */
|
|
26
|
+
position: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
z: number;
|
|
30
|
+
};
|
|
31
|
+
/** Rotation quaternion (last value wins) */
|
|
32
|
+
rotation: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
z: number;
|
|
36
|
+
w: number;
|
|
37
|
+
};
|
|
38
|
+
/** Linear velocity (accumulated) */
|
|
39
|
+
velocity: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
z: number;
|
|
43
|
+
};
|
|
44
|
+
/** Angular velocity (accumulated) */
|
|
45
|
+
angularVelocity: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
z: number;
|
|
49
|
+
};
|
|
50
|
+
/** Per-source velocity intents composed once per frame */
|
|
51
|
+
velocityChannels: Record<string, VelocityIntent>;
|
|
52
|
+
/** Dirty flags to track what needs to be applied */
|
|
53
|
+
dirty: {
|
|
54
|
+
position: boolean;
|
|
55
|
+
rotation: boolean;
|
|
56
|
+
velocityX: boolean;
|
|
57
|
+
velocityY: boolean;
|
|
58
|
+
velocityZ: boolean;
|
|
59
|
+
velocityChannels: boolean;
|
|
60
|
+
angularVelocity: boolean;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a new transform store with optional initial values.
|
|
65
|
+
* The store is a Valtio proxy, making it reactive for debugging/visualization.
|
|
66
|
+
*
|
|
67
|
+
* @param initial Optional initial state values
|
|
68
|
+
* @returns Reactive transform state
|
|
69
|
+
*/
|
|
70
|
+
declare function createTransformStore(initial?: Partial<TransformState>): TransformState;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Minimal, runtime-agnostic entity options contract.
|
|
74
|
+
*
|
|
75
|
+
* The full engine entity (in `@zylem/game-lib`) provides a richer options type,
|
|
76
|
+
* but behaviors only rely on this loose shape.
|
|
77
|
+
*/
|
|
78
|
+
interface GameEntityOptions {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
name?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Structural stand-in for the engine `GameEntity`.
|
|
84
|
+
*
|
|
85
|
+
* Behaviors annotate against this loose contract so that `@zylem/behaviors`
|
|
86
|
+
* (and its `@zylem/behaviors/core` surface) never has to depend on the concrete
|
|
87
|
+
* `@zylem/game-lib` entity implementation. The real engine entity is
|
|
88
|
+
* structurally assignable to this type.
|
|
89
|
+
*/
|
|
90
|
+
declare class GameEntity<TOptions = unknown> {
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
uuid: string;
|
|
93
|
+
name: string;
|
|
94
|
+
type: string;
|
|
95
|
+
options?: TOptions & Record<string, unknown>;
|
|
96
|
+
group: any;
|
|
97
|
+
mesh?: any;
|
|
98
|
+
materials?: any[];
|
|
99
|
+
/** Opaque host-owned physics references (never inspected by behaviors). */
|
|
100
|
+
body: unknown | null;
|
|
101
|
+
collider: unknown | null;
|
|
102
|
+
colliderDesc?: any;
|
|
103
|
+
colliderDescs: any[];
|
|
104
|
+
bodyDesc?: any;
|
|
105
|
+
physicsAttached: boolean;
|
|
106
|
+
runtimeHandle?: number;
|
|
107
|
+
transformStore?: TransformState;
|
|
108
|
+
nodeDestroy?: any;
|
|
109
|
+
isInstanced?: boolean;
|
|
110
|
+
private __behaviorRefs;
|
|
111
|
+
create(): this;
|
|
112
|
+
onCleanup(callback: () => void): this;
|
|
113
|
+
setPosition(_x: number, _y: number, _z: number): void;
|
|
114
|
+
setRotation(_x: number, _y: number, _z: number): void;
|
|
115
|
+
setRotationZ(_z: number): void;
|
|
116
|
+
setScale(_x: number, _y: number, _z: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Attach a behavior to this entity. The real engine entity does substantially
|
|
119
|
+
* more, but this functional stub stores the merged ref and builds the handle
|
|
120
|
+
* so descriptor/handle logic (and tests that drive behaviors directly) work
|
|
121
|
+
* without the full engine.
|
|
122
|
+
*/
|
|
123
|
+
use<O extends Record<string, any>, H extends Record<string, any> = Record<string, never>>(descriptor: BehaviorDescriptor<O, H>, options?: Partial<O>): BehaviorHandle<O, H>;
|
|
124
|
+
/** Live behavior refs attached via {@link use}. */
|
|
125
|
+
getBehaviorRefs(): BehaviorRef<any>[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Factory contract injected into behavior systems via
|
|
129
|
+
* {@link BehaviorSystemContext.createEntity}. The host engine supplies the real
|
|
130
|
+
* entity factory at stage-construction time.
|
|
131
|
+
*/
|
|
132
|
+
type CreateEntityFn = (options?: Partial<GameEntityOptions>) => GameEntity<GameEntityOptions>;
|
|
133
|
+
|
|
134
|
+
/** B191–B200. Milliseconds and input edges are explicit, ordered host data.
|
|
135
|
+
* Input timestamps are corrected by subtracting latencyMs; chart/clock times are already calibrated.
|
|
136
|
+
* Submit queued inputs in timestamp order BEFORE advancing the clock watermark. Physics/render
|
|
137
|
+
* stepping never moves chart time. Inclusive judgment windows; a miss finalizes at lateWindow+1ms.
|
|
138
|
+
* 64 notes, 8 tempo segments, 8 nonoverlapping score phrases, 8 unique scene transitions.
|
|
139
|
+
* Setup is immutable after start. Note kinds: 0 tap, 1 hold/release, 2 sustain.
|
|
140
|
+
* Results: 0 pending, 1 perfect, 2 good, 3 miss, 4 canceled; phases: 0 queued, 1 held, 2 final.
|
|
141
|
+
* Lane masks use five bits (1..31). Scene 1 starts; transition IDs are unique in 2..255.
|
|
142
|
+
* Beat units are integer ticks, 480 per quarter note. Tempo changes must precede beat notes.
|
|
143
|
+
* Pause freezes chart time; the host rebases its audio clock on resume. Seeking is forward-only,
|
|
144
|
+
* while paused, and cancels skipped/held notes without score, meter changes or replay rewards.
|
|
145
|
+
* A successful sustain earns 10 points per completed 100ms since max(head time, press time).
|
|
146
|
+
* A score phrase credits once after all its notes succeed. 50 charge buys 2000ms of 2x scoring;
|
|
147
|
+
* the end timestamp is exclusive. Hits earn 300/100 base points through the same score pipeline.
|
|
148
|
+
* Failure is terminal; remaining notes are canceled. Detach/despawn releases all session state.
|
|
149
|
+
* Values and request IDs are exact integers within 0..0xffffff. Request IDs strictly increase.
|
|
150
|
+
*/
|
|
151
|
+
declare const RHYTHM_ABILITIES: readonly ["timestamped-rhythm-judgment", "hold-release-rhythm", "call-and-response-pattern", "tempo-map-chart-player", "fret-chord-strum", "hammer-on-pull-off-chain", "sustain-note-tracking", "phrase-earned-score-power", "rhythm-scene-remix", "performance-failure-meter"];
|
|
152
|
+
declare const RHYTHM_EVENTS: readonly ["timestamped-rhythm-judgment", "hold-release-rhythm", "call-and-response-pattern", "tempo-map-chart-player", "fret-chord-strum", "hammer-on-pull-off-chain", "sustain-note-tracking", "phrase-earned-score-power", "rhythm-scene-remix", "performance-failure-meter", "chart-or-clock", "note-result", "failed", "scene-changed", "cue"];
|
|
153
|
+
type RhythmAbility = (typeof RHYTHM_ABILITIES)[number];
|
|
154
|
+
type RhythmEvent = (typeof RHYTHM_EVENTS)[number];
|
|
155
|
+
interface RhythmOptions {
|
|
156
|
+
perfectMs?: number;
|
|
157
|
+
goodMs?: number;
|
|
158
|
+
lateMs?: number;
|
|
159
|
+
latencyMs?: number;
|
|
160
|
+
}
|
|
161
|
+
type RhythmAction = {
|
|
162
|
+
requestId: number;
|
|
163
|
+
} & ({
|
|
164
|
+
type: "hit";
|
|
165
|
+
note: number;
|
|
166
|
+
timestamp: number;
|
|
167
|
+
lanes: number;
|
|
168
|
+
scene: number;
|
|
169
|
+
} | {
|
|
170
|
+
type: "hold-press";
|
|
171
|
+
note: number;
|
|
172
|
+
timestamp: number;
|
|
173
|
+
lanes: number;
|
|
174
|
+
scene: number;
|
|
175
|
+
} | {
|
|
176
|
+
type: "hold-release";
|
|
177
|
+
note: number;
|
|
178
|
+
timestamp: number;
|
|
179
|
+
lanes: number;
|
|
180
|
+
scene: number;
|
|
181
|
+
} | {
|
|
182
|
+
type: "call";
|
|
183
|
+
start: number;
|
|
184
|
+
response: number;
|
|
185
|
+
duration: number;
|
|
186
|
+
} | {
|
|
187
|
+
type: "cue";
|
|
188
|
+
offset: number;
|
|
189
|
+
lanes: number;
|
|
190
|
+
} | {
|
|
191
|
+
type: "response";
|
|
192
|
+
note: number;
|
|
193
|
+
timestamp: number;
|
|
194
|
+
lanes: number;
|
|
195
|
+
scene: number;
|
|
196
|
+
} | {
|
|
197
|
+
type: "tempo";
|
|
198
|
+
beat: number;
|
|
199
|
+
bpm: number;
|
|
200
|
+
} | {
|
|
201
|
+
type: "beat-note";
|
|
202
|
+
beat: number;
|
|
203
|
+
lanes: number;
|
|
204
|
+
scene: number;
|
|
205
|
+
} | {
|
|
206
|
+
type: "chart-hit";
|
|
207
|
+
note: number;
|
|
208
|
+
timestamp: number;
|
|
209
|
+
lanes: number;
|
|
210
|
+
scene: number;
|
|
211
|
+
} | {
|
|
212
|
+
type: "seek";
|
|
213
|
+
timestamp: number;
|
|
214
|
+
} | {
|
|
215
|
+
type: "strum";
|
|
216
|
+
note: number;
|
|
217
|
+
timestamp: number;
|
|
218
|
+
lanes: number;
|
|
219
|
+
scene: number;
|
|
220
|
+
} | {
|
|
221
|
+
type: "chain-strum";
|
|
222
|
+
note: number;
|
|
223
|
+
timestamp: number;
|
|
224
|
+
lanes: number;
|
|
225
|
+
scene: number;
|
|
226
|
+
} | {
|
|
227
|
+
type: "fret-edge";
|
|
228
|
+
note: number;
|
|
229
|
+
timestamp: number;
|
|
230
|
+
lanes: number;
|
|
231
|
+
scene: number;
|
|
232
|
+
} | {
|
|
233
|
+
type: "sustain-press";
|
|
234
|
+
note: number;
|
|
235
|
+
timestamp: number;
|
|
236
|
+
lanes: number;
|
|
237
|
+
scene: number;
|
|
238
|
+
} | {
|
|
239
|
+
type: "sustain-release";
|
|
240
|
+
note: number;
|
|
241
|
+
timestamp: number;
|
|
242
|
+
lanes: number;
|
|
243
|
+
scene: number;
|
|
244
|
+
} | {
|
|
245
|
+
type: "phrase";
|
|
246
|
+
first: number;
|
|
247
|
+
last: number;
|
|
248
|
+
reward: number;
|
|
249
|
+
} | {
|
|
250
|
+
type: "activate-power";
|
|
251
|
+
timestamp: number;
|
|
252
|
+
} | {
|
|
253
|
+
type: "power-hit";
|
|
254
|
+
note: number;
|
|
255
|
+
timestamp: number;
|
|
256
|
+
lanes: number;
|
|
257
|
+
scene: number;
|
|
258
|
+
} | {
|
|
259
|
+
type: "transition";
|
|
260
|
+
timestamp: number;
|
|
261
|
+
scene: number;
|
|
262
|
+
} | {
|
|
263
|
+
type: "remix-hit";
|
|
264
|
+
note: number;
|
|
265
|
+
timestamp: number;
|
|
266
|
+
lanes: number;
|
|
267
|
+
scene: number;
|
|
268
|
+
} | {
|
|
269
|
+
type: "performance";
|
|
270
|
+
initial: number;
|
|
271
|
+
hitGain: number;
|
|
272
|
+
missLoss: number;
|
|
273
|
+
threshold: number;
|
|
274
|
+
} | {
|
|
275
|
+
type: "performance-hit";
|
|
276
|
+
note: number;
|
|
277
|
+
timestamp: number;
|
|
278
|
+
lanes: number;
|
|
279
|
+
scene: number;
|
|
280
|
+
} | {
|
|
281
|
+
type: "note";
|
|
282
|
+
kind: number;
|
|
283
|
+
timestamp: number;
|
|
284
|
+
end: number;
|
|
285
|
+
lanes: number;
|
|
286
|
+
scene: number;
|
|
287
|
+
eligible: number;
|
|
288
|
+
} | {
|
|
289
|
+
type: "start";
|
|
290
|
+
} | {
|
|
291
|
+
type: "clock";
|
|
292
|
+
timestamp: number;
|
|
293
|
+
} | {
|
|
294
|
+
type: "pause";
|
|
295
|
+
paused: number;
|
|
296
|
+
});
|
|
297
|
+
interface RhythmNote {
|
|
298
|
+
kind: number;
|
|
299
|
+
timestamp: number;
|
|
300
|
+
end: number;
|
|
301
|
+
lanes: number;
|
|
302
|
+
scene: number;
|
|
303
|
+
eligible: boolean;
|
|
304
|
+
phase: number;
|
|
305
|
+
result: number;
|
|
306
|
+
headResult: number;
|
|
307
|
+
offset: number;
|
|
308
|
+
releaseOffset: number;
|
|
309
|
+
ticks: number;
|
|
310
|
+
cue: number;
|
|
311
|
+
responseCue: boolean;
|
|
312
|
+
}
|
|
313
|
+
interface RhythmState {
|
|
314
|
+
abilities: RhythmAbility[];
|
|
315
|
+
lastRequest: number;
|
|
316
|
+
revision: number;
|
|
317
|
+
clock: number;
|
|
318
|
+
started: boolean;
|
|
319
|
+
paused: boolean;
|
|
320
|
+
score: number;
|
|
321
|
+
hits: number;
|
|
322
|
+
misses: number;
|
|
323
|
+
scene: number;
|
|
324
|
+
held: number;
|
|
325
|
+
chain: boolean;
|
|
326
|
+
meter: number;
|
|
327
|
+
powerUntil: number;
|
|
328
|
+
failed: boolean;
|
|
329
|
+
performance: number;
|
|
330
|
+
transitions: number;
|
|
331
|
+
cues: number;
|
|
332
|
+
tempoSegments: number;
|
|
333
|
+
settledPhrases: number;
|
|
334
|
+
callPhase: number;
|
|
335
|
+
chartCursor: number;
|
|
336
|
+
patternResult: number;
|
|
337
|
+
notes: RhythmNote[];
|
|
338
|
+
}
|
|
339
|
+
declare function rhythmData(o: RhythmOptions): number[];
|
|
340
|
+
declare function rhythmOperation(a: RhythmAction): {
|
|
341
|
+
op: number;
|
|
342
|
+
data: number[];
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/** B181–B190. Board cells use x=0..width-1, y=0 at the bottom; storage has stride 8.
|
|
346
|
+
* Configure cells once before start-board. Colors 1..colors; 0 is empty.
|
|
347
|
+
* Phases: 0 idle, 1 swapping, 2 clearing, 3 settling, 4 garbage, 5 converting.
|
|
348
|
+
* Clock is explicit monotonic integer milliseconds, 0..0xffffff, <=60000 per command.
|
|
349
|
+
* Frame stepping publishes events and processes physical contacts; it never advances this clock.
|
|
350
|
+
* Swaps/matches/collapse reject busy boards. Clearing keeps occupancy until its deadline.
|
|
351
|
+
* Only panels falling through holes from the previous credited clear continue a chain.
|
|
352
|
+
* Pauses suspend stack rise, not danger grace. Full top rows never silently disappear.
|
|
353
|
+
* Pinball balls require enabled centered solid dynamic spheres with CCD; flippers require
|
|
354
|
+
* CCD dynamic paddles and fixed anchors, aligned at the supplied local pivot (Z-axis hinge).
|
|
355
|
+
* Distances are meters, angles radians, impulses N·s, motor maxForce N·m.
|
|
356
|
+
* The host owns bodies and exclusive motion control; detach removes the owned joint.
|
|
357
|
+
* A plunger can launch up to eight distinct ball identities per attachment, once each.
|
|
358
|
+
* Bumpers require separation AND cooldown before another kick. Mode hits require actual
|
|
359
|
+
* solid contact with registered targets, in sequence, before an exclusive deadline.
|
|
360
|
+
* Mode phases: 0 ready, 1 active, 2 won, 3 failed; one mode attempt per attachment.
|
|
361
|
+
* Configure-once profiles and rejected commands never replenish or partially mutate state.
|
|
362
|
+
*/
|
|
363
|
+
declare const MATCHING_ABILITIES: readonly ["adjacent-panel-swap", "simultaneous-match-clear", "column-collapse", "cascade-chain-credit", "rising-stack-pressure", "garbage-block-conversion", "powered-pinball-flipper", "spring-plunger-launch", "active-bumper-kick", "pinball-mode-objectives"];
|
|
364
|
+
declare const MATCHING_EVENTS: readonly ["adjacent-panel-swap", "simultaneous-match-clear", "column-collapse", "cascade-chain-credit", "rising-stack-pressure", "garbage-block-conversion", "powered-pinball-flipper", "spring-plunger-launch", "active-bumper-kick", "pinball-mode-objectives", "board-or-clock", "bumper-contact"];
|
|
365
|
+
type MatchingAbility = (typeof MATCHING_ABILITIES)[number];
|
|
366
|
+
type MatchingEvent = (typeof MATCHING_EVENTS)[number];
|
|
367
|
+
interface MatchingOptions {
|
|
368
|
+
width?: number;
|
|
369
|
+
height?: number;
|
|
370
|
+
colors?: number;
|
|
371
|
+
swapMs?: number;
|
|
372
|
+
clearMs?: number;
|
|
373
|
+
settleMs?: number;
|
|
374
|
+
riseMs?: number;
|
|
375
|
+
dangerMs?: number;
|
|
376
|
+
chainWindowMs?: number;
|
|
377
|
+
seed?: number;
|
|
378
|
+
launchReach?: number;
|
|
379
|
+
}
|
|
380
|
+
/** Request IDs strictly increase in 1..0xffffff. Common setup and clock commands work
|
|
381
|
+
* in every standalone selection. All deadlines use the component clock, not wall time. */
|
|
382
|
+
type MatchingAction<T = number> = {
|
|
383
|
+
requestId: number;
|
|
384
|
+
} & ({
|
|
385
|
+
type: "swap";
|
|
386
|
+
x: number;
|
|
387
|
+
y: number;
|
|
388
|
+
toX: number;
|
|
389
|
+
toY: number;
|
|
390
|
+
} | {
|
|
391
|
+
type: "match";
|
|
392
|
+
} | {
|
|
393
|
+
type: "collapse";
|
|
394
|
+
} | {
|
|
395
|
+
type: "chain-match";
|
|
396
|
+
} | {
|
|
397
|
+
type: "chain-collapse";
|
|
398
|
+
} | {
|
|
399
|
+
type: "pressure";
|
|
400
|
+
} | {
|
|
401
|
+
type: "pause-rise";
|
|
402
|
+
duration: number;
|
|
403
|
+
} | {
|
|
404
|
+
type: "garbage";
|
|
405
|
+
x: number;
|
|
406
|
+
y: number;
|
|
407
|
+
width: number;
|
|
408
|
+
height: number;
|
|
409
|
+
region: number;
|
|
410
|
+
} | {
|
|
411
|
+
type: "garbage-match";
|
|
412
|
+
} | {
|
|
413
|
+
type: "flipper";
|
|
414
|
+
target: T;
|
|
415
|
+
pivotX: number;
|
|
416
|
+
pivotY: number;
|
|
417
|
+
pivotZ: number;
|
|
418
|
+
rest: number;
|
|
419
|
+
active: number;
|
|
420
|
+
stiffness: number;
|
|
421
|
+
damping: number;
|
|
422
|
+
maxForce: number;
|
|
423
|
+
} | {
|
|
424
|
+
type: "flipper-input";
|
|
425
|
+
pressed: number;
|
|
426
|
+
} | {
|
|
427
|
+
type: "stage-ball";
|
|
428
|
+
target: T;
|
|
429
|
+
directionX: number;
|
|
430
|
+
directionY: number;
|
|
431
|
+
directionZ: number;
|
|
432
|
+
maxImpulse: number;
|
|
433
|
+
} | {
|
|
434
|
+
type: "pull";
|
|
435
|
+
amount: number;
|
|
436
|
+
} | {
|
|
437
|
+
type: "launch";
|
|
438
|
+
} | {
|
|
439
|
+
type: "cancel-launch";
|
|
440
|
+
} | {
|
|
441
|
+
type: "bumper";
|
|
442
|
+
target: T;
|
|
443
|
+
impulse: number;
|
|
444
|
+
cooldown: number;
|
|
445
|
+
reward: number;
|
|
446
|
+
} | {
|
|
447
|
+
type: "bumper-hit";
|
|
448
|
+
} | {
|
|
449
|
+
type: "mode";
|
|
450
|
+
length: number;
|
|
451
|
+
duration: number;
|
|
452
|
+
reward: number;
|
|
453
|
+
target0: number;
|
|
454
|
+
target1: number;
|
|
455
|
+
target2: number;
|
|
456
|
+
target3: number;
|
|
457
|
+
target4: number;
|
|
458
|
+
target5: number;
|
|
459
|
+
target6: number;
|
|
460
|
+
target7: number;
|
|
461
|
+
} | {
|
|
462
|
+
type: "mode-start";
|
|
463
|
+
target: T;
|
|
464
|
+
} | {
|
|
465
|
+
type: "mode-hit";
|
|
466
|
+
target: T;
|
|
467
|
+
row: number;
|
|
468
|
+
} | {
|
|
469
|
+
type: "mode-cancel";
|
|
470
|
+
} | {
|
|
471
|
+
type: "cell";
|
|
472
|
+
x: number;
|
|
473
|
+
y: number;
|
|
474
|
+
color: number;
|
|
475
|
+
} | {
|
|
476
|
+
type: "start-board";
|
|
477
|
+
} | {
|
|
478
|
+
type: "clock";
|
|
479
|
+
timestamp: number;
|
|
480
|
+
} | {
|
|
481
|
+
type: "mode-target";
|
|
482
|
+
target: T;
|
|
483
|
+
row: number;
|
|
484
|
+
});
|
|
485
|
+
interface MatchingCell {
|
|
486
|
+
color: number;
|
|
487
|
+
phase: number;
|
|
488
|
+
generation: number;
|
|
489
|
+
garbage: number;
|
|
490
|
+
}
|
|
491
|
+
interface MatchingState {
|
|
492
|
+
abilities: MatchingAbility[];
|
|
493
|
+
cells: MatchingCell[];
|
|
494
|
+
pattern: number[];
|
|
495
|
+
targets: boolean[];
|
|
496
|
+
lastRequest: number;
|
|
497
|
+
revision: number;
|
|
498
|
+
clock: number;
|
|
499
|
+
width: number;
|
|
500
|
+
height: number;
|
|
501
|
+
started: boolean;
|
|
502
|
+
chain: number;
|
|
503
|
+
score: number;
|
|
504
|
+
cleared: number;
|
|
505
|
+
lastMatch: number;
|
|
506
|
+
rows: number;
|
|
507
|
+
riseProgress: number;
|
|
508
|
+
dangerElapsed: number;
|
|
509
|
+
lost: boolean;
|
|
510
|
+
generation: number;
|
|
511
|
+
flipperConfigured: boolean;
|
|
512
|
+
flipperPressed: boolean;
|
|
513
|
+
flipperAngle: number;
|
|
514
|
+
charge: number;
|
|
515
|
+
staged: boolean;
|
|
516
|
+
launches: number;
|
|
517
|
+
bumperHits: number;
|
|
518
|
+
bumperReadyAt: number;
|
|
519
|
+
modePhase: number;
|
|
520
|
+
modeCursor: number;
|
|
521
|
+
modeDeadline: number;
|
|
522
|
+
wins: number;
|
|
523
|
+
patternLength: number;
|
|
524
|
+
pressure: boolean;
|
|
525
|
+
pauseUntil: number;
|
|
526
|
+
chainUntil: number;
|
|
527
|
+
}
|
|
528
|
+
declare function matchingData(o: MatchingOptions): number[];
|
|
529
|
+
declare function matchingOperation<T>(a: MatchingAction<T>): {
|
|
530
|
+
op: number;
|
|
531
|
+
data: number[];
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/** B171–B180. Eight rows per table; 128 contexts. Calendar commands close exactly one day.
|
|
535
|
+
* Day 0 is weekday 0; seasons are floor(day / seasonLength) % 4. Masks select bits 0..3/0..6.
|
|
536
|
+
* Daily order: growth/care, calendar, withering, moisture decay + new-day rain, reward reset,
|
|
537
|
+
* fruit regrowth, routine. Frame stepping never advances the calendar or fishing clock.
|
|
538
|
+
* Plot phases: 0 empty, 1 growing, 2 ripe, 3 withered. Stages 0..2 grow; 3 is ripe.
|
|
539
|
+
* Animal care flags: 1 feed, 2 affection, 4 medicine. Product capacity is one per animal.
|
|
540
|
+
* Relationship kinds: 0 gift, 1 request, 2 offense. Rewards are once per kind/person/day;
|
|
541
|
+
* independent increasing event serials protect replay after the eight-entry history wraps.
|
|
542
|
+
* Fish phases: 0 idle, 1 waiting, 2 bite, 3 hooked, 4 lost. Integer millisecond timestamps
|
|
543
|
+
* are monotonic within this component. Hook interval is [biteAt, deadline); early reels lose.
|
|
544
|
+
* Water is an explicitly registered enabled sensor volume. A catch is a ledger increment;
|
|
545
|
+
* the host selects species and owns inventory/spawning. No engine types cross this API.
|
|
546
|
+
* Tree harvests issue one stack receipt; acknowledge a live nearby pickup or discard it.
|
|
547
|
+
* A bound live pickup blocks a new harvest. Host owns despawn/collection; regrowth is by day.
|
|
548
|
+
* Furniture uses a logical <=16x16 room, top-left cells and quarter-turn rotations 0..3.
|
|
549
|
+
* Hosts update optional colliders only after successful placement, using committed state.
|
|
550
|
+
* Commands are trusted host authority; configure-once profiles cannot replenish resources.
|
|
551
|
+
*/
|
|
552
|
+
declare const LIFE_ABILITIES: readonly ["crop-growth-stages", "soil-moisture-cycle", "seasonal-crop-eligibility", "exertion-and-fatigue", "livestock-daily-care", "calendar-npc-routine", "relationship-event-memory", "fishing-bite-and-hook", "harvestable-fruit-regrowth", "room-furniture-placement"];
|
|
553
|
+
declare const LIFE_EVENTS: readonly ["crop-growth-stages", "soil-moisture-cycle", "seasonal-crop-eligibility", "exertion-and-fatigue", "livestock-daily-care", "calendar-npc-routine", "relationship-event-memory", "fishing-bite-and-hook", "harvestable-fruit-regrowth", "room-furniture-placement", "calendar-or-plot", "fishing-lost"];
|
|
554
|
+
type LifeAbility = (typeof LIFE_ABILITIES)[number];
|
|
555
|
+
type LifeEvent = (typeof LIFE_EVENTS)[number];
|
|
556
|
+
interface LifeOptions {
|
|
557
|
+
day?: number;
|
|
558
|
+
seasonLength?: number;
|
|
559
|
+
stamina?: number;
|
|
560
|
+
reach?: number;
|
|
561
|
+
roomWidth?: number;
|
|
562
|
+
roomHeight?: number;
|
|
563
|
+
}
|
|
564
|
+
/** Request IDs strictly increase in 1..0xffffff. Rejected commands leave all state unchanged.
|
|
565
|
+
* Common calendar-time/day/plot/seed/clear commands are host setup and work in every standalone capability.
|
|
566
|
+
* Each context owns a calendar; broadcast the same day transaction to contexts in a world.
|
|
567
|
+
* Schedules return activity/destination only; a separate navigation behavior executes movement. */
|
|
568
|
+
type LifeAction<T = number> = {
|
|
569
|
+
requestId: number;
|
|
570
|
+
} & ({
|
|
571
|
+
type: "calendar-time";
|
|
572
|
+
minute: number;
|
|
573
|
+
} | {
|
|
574
|
+
type: "plant";
|
|
575
|
+
row: number;
|
|
576
|
+
} | {
|
|
577
|
+
type: "harvest-crop";
|
|
578
|
+
row: number;
|
|
579
|
+
} | {
|
|
580
|
+
type: "clear-crop";
|
|
581
|
+
row: number;
|
|
582
|
+
} | {
|
|
583
|
+
type: "water";
|
|
584
|
+
row: number;
|
|
585
|
+
amount: number;
|
|
586
|
+
} | {
|
|
587
|
+
type: "season-plant";
|
|
588
|
+
row: number;
|
|
589
|
+
} | {
|
|
590
|
+
type: "season-clear";
|
|
591
|
+
row: number;
|
|
592
|
+
} | {
|
|
593
|
+
type: "work";
|
|
594
|
+
cost: number;
|
|
595
|
+
fatiguePerMissing: number;
|
|
596
|
+
} | {
|
|
597
|
+
type: "recover";
|
|
598
|
+
stamina: number;
|
|
599
|
+
fatigue: number;
|
|
600
|
+
} | {
|
|
601
|
+
type: "sleep";
|
|
602
|
+
} | {
|
|
603
|
+
type: "animal";
|
|
604
|
+
row: number;
|
|
605
|
+
health: number;
|
|
606
|
+
affection: number;
|
|
607
|
+
} | {
|
|
608
|
+
type: "care";
|
|
609
|
+
row: number;
|
|
610
|
+
flags: number;
|
|
611
|
+
} | {
|
|
612
|
+
type: "collect-product";
|
|
613
|
+
row: number;
|
|
614
|
+
} | {
|
|
615
|
+
type: "schedule";
|
|
616
|
+
row: number;
|
|
617
|
+
start: number;
|
|
618
|
+
end: number;
|
|
619
|
+
weekdays: number;
|
|
620
|
+
seasons: number;
|
|
621
|
+
activity: number;
|
|
622
|
+
x: number;
|
|
623
|
+
y: number;
|
|
624
|
+
z: number;
|
|
625
|
+
priority: number;
|
|
626
|
+
} | {
|
|
627
|
+
type: "time";
|
|
628
|
+
minute: number;
|
|
629
|
+
} | {
|
|
630
|
+
type: "routine-override";
|
|
631
|
+
activity: number;
|
|
632
|
+
x: number;
|
|
633
|
+
y: number;
|
|
634
|
+
z: number;
|
|
635
|
+
until: number;
|
|
636
|
+
} | {
|
|
637
|
+
type: "routine-resume";
|
|
638
|
+
} | {
|
|
639
|
+
type: "person";
|
|
640
|
+
row: number;
|
|
641
|
+
score: number;
|
|
642
|
+
} | {
|
|
643
|
+
type: "interaction";
|
|
644
|
+
row: number;
|
|
645
|
+
eventSerial: number;
|
|
646
|
+
kind: number;
|
|
647
|
+
delta: number;
|
|
648
|
+
} | {
|
|
649
|
+
type: "water-habitat";
|
|
650
|
+
target: T;
|
|
651
|
+
species: number;
|
|
652
|
+
seasons: number;
|
|
653
|
+
start: number;
|
|
654
|
+
end: number;
|
|
655
|
+
delay: number;
|
|
656
|
+
window: number;
|
|
657
|
+
} | {
|
|
658
|
+
type: "cast";
|
|
659
|
+
x: number;
|
|
660
|
+
y: number;
|
|
661
|
+
z: number;
|
|
662
|
+
timestamp: number;
|
|
663
|
+
species: number;
|
|
664
|
+
} | {
|
|
665
|
+
type: "reel";
|
|
666
|
+
timestamp: number;
|
|
667
|
+
} | {
|
|
668
|
+
type: "fish-time";
|
|
669
|
+
timestamp: number;
|
|
670
|
+
} | {
|
|
671
|
+
type: "tree";
|
|
672
|
+
target: T;
|
|
673
|
+
row: number;
|
|
674
|
+
capacity: number;
|
|
675
|
+
regrowDays: number;
|
|
676
|
+
} | {
|
|
677
|
+
type: "harvest-fruit";
|
|
678
|
+
row: number;
|
|
679
|
+
} | {
|
|
680
|
+
type: "fruit-confirm";
|
|
681
|
+
target: T;
|
|
682
|
+
row: number;
|
|
683
|
+
receipt: number;
|
|
684
|
+
} | {
|
|
685
|
+
type: "fruit-discard";
|
|
686
|
+
row: number;
|
|
687
|
+
receipt: number;
|
|
688
|
+
} | {
|
|
689
|
+
type: "furniture";
|
|
690
|
+
row: number;
|
|
691
|
+
width: number;
|
|
692
|
+
height: number;
|
|
693
|
+
score: number;
|
|
694
|
+
style: number;
|
|
695
|
+
} | {
|
|
696
|
+
type: "place";
|
|
697
|
+
row: number;
|
|
698
|
+
x: number;
|
|
699
|
+
y: number;
|
|
700
|
+
rotation: number;
|
|
701
|
+
} | {
|
|
702
|
+
type: "remove";
|
|
703
|
+
row: number;
|
|
704
|
+
} | {
|
|
705
|
+
type: "room-block";
|
|
706
|
+
x: number;
|
|
707
|
+
y: number;
|
|
708
|
+
blocked: number;
|
|
709
|
+
} | {
|
|
710
|
+
type: "day";
|
|
711
|
+
day: number;
|
|
712
|
+
rain: number;
|
|
713
|
+
} | {
|
|
714
|
+
type: "plot";
|
|
715
|
+
row: number;
|
|
716
|
+
seasons: number;
|
|
717
|
+
stage0Days: number;
|
|
718
|
+
stage1Days: number;
|
|
719
|
+
stage2Days: number;
|
|
720
|
+
moistureRequired: number;
|
|
721
|
+
capacity: number;
|
|
722
|
+
decay: number;
|
|
723
|
+
moisture: number;
|
|
724
|
+
regrowDays: number;
|
|
725
|
+
} | {
|
|
726
|
+
type: "seed-plot";
|
|
727
|
+
row: number;
|
|
728
|
+
} | {
|
|
729
|
+
type: "clear-plot";
|
|
730
|
+
row: number;
|
|
731
|
+
});
|
|
732
|
+
interface LifePlot {
|
|
733
|
+
configured: boolean;
|
|
734
|
+
phase: number;
|
|
735
|
+
stage: number;
|
|
736
|
+
progress: number;
|
|
737
|
+
moisture: number;
|
|
738
|
+
seasons: number;
|
|
739
|
+
harvests: number;
|
|
740
|
+
capacity: number;
|
|
741
|
+
moistureRequired: number;
|
|
742
|
+
regrowDays: number;
|
|
743
|
+
regrowing: boolean;
|
|
744
|
+
}
|
|
745
|
+
interface LifeAnimal {
|
|
746
|
+
configured: boolean;
|
|
747
|
+
health: number;
|
|
748
|
+
affection: number;
|
|
749
|
+
care: number;
|
|
750
|
+
product: number;
|
|
751
|
+
collected: number;
|
|
752
|
+
}
|
|
753
|
+
interface LifePerson {
|
|
754
|
+
configured: boolean;
|
|
755
|
+
score: number;
|
|
756
|
+
eventSerial: number;
|
|
757
|
+
rewards: number;
|
|
758
|
+
}
|
|
759
|
+
interface LifeMemory {
|
|
760
|
+
eventSerial: number;
|
|
761
|
+
row: number;
|
|
762
|
+
kind: number;
|
|
763
|
+
delta: number;
|
|
764
|
+
day: number;
|
|
765
|
+
}
|
|
766
|
+
interface LifeTree {
|
|
767
|
+
configured: boolean;
|
|
768
|
+
fruit: number;
|
|
769
|
+
capacity: number;
|
|
770
|
+
due: number;
|
|
771
|
+
receipt: number;
|
|
772
|
+
pending: boolean;
|
|
773
|
+
bound: boolean;
|
|
774
|
+
x: number;
|
|
775
|
+
y: number;
|
|
776
|
+
z: number;
|
|
777
|
+
regrowDays: number;
|
|
778
|
+
}
|
|
779
|
+
interface LifeFurniture {
|
|
780
|
+
configured: boolean;
|
|
781
|
+
placed: boolean;
|
|
782
|
+
width: number;
|
|
783
|
+
height: number;
|
|
784
|
+
x: number;
|
|
785
|
+
y: number;
|
|
786
|
+
rotation: number;
|
|
787
|
+
score: number;
|
|
788
|
+
style: number;
|
|
789
|
+
}
|
|
790
|
+
interface LifeSchedule {
|
|
791
|
+
configured: boolean;
|
|
792
|
+
start: number;
|
|
793
|
+
end: number;
|
|
794
|
+
weekdays: number;
|
|
795
|
+
seasons: number;
|
|
796
|
+
activity: number;
|
|
797
|
+
x: number;
|
|
798
|
+
y: number;
|
|
799
|
+
z: number;
|
|
800
|
+
priority: number;
|
|
801
|
+
}
|
|
802
|
+
interface LifeState {
|
|
803
|
+
lastRequest: number;
|
|
804
|
+
revision: number;
|
|
805
|
+
day: number;
|
|
806
|
+
season: number;
|
|
807
|
+
minute: number;
|
|
808
|
+
rain: number;
|
|
809
|
+
stamina: number;
|
|
810
|
+
fatigue: number;
|
|
811
|
+
route: number;
|
|
812
|
+
activity: number;
|
|
813
|
+
destinationX: number;
|
|
814
|
+
destinationY: number;
|
|
815
|
+
destinationZ: number;
|
|
816
|
+
overrideUntil: number;
|
|
817
|
+
roomScore: number;
|
|
818
|
+
fishPhase: number;
|
|
819
|
+
fishClock: number;
|
|
820
|
+
biteAt: number;
|
|
821
|
+
deadline: number;
|
|
822
|
+
catches: number;
|
|
823
|
+
castX: number;
|
|
824
|
+
castY: number;
|
|
825
|
+
castZ: number;
|
|
826
|
+
fruitSerial: number;
|
|
827
|
+
memoryCount: number;
|
|
828
|
+
roomWidth: number;
|
|
829
|
+
roomHeight: number;
|
|
830
|
+
slept: boolean;
|
|
831
|
+
abilities: LifeAbility[];
|
|
832
|
+
blocked: boolean[];
|
|
833
|
+
plots: LifePlot[];
|
|
834
|
+
animals: LifeAnimal[];
|
|
835
|
+
people: LifePerson[];
|
|
836
|
+
memories: LifeMemory[];
|
|
837
|
+
trees: LifeTree[];
|
|
838
|
+
furniture: LifeFurniture[];
|
|
839
|
+
schedules: LifeSchedule[];
|
|
840
|
+
}
|
|
841
|
+
declare function lifeData(o: LifeOptions): number[];
|
|
842
|
+
declare function lifeOperation<T>(a: LifeAction<T>): {
|
|
843
|
+
op: number;
|
|
844
|
+
data: number[];
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
/** B161–B170. Eight retained target rows, eight resource/wave/tile slots, four cards, three armor layers.
|
|
848
|
+
* Lanes 0..4 run along world X. Direction is -1 or +1; positions must agree with authored lane IDs.
|
|
849
|
+
* Target kinds: 0 enemy, 1 blocker. Flags: 1 targetable/edible, 2 vaultable, 4 ordinary burrow blocker.
|
|
850
|
+
* Moving owners and deployment bodies: enabled position-kinematic solid centered spheres.
|
|
851
|
+
* Burrow uses phase-scoped query exclusions for registered static/kinematic ordinary blockers;
|
|
852
|
+
* visual underground depth is presentation. Body/collider settings are never changed.
|
|
853
|
+
* Hosts must give this family exclusive motion authority and own spawn/despawn/health replication.
|
|
854
|
+
* Receipt phases: 0 free/retired, 1 requested, 2 bound/active. Host acknowledges real live entities.
|
|
855
|
+
* Mine: 0 new, 1 arming, 2 armed, 3 spent. Wave: 0 idle, 1 issuing, 2 draining, 3 complete.
|
|
856
|
+
* Vault: 0 unused, 1 airborne, 2 landed, 3 blocked/interrupted, 4 unsupported.
|
|
857
|
+
* Burrow: 0 unused, 1 underground, 2 emerging, 3 surface. Sweeper: 0 new, 1 armed, 2 active, 3 spent.
|
|
858
|
+
* Tiles: 0 free, 1 reserved (cost held), 2 occupied. Confirmation starts card cooldown;
|
|
859
|
+
* cancellation refunds once. Target rows cannot be reused until detach. Query references are one-based.
|
|
860
|
+
*/
|
|
861
|
+
declare const DEFENSE_ABILITIES: readonly ["lane-target-acquisition", "blocker-chew-transition", "layered-breakaway-armor", "arming-proximity-mine", "periodic-resource-production", "budgeted-wave-scheduler", "single-use-obstacle-vault", "burrow-to-backline", "costed-grid-deployment", "last-chance-lane-sweeper"];
|
|
862
|
+
declare const DEFENSE_EVENTS: readonly ["lane-target-acquisition", "blocker-chew-transition", "layered-breakaway-armor", "arming-proximity-mine", "periodic-resource-production", "budgeted-wave-scheduler", "single-use-obstacle-vault", "burrow-to-backline", "costed-grid-deployment", "last-chance-lane-sweeper", "host-update", "armor-break", "body-damage", "target-damage", "mine-detonated", "resource-requested", "spawn-requested", "wave-complete", "vault-ended", "burrow-emerged", "sweep-ended"];
|
|
863
|
+
type DefenseAbility = (typeof DEFENSE_ABILITIES)[number];
|
|
864
|
+
type DefenseEvent = (typeof DEFENSE_EVENTS)[number];
|
|
865
|
+
interface DefenseOptions {
|
|
866
|
+
lane?: number;
|
|
867
|
+
direction?: number;
|
|
868
|
+
speed?: number;
|
|
869
|
+
reach?: number;
|
|
870
|
+
resources?: number;
|
|
871
|
+
health?: number;
|
|
872
|
+
}
|
|
873
|
+
/** Request IDs strictly increase in 1..0xffffff; rejects are atomic. Setup and credits are trusted host authority.
|
|
874
|
+
* Damage/credit/wave serials also increase independently. Bind/collect/confirm consume exact receipts.
|
|
875
|
+
* Target damage updates this component's ledger and emits receipts for host health/despawn integration.
|
|
876
|
+
* Profile edits cannot replenish damaged armor or reset an active card cooldown. */
|
|
877
|
+
type DefenseAction<T = number> = {
|
|
878
|
+
requestId: number;
|
|
879
|
+
} & ({
|
|
880
|
+
type: "targeting-start";
|
|
881
|
+
range: number;
|
|
882
|
+
damage: number;
|
|
883
|
+
interval: number;
|
|
884
|
+
} | {
|
|
885
|
+
type: "targeting-stop";
|
|
886
|
+
} | {
|
|
887
|
+
type: "advance";
|
|
888
|
+
damage: number;
|
|
889
|
+
interval: number;
|
|
890
|
+
} | {
|
|
891
|
+
type: "halt";
|
|
892
|
+
} | {
|
|
893
|
+
type: "armor-layer";
|
|
894
|
+
layer: number;
|
|
895
|
+
health: number;
|
|
896
|
+
damageMask: number;
|
|
897
|
+
} | {
|
|
898
|
+
type: "damage";
|
|
899
|
+
damageSerial: number;
|
|
900
|
+
amount: number;
|
|
901
|
+
damageMask: number;
|
|
902
|
+
} | {
|
|
903
|
+
type: "mine-prepare";
|
|
904
|
+
delay: number;
|
|
905
|
+
radius: number;
|
|
906
|
+
damage: number;
|
|
907
|
+
} | {
|
|
908
|
+
type: "production-start";
|
|
909
|
+
interval: number;
|
|
910
|
+
value: number;
|
|
911
|
+
capacity: number;
|
|
912
|
+
} | {
|
|
913
|
+
type: "resource-bind";
|
|
914
|
+
target: T;
|
|
915
|
+
receipt: number;
|
|
916
|
+
} | {
|
|
917
|
+
type: "resource-collect";
|
|
918
|
+
target: T;
|
|
919
|
+
receipt: number;
|
|
920
|
+
} | {
|
|
921
|
+
type: "resource-expire";
|
|
922
|
+
receipt: number;
|
|
923
|
+
} | {
|
|
924
|
+
type: "wave-start";
|
|
925
|
+
waveSerial: number;
|
|
926
|
+
budget: number;
|
|
927
|
+
cost: number;
|
|
928
|
+
laneMask: number;
|
|
929
|
+
interval: number;
|
|
930
|
+
activeLimit: number;
|
|
931
|
+
} | {
|
|
932
|
+
type: "spawn-confirm";
|
|
933
|
+
target: T;
|
|
934
|
+
receipt: number;
|
|
935
|
+
} | {
|
|
936
|
+
type: "spawn-retire";
|
|
937
|
+
target: T;
|
|
938
|
+
receipt: number;
|
|
939
|
+
} | {
|
|
940
|
+
type: "spawn-cancel";
|
|
941
|
+
receipt: number;
|
|
942
|
+
} | {
|
|
943
|
+
type: "vault";
|
|
944
|
+
row: number;
|
|
945
|
+
landingDistance: number;
|
|
946
|
+
height: number;
|
|
947
|
+
duration: number;
|
|
948
|
+
postSpeed: number;
|
|
949
|
+
} | {
|
|
950
|
+
type: "burrow";
|
|
951
|
+
destinationX: number;
|
|
952
|
+
emergeDelay: number;
|
|
953
|
+
} | {
|
|
954
|
+
type: "tile";
|
|
955
|
+
row: number;
|
|
956
|
+
terrainMask: number;
|
|
957
|
+
x: number;
|
|
958
|
+
y: number;
|
|
959
|
+
z: number;
|
|
960
|
+
} | {
|
|
961
|
+
type: "card";
|
|
962
|
+
row: number;
|
|
963
|
+
cost: number;
|
|
964
|
+
cooldown: number;
|
|
965
|
+
terrainMask: number;
|
|
966
|
+
} | {
|
|
967
|
+
type: "deployment-request";
|
|
968
|
+
tile: number;
|
|
969
|
+
card: number;
|
|
970
|
+
} | {
|
|
971
|
+
type: "deployment-confirm";
|
|
972
|
+
target: T;
|
|
973
|
+
receipt: number;
|
|
974
|
+
} | {
|
|
975
|
+
type: "deployment-cancel";
|
|
976
|
+
receipt: number;
|
|
977
|
+
} | {
|
|
978
|
+
type: "sweeper-arm";
|
|
979
|
+
destinationX: number;
|
|
980
|
+
speed: number;
|
|
981
|
+
triggerRadius: number;
|
|
982
|
+
hitRadius: number;
|
|
983
|
+
} | {
|
|
984
|
+
type: "target";
|
|
985
|
+
target: T;
|
|
986
|
+
row: number;
|
|
987
|
+
kind: number;
|
|
988
|
+
lane: number;
|
|
989
|
+
health: number;
|
|
990
|
+
flags: number;
|
|
991
|
+
} | {
|
|
992
|
+
type: "target-health";
|
|
993
|
+
row: number;
|
|
994
|
+
health: number;
|
|
995
|
+
} | {
|
|
996
|
+
type: "credit";
|
|
997
|
+
creditSerial: number;
|
|
998
|
+
amount: number;
|
|
999
|
+
} | {
|
|
1000
|
+
type: "interrupt";
|
|
1001
|
+
});
|
|
1002
|
+
interface DefenseTarget {
|
|
1003
|
+
present: boolean;
|
|
1004
|
+
kind: number;
|
|
1005
|
+
lane: number;
|
|
1006
|
+
health: number;
|
|
1007
|
+
flags: number;
|
|
1008
|
+
x: number;
|
|
1009
|
+
y: number;
|
|
1010
|
+
z: number;
|
|
1011
|
+
}
|
|
1012
|
+
interface DefenseReceipt {
|
|
1013
|
+
receipt: number;
|
|
1014
|
+
phase: number;
|
|
1015
|
+
value: number;
|
|
1016
|
+
lane: number;
|
|
1017
|
+
bound: boolean;
|
|
1018
|
+
}
|
|
1019
|
+
interface DefenseTile {
|
|
1020
|
+
configured: boolean;
|
|
1021
|
+
terrainMask: number;
|
|
1022
|
+
x: number;
|
|
1023
|
+
y: number;
|
|
1024
|
+
z: number;
|
|
1025
|
+
phase: number;
|
|
1026
|
+
receipt: number;
|
|
1027
|
+
card: number;
|
|
1028
|
+
cost: number;
|
|
1029
|
+
bound: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
interface DefenseState {
|
|
1032
|
+
lastRequest: number;
|
|
1033
|
+
revision: number;
|
|
1034
|
+
bank: number;
|
|
1035
|
+
health: number;
|
|
1036
|
+
direction: number;
|
|
1037
|
+
speed: number;
|
|
1038
|
+
blocked: number;
|
|
1039
|
+
selected: number;
|
|
1040
|
+
shots: number;
|
|
1041
|
+
chewed: number;
|
|
1042
|
+
bites: number;
|
|
1043
|
+
breaks: number;
|
|
1044
|
+
damageSerial: number;
|
|
1045
|
+
firing: boolean;
|
|
1046
|
+
advancing: boolean;
|
|
1047
|
+
minePhase: number;
|
|
1048
|
+
mineRemaining: number;
|
|
1049
|
+
detonations: number;
|
|
1050
|
+
producing: boolean;
|
|
1051
|
+
productionClock: number;
|
|
1052
|
+
resourceSerial: number;
|
|
1053
|
+
collected: number;
|
|
1054
|
+
wavePhase: number;
|
|
1055
|
+
waveSerial: number;
|
|
1056
|
+
budget: number;
|
|
1057
|
+
spawnSerial: number;
|
|
1058
|
+
spawnCount: number;
|
|
1059
|
+
deploymentSerial: number;
|
|
1060
|
+
sweepPhase: number;
|
|
1061
|
+
sweepHits: number;
|
|
1062
|
+
outstandingResources: number;
|
|
1063
|
+
x: number;
|
|
1064
|
+
y: number;
|
|
1065
|
+
z: number;
|
|
1066
|
+
vaultUsed: boolean;
|
|
1067
|
+
vaultPhase: number;
|
|
1068
|
+
vaultTime: number;
|
|
1069
|
+
vaultDuration: number;
|
|
1070
|
+
burrowPhase: number;
|
|
1071
|
+
burrowGoal: number;
|
|
1072
|
+
emergeRemaining: number;
|
|
1073
|
+
sweepEnd: number;
|
|
1074
|
+
activeSpawns: number;
|
|
1075
|
+
shotClock: number;
|
|
1076
|
+
chewClock: number;
|
|
1077
|
+
waveClock: number;
|
|
1078
|
+
creditSerial: number;
|
|
1079
|
+
abilities: DefenseAbility[];
|
|
1080
|
+
targets: DefenseTarget[];
|
|
1081
|
+
resources: DefenseReceipt[];
|
|
1082
|
+
spawns: DefenseReceipt[];
|
|
1083
|
+
tiles: DefenseTile[];
|
|
1084
|
+
cards: {
|
|
1085
|
+
configured: boolean;
|
|
1086
|
+
cost: number;
|
|
1087
|
+
remaining: number;
|
|
1088
|
+
terrainMask: number;
|
|
1089
|
+
}[];
|
|
1090
|
+
armor: {
|
|
1091
|
+
health: number;
|
|
1092
|
+
damageMask: number;
|
|
1093
|
+
}[];
|
|
1094
|
+
}
|
|
1095
|
+
declare function defenseData(o: DefenseOptions): number[];
|
|
1096
|
+
declare function defenseOperation<T>(a: DefenseAction<T>): {
|
|
1097
|
+
op: number;
|
|
1098
|
+
data: number[];
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
/** B151–B160. Original bounded squad policies; eight workers, four tasks/species, three growth stages.
|
|
1102
|
+
* Workers and payloads must be enabled position-kinematic bodies with one centered solid sphere.
|
|
1103
|
+
* Squad owns their motion until released/detached: do not combine with another movement controller.
|
|
1104
|
+
* Rows are zero-based; query task/landing/base references are one-based (zero means none).
|
|
1105
|
+
* Task kinds: 0 payload, 1 worksite, 2 enemy, 3 base. Commands use 4 for no landing task/base.
|
|
1106
|
+
* Modes: 0 idle, 1 follow, 2 airborne, 3 carry, 4 work, 5 latch, 6 panic, 7 safe, 8 lost.
|
|
1107
|
+
* Task phases: 0 active, 1 arrived/complete, 2 consumed/dead, 3 removed.
|
|
1108
|
+
* Flight results: 0 pending, 1 supported, 2 blocked, 3 unsupported.
|
|
1109
|
+
* Hosts supply hazards, navigation destinations, health and spawn/despawn from receipts.
|
|
1110
|
+
* Queries expose cached poses refreshed by accepted commands and simulation steps. */
|
|
1111
|
+
declare const SQUAD_ABILITIES: readonly ["whistle-recall", "squad-formation-follow", "thrown-worker-deployment", "cooperative-object-transport", "cooperative-construction-work", "surface-latch-attack", "species-hazard-affinity", "growth-stage-mobility", "delivered-resource-conversion", "day-end-unit-recall"];
|
|
1112
|
+
declare const SQUAD_EVENTS: readonly ["whistle-recall", "squad-formation-follow", "thrown-worker-deployment", "cooperative-object-transport", "cooperative-construction-work", "surface-latch-attack", "species-hazard-affinity", "growth-stage-mobility", "delivered-resource-conversion", "day-end-unit-recall", "host-update", "worker-landed", "task-complete", "latch-hit", "worker-lost", "day-resolved"];
|
|
1113
|
+
type SquadAbility = (typeof SQUAD_ABILITIES)[number];
|
|
1114
|
+
type SquadEvent = (typeof SQUAD_EVENTS)[number];
|
|
1115
|
+
interface SquadOptions {
|
|
1116
|
+
speed?: number;
|
|
1117
|
+
reach?: number;
|
|
1118
|
+
separation?: number;
|
|
1119
|
+
gravity?: number;
|
|
1120
|
+
attackInterval?: number;
|
|
1121
|
+
}
|
|
1122
|
+
/** Accepted request IDs strictly increase in 1..0xffffff; rejected commands do not mutate state.
|
|
1123
|
+
* Setup/profile/health/protection/credit commands are trusted host authority.
|
|
1124
|
+
* Each worker/task body is exclusively claimed by one squad; rows are never reused until detach.
|
|
1125
|
+
* Delivery consumes a payload receipt once; deploy/retire update credits, never spawn ECS entities.
|
|
1126
|
+
* A resolved day accepts only a new day-start; lost workers stay lost. */
|
|
1127
|
+
type SquadAction<T = number> = {
|
|
1128
|
+
requestId: number;
|
|
1129
|
+
} & ({
|
|
1130
|
+
type: "whistle-start";
|
|
1131
|
+
maximumRadius: number;
|
|
1132
|
+
rate: number;
|
|
1133
|
+
duration: number;
|
|
1134
|
+
} | {
|
|
1135
|
+
type: "whistle-stop";
|
|
1136
|
+
} | {
|
|
1137
|
+
type: "formation-slot";
|
|
1138
|
+
row: number;
|
|
1139
|
+
x: number;
|
|
1140
|
+
y: number;
|
|
1141
|
+
z: number;
|
|
1142
|
+
} | {
|
|
1143
|
+
type: "follow";
|
|
1144
|
+
row: number;
|
|
1145
|
+
} | {
|
|
1146
|
+
type: "dismiss";
|
|
1147
|
+
row: number;
|
|
1148
|
+
} | {
|
|
1149
|
+
type: "throw";
|
|
1150
|
+
row: number;
|
|
1151
|
+
x: number;
|
|
1152
|
+
y: number;
|
|
1153
|
+
z: number;
|
|
1154
|
+
duration: number;
|
|
1155
|
+
landingTask: number;
|
|
1156
|
+
} | {
|
|
1157
|
+
type: "assign-carrier";
|
|
1158
|
+
row: number;
|
|
1159
|
+
task: number;
|
|
1160
|
+
} | {
|
|
1161
|
+
type: "payload-route";
|
|
1162
|
+
task: number;
|
|
1163
|
+
x: number;
|
|
1164
|
+
y: number;
|
|
1165
|
+
z: number;
|
|
1166
|
+
speed: number;
|
|
1167
|
+
} | {
|
|
1168
|
+
type: "release-carrier";
|
|
1169
|
+
row: number;
|
|
1170
|
+
} | {
|
|
1171
|
+
type: "assign-work";
|
|
1172
|
+
row: number;
|
|
1173
|
+
task: number;
|
|
1174
|
+
} | {
|
|
1175
|
+
type: "stop-work";
|
|
1176
|
+
row: number;
|
|
1177
|
+
} | {
|
|
1178
|
+
type: "latch";
|
|
1179
|
+
row: number;
|
|
1180
|
+
task: number;
|
|
1181
|
+
x: number;
|
|
1182
|
+
y: number;
|
|
1183
|
+
z: number;
|
|
1184
|
+
} | {
|
|
1185
|
+
type: "shake";
|
|
1186
|
+
task: number;
|
|
1187
|
+
speciesMask: number;
|
|
1188
|
+
} | {
|
|
1189
|
+
type: "unlatch";
|
|
1190
|
+
row: number;
|
|
1191
|
+
} | {
|
|
1192
|
+
type: "affinity";
|
|
1193
|
+
species: number;
|
|
1194
|
+
immuneMask: number;
|
|
1195
|
+
rescueMask: number;
|
|
1196
|
+
panicDuration: number;
|
|
1197
|
+
} | {
|
|
1198
|
+
type: "expose";
|
|
1199
|
+
row: number;
|
|
1200
|
+
hazard: number;
|
|
1201
|
+
} | {
|
|
1202
|
+
type: "rescue";
|
|
1203
|
+
rescuer: number;
|
|
1204
|
+
victim: number;
|
|
1205
|
+
} | {
|
|
1206
|
+
type: "growth-profile";
|
|
1207
|
+
stage: number;
|
|
1208
|
+
speed: number;
|
|
1209
|
+
work: number;
|
|
1210
|
+
} | {
|
|
1211
|
+
type: "grow";
|
|
1212
|
+
row: number;
|
|
1213
|
+
stage: number;
|
|
1214
|
+
growthReceipt: number;
|
|
1215
|
+
} | {
|
|
1216
|
+
type: "base-profile";
|
|
1217
|
+
task: number;
|
|
1218
|
+
populationCapacity: number;
|
|
1219
|
+
activeLimit: number;
|
|
1220
|
+
} | {
|
|
1221
|
+
type: "deliver";
|
|
1222
|
+
payload: number;
|
|
1223
|
+
base: number;
|
|
1224
|
+
deliverySerial: number;
|
|
1225
|
+
} | {
|
|
1226
|
+
type: "deploy";
|
|
1227
|
+
base: number;
|
|
1228
|
+
count: number;
|
|
1229
|
+
spawnSerial: number;
|
|
1230
|
+
} | {
|
|
1231
|
+
type: "retire";
|
|
1232
|
+
base: number;
|
|
1233
|
+
count: number;
|
|
1234
|
+
spawnSerial: number;
|
|
1235
|
+
} | {
|
|
1236
|
+
type: "day-start";
|
|
1237
|
+
daySerial: number;
|
|
1238
|
+
duration: number;
|
|
1239
|
+
base: number;
|
|
1240
|
+
safeRadius: number;
|
|
1241
|
+
} | {
|
|
1242
|
+
type: "protect";
|
|
1243
|
+
row: number;
|
|
1244
|
+
protected: boolean;
|
|
1245
|
+
} | {
|
|
1246
|
+
type: "worker";
|
|
1247
|
+
target: T;
|
|
1248
|
+
row: number;
|
|
1249
|
+
species: number;
|
|
1250
|
+
growth: number;
|
|
1251
|
+
workRate: number;
|
|
1252
|
+
strength: number;
|
|
1253
|
+
damage: number;
|
|
1254
|
+
recallable: boolean;
|
|
1255
|
+
} | {
|
|
1256
|
+
type: "task";
|
|
1257
|
+
target: T;
|
|
1258
|
+
row: number;
|
|
1259
|
+
kind: number;
|
|
1260
|
+
required: number;
|
|
1261
|
+
capacity: number;
|
|
1262
|
+
value: number;
|
|
1263
|
+
} | {
|
|
1264
|
+
type: "release-worker";
|
|
1265
|
+
row: number;
|
|
1266
|
+
} | {
|
|
1267
|
+
type: "target-health";
|
|
1268
|
+
task: number;
|
|
1269
|
+
health: number;
|
|
1270
|
+
});
|
|
1271
|
+
interface SquadWorker {
|
|
1272
|
+
present: boolean;
|
|
1273
|
+
mode: number;
|
|
1274
|
+
species: number;
|
|
1275
|
+
growth: number;
|
|
1276
|
+
task: number;
|
|
1277
|
+
speed: number;
|
|
1278
|
+
workRate: number;
|
|
1279
|
+
strength: number;
|
|
1280
|
+
damage: number;
|
|
1281
|
+
recallable: boolean;
|
|
1282
|
+
protected: boolean;
|
|
1283
|
+
hazard: number;
|
|
1284
|
+
panicRemaining: number;
|
|
1285
|
+
flightResult: number;
|
|
1286
|
+
growthReceipt: number;
|
|
1287
|
+
lossReceipt: number;
|
|
1288
|
+
x: number;
|
|
1289
|
+
y: number;
|
|
1290
|
+
z: number;
|
|
1291
|
+
goalX: number;
|
|
1292
|
+
goalY: number;
|
|
1293
|
+
goalZ: number;
|
|
1294
|
+
slotX: number;
|
|
1295
|
+
slotY: number;
|
|
1296
|
+
slotZ: number;
|
|
1297
|
+
flightTime: number;
|
|
1298
|
+
flightDuration: number;
|
|
1299
|
+
attackClock: number;
|
|
1300
|
+
dealt: number;
|
|
1301
|
+
landedTask: number;
|
|
1302
|
+
}
|
|
1303
|
+
interface SquadTask {
|
|
1304
|
+
present: boolean;
|
|
1305
|
+
kind: number;
|
|
1306
|
+
phase: number;
|
|
1307
|
+
required: number;
|
|
1308
|
+
progress: number;
|
|
1309
|
+
capacity: number;
|
|
1310
|
+
value: number;
|
|
1311
|
+
health: number;
|
|
1312
|
+
stored: number;
|
|
1313
|
+
active: number;
|
|
1314
|
+
populationCapacity: number;
|
|
1315
|
+
activeLimit: number;
|
|
1316
|
+
receipt: number;
|
|
1317
|
+
assigned: number;
|
|
1318
|
+
strength: number;
|
|
1319
|
+
speed: number;
|
|
1320
|
+
x: number;
|
|
1321
|
+
y: number;
|
|
1322
|
+
z: number;
|
|
1323
|
+
destinationX: number;
|
|
1324
|
+
destinationY: number;
|
|
1325
|
+
destinationZ: number;
|
|
1326
|
+
routed: boolean;
|
|
1327
|
+
}
|
|
1328
|
+
interface SquadState {
|
|
1329
|
+
lastRequest: number;
|
|
1330
|
+
revision: number;
|
|
1331
|
+
whistling: boolean;
|
|
1332
|
+
radius: number;
|
|
1333
|
+
maximumRadius: number;
|
|
1334
|
+
recalls: number;
|
|
1335
|
+
flightSerial: number;
|
|
1336
|
+
completed: number;
|
|
1337
|
+
hitSerial: number;
|
|
1338
|
+
lossSerial: number;
|
|
1339
|
+
deliverySerial: number;
|
|
1340
|
+
spawnSerial: number;
|
|
1341
|
+
daySerial: number;
|
|
1342
|
+
dayPhase: number;
|
|
1343
|
+
dayRemaining: number;
|
|
1344
|
+
dayBase: number;
|
|
1345
|
+
safeRadius: number;
|
|
1346
|
+
safe: number;
|
|
1347
|
+
lost: number;
|
|
1348
|
+
blocked: number;
|
|
1349
|
+
abilities: SquadAbility[];
|
|
1350
|
+
workers: SquadWorker[];
|
|
1351
|
+
tasks: SquadTask[];
|
|
1352
|
+
growth: {
|
|
1353
|
+
speed: number;
|
|
1354
|
+
work: number;
|
|
1355
|
+
}[];
|
|
1356
|
+
affinities: {
|
|
1357
|
+
immuneMask: number;
|
|
1358
|
+
rescueMask: number;
|
|
1359
|
+
panicDuration: number;
|
|
1360
|
+
}[];
|
|
1361
|
+
}
|
|
1362
|
+
declare function squadData(o: SquadOptions): number[];
|
|
1363
|
+
declare function squadOperation<T>(a: SquadAction<T>): {
|
|
1364
|
+
op: number;
|
|
1365
|
+
data: number[];
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
/** B141–B150. Original configurable grid policies. Coordinates and rules are host-authored.
|
|
1369
|
+
* Eight units, eight structures, four teams/classes/weapons, eight terrain types, at most 8×8 cells.
|
|
1370
|
+
* Queries use zero-based rows except explicit 1-based references (zero means none).
|
|
1371
|
+
* Physics supplies lifetime only; the host maps committed grid coordinates to world poses. */
|
|
1372
|
+
declare const TACTICS_ABILITIES: readonly ["terrain-movement-budget", "min-max-attack-range", "terrain-defense-modifier", "counterattack-and-follow-up", "weapon-advantage-cycle", "persistent-unit-loss", "progressive-building-capture", "fuel-ammunition-resupply", "transport-load-unload", "commander-power-window"];
|
|
1373
|
+
declare const TACTICS_EVENTS: readonly ["terrain-movement-budget", "min-max-attack-range", "terrain-defense-modifier", "counterattack-and-follow-up", "weapon-advantage-cycle", "persistent-unit-loss", "progressive-building-capture", "fuel-ammunition-resupply", "transport-load-unload", "commander-power-window", "host-update"];
|
|
1374
|
+
type TacticsAbility = (typeof TACTICS_ABILITIES)[number];
|
|
1375
|
+
type TacticsEvent = (typeof TACTICS_EVENTS)[number];
|
|
1376
|
+
interface TacticsOptions {
|
|
1377
|
+
width?: number;
|
|
1378
|
+
height?: number;
|
|
1379
|
+
followUpSpeedThreshold?: number;
|
|
1380
|
+
captureStrength?: number;
|
|
1381
|
+
maximumFuel?: number;
|
|
1382
|
+
maximumAmmo?: number;
|
|
1383
|
+
}
|
|
1384
|
+
/** Accepted request IDs strictly increase in 1..0xffffff; rejected commands are atomic.
|
|
1385
|
+
* Setup/stat/turn/charge/resource inputs are trusted host authority, not client validation.
|
|
1386
|
+
* During an exchange only next/cancel/defeat/host-health commands are accepted. */
|
|
1387
|
+
type TacticsAction<T = number> = {
|
|
1388
|
+
requestId: number;
|
|
1389
|
+
} & ({
|
|
1390
|
+
type: "movement-cost";
|
|
1391
|
+
unitClass: number;
|
|
1392
|
+
terrain: number;
|
|
1393
|
+
cost: number;
|
|
1394
|
+
} | {
|
|
1395
|
+
type: "reachable";
|
|
1396
|
+
row: number;
|
|
1397
|
+
} | {
|
|
1398
|
+
type: "move";
|
|
1399
|
+
row: number;
|
|
1400
|
+
x: number;
|
|
1401
|
+
y: number;
|
|
1402
|
+
} | {
|
|
1403
|
+
type: "weapon-range";
|
|
1404
|
+
row: number;
|
|
1405
|
+
minimum: number;
|
|
1406
|
+
maximum: number;
|
|
1407
|
+
lineOfSight: boolean;
|
|
1408
|
+
} | {
|
|
1409
|
+
type: "range-map";
|
|
1410
|
+
row: number;
|
|
1411
|
+
} | {
|
|
1412
|
+
type: "check-range";
|
|
1413
|
+
attacker: number;
|
|
1414
|
+
defender: number;
|
|
1415
|
+
} | {
|
|
1416
|
+
type: "terrain-profile";
|
|
1417
|
+
unitClass: number;
|
|
1418
|
+
terrain: number;
|
|
1419
|
+
defense: number;
|
|
1420
|
+
avoid: number;
|
|
1421
|
+
recovery: number;
|
|
1422
|
+
} | {
|
|
1423
|
+
type: "terrain-evaluate";
|
|
1424
|
+
row: number;
|
|
1425
|
+
raw: number;
|
|
1426
|
+
seed: number;
|
|
1427
|
+
} | {
|
|
1428
|
+
type: "terrain-recover";
|
|
1429
|
+
row: number;
|
|
1430
|
+
} | {
|
|
1431
|
+
type: "combat-start";
|
|
1432
|
+
attacker: number;
|
|
1433
|
+
defender: number;
|
|
1434
|
+
combatSerial: number;
|
|
1435
|
+
seed: number;
|
|
1436
|
+
} | {
|
|
1437
|
+
type: "combat-next";
|
|
1438
|
+
} | {
|
|
1439
|
+
type: "combat-cancel";
|
|
1440
|
+
} | {
|
|
1441
|
+
type: "weapon-durability";
|
|
1442
|
+
row: number;
|
|
1443
|
+
durability: number;
|
|
1444
|
+
} | {
|
|
1445
|
+
type: "advantage-row";
|
|
1446
|
+
attackerWeapon: number;
|
|
1447
|
+
defenderWeapon: number;
|
|
1448
|
+
damage: number;
|
|
1449
|
+
hit: number;
|
|
1450
|
+
} | {
|
|
1451
|
+
type: "evaluate-advantage";
|
|
1452
|
+
attacker: number;
|
|
1453
|
+
defender: number;
|
|
1454
|
+
} | {
|
|
1455
|
+
type: "defeat";
|
|
1456
|
+
row: number;
|
|
1457
|
+
} | {
|
|
1458
|
+
type: "loss-exception";
|
|
1459
|
+
row: number;
|
|
1460
|
+
exempt: boolean;
|
|
1461
|
+
} | {
|
|
1462
|
+
type: "recover";
|
|
1463
|
+
row: number;
|
|
1464
|
+
health: number;
|
|
1465
|
+
} | {
|
|
1466
|
+
type: "capture-building";
|
|
1467
|
+
row: number;
|
|
1468
|
+
structure: number;
|
|
1469
|
+
} | {
|
|
1470
|
+
type: "supply-profile";
|
|
1471
|
+
row: number;
|
|
1472
|
+
classMask: number;
|
|
1473
|
+
} | {
|
|
1474
|
+
type: "spend-resources";
|
|
1475
|
+
row: number;
|
|
1476
|
+
fuel: number;
|
|
1477
|
+
ammo: number;
|
|
1478
|
+
resourceSerial: number;
|
|
1479
|
+
} | {
|
|
1480
|
+
type: "resupply-unit";
|
|
1481
|
+
supplier: number;
|
|
1482
|
+
recipient: number;
|
|
1483
|
+
fuel: number;
|
|
1484
|
+
ammo: number;
|
|
1485
|
+
} | {
|
|
1486
|
+
type: "resupply-facility";
|
|
1487
|
+
row: number;
|
|
1488
|
+
structure: number;
|
|
1489
|
+
fuel: number;
|
|
1490
|
+
ammo: number;
|
|
1491
|
+
} | {
|
|
1492
|
+
type: "transport-profile";
|
|
1493
|
+
row: number;
|
|
1494
|
+
capacity: number;
|
|
1495
|
+
classMask: number;
|
|
1496
|
+
size: number;
|
|
1497
|
+
} | {
|
|
1498
|
+
type: "load";
|
|
1499
|
+
carrier: number;
|
|
1500
|
+
cargo: number;
|
|
1501
|
+
} | {
|
|
1502
|
+
type: "unload";
|
|
1503
|
+
carrier: number;
|
|
1504
|
+
cargo: number;
|
|
1505
|
+
x: number;
|
|
1506
|
+
y: number;
|
|
1507
|
+
} | {
|
|
1508
|
+
type: "power-profile";
|
|
1509
|
+
team: number;
|
|
1510
|
+
threshold: number;
|
|
1511
|
+
duration: number;
|
|
1512
|
+
attack: number;
|
|
1513
|
+
defense: number;
|
|
1514
|
+
movement: number;
|
|
1515
|
+
} | {
|
|
1516
|
+
type: "power-charge";
|
|
1517
|
+
team: number;
|
|
1518
|
+
amount: number;
|
|
1519
|
+
chargeSerial: number;
|
|
1520
|
+
} | {
|
|
1521
|
+
type: "power-activate";
|
|
1522
|
+
team: number;
|
|
1523
|
+
} | {
|
|
1524
|
+
type: "power-cancel";
|
|
1525
|
+
team: number;
|
|
1526
|
+
} | {
|
|
1527
|
+
type: "unit";
|
|
1528
|
+
target: T;
|
|
1529
|
+
row: number;
|
|
1530
|
+
x: number;
|
|
1531
|
+
y: number;
|
|
1532
|
+
team: number;
|
|
1533
|
+
unitClass: number;
|
|
1534
|
+
health: number;
|
|
1535
|
+
maximumHealth: number;
|
|
1536
|
+
movement: number;
|
|
1537
|
+
attack: number;
|
|
1538
|
+
defense: number;
|
|
1539
|
+
speed: number;
|
|
1540
|
+
weapon: number;
|
|
1541
|
+
minimumRange: number;
|
|
1542
|
+
maximumRange: number;
|
|
1543
|
+
fuel: number;
|
|
1544
|
+
ammo: number;
|
|
1545
|
+
} | {
|
|
1546
|
+
type: "tile";
|
|
1547
|
+
x: number;
|
|
1548
|
+
y: number;
|
|
1549
|
+
terrain: number;
|
|
1550
|
+
blocked: boolean;
|
|
1551
|
+
} | {
|
|
1552
|
+
type: "begin-turn";
|
|
1553
|
+
phase: number;
|
|
1554
|
+
team: number;
|
|
1555
|
+
} | {
|
|
1556
|
+
type: "structure";
|
|
1557
|
+
row: number;
|
|
1558
|
+
x: number;
|
|
1559
|
+
y: number;
|
|
1560
|
+
owner: number;
|
|
1561
|
+
maximumCapture: number;
|
|
1562
|
+
fuel: number;
|
|
1563
|
+
ammo: number;
|
|
1564
|
+
classMask: number;
|
|
1565
|
+
} | {
|
|
1566
|
+
type: "host-health";
|
|
1567
|
+
row: number;
|
|
1568
|
+
health: number;
|
|
1569
|
+
});
|
|
1570
|
+
interface TacticsUnit {
|
|
1571
|
+
present: boolean;
|
|
1572
|
+
x: number;
|
|
1573
|
+
y: number;
|
|
1574
|
+
team: number;
|
|
1575
|
+
unitClass: number;
|
|
1576
|
+
health: number;
|
|
1577
|
+
maximumHealth: number;
|
|
1578
|
+
movementRemaining: number;
|
|
1579
|
+
attack: number;
|
|
1580
|
+
defense: number;
|
|
1581
|
+
speed: number;
|
|
1582
|
+
weapon: number;
|
|
1583
|
+
minimumRange: number;
|
|
1584
|
+
maximumRange: number;
|
|
1585
|
+
fuel: number;
|
|
1586
|
+
ammo: number;
|
|
1587
|
+
loss: number;
|
|
1588
|
+
lossSerial: number;
|
|
1589
|
+
exempt: boolean;
|
|
1590
|
+
carrier: number;
|
|
1591
|
+
size: number;
|
|
1592
|
+
capacity: number;
|
|
1593
|
+
cargoMask: number;
|
|
1594
|
+
supplyMask: number;
|
|
1595
|
+
durability: number;
|
|
1596
|
+
acted: boolean;
|
|
1597
|
+
spent: number;
|
|
1598
|
+
resourceSerial: number;
|
|
1599
|
+
healPhase: number;
|
|
1600
|
+
maximumFuel: number;
|
|
1601
|
+
maximumAmmo: number;
|
|
1602
|
+
lineOfSight: boolean;
|
|
1603
|
+
}
|
|
1604
|
+
interface TacticsStructure {
|
|
1605
|
+
present: boolean;
|
|
1606
|
+
x: number;
|
|
1607
|
+
y: number;
|
|
1608
|
+
owner: number;
|
|
1609
|
+
progress: number;
|
|
1610
|
+
maximum: number;
|
|
1611
|
+
fuel: number;
|
|
1612
|
+
ammo: number;
|
|
1613
|
+
}
|
|
1614
|
+
interface TacticsPower {
|
|
1615
|
+
charge: number;
|
|
1616
|
+
threshold: number;
|
|
1617
|
+
duration: number;
|
|
1618
|
+
active: boolean;
|
|
1619
|
+
remainingTurns: number;
|
|
1620
|
+
attack: number;
|
|
1621
|
+
defense: number;
|
|
1622
|
+
movement: number;
|
|
1623
|
+
chargeSerial: number;
|
|
1624
|
+
turns: number;
|
|
1625
|
+
}
|
|
1626
|
+
interface TacticsState {
|
|
1627
|
+
lastRequest: number;
|
|
1628
|
+
revision: number;
|
|
1629
|
+
width: number;
|
|
1630
|
+
height: number;
|
|
1631
|
+
phase: number;
|
|
1632
|
+
team: number;
|
|
1633
|
+
movementUnit: number;
|
|
1634
|
+
rangeUnit: number;
|
|
1635
|
+
rangeAllowed: boolean;
|
|
1636
|
+
rangeDistance: number;
|
|
1637
|
+
terrainDefense: number;
|
|
1638
|
+
terrainAvoid: number;
|
|
1639
|
+
healed: number;
|
|
1640
|
+
previewDamage: number;
|
|
1641
|
+
lastCost: number;
|
|
1642
|
+
combatSerial: number;
|
|
1643
|
+
combatPhase: number;
|
|
1644
|
+
cursor: number;
|
|
1645
|
+
strikeCount: number;
|
|
1646
|
+
lastAttacker: number;
|
|
1647
|
+
lastDefender: number;
|
|
1648
|
+
damage: number;
|
|
1649
|
+
hit: boolean;
|
|
1650
|
+
lossSerial: number;
|
|
1651
|
+
captureSerial: number;
|
|
1652
|
+
supplySerial: number;
|
|
1653
|
+
transportSerial: number;
|
|
1654
|
+
advantageDamage: number;
|
|
1655
|
+
advantageHit: number;
|
|
1656
|
+
powerSerial: number;
|
|
1657
|
+
abilities: TacticsAbility[];
|
|
1658
|
+
units: TacticsUnit[];
|
|
1659
|
+
structures: TacticsStructure[];
|
|
1660
|
+
powers: TacticsPower[];
|
|
1661
|
+
cells: TacticsCell[];
|
|
1662
|
+
}
|
|
1663
|
+
interface TacticsCell {
|
|
1664
|
+
x: number;
|
|
1665
|
+
y: number;
|
|
1666
|
+
terrain: number;
|
|
1667
|
+
blocked: boolean;
|
|
1668
|
+
occupant: number;
|
|
1669
|
+
structure: number;
|
|
1670
|
+
inRange: boolean;
|
|
1671
|
+
cost: number;
|
|
1672
|
+
}
|
|
1673
|
+
declare function tacticsData(o: TacticsOptions): number[];
|
|
1674
|
+
declare function tacticsOperation<T>(a: TacticsAction<T>): {
|
|
1675
|
+
op: number;
|
|
1676
|
+
data: number[];
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
/** B131–B140. Host-authoritative battle inputs and simulation-time judgment. */
|
|
1680
|
+
declare const BATTLE_ABILITIES: readonly ["priority-speed-turn-order", "type-effectiveness-matrix", "turn-duration-status", "capture-attempt-resolution", "conditional-evolution", "timed-battle-action-command", "active-partner-swap", "budgeted-passive-loadout", "field-first-strike", "escape-attempt"];
|
|
1681
|
+
declare const BATTLE_EVENTS: readonly ["priority-speed-turn-order", "type-effectiveness-matrix", "turn-duration-status", "capture-attempt-resolution", "conditional-evolution", "timed-battle-action-command", "active-partner-swap", "budgeted-passive-loadout", "field-first-strike", "escape-attempt", "action-command-timeout"];
|
|
1682
|
+
type BattleEvent = (typeof BATTLE_EVENTS)[number];
|
|
1683
|
+
type BattleAbility = (typeof BATTLE_ABILITIES)[number];
|
|
1684
|
+
type BattleTriple = readonly [number, number, number];
|
|
1685
|
+
type BattleFour = readonly [number, number, number, number];
|
|
1686
|
+
type BattleEight = readonly [
|
|
1687
|
+
number,
|
|
1688
|
+
number,
|
|
1689
|
+
number,
|
|
1690
|
+
number,
|
|
1691
|
+
number,
|
|
1692
|
+
number,
|
|
1693
|
+
number,
|
|
1694
|
+
number
|
|
1695
|
+
];
|
|
1696
|
+
interface BattleOptions {
|
|
1697
|
+
swapCost?: number;
|
|
1698
|
+
actionPoints?: number;
|
|
1699
|
+
passiveBudget?: number;
|
|
1700
|
+
captureItems?: number;
|
|
1701
|
+
escapeCost?: number;
|
|
1702
|
+
escapeBaseChance?: number;
|
|
1703
|
+
escapeRetryBonus?: number;
|
|
1704
|
+
}
|
|
1705
|
+
/** Successful requests strictly increase in 1..0xffffff. Rejections are atomic.
|
|
1706
|
+
* Targets are live handles. Registration, stats, eligibility and budgets are trusted host inputs.
|
|
1707
|
+
* Terminal outcomes emit receipts; the host applies ownership, inventory and encounter transitions once. */
|
|
1708
|
+
type BattleAction<T = number> = {
|
|
1709
|
+
requestId: number;
|
|
1710
|
+
} & ({
|
|
1711
|
+
type: 'queue-action';
|
|
1712
|
+
target: T;
|
|
1713
|
+
row: number;
|
|
1714
|
+
actionId: number;
|
|
1715
|
+
priority: number;
|
|
1716
|
+
speed: number;
|
|
1717
|
+
tieKey: number;
|
|
1718
|
+
} | {
|
|
1719
|
+
type: 'freeze-order';
|
|
1720
|
+
turn: number;
|
|
1721
|
+
} | {
|
|
1722
|
+
type: 'next-action';
|
|
1723
|
+
} | {
|
|
1724
|
+
type: 'clear-order';
|
|
1725
|
+
} | {
|
|
1726
|
+
type: 'type-row';
|
|
1727
|
+
attackType: number;
|
|
1728
|
+
defenderType: number;
|
|
1729
|
+
multiplier: number;
|
|
1730
|
+
} | {
|
|
1731
|
+
type: 'resolve-type';
|
|
1732
|
+
attackType: number;
|
|
1733
|
+
defenderType: number;
|
|
1734
|
+
secondType?: number;
|
|
1735
|
+
raw: number;
|
|
1736
|
+
damageSerial: number;
|
|
1737
|
+
} | {
|
|
1738
|
+
type: 'status-apply';
|
|
1739
|
+
id: number;
|
|
1740
|
+
turns: number;
|
|
1741
|
+
phaseMask: 1 | 2 | 3;
|
|
1742
|
+
restrict: boolean;
|
|
1743
|
+
amount: number;
|
|
1744
|
+
} | {
|
|
1745
|
+
type: 'status-phase';
|
|
1746
|
+
turn: number;
|
|
1747
|
+
phase: 0 | 1;
|
|
1748
|
+
} | {
|
|
1749
|
+
type: 'status-remove';
|
|
1750
|
+
id: number;
|
|
1751
|
+
} | {
|
|
1752
|
+
type: 'capture';
|
|
1753
|
+
target: T;
|
|
1754
|
+
attemptSerial: number;
|
|
1755
|
+
seed: number;
|
|
1756
|
+
health: number;
|
|
1757
|
+
maximumHealth: number;
|
|
1758
|
+
catchRate: number;
|
|
1759
|
+
itemBonus: number;
|
|
1760
|
+
statusBonus: number;
|
|
1761
|
+
eligible: boolean;
|
|
1762
|
+
itemId: number;
|
|
1763
|
+
} | {
|
|
1764
|
+
type: 'capture-stock';
|
|
1765
|
+
count: number;
|
|
1766
|
+
} | {
|
|
1767
|
+
type: 'creature';
|
|
1768
|
+
species: number;
|
|
1769
|
+
level: number;
|
|
1770
|
+
friendship: number;
|
|
1771
|
+
stats: BattleTriple;
|
|
1772
|
+
moves: BattleFour;
|
|
1773
|
+
} | {
|
|
1774
|
+
type: 'evolution-rule';
|
|
1775
|
+
row: number;
|
|
1776
|
+
from: number;
|
|
1777
|
+
to: number;
|
|
1778
|
+
level: number;
|
|
1779
|
+
item: number;
|
|
1780
|
+
friendship: number;
|
|
1781
|
+
context: number;
|
|
1782
|
+
stats: BattleTriple;
|
|
1783
|
+
keepMovesMask: number;
|
|
1784
|
+
} | {
|
|
1785
|
+
type: 'evolve';
|
|
1786
|
+
evolutionSerial: number;
|
|
1787
|
+
item: number;
|
|
1788
|
+
context: number;
|
|
1789
|
+
} | {
|
|
1790
|
+
type: 'creature-progress';
|
|
1791
|
+
level: number;
|
|
1792
|
+
friendship: number;
|
|
1793
|
+
} | {
|
|
1794
|
+
type: 'timing-start';
|
|
1795
|
+
moveSerial: number;
|
|
1796
|
+
count: number;
|
|
1797
|
+
window: number;
|
|
1798
|
+
bonus: number;
|
|
1799
|
+
times: BattleFour;
|
|
1800
|
+
buttons: BattleFour;
|
|
1801
|
+
} | {
|
|
1802
|
+
type: 'timing-input';
|
|
1803
|
+
button: number;
|
|
1804
|
+
timestamp: number;
|
|
1805
|
+
} | {
|
|
1806
|
+
type: 'timing-finish';
|
|
1807
|
+
} | {
|
|
1808
|
+
type: 'partner-register';
|
|
1809
|
+
target: T;
|
|
1810
|
+
row: number;
|
|
1811
|
+
health: number;
|
|
1812
|
+
maximumHealth: number;
|
|
1813
|
+
} | {
|
|
1814
|
+
type: 'partner-swap';
|
|
1815
|
+
row: number;
|
|
1816
|
+
} | {
|
|
1817
|
+
type: 'partner-health';
|
|
1818
|
+
row: number;
|
|
1819
|
+
health: number;
|
|
1820
|
+
} | {
|
|
1821
|
+
type: 'partner-turn';
|
|
1822
|
+
turn: number;
|
|
1823
|
+
points: number;
|
|
1824
|
+
} | {
|
|
1825
|
+
type: 'passive-row';
|
|
1826
|
+
row: number;
|
|
1827
|
+
id: number;
|
|
1828
|
+
cost: number;
|
|
1829
|
+
group: number;
|
|
1830
|
+
stat: 0 | 1 | 2;
|
|
1831
|
+
amount: number;
|
|
1832
|
+
maximumStacks: number;
|
|
1833
|
+
} | {
|
|
1834
|
+
type: 'passive-equip';
|
|
1835
|
+
counts: BattleEight;
|
|
1836
|
+
} | {
|
|
1837
|
+
type: 'passive-budget';
|
|
1838
|
+
budget: number;
|
|
1839
|
+
} | {
|
|
1840
|
+
type: 'passive-clear';
|
|
1841
|
+
} | {
|
|
1842
|
+
type: 'field-contact';
|
|
1843
|
+
target: T;
|
|
1844
|
+
side: 0 | 1 | 2;
|
|
1845
|
+
attackId: number;
|
|
1846
|
+
} | {
|
|
1847
|
+
type: 'opening-transfer';
|
|
1848
|
+
encounterSerial: number;
|
|
1849
|
+
} | {
|
|
1850
|
+
type: 'escape';
|
|
1851
|
+
seed: number;
|
|
1852
|
+
speed: number;
|
|
1853
|
+
enemySpeed: number;
|
|
1854
|
+
eligible: boolean;
|
|
1855
|
+
} | {
|
|
1856
|
+
type: 'escape-turn';
|
|
1857
|
+
turn: number;
|
|
1858
|
+
points: number;
|
|
1859
|
+
} | {
|
|
1860
|
+
type: 'battle-end';
|
|
1861
|
+
outcome: 3 | 4;
|
|
1862
|
+
});
|
|
1863
|
+
interface BattleState {
|
|
1864
|
+
abilities: BattleAbility[];
|
|
1865
|
+
lastRequest: number;
|
|
1866
|
+
revision: number;
|
|
1867
|
+
outcome: number;
|
|
1868
|
+
points: number;
|
|
1869
|
+
budgetTurn: number;
|
|
1870
|
+
turn: number;
|
|
1871
|
+
frozen: boolean;
|
|
1872
|
+
orderCount: number;
|
|
1873
|
+
cursor: number;
|
|
1874
|
+
lastAction: number;
|
|
1875
|
+
canceled: number;
|
|
1876
|
+
typeSerial: number;
|
|
1877
|
+
multiplier: number;
|
|
1878
|
+
damage: number;
|
|
1879
|
+
reaction: number;
|
|
1880
|
+
hook: number;
|
|
1881
|
+
tickAmount: number;
|
|
1882
|
+
blocked: boolean;
|
|
1883
|
+
captureSerial: number;
|
|
1884
|
+
captureResult: number;
|
|
1885
|
+
captureChance: number;
|
|
1886
|
+
captureRoll: number;
|
|
1887
|
+
captureStock: number;
|
|
1888
|
+
captureItem: number;
|
|
1889
|
+
species: number;
|
|
1890
|
+
level: number;
|
|
1891
|
+
friendship: number;
|
|
1892
|
+
evolutionSerial: number;
|
|
1893
|
+
usedItem: number;
|
|
1894
|
+
stats: BattleTriple;
|
|
1895
|
+
moves: BattleFour;
|
|
1896
|
+
moveSerial: number;
|
|
1897
|
+
timingPhase: number;
|
|
1898
|
+
clock: number;
|
|
1899
|
+
inputCount: number;
|
|
1900
|
+
inputNext: number;
|
|
1901
|
+
hits: number;
|
|
1902
|
+
quality: number;
|
|
1903
|
+
actionMultiplier: number;
|
|
1904
|
+
window: number;
|
|
1905
|
+
times: BattleFour;
|
|
1906
|
+
buttons: BattleFour;
|
|
1907
|
+
/** Active partner is a 1-based roster index; zero means none. */
|
|
1908
|
+
activePartner: number;
|
|
1909
|
+
swapSerial: number;
|
|
1910
|
+
passiveBudget: number;
|
|
1911
|
+
spent: number;
|
|
1912
|
+
modifiers: BattleTriple;
|
|
1913
|
+
bonus: number;
|
|
1914
|
+
openingPhase: number;
|
|
1915
|
+
openingSide: number;
|
|
1916
|
+
openingAttack: number;
|
|
1917
|
+
openingSerial: number;
|
|
1918
|
+
escapeAttempts: number;
|
|
1919
|
+
escapeResult: number;
|
|
1920
|
+
escapeChance: number;
|
|
1921
|
+
escapeRoll: number;
|
|
1922
|
+
order: number[];
|
|
1923
|
+
queued: boolean[];
|
|
1924
|
+
partnerHealth: number[];
|
|
1925
|
+
partnerMaximum: number[];
|
|
1926
|
+
passiveCounts: number[];
|
|
1927
|
+
passiveIds: number[];
|
|
1928
|
+
statusIds: number[];
|
|
1929
|
+
statusTurns: number[];
|
|
1930
|
+
statusAmounts: number[];
|
|
1931
|
+
statusPhases: number[];
|
|
1932
|
+
typeMatrix: number[];
|
|
1933
|
+
}
|
|
1934
|
+
declare function battleData(o: BattleOptions): number[];
|
|
1935
|
+
declare function battleOperation<T>(a: BattleAction<T>): {
|
|
1936
|
+
op: number;
|
|
1937
|
+
data: number[];
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
/** B121–B130. Host-authoritative inventory inputs; world metres and simulation seconds. */
|
|
1941
|
+
declare const RPG_ABILITIES: readonly ["equipment-stat-aggregation", "durability-and-repair", "affix-budget-generation", "death-drop-ownership", "consumable-belt-slots", "seeded-loot-table", "damage-to-resource-leech", "typed-resistance-resolution", "autonomous-familiar", "resource-draining-transformation"];
|
|
1942
|
+
declare const RPG_EVENTS: readonly ["equipment-stat-aggregation", "durability-and-repair", "affix-budget-generation", "death-drop-ownership", "consumable-belt-slots", "seeded-loot-table", "damage-to-resource-leech", "typed-resistance-resolution", "autonomous-familiar", "resource-draining-transformation", "familiar-attack", "familiar-support"];
|
|
1943
|
+
type RpgEvent = (typeof RPG_EVENTS)[number];
|
|
1944
|
+
type RpgAbility = (typeof RPG_ABILITIES)[number];
|
|
1945
|
+
type RpgPoint = readonly [number, number, number];
|
|
1946
|
+
interface RpgOptions {
|
|
1947
|
+
strength?: number;
|
|
1948
|
+
defense?: number;
|
|
1949
|
+
speed?: number;
|
|
1950
|
+
maximumHealth?: number;
|
|
1951
|
+
maximumMana?: number;
|
|
1952
|
+
currency?: number;
|
|
1953
|
+
repairUnitCost?: number;
|
|
1954
|
+
pickupRange?: number;
|
|
1955
|
+
reservationSeconds?: number;
|
|
1956
|
+
followDistance?: number;
|
|
1957
|
+
familiarSpeed?: number;
|
|
1958
|
+
actionRange?: number;
|
|
1959
|
+
actionCooldown?: number;
|
|
1960
|
+
leashRange?: number;
|
|
1961
|
+
maximumDrain?: number;
|
|
1962
|
+
maximumRadius?: number;
|
|
1963
|
+
}
|
|
1964
|
+
/** Request IDs strictly increase (1..0xffffff). Invalid commands are atomic.
|
|
1965
|
+
* Item targets are live entity handles, uniquely claimed within the RPG registry.
|
|
1966
|
+
* Authored data/notifications must come from the host's authoritative inventory/combat system. */
|
|
1967
|
+
type RpgAction<T = number> = {
|
|
1968
|
+
requestId: number;
|
|
1969
|
+
} & ({
|
|
1970
|
+
type: 'equipment-register';
|
|
1971
|
+
target: T;
|
|
1972
|
+
slotMask: number;
|
|
1973
|
+
requiredStrength: number;
|
|
1974
|
+
flat: RpgPoint;
|
|
1975
|
+
percent: RpgPoint;
|
|
1976
|
+
} | {
|
|
1977
|
+
type: 'equip';
|
|
1978
|
+
target: T;
|
|
1979
|
+
slot: 0 | 1 | 2 | 3;
|
|
1980
|
+
} | {
|
|
1981
|
+
type: 'unequip';
|
|
1982
|
+
slot: 0 | 1 | 2 | 3;
|
|
1983
|
+
} | {
|
|
1984
|
+
type: 'base-stats';
|
|
1985
|
+
values: RpgPoint;
|
|
1986
|
+
} | {
|
|
1987
|
+
type: 'durability-register';
|
|
1988
|
+
target: T;
|
|
1989
|
+
current: number;
|
|
1990
|
+
maximum: number;
|
|
1991
|
+
} | {
|
|
1992
|
+
type: 'wear';
|
|
1993
|
+
target: T;
|
|
1994
|
+
amount: number;
|
|
1995
|
+
useSerial: number;
|
|
1996
|
+
} | {
|
|
1997
|
+
type: 'repair';
|
|
1998
|
+
target: T;
|
|
1999
|
+
amount: number;
|
|
2000
|
+
} | {
|
|
2001
|
+
type: 'wallet';
|
|
2002
|
+
currency: number;
|
|
2003
|
+
} | {
|
|
2004
|
+
type: 'affix-row';
|
|
2005
|
+
row: number;
|
|
2006
|
+
id: number;
|
|
2007
|
+
cost: number;
|
|
2008
|
+
level: number;
|
|
2009
|
+
classMask: number;
|
|
2010
|
+
group: number;
|
|
2011
|
+
stat: 0 | 1 | 2;
|
|
2012
|
+
amount: number;
|
|
2013
|
+
weight: number;
|
|
2014
|
+
} | {
|
|
2015
|
+
type: 'affix-roll';
|
|
2016
|
+
seed: number;
|
|
2017
|
+
level: number;
|
|
2018
|
+
itemClass: number;
|
|
2019
|
+
budget: number;
|
|
2020
|
+
count: number;
|
|
2021
|
+
} | {
|
|
2022
|
+
type: 'affix-clear';
|
|
2023
|
+
} | {
|
|
2024
|
+
type: 'drop-public';
|
|
2025
|
+
itemType: number;
|
|
2026
|
+
rarity: number;
|
|
2027
|
+
} | {
|
|
2028
|
+
type: 'drop-reserve';
|
|
2029
|
+
target: T;
|
|
2030
|
+
itemType: number;
|
|
2031
|
+
rarity: number;
|
|
2032
|
+
} | {
|
|
2033
|
+
type: 'death-drop';
|
|
2034
|
+
deathSerial: number;
|
|
2035
|
+
lootSerial: number;
|
|
2036
|
+
affixSerial: number;
|
|
2037
|
+
} | {
|
|
2038
|
+
type: 'drop-pickup';
|
|
2039
|
+
target: T;
|
|
2040
|
+
} | {
|
|
2041
|
+
type: 'belt-stock';
|
|
2042
|
+
target: T;
|
|
2043
|
+
slot: 0 | 1 | 2 | 3;
|
|
2044
|
+
count: number;
|
|
2045
|
+
kind: 1 | 2;
|
|
2046
|
+
potency: number;
|
|
2047
|
+
} | {
|
|
2048
|
+
type: 'belt-use';
|
|
2049
|
+
slot: 0 | 1 | 2 | 3;
|
|
2050
|
+
} | {
|
|
2051
|
+
type: 'belt-move';
|
|
2052
|
+
from: 0 | 1 | 2 | 3;
|
|
2053
|
+
to: 0 | 1 | 2 | 3;
|
|
2054
|
+
} | {
|
|
2055
|
+
type: 'belt-resources';
|
|
2056
|
+
health: number;
|
|
2057
|
+
mana: number;
|
|
2058
|
+
} | {
|
|
2059
|
+
type: 'loot-row';
|
|
2060
|
+
row: number;
|
|
2061
|
+
itemType: number;
|
|
2062
|
+
weight: number;
|
|
2063
|
+
level: number;
|
|
2064
|
+
rarity: number;
|
|
2065
|
+
} | {
|
|
2066
|
+
type: 'loot-roll';
|
|
2067
|
+
seed: number;
|
|
2068
|
+
level: number;
|
|
2069
|
+
} | {
|
|
2070
|
+
type: 'loot-clear';
|
|
2071
|
+
} | {
|
|
2072
|
+
type: 'leech-rates';
|
|
2073
|
+
health: number;
|
|
2074
|
+
mana: number;
|
|
2075
|
+
} | {
|
|
2076
|
+
type: 'leech';
|
|
2077
|
+
damage: number;
|
|
2078
|
+
damageSerial: number;
|
|
2079
|
+
flags: number;
|
|
2080
|
+
} | {
|
|
2081
|
+
type: 'leech-resources';
|
|
2082
|
+
health: number;
|
|
2083
|
+
mana: number;
|
|
2084
|
+
} | {
|
|
2085
|
+
type: 'resistance';
|
|
2086
|
+
damageType: 0 | 1 | 2 | 3;
|
|
2087
|
+
resistance: number;
|
|
2088
|
+
immune: boolean;
|
|
2089
|
+
} | {
|
|
2090
|
+
type: 'resolve-damage';
|
|
2091
|
+
raw: number;
|
|
2092
|
+
damageType: 0 | 1 | 2 | 3;
|
|
2093
|
+
damageSerial: number;
|
|
2094
|
+
flags: number;
|
|
2095
|
+
availableHealth: number;
|
|
2096
|
+
} | {
|
|
2097
|
+
type: 'familiar-bind';
|
|
2098
|
+
target: T;
|
|
2099
|
+
role: 0 | 1;
|
|
2100
|
+
} | {
|
|
2101
|
+
type: 'familiar-candidate';
|
|
2102
|
+
target: T;
|
|
2103
|
+
} | {
|
|
2104
|
+
type: 'familiar-stop';
|
|
2105
|
+
} | {
|
|
2106
|
+
type: 'familiar-remove';
|
|
2107
|
+
target: T;
|
|
2108
|
+
} | {
|
|
2109
|
+
type: 'transform';
|
|
2110
|
+
form: 1 | 2;
|
|
2111
|
+
radius: number;
|
|
2112
|
+
drain: number;
|
|
2113
|
+
speed: number;
|
|
2114
|
+
} | {
|
|
2115
|
+
type: 'revert';
|
|
2116
|
+
} | {
|
|
2117
|
+
type: 'form-mana';
|
|
2118
|
+
mana: number;
|
|
2119
|
+
});
|
|
2120
|
+
interface RpgItem {
|
|
2121
|
+
owned: boolean;
|
|
2122
|
+
equipment: boolean;
|
|
2123
|
+
slotMask: number;
|
|
2124
|
+
requiredStrength: number;
|
|
2125
|
+
flat: RpgPoint;
|
|
2126
|
+
percent: RpgPoint;
|
|
2127
|
+
durability: number;
|
|
2128
|
+
maximumDurability: number;
|
|
2129
|
+
count: number;
|
|
2130
|
+
kind: number;
|
|
2131
|
+
potency: number;
|
|
2132
|
+
lastWear: number;
|
|
2133
|
+
}
|
|
2134
|
+
interface RpgAffix {
|
|
2135
|
+
id: number;
|
|
2136
|
+
stat: number;
|
|
2137
|
+
amount: number;
|
|
2138
|
+
cost: number;
|
|
2139
|
+
}
|
|
2140
|
+
interface RpgState {
|
|
2141
|
+
abilities: RpgAbility[];
|
|
2142
|
+
lastRequest: number;
|
|
2143
|
+
revision: number;
|
|
2144
|
+
base: RpgPoint;
|
|
2145
|
+
derived: RpgPoint;
|
|
2146
|
+
health: number;
|
|
2147
|
+
mana: number;
|
|
2148
|
+
currency: number;
|
|
2149
|
+
repairCost: number;
|
|
2150
|
+
beltSerial: number;
|
|
2151
|
+
healthGained: number;
|
|
2152
|
+
manaGained: number;
|
|
2153
|
+
affixSerial: number;
|
|
2154
|
+
affixCount: number;
|
|
2155
|
+
affixSpent: number;
|
|
2156
|
+
affixSeed: number;
|
|
2157
|
+
lootSerial: number;
|
|
2158
|
+
lootType: number;
|
|
2159
|
+
lootRarity: number;
|
|
2160
|
+
lootSeed: number;
|
|
2161
|
+
dropPhase: number;
|
|
2162
|
+
deathSerial: number;
|
|
2163
|
+
dropType: number;
|
|
2164
|
+
dropRarity: number;
|
|
2165
|
+
reservation: number;
|
|
2166
|
+
dropAffixCount: number;
|
|
2167
|
+
leechSerial: number;
|
|
2168
|
+
damageSerial: number;
|
|
2169
|
+
damage: number;
|
|
2170
|
+
damageType: number;
|
|
2171
|
+
damageFlags: number;
|
|
2172
|
+
reaction: number;
|
|
2173
|
+
familiarPhase: number;
|
|
2174
|
+
destination: RpgPoint;
|
|
2175
|
+
actionSerial: number;
|
|
2176
|
+
cooldown: number;
|
|
2177
|
+
form: number;
|
|
2178
|
+
formPhase: number;
|
|
2179
|
+
formRadius: number;
|
|
2180
|
+
formSpeed: number;
|
|
2181
|
+
formSerial: number;
|
|
2182
|
+
/** References are 1-based indexes into items; zero is an empty slot. */
|
|
2183
|
+
equipmentSlots: number[];
|
|
2184
|
+
beltSlots: number[];
|
|
2185
|
+
resistances: number[];
|
|
2186
|
+
immunities: boolean[];
|
|
2187
|
+
items: RpgItem[];
|
|
2188
|
+
affixes: RpgAffix[];
|
|
2189
|
+
dropAffixes: RpgAffix[];
|
|
2190
|
+
}
|
|
2191
|
+
declare function rpgData(o: RpgOptions): number[];
|
|
2192
|
+
declare function rpgOperation<T>(a: RpgAction<T>): {
|
|
2193
|
+
op: number;
|
|
2194
|
+
data: number[];
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2197
|
+
/** B111–B120. Metres/seconds, Y up; tennis court is X width / Z length. */
|
|
2198
|
+
declare const SPORTS_ABILITIES: readonly ["swing-power-accuracy", "club-shot-profile", "wind-drag-ball-flight", "landing-spin-transfer", "slope-aware-putting", "racket-contact-timing", "racket-spin-shot", "lob-and-drop-placement", "serve-and-fault-sequence", "rally-point-adjudication"];
|
|
2199
|
+
type SportsAbility = (typeof SPORTS_ABILITIES)[number];
|
|
2200
|
+
type SportsPoint = readonly [number, number, number];
|
|
2201
|
+
interface SportsOptions {
|
|
2202
|
+
swingDuration?: number;
|
|
2203
|
+
idealImpactTime?: number;
|
|
2204
|
+
accuracyWindow?: number;
|
|
2205
|
+
ballRadius?: number;
|
|
2206
|
+
drag?: number;
|
|
2207
|
+
lift?: number;
|
|
2208
|
+
gravity?: number;
|
|
2209
|
+
restitution?: number;
|
|
2210
|
+
rollingResistance?: number;
|
|
2211
|
+
cupRadius?: number;
|
|
2212
|
+
cupMaximumSpeed?: number;
|
|
2213
|
+
racketWindow?: number;
|
|
2214
|
+
maximumSpin?: number;
|
|
2215
|
+
maximumSpeed?: number;
|
|
2216
|
+
courtHalfWidth?: number;
|
|
2217
|
+
courtHalfLength?: number;
|
|
2218
|
+
}
|
|
2219
|
+
/** Request IDs strictly increase (1..0xffffff). Invalid commands are atomic.
|
|
2220
|
+
* With prerequisite abilities attached, consume their current serial rather than host inputs.
|
|
2221
|
+
* Flight / putting own a virtual ball; host applies destination once per fixed step. */
|
|
2222
|
+
type SportsAction<T = number> = {
|
|
2223
|
+
requestId: number;
|
|
2224
|
+
} & ({
|
|
2225
|
+
type: 'swing-start';
|
|
2226
|
+
} | {
|
|
2227
|
+
type: 'swing-power';
|
|
2228
|
+
} | {
|
|
2229
|
+
type: 'swing-impact';
|
|
2230
|
+
} | {
|
|
2231
|
+
type: 'swing-cancel';
|
|
2232
|
+
} | {
|
|
2233
|
+
type: 'club-profile';
|
|
2234
|
+
speed: number;
|
|
2235
|
+
loft: number;
|
|
2236
|
+
spin: number;
|
|
2237
|
+
} | {
|
|
2238
|
+
type: 'club-shot';
|
|
2239
|
+
aim: SportsPoint;
|
|
2240
|
+
power: number;
|
|
2241
|
+
error: number;
|
|
2242
|
+
lie: number;
|
|
2243
|
+
swingSerial: number;
|
|
2244
|
+
} | {
|
|
2245
|
+
type: 'flight-start';
|
|
2246
|
+
velocity: SportsPoint;
|
|
2247
|
+
spin: SportsPoint;
|
|
2248
|
+
shotSerial: number;
|
|
2249
|
+
} | {
|
|
2250
|
+
type: 'wind';
|
|
2251
|
+
velocity: SportsPoint;
|
|
2252
|
+
drag: number;
|
|
2253
|
+
lift: number;
|
|
2254
|
+
} | {
|
|
2255
|
+
type: 'flight-stop';
|
|
2256
|
+
} | {
|
|
2257
|
+
type: 'landing-spin';
|
|
2258
|
+
spin: SportsPoint;
|
|
2259
|
+
} | {
|
|
2260
|
+
type: 'spin-transfer';
|
|
2261
|
+
} | {
|
|
2262
|
+
type: 'putt';
|
|
2263
|
+
target: T;
|
|
2264
|
+
velocity: SportsPoint;
|
|
2265
|
+
} | {
|
|
2266
|
+
type: 'putt-stop';
|
|
2267
|
+
} | {
|
|
2268
|
+
type: 'racket-swing';
|
|
2269
|
+
target: T;
|
|
2270
|
+
} | {
|
|
2271
|
+
type: 'racket-cancel';
|
|
2272
|
+
} | {
|
|
2273
|
+
type: 'spin-shot';
|
|
2274
|
+
aim: SportsPoint;
|
|
2275
|
+
mode: -1 | 0 | 1;
|
|
2276
|
+
power: number;
|
|
2277
|
+
contactSerial: number;
|
|
2278
|
+
} | {
|
|
2279
|
+
type: 'placement';
|
|
2280
|
+
position: SportsPoint;
|
|
2281
|
+
apex: number;
|
|
2282
|
+
} | {
|
|
2283
|
+
type: 'serve-start';
|
|
2284
|
+
target: T;
|
|
2285
|
+
server: 0 | 1;
|
|
2286
|
+
boxSide: -1 | 1;
|
|
2287
|
+
serviceDepth: number;
|
|
2288
|
+
} | {
|
|
2289
|
+
type: 'serve-strike';
|
|
2290
|
+
} | {
|
|
2291
|
+
type: 'serve-contact';
|
|
2292
|
+
kind: 'net' | 'bounce';
|
|
2293
|
+
} | {
|
|
2294
|
+
type: 'rally-start';
|
|
2295
|
+
lastHitter: 0 | 1;
|
|
2296
|
+
} | {
|
|
2297
|
+
type: 'rally-hit';
|
|
2298
|
+
player: 0 | 1;
|
|
2299
|
+
contactSerial: number;
|
|
2300
|
+
} | {
|
|
2301
|
+
type: 'rally-bounce';
|
|
2302
|
+
});
|
|
2303
|
+
interface SportsState {
|
|
2304
|
+
abilities: SportsAbility[];
|
|
2305
|
+
lastRequest: number;
|
|
2306
|
+
revision: number;
|
|
2307
|
+
swingPhase: number;
|
|
2308
|
+
swingTime: number;
|
|
2309
|
+
power: number;
|
|
2310
|
+
directionError: number;
|
|
2311
|
+
swingSerial: number;
|
|
2312
|
+
shotSerial: number;
|
|
2313
|
+
shotVelocity: SportsPoint;
|
|
2314
|
+
shotSpin: SportsPoint;
|
|
2315
|
+
flightPhase: number;
|
|
2316
|
+
destination: SportsPoint;
|
|
2317
|
+
velocity: SportsPoint;
|
|
2318
|
+
spin: SportsPoint;
|
|
2319
|
+
collisionSerial: number;
|
|
2320
|
+
impactSerial: number;
|
|
2321
|
+
impactVelocity: SportsPoint;
|
|
2322
|
+
puttPhase: number;
|
|
2323
|
+
bounceEpoch: number;
|
|
2324
|
+
racketPhase: number;
|
|
2325
|
+
racketTime: number;
|
|
2326
|
+
contactQuality: number;
|
|
2327
|
+
contactSerial: number;
|
|
2328
|
+
contactAge: number;
|
|
2329
|
+
placementTime: number;
|
|
2330
|
+
placement: SportsPoint;
|
|
2331
|
+
servePhase: number;
|
|
2332
|
+
attempt: number;
|
|
2333
|
+
server: number;
|
|
2334
|
+
netTouched: boolean;
|
|
2335
|
+
lets: number;
|
|
2336
|
+
rallyPhase: number;
|
|
2337
|
+
lastHitter: number;
|
|
2338
|
+
bounceCount: number;
|
|
2339
|
+
crossedNet: boolean;
|
|
2340
|
+
winner: number;
|
|
2341
|
+
pointSerial: number;
|
|
2342
|
+
pointReason: number;
|
|
2343
|
+
supported: boolean;
|
|
2344
|
+
wind: SportsPoint;
|
|
2345
|
+
consumedShot: number;
|
|
2346
|
+
consumedSwing: number;
|
|
2347
|
+
consumedContact: number;
|
|
2348
|
+
adjudicatedContact: number;
|
|
2349
|
+
adjudicatedBounce: number;
|
|
2350
|
+
}
|
|
2351
|
+
declare function sportsData(o: SportsOptions): number[];
|
|
2352
|
+
declare function sportsOperation<T>(a: SportsAction<T>): {
|
|
2353
|
+
op: number;
|
|
2354
|
+
data: number[];
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
/** B101–B110. Metres/seconds, Y up, local +X forward. Host applies motion intents. */
|
|
2358
|
+
declare const SKATE_ABILITIES: readonly ["rail-grind-balance", "wall-ride", "manual-balance", "ramp-lip-launch", "unbanked-trick-combo", "repeated-trick-devaluation", "air-grab-trick", "prewound-spin", "landing-alignment-bail", "trick-earned-boost-meter"];
|
|
2359
|
+
type SkateAbility = (typeof SKATE_ABILITIES)[number];
|
|
2360
|
+
type SkatePoint = readonly [number, number, number];
|
|
2361
|
+
interface SkateOptions {
|
|
2362
|
+
supportDistance?: number;
|
|
2363
|
+
snapDistance?: number;
|
|
2364
|
+
minimumSpeed?: number;
|
|
2365
|
+
wallDuration?: number;
|
|
2366
|
+
lipWindow?: number;
|
|
2367
|
+
grabReleaseLead?: number;
|
|
2368
|
+
minimumUpDot?: number;
|
|
2369
|
+
minimumTravelDot?: number;
|
|
2370
|
+
maximumImpactSpeed?: number;
|
|
2371
|
+
minimumGrabTime?: number;
|
|
2372
|
+
maximumSpinRate?: number;
|
|
2373
|
+
maximumSpinAngle?: number;
|
|
2374
|
+
boostCapacity?: number;
|
|
2375
|
+
boostDrain?: number;
|
|
2376
|
+
boostPerPoint?: number;
|
|
2377
|
+
jumpSpeed?: number;
|
|
2378
|
+
}
|
|
2379
|
+
/** Successful request IDs strictly increase (1..0xffffff). Rejected commands are atomic.
|
|
2380
|
+
* Scoring is host-authored; bank/award validates the live landing frame. No raw boost grants. */
|
|
2381
|
+
type SkateAction<T = number> = {
|
|
2382
|
+
requestId: number;
|
|
2383
|
+
} & ({
|
|
2384
|
+
type: 'grind';
|
|
2385
|
+
target: T;
|
|
2386
|
+
start: SkatePoint;
|
|
2387
|
+
end: SkatePoint;
|
|
2388
|
+
} | {
|
|
2389
|
+
type: 'grind-balance';
|
|
2390
|
+
correction: number;
|
|
2391
|
+
} | {
|
|
2392
|
+
type: 'dismount';
|
|
2393
|
+
position: SkatePoint;
|
|
2394
|
+
} | {
|
|
2395
|
+
type: 'wall-attach';
|
|
2396
|
+
target: T;
|
|
2397
|
+
direction: SkatePoint;
|
|
2398
|
+
} | {
|
|
2399
|
+
type: 'wall-exit';
|
|
2400
|
+
direction: SkatePoint;
|
|
2401
|
+
} | {
|
|
2402
|
+
type: 'manual';
|
|
2403
|
+
} | {
|
|
2404
|
+
type: 'manual-balance';
|
|
2405
|
+
correction: number;
|
|
2406
|
+
} | {
|
|
2407
|
+
type: 'end-manual';
|
|
2408
|
+
} | {
|
|
2409
|
+
type: 'ramp-sample';
|
|
2410
|
+
target: T;
|
|
2411
|
+
tangent: SkatePoint;
|
|
2412
|
+
jump: boolean;
|
|
2413
|
+
} | {
|
|
2414
|
+
type: 'trick';
|
|
2415
|
+
trick: number;
|
|
2416
|
+
points: number;
|
|
2417
|
+
} | {
|
|
2418
|
+
type: 'begin-combo';
|
|
2419
|
+
} | {
|
|
2420
|
+
type: 'land-combo';
|
|
2421
|
+
} | {
|
|
2422
|
+
type: 'bail-combo';
|
|
2423
|
+
} | {
|
|
2424
|
+
type: 'preview-repeat';
|
|
2425
|
+
trick: number;
|
|
2426
|
+
} | {
|
|
2427
|
+
type: 'practice-repeat';
|
|
2428
|
+
trick: number;
|
|
2429
|
+
} | {
|
|
2430
|
+
type: 'reset-history';
|
|
2431
|
+
} | {
|
|
2432
|
+
type: 'grab';
|
|
2433
|
+
trick: number;
|
|
2434
|
+
} | {
|
|
2435
|
+
type: 'release-grab';
|
|
2436
|
+
} | {
|
|
2437
|
+
type: 'land-grab';
|
|
2438
|
+
} | {
|
|
2439
|
+
type: 'wind';
|
|
2440
|
+
direction: number;
|
|
2441
|
+
} | {
|
|
2442
|
+
type: 'spin-takeoff';
|
|
2443
|
+
} | {
|
|
2444
|
+
type: 'land-spin';
|
|
2445
|
+
} | {
|
|
2446
|
+
type: 'begin-landing';
|
|
2447
|
+
} | {
|
|
2448
|
+
type: 'resolve-landing';
|
|
2449
|
+
} | {
|
|
2450
|
+
type: 'boost-trick';
|
|
2451
|
+
trick: number;
|
|
2452
|
+
points: number;
|
|
2453
|
+
} | {
|
|
2454
|
+
type: 'boost-input';
|
|
2455
|
+
held: boolean;
|
|
2456
|
+
} | {
|
|
2457
|
+
type: 'land-boost';
|
|
2458
|
+
} | {
|
|
2459
|
+
type: 'bail-boost';
|
|
2460
|
+
});
|
|
2461
|
+
type SkatePhase = 'idle' | 'active' | 'ended' | 'bailed' | 'blocked';
|
|
2462
|
+
interface SkateState {
|
|
2463
|
+
abilities: SkateAbility[];
|
|
2464
|
+
lastRequest: number;
|
|
2465
|
+
revision: number;
|
|
2466
|
+
railPhase: SkatePhase;
|
|
2467
|
+
railCoordinate: number;
|
|
2468
|
+
balance: number;
|
|
2469
|
+
balanceTime: number;
|
|
2470
|
+
wallPhase: SkatePhase;
|
|
2471
|
+
wallRemaining: number;
|
|
2472
|
+
manualPhase: SkatePhase;
|
|
2473
|
+
destination: SkatePoint;
|
|
2474
|
+
velocity: SkatePoint;
|
|
2475
|
+
launchSerial: number;
|
|
2476
|
+
launchVelocity: SkatePoint;
|
|
2477
|
+
flight: number;
|
|
2478
|
+
comboOpen: boolean;
|
|
2479
|
+
landing: 'none' | 'landed' | 'bailed';
|
|
2480
|
+
resolvedFlight: number;
|
|
2481
|
+
pendingBase: number;
|
|
2482
|
+
trickCount: number;
|
|
2483
|
+
totalScore: number;
|
|
2484
|
+
lastBank: number;
|
|
2485
|
+
bankSerial: number;
|
|
2486
|
+
repeatFactor: number;
|
|
2487
|
+
repeatCount: number;
|
|
2488
|
+
historySize: number;
|
|
2489
|
+
grab: number;
|
|
2490
|
+
grabHeld: boolean;
|
|
2491
|
+
grabTime: number;
|
|
2492
|
+
releaseAge: number;
|
|
2493
|
+
grabValid: boolean;
|
|
2494
|
+
windup: number;
|
|
2495
|
+
spinRate: number;
|
|
2496
|
+
spinAngle: number;
|
|
2497
|
+
energy: number;
|
|
2498
|
+
boosting: boolean;
|
|
2499
|
+
boostFraction: number;
|
|
2500
|
+
touchdownCaptured: boolean;
|
|
2501
|
+
wallNormal: SkatePoint;
|
|
2502
|
+
lipRemaining: number;
|
|
2503
|
+
}
|
|
2504
|
+
declare function skateData(o: SkateOptions): number[];
|
|
2505
|
+
declare function skateOperation<T>(a: SkateAction<T>): {
|
|
2506
|
+
op: number;
|
|
2507
|
+
data: number[];
|
|
2508
|
+
};
|
|
2509
|
+
|
|
2510
|
+
/** B091–B100. Metres/seconds, Y up, local +X forward/+Z right. Host owns motion and collision leases. */
|
|
2511
|
+
declare const RACING_ABILITIES: readonly ["drift-charge-boost", "slipstream-drafting", "position-weighted-race-items", "track-following-homing-item", "ordered-lap-checkpoints", "hover-track-suspension", "energy-funded-race-boost", "vehicle-side-attack", "vehicle-damage-progression", "vehicle-seat-entry-exit"];
|
|
2512
|
+
type RacingAbility = (typeof RACING_ABILITIES)[number];
|
|
2513
|
+
type RacingPoint = readonly [number, number, number];
|
|
2514
|
+
interface RacingOptions {
|
|
2515
|
+
driftTierTime?: number;
|
|
2516
|
+
boostDuration?: number;
|
|
2517
|
+
minimumSpeed?: number;
|
|
2518
|
+
draftRange?: number;
|
|
2519
|
+
draftDwell?: number;
|
|
2520
|
+
rideHeight?: number;
|
|
2521
|
+
spring?: number;
|
|
2522
|
+
damping?: number;
|
|
2523
|
+
maxAcceleration?: number;
|
|
2524
|
+
energyCapacity?: number;
|
|
2525
|
+
boostDrain?: number;
|
|
2526
|
+
rechargeRate?: number;
|
|
2527
|
+
attackDuration?: number;
|
|
2528
|
+
attackCooldown?: number;
|
|
2529
|
+
burnDuration?: number;
|
|
2530
|
+
seatRange?: number;
|
|
2531
|
+
}
|
|
2532
|
+
/** Successful IDs strictly increase, 1..0xffffff. Rejected commands leave all state untouched. */
|
|
2533
|
+
type RacingAction<T = number> = {
|
|
2534
|
+
requestId: number;
|
|
2535
|
+
} & ({
|
|
2536
|
+
type: 'drift-input';
|
|
2537
|
+
held: boolean;
|
|
2538
|
+
supported: boolean;
|
|
2539
|
+
slipAngle: number;
|
|
2540
|
+
steering: number;
|
|
2541
|
+
} | {
|
|
2542
|
+
type: 'draft-target';
|
|
2543
|
+
target: T;
|
|
2544
|
+
} | {
|
|
2545
|
+
type: 'clear-draft';
|
|
2546
|
+
} | {
|
|
2547
|
+
type: 'item-weight';
|
|
2548
|
+
firstRank: number;
|
|
2549
|
+
lastRank: number;
|
|
2550
|
+
item: number;
|
|
2551
|
+
weight: number;
|
|
2552
|
+
} | {
|
|
2553
|
+
type: 'draw-item';
|
|
2554
|
+
rank: number;
|
|
2555
|
+
racers: number;
|
|
2556
|
+
seed: number;
|
|
2557
|
+
} | {
|
|
2558
|
+
type: 'use-item';
|
|
2559
|
+
} | {
|
|
2560
|
+
type: 'route-point';
|
|
2561
|
+
position: RacingPoint;
|
|
2562
|
+
} | {
|
|
2563
|
+
type: 'launch-item';
|
|
2564
|
+
target: T;
|
|
2565
|
+
} | {
|
|
2566
|
+
type: 'cancel-item';
|
|
2567
|
+
} | {
|
|
2568
|
+
type: 'checkpoint';
|
|
2569
|
+
position: RacingPoint;
|
|
2570
|
+
normal: RacingPoint;
|
|
2571
|
+
radius: number;
|
|
2572
|
+
} | {
|
|
2573
|
+
type: 'start-race';
|
|
2574
|
+
laps: number;
|
|
2575
|
+
} | {
|
|
2576
|
+
type: 'hover-track';
|
|
2577
|
+
target: T;
|
|
2578
|
+
} | {
|
|
2579
|
+
type: 'clear-hover';
|
|
2580
|
+
} | {
|
|
2581
|
+
type: 'boost-input';
|
|
2582
|
+
held: boolean;
|
|
2583
|
+
} | {
|
|
2584
|
+
type: 'recharge-zone';
|
|
2585
|
+
target: T;
|
|
2586
|
+
radius: number;
|
|
2587
|
+
} | {
|
|
2588
|
+
type: 'energy-damage';
|
|
2589
|
+
amount: number;
|
|
2590
|
+
} | {
|
|
2591
|
+
type: 'side-attack';
|
|
2592
|
+
direction: -1 | 0 | 1;
|
|
2593
|
+
} | {
|
|
2594
|
+
type: 'attack-contact';
|
|
2595
|
+
target: T;
|
|
2596
|
+
} | {
|
|
2597
|
+
type: 'vehicle-damage';
|
|
2598
|
+
amount: number;
|
|
2599
|
+
} | {
|
|
2600
|
+
type: 'repair';
|
|
2601
|
+
amount: number;
|
|
2602
|
+
} | {
|
|
2603
|
+
type: 'reserve-seat';
|
|
2604
|
+
target: T;
|
|
2605
|
+
seat: number;
|
|
2606
|
+
local: RacingPoint;
|
|
2607
|
+
} | {
|
|
2608
|
+
type: 'complete-entry';
|
|
2609
|
+
} | {
|
|
2610
|
+
type: 'exit-seat';
|
|
2611
|
+
position: RacingPoint;
|
|
2612
|
+
} | {
|
|
2613
|
+
type: 'release-seat';
|
|
2614
|
+
});
|
|
2615
|
+
interface RacingState {
|
|
2616
|
+
abilities: RacingAbility[];
|
|
2617
|
+
lastRequest: number;
|
|
2618
|
+
revision: number;
|
|
2619
|
+
driftCharge: number;
|
|
2620
|
+
driftTier: number;
|
|
2621
|
+
driftBoost: number;
|
|
2622
|
+
draftDwell: number;
|
|
2623
|
+
draftBoost: number;
|
|
2624
|
+
item: number;
|
|
2625
|
+
itemRank: number;
|
|
2626
|
+
routeIndex: number;
|
|
2627
|
+
homing: 'idle' | 'following' | 'hit' | 'arrived' | 'cancelled';
|
|
2628
|
+
destination: RacingPoint;
|
|
2629
|
+
randomState: number;
|
|
2630
|
+
nextCheckpoint: number;
|
|
2631
|
+
lap: number;
|
|
2632
|
+
laps: number;
|
|
2633
|
+
racing: boolean;
|
|
2634
|
+
supportProbes: number;
|
|
2635
|
+
hoverAcceleration: RacingPoint;
|
|
2636
|
+
trackUp: RacingPoint;
|
|
2637
|
+
energy: number;
|
|
2638
|
+
boostFraction: number;
|
|
2639
|
+
attackRemaining: number;
|
|
2640
|
+
attackCooldown: number;
|
|
2641
|
+
attackHits: number;
|
|
2642
|
+
integrity: number;
|
|
2643
|
+
damage: 'healthy' | 'smoke' | 'fire' | 'destroyed';
|
|
2644
|
+
burnElapsed: number;
|
|
2645
|
+
handlingMultiplier: number;
|
|
2646
|
+
seatPhase: 'free' | 'entering' | 'occupied' | 'exiting';
|
|
2647
|
+
seat: number;
|
|
2648
|
+
seatDestination: RacingPoint;
|
|
2649
|
+
seatRemaining: number;
|
|
2650
|
+
weightCount: number;
|
|
2651
|
+
routePoints: number;
|
|
2652
|
+
checkpointCount: number;
|
|
2653
|
+
drifting: boolean;
|
|
2654
|
+
boosting: boolean;
|
|
2655
|
+
attackDirection: number;
|
|
2656
|
+
}
|
|
2657
|
+
declare function racingData(o: RacingOptions): number[];
|
|
2658
|
+
declare function racingOperation<T>(a: RacingAction<T>): {
|
|
2659
|
+
op: number;
|
|
2660
|
+
data: number[];
|
|
2661
|
+
};
|
|
2662
|
+
|
|
2663
|
+
/** B081–B090: Y-up metres/seconds. Host owns motion, combat outcomes, gates and durable storage. */
|
|
2664
|
+
declare const SURVIVAL_ABILITIES: readonly ["escort-follow-wait", "companion-abduction-objective", "environmental-vault-action", "stagger-finisher-opportunity", "adaptive-encounter-pressure", "spatial-inventory-packing", "ingredient-combination", "weapon-upgrade-track", "encounter-clear-lock", "save-point-checkpoint"];
|
|
2665
|
+
type SurvivalAbility = (typeof SURVIVAL_ABILITIES)[number];
|
|
2666
|
+
type SurvivalPoint = readonly [number, number, number];
|
|
2667
|
+
interface SurvivalOptions {
|
|
2668
|
+
followDistance?: number;
|
|
2669
|
+
maxTravelDistance?: number;
|
|
2670
|
+
interactionRange?: number;
|
|
2671
|
+
boundaryRadius?: number;
|
|
2672
|
+
finisherRange?: number;
|
|
2673
|
+
minPressure?: number;
|
|
2674
|
+
maxPressure?: number;
|
|
2675
|
+
columns?: number;
|
|
2676
|
+
rows?: number;
|
|
2677
|
+
pressureGain?: number;
|
|
2678
|
+
}
|
|
2679
|
+
/** Successful request IDs strictly increase per attached actor (1..0xffffff). Rejections are retryable. */
|
|
2680
|
+
type SurvivalAction<T = number> = {
|
|
2681
|
+
requestId: number;
|
|
2682
|
+
} & ({
|
|
2683
|
+
type: 'follow';
|
|
2684
|
+
target: T;
|
|
2685
|
+
} | {
|
|
2686
|
+
type: 'wait';
|
|
2687
|
+
} | {
|
|
2688
|
+
type: 'seek-safe';
|
|
2689
|
+
position: SurvivalPoint;
|
|
2690
|
+
} | {
|
|
2691
|
+
type: 'capture';
|
|
2692
|
+
target: T;
|
|
2693
|
+
boundary: SurvivalPoint;
|
|
2694
|
+
} | {
|
|
2695
|
+
type: 'rescue';
|
|
2696
|
+
} | {
|
|
2697
|
+
type: 'vault';
|
|
2698
|
+
target: T;
|
|
2699
|
+
landing: SurvivalPoint;
|
|
2700
|
+
height: number;
|
|
2701
|
+
duration: number;
|
|
2702
|
+
} | {
|
|
2703
|
+
type: 'cancel-vault';
|
|
2704
|
+
} | {
|
|
2705
|
+
type: 'stagger';
|
|
2706
|
+
class: 1 | 2 | 3;
|
|
2707
|
+
duration: number;
|
|
2708
|
+
} | {
|
|
2709
|
+
type: 'finish';
|
|
2710
|
+
target: T;
|
|
2711
|
+
eligibleMask: number;
|
|
2712
|
+
} | {
|
|
2713
|
+
type: 'performance';
|
|
2714
|
+
score: number;
|
|
2715
|
+
} | {
|
|
2716
|
+
type: 'begin-encounter';
|
|
2717
|
+
} | {
|
|
2718
|
+
type: 'pack';
|
|
2719
|
+
kind: number;
|
|
2720
|
+
quantity: number;
|
|
2721
|
+
limit: number;
|
|
2722
|
+
shape: number;
|
|
2723
|
+
x: number;
|
|
2724
|
+
y: number;
|
|
2725
|
+
rotated?: boolean;
|
|
2726
|
+
} | {
|
|
2727
|
+
type: 'move-item';
|
|
2728
|
+
item: number;
|
|
2729
|
+
x: number;
|
|
2730
|
+
y: number;
|
|
2731
|
+
rotated?: boolean;
|
|
2732
|
+
} | {
|
|
2733
|
+
type: 'stack';
|
|
2734
|
+
item: number;
|
|
2735
|
+
into: number;
|
|
2736
|
+
quantity: number;
|
|
2737
|
+
} | {
|
|
2738
|
+
type: 'stock';
|
|
2739
|
+
kind: number;
|
|
2740
|
+
quantity: number;
|
|
2741
|
+
limit: number;
|
|
2742
|
+
} | {
|
|
2743
|
+
type: 'recipe';
|
|
2744
|
+
id: number;
|
|
2745
|
+
first: number;
|
|
2746
|
+
firstCount: number;
|
|
2747
|
+
second: number;
|
|
2748
|
+
secondCount: number;
|
|
2749
|
+
output: number;
|
|
2750
|
+
outputCount: number;
|
|
2751
|
+
limit: number;
|
|
2752
|
+
} | {
|
|
2753
|
+
type: 'combine';
|
|
2754
|
+
recipe: number;
|
|
2755
|
+
} | {
|
|
2756
|
+
type: 'credit';
|
|
2757
|
+
amount: number;
|
|
2758
|
+
} | {
|
|
2759
|
+
type: 'upgrade-level';
|
|
2760
|
+
level: number;
|
|
2761
|
+
cost: number;
|
|
2762
|
+
gate: number;
|
|
2763
|
+
value: number;
|
|
2764
|
+
} | {
|
|
2765
|
+
type: 'purchase';
|
|
2766
|
+
unlockedGate: number;
|
|
2767
|
+
} | {
|
|
2768
|
+
type: 'expect-spawns';
|
|
2769
|
+
count: number;
|
|
2770
|
+
} | {
|
|
2771
|
+
type: 'track-enemy';
|
|
2772
|
+
target: T;
|
|
2773
|
+
id: number;
|
|
2774
|
+
} | {
|
|
2775
|
+
type: 'resolve-enemy';
|
|
2776
|
+
id: number;
|
|
2777
|
+
resolution: 'defeated' | 'exempt';
|
|
2778
|
+
} | {
|
|
2779
|
+
type: 'link-gate';
|
|
2780
|
+
target: T;
|
|
2781
|
+
} | {
|
|
2782
|
+
type: 'save-permission';
|
|
2783
|
+
allowed: boolean;
|
|
2784
|
+
} | {
|
|
2785
|
+
type: 'request-save';
|
|
2786
|
+
target: T;
|
|
2787
|
+
checkpoint: number;
|
|
2788
|
+
} | {
|
|
2789
|
+
type: 'complete-save';
|
|
2790
|
+
saveRequest: number;
|
|
2791
|
+
success: boolean;
|
|
2792
|
+
});
|
|
2793
|
+
interface SurvivalItem {
|
|
2794
|
+
id: number;
|
|
2795
|
+
kind: number;
|
|
2796
|
+
quantity: number;
|
|
2797
|
+
limit: number;
|
|
2798
|
+
shape: number;
|
|
2799
|
+
x: number;
|
|
2800
|
+
y: number;
|
|
2801
|
+
rotated: boolean;
|
|
2802
|
+
}
|
|
2803
|
+
/** Versioned gameplay record. The host adds stable actor/world IDs and performs durable IO. */
|
|
2804
|
+
interface SurvivalCheckpoint {
|
|
2805
|
+
version: 1;
|
|
2806
|
+
checkpoint: number;
|
|
2807
|
+
requestId: number;
|
|
2808
|
+
revision: number;
|
|
2809
|
+
currency: number;
|
|
2810
|
+
upgradeLevel: number;
|
|
2811
|
+
weaponValue: number;
|
|
2812
|
+
pressure: number;
|
|
2813
|
+
items: SurvivalItem[];
|
|
2814
|
+
}
|
|
2815
|
+
interface SurvivalState {
|
|
2816
|
+
abilities: SurvivalAbility[];
|
|
2817
|
+
lastRequest: number;
|
|
2818
|
+
revision: number;
|
|
2819
|
+
escortMode: 'wait' | 'follow' | 'safe';
|
|
2820
|
+
intent: 'hold' | 'move' | 'transport' | 'vault';
|
|
2821
|
+
destination: SurvivalPoint;
|
|
2822
|
+
capture: 'free' | 'captured' | 'failed';
|
|
2823
|
+
vault: 'idle' | 'active' | 'completed' | 'cancelled';
|
|
2824
|
+
finisherRemaining: number;
|
|
2825
|
+
staggerClass: number;
|
|
2826
|
+
finisherConsumed: boolean;
|
|
2827
|
+
pressure: number;
|
|
2828
|
+
nextPressure: number;
|
|
2829
|
+
sampleCount: number;
|
|
2830
|
+
items: SurvivalItem[];
|
|
2831
|
+
currency: number;
|
|
2832
|
+
upgradeLevel: number;
|
|
2833
|
+
weaponValue: number;
|
|
2834
|
+
spawnObligations: number;
|
|
2835
|
+
unresolvedEnemies: number;
|
|
2836
|
+
locked: boolean;
|
|
2837
|
+
savePending: boolean;
|
|
2838
|
+
lastCheckpoint: number;
|
|
2839
|
+
gateCount: number;
|
|
2840
|
+
vaultElapsed: number;
|
|
2841
|
+
vaultDuration: number;
|
|
2842
|
+
recipeCount: number;
|
|
2843
|
+
columns: number;
|
|
2844
|
+
rows: number;
|
|
2845
|
+
saveAllowed: boolean;
|
|
2846
|
+
checkpoint: SurvivalCheckpoint | null;
|
|
2847
|
+
}
|
|
2848
|
+
declare function survivalData(o: SurvivalOptions): number[];
|
|
2849
|
+
declare function survivalOperation<T>(a: SurvivalAction<T>): {
|
|
2850
|
+
op: number;
|
|
2851
|
+
data: number[];
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2854
|
+
/** B071–B080. Metres, seconds, Y-up. Policies emit intents and never move bodies. */
|
|
2855
|
+
declare const CITY_ABILITIES: readonly ["vision-cone-awareness", "last-seen-search", "noise-investigation", "footprint-trail-following", "contextual-disguise", "alarm-communication-network", "wanted-level-escalation", "pursuit-evasion-decay", "pedestrian-panic-propagation", "traffic-junction-yield"];
|
|
2856
|
+
type CityAbility = (typeof CITY_ABILITIES)[number];
|
|
2857
|
+
declare const CITY_INTENTS: readonly ["hold", "observe", "search", "investigate", "track", "flee", "wait", "drive"];
|
|
2858
|
+
declare const CITY_EVENTS: readonly ["none", "awareness-changed", "search-ended", "noise-heard", "clue-reached", "disguise-changed", "report-sent", "alert-received", "wanted-changed", "panic", "traffic-changed"];
|
|
2859
|
+
declare const CITY_LINKS: readonly ["target", "radio", "neighbor", "junction", "observer"];
|
|
2860
|
+
type CityLinkKind = (typeof CITY_LINKS)[number];
|
|
2861
|
+
type CityPoint = readonly [number, number, number];
|
|
2862
|
+
interface CityOptions {
|
|
2863
|
+
visionRange?: number;
|
|
2864
|
+
coneCosine?: number;
|
|
2865
|
+
suspicionRate?: number;
|
|
2866
|
+
suspicionDecay?: number;
|
|
2867
|
+
alertThreshold?: number;
|
|
2868
|
+
searchDuration?: number;
|
|
2869
|
+
searchRadius?: number;
|
|
2870
|
+
hearingRange?: number;
|
|
2871
|
+
noiseMemory?: number;
|
|
2872
|
+
trailLifetime?: number;
|
|
2873
|
+
disguiseModifier?: number;
|
|
2874
|
+
reportDelay?: number;
|
|
2875
|
+
wantedDecay?: number;
|
|
2876
|
+
evasionDelay?: number;
|
|
2877
|
+
panicDuration?: number;
|
|
2878
|
+
trafficSpeed?: number;
|
|
2879
|
+
}
|
|
2880
|
+
interface CityTarget {
|
|
2881
|
+
exposure?: number;
|
|
2882
|
+
crouched?: boolean;
|
|
2883
|
+
zone?: number;
|
|
2884
|
+
disguiseZone?: number;
|
|
2885
|
+
disguised?: boolean;
|
|
2886
|
+
actions?: number;
|
|
2887
|
+
recognized?: boolean;
|
|
2888
|
+
}
|
|
2889
|
+
/** Sequence is an integer in 1..0xffffff and strictly increases per source, recipient and signal kind. Offense IDs increase per offender across all witnesses. */
|
|
2890
|
+
interface CityNoise {
|
|
2891
|
+
sequence: number;
|
|
2892
|
+
position: CityPoint;
|
|
2893
|
+
loudness?: number;
|
|
2894
|
+
category?: 'footstep' | 'impact' | 'gunshot';
|
|
2895
|
+
age?: number;
|
|
2896
|
+
}
|
|
2897
|
+
interface CityFootprint {
|
|
2898
|
+
sequence: number;
|
|
2899
|
+
position: CityPoint;
|
|
2900
|
+
age?: number;
|
|
2901
|
+
eligible?: boolean;
|
|
2902
|
+
}
|
|
2903
|
+
interface CityDanger {
|
|
2904
|
+
sequence: number;
|
|
2905
|
+
position: CityPoint;
|
|
2906
|
+
radius?: number;
|
|
2907
|
+
age?: number;
|
|
2908
|
+
}
|
|
2909
|
+
interface CityTraffic {
|
|
2910
|
+
green: boolean;
|
|
2911
|
+
exitOpen: boolean;
|
|
2912
|
+
request: boolean;
|
|
2913
|
+
inside?: boolean;
|
|
2914
|
+
}
|
|
2915
|
+
interface CityState {
|
|
2916
|
+
abilities: CityAbility[];
|
|
2917
|
+
suspicion: number;
|
|
2918
|
+
visible: boolean;
|
|
2919
|
+
intent: (typeof CITY_INTENTS)[number];
|
|
2920
|
+
destination: CityPoint;
|
|
2921
|
+
disguiseModifier: number;
|
|
2922
|
+
searchRemaining: number;
|
|
2923
|
+
noiseRemaining: number;
|
|
2924
|
+
trailCount: number;
|
|
2925
|
+
alert: boolean;
|
|
2926
|
+
reportRemaining: number;
|
|
2927
|
+
wantedLevel: number;
|
|
2928
|
+
pursuitScore: number;
|
|
2929
|
+
targetSlot: number | null;
|
|
2930
|
+
responseMask: number;
|
|
2931
|
+
unseenFor: number;
|
|
2932
|
+
panicRemaining: number;
|
|
2933
|
+
reserved: boolean;
|
|
2934
|
+
desiredSpeed: number;
|
|
2935
|
+
trafficReason: 'clear' | 'no-request' | 'red' | 'blocked' | 'conflict';
|
|
2936
|
+
trailSequence: number;
|
|
2937
|
+
reportsSent: number;
|
|
2938
|
+
lastEvent: (typeof CITY_EVENTS)[number];
|
|
2939
|
+
lastSeen: CityPoint;
|
|
2940
|
+
searchIndex: number;
|
|
2941
|
+
noiseCategory: 'footstep' | 'impact' | 'gunshot';
|
|
2942
|
+
receiptCount: number;
|
|
2943
|
+
linkCount: number;
|
|
2944
|
+
}
|
|
2945
|
+
declare function cityData(o: CityOptions): number[];
|
|
2946
|
+
|
|
2947
|
+
/** Combat AI emits decisions, never body writes. Metres, seconds, Y-up. */
|
|
2948
|
+
declare const ENCOUNTER_ABILITIES: readonly ["squad-flank-assignment", "leader-loss-morale", "grenade-danger-evasion", "cover-peek-cycle", "threat-target-selection", "tactical-burst-selection", "latent-ambush-activation", "boss-phase-controller", "localized-weak-point-damage", "shootable-projectile-interception"];
|
|
2949
|
+
type EncounterAbility = (typeof ENCOUNTER_ABILITIES)[number];
|
|
2950
|
+
declare const ENCOUNTER_INTENTS: readonly ["hold", "flank", "retreat", "evade", "hide", "peek", "attack", "reposition", "dormant", "dead", "intercepted", "impact"];
|
|
2951
|
+
declare const ENCOUNTER_EVENTS: readonly ["none", "target-changed", "flank-assigned", "morale-changed", "evasion", "cover-changed", "fire-request", "activated", "phase-changed", "damage", "stagger", "intercepted", "impact"];
|
|
2952
|
+
interface EncounterOptions {
|
|
2953
|
+
health?: number;
|
|
2954
|
+
team?: number;
|
|
2955
|
+
squad?: number;
|
|
2956
|
+
perceptionRange?: number;
|
|
2957
|
+
flankRadius?: number;
|
|
2958
|
+
retreatThreshold?: number;
|
|
2959
|
+
leaderPenalty?: number;
|
|
2960
|
+
casualtyPenalty?: number;
|
|
2961
|
+
dangerHorizon?: number;
|
|
2962
|
+
evadeSpeed?: number;
|
|
2963
|
+
concealDuration?: number;
|
|
2964
|
+
attackDuration?: number;
|
|
2965
|
+
shotInterval?: number;
|
|
2966
|
+
burstPause?: number;
|
|
2967
|
+
activationDelay?: number;
|
|
2968
|
+
targetHysteresis?: number;
|
|
2969
|
+
}
|
|
2970
|
+
interface EncounterCandidate {
|
|
2971
|
+
team?: number;
|
|
2972
|
+
priority?: number;
|
|
2973
|
+
recentDamage?: number;
|
|
2974
|
+
}
|
|
2975
|
+
interface EncounterCover {
|
|
2976
|
+
hide: readonly [number, number, number];
|
|
2977
|
+
peek: readonly [number, number, number];
|
|
2978
|
+
}
|
|
2979
|
+
interface EncounterHazard {
|
|
2980
|
+
radius: number;
|
|
2981
|
+
fuse: number;
|
|
2982
|
+
velocity?: readonly [number, number, number];
|
|
2983
|
+
}
|
|
2984
|
+
interface EncounterRegion {
|
|
2985
|
+
multiplier?: number;
|
|
2986
|
+
staggerThreshold?: number;
|
|
2987
|
+
}
|
|
2988
|
+
interface EncounterPhase {
|
|
2989
|
+
healthFraction: number;
|
|
2990
|
+
attackMask: number;
|
|
2991
|
+
vulnerability?: number;
|
|
2992
|
+
}
|
|
2993
|
+
/** Sequence must strictly increase per source/recipient; retries are rejected. */
|
|
2994
|
+
interface EncounterHit {
|
|
2995
|
+
damage: number;
|
|
2996
|
+
team: number;
|
|
2997
|
+
sequence: number;
|
|
2998
|
+
impact?: boolean;
|
|
2999
|
+
}
|
|
3000
|
+
type EncounterLinkKind = 'candidate' | 'leader' | 'ally' | 'cover' | 'hazard' | 'region';
|
|
3001
|
+
declare const ENCOUNTER_LINKS: readonly ["candidate", "leader", "ally", "cover", "hazard", "region"];
|
|
3002
|
+
interface EncounterState {
|
|
3003
|
+
abilities: EncounterAbility[];
|
|
3004
|
+
health: number;
|
|
3005
|
+
morale: number;
|
|
3006
|
+
intent: (typeof ENCOUNTER_INTENTS)[number];
|
|
3007
|
+
destination: readonly [number, number, number];
|
|
3008
|
+
targetSlot: number | null;
|
|
3009
|
+
flankSlot: number | null;
|
|
3010
|
+
coverPhase: 'concealed' | 'observing' | 'attacking';
|
|
3011
|
+
activation: 'dormant' | 'activating' | 'active';
|
|
3012
|
+
bossPhase: number;
|
|
3013
|
+
attackMask: number;
|
|
3014
|
+
vulnerability: number;
|
|
3015
|
+
shotSequence: number;
|
|
3016
|
+
terminal: 'live' | 'intercepted' | 'impact';
|
|
3017
|
+
burstRemaining: number;
|
|
3018
|
+
shotBudget: number;
|
|
3019
|
+
activationRemaining: number;
|
|
3020
|
+
staggerRemaining: number;
|
|
3021
|
+
lastDamage: number;
|
|
3022
|
+
lastEvent: (typeof ENCOUNTER_EVENTS)[number];
|
|
3023
|
+
retiredAttackMask: number;
|
|
3024
|
+
attackEpoch: number;
|
|
3025
|
+
leaderLost: boolean;
|
|
3026
|
+
coverElapsed: number;
|
|
3027
|
+
targetScore: number;
|
|
3028
|
+
}
|
|
3029
|
+
declare function encounterData(o: EncounterOptions): number[];
|
|
3030
|
+
|
|
3031
|
+
/** Weapon policy units: metres, seconds, radians; Y-up, +X forward at yaw 0. */
|
|
3032
|
+
declare const WEAPON_ABILITIES: readonly ["delayed-shield-regeneration", "weapon-heat-and-vent", "interruptible-magazine-reload", "sticky-grenade-attachment", "alternate-weapon-mode", "remote-guided-projectile", "charge-and-release-shot", "material-penetrating-shot", "beam-missile-combination", "stationary-aim-mode"];
|
|
3033
|
+
type WeaponAbility = (typeof WEAPON_ABILITIES)[number];
|
|
3034
|
+
declare const WEAPON_PHASES: readonly ["idle", "cooldown", "reloading", "venting", "switching", "charging", "overheated", "guiding", "dead"];
|
|
3035
|
+
declare const WEAPON_EVENTS: readonly ["none", "damage", "shot", "recharge-start", "shield-full", "vent-start", "vent-end", "reload-start", "reload-commit", "reload-cancel", "attached", "detonated", "control-returned", "mode-changed"];
|
|
3036
|
+
interface WeaponOptions {
|
|
3037
|
+
speed?: number;
|
|
3038
|
+
gravity?: number;
|
|
3039
|
+
health?: number;
|
|
3040
|
+
shieldCapacity?: number;
|
|
3041
|
+
rechargeDelay?: number;
|
|
3042
|
+
rechargeRate?: number;
|
|
3043
|
+
heatCapacity?: number;
|
|
3044
|
+
coolingRate?: number;
|
|
3045
|
+
resumeHeat?: number;
|
|
3046
|
+
ventDuration?: number;
|
|
3047
|
+
reloadDuration?: number;
|
|
3048
|
+
reloadCommit?: number;
|
|
3049
|
+
magazineSize?: number;
|
|
3050
|
+
reserve?: number;
|
|
3051
|
+
secondaryAmmo?: number;
|
|
3052
|
+
chargeDuration?: number;
|
|
3053
|
+
turnRate?: number;
|
|
3054
|
+
}
|
|
3055
|
+
interface WeaponInput {
|
|
3056
|
+
moveX?: number;
|
|
3057
|
+
moveZ?: number;
|
|
3058
|
+
turnYaw?: number;
|
|
3059
|
+
turnPitch?: number;
|
|
3060
|
+
fire?: boolean;
|
|
3061
|
+
reload?: boolean;
|
|
3062
|
+
vent?: boolean;
|
|
3063
|
+
switchMode?: boolean;
|
|
3064
|
+
cancelGuide?: boolean;
|
|
3065
|
+
combo?: boolean;
|
|
3066
|
+
aim?: boolean;
|
|
3067
|
+
cancelReload?: boolean;
|
|
3068
|
+
}
|
|
3069
|
+
interface WeaponMode {
|
|
3070
|
+
damage?: number;
|
|
3071
|
+
interval?: number;
|
|
3072
|
+
roundsPerShot?: number;
|
|
3073
|
+
heatPerShot?: number;
|
|
3074
|
+
range?: number;
|
|
3075
|
+
penetrationBudget?: number;
|
|
3076
|
+
chargeMultiplier?: number;
|
|
3077
|
+
comboCost?: number;
|
|
3078
|
+
comboMultiplier?: number;
|
|
3079
|
+
comboCompatible?: boolean;
|
|
3080
|
+
switchDuration?: number;
|
|
3081
|
+
minimumCharge?: number;
|
|
3082
|
+
}
|
|
3083
|
+
interface WeaponSurface {
|
|
3084
|
+
penetrable?: boolean;
|
|
3085
|
+
resistance?: number;
|
|
3086
|
+
sticky?: boolean;
|
|
3087
|
+
}
|
|
3088
|
+
/** Spawn the body first: one centered sphere, dynamic, solid. Host owns projectile inventory. */
|
|
3089
|
+
interface WeaponProjectileOptions {
|
|
3090
|
+
speed?: number;
|
|
3091
|
+
lifetime?: number;
|
|
3092
|
+
turnRate?: number;
|
|
3093
|
+
blastRadius?: number;
|
|
3094
|
+
damage?: number;
|
|
3095
|
+
}
|
|
3096
|
+
type WeaponProjectileKind = 'sticky' | 'guided';
|
|
3097
|
+
interface WeaponProjectileState {
|
|
3098
|
+
kind: WeaponProjectileKind;
|
|
3099
|
+
phase: 'flying' | 'attached' | 'detonated' | 'cancelled';
|
|
3100
|
+
remaining: number;
|
|
3101
|
+
position: readonly [number, number, number];
|
|
3102
|
+
yaw: number;
|
|
3103
|
+
pitch: number;
|
|
3104
|
+
ownerSlot: number | null;
|
|
3105
|
+
hostSlot: number | null;
|
|
3106
|
+
radius: number;
|
|
3107
|
+
}
|
|
3108
|
+
interface WeaponShot {
|
|
3109
|
+
sequence: number;
|
|
3110
|
+
kind: 'normal' | 'charged' | 'combo';
|
|
3111
|
+
damage: number;
|
|
3112
|
+
from: readonly [number, number, number];
|
|
3113
|
+
to: readonly [number, number, number];
|
|
3114
|
+
intersections: number;
|
|
3115
|
+
}
|
|
3116
|
+
interface WeaponState {
|
|
3117
|
+
abilities: WeaponAbility[];
|
|
3118
|
+
phase: (typeof WEAPON_PHASES)[number];
|
|
3119
|
+
health: number;
|
|
3120
|
+
shield: number;
|
|
3121
|
+
heat: number;
|
|
3122
|
+
magazine: number;
|
|
3123
|
+
reserve: number;
|
|
3124
|
+
secondaryAmmo: number;
|
|
3125
|
+
mode: 0 | 1;
|
|
3126
|
+
charge: number;
|
|
3127
|
+
cooldown: number;
|
|
3128
|
+
reloadTime: number | null;
|
|
3129
|
+
reloadCommitted: boolean;
|
|
3130
|
+
yaw: number;
|
|
3131
|
+
pitch: number;
|
|
3132
|
+
lastEvent: (typeof WEAPON_EVENTS)[number];
|
|
3133
|
+
shot: WeaponShot;
|
|
3134
|
+
aiming: boolean;
|
|
3135
|
+
guidedSlot: number | null;
|
|
3136
|
+
overheated: boolean;
|
|
3137
|
+
ventTime: number;
|
|
3138
|
+
switchTime: number;
|
|
3139
|
+
timeSinceDamage: number;
|
|
3140
|
+
}
|
|
3141
|
+
/** Camera intent only. The renderer owns camera placement and interpolation. */
|
|
3142
|
+
interface WeaponCameraIntent {
|
|
3143
|
+
mode: 'actor' | 'precision' | 'projectile';
|
|
3144
|
+
slot: number;
|
|
3145
|
+
yaw: number;
|
|
3146
|
+
pitch: number;
|
|
3147
|
+
}
|
|
3148
|
+
declare function weaponData(o: WeaponOptions): number[];
|
|
3149
|
+
declare function weaponModeData(o: WeaponMode): number[];
|
|
3150
|
+
declare function weaponProjectileData(o: WeaponProjectileOptions): number[];
|
|
3151
|
+
declare function weaponButtons(i: WeaponInput): number;
|
|
3152
|
+
|
|
3153
|
+
/** Y-up, XY combat plane. Distances in metres; clocks in simulation seconds. */
|
|
3154
|
+
declare const COMBAT_ABILITIES: readonly ["attack-phase-hitboxes", "damage-scaled-knockback", "combat-hitstop", "depleting-shield", "timed-perfect-guard", "grab-hold-throw", "air-dodge-recovery", "directional-influence", "impact-tech-window", "grounded-attack-chain"];
|
|
3155
|
+
type CombatAbility = (typeof COMBAT_ABILITIES)[number];
|
|
3156
|
+
declare const COMBAT_PHASES: readonly ["idle", "startup", "active", "recovery", "stunned", "guarding", "captured", "holding", "dodging", "recovering", "shield-break"];
|
|
3157
|
+
declare const COMBAT_EVENTS: readonly ["none", "hit", "shield", "perfect-guard", "evaded", "shield-break", "launch", "grab", "throw", "release", "air-dodge", "floor-tech", "wall-tech", "failed-tech"];
|
|
3158
|
+
interface CombatOptions {
|
|
3159
|
+
speed?: number;
|
|
3160
|
+
gravity?: number;
|
|
3161
|
+
weight?: number;
|
|
3162
|
+
shieldCapacity?: number;
|
|
3163
|
+
shieldDrain?: number;
|
|
3164
|
+
shieldRegen?: number;
|
|
3165
|
+
perfectWindow?: number;
|
|
3166
|
+
grabDuration?: number;
|
|
3167
|
+
dodgeDuration?: number;
|
|
3168
|
+
dodgeRecovery?: number;
|
|
3169
|
+
maxInfluenceAngle?: number;
|
|
3170
|
+
techWindow?: number;
|
|
3171
|
+
techLockout?: number;
|
|
3172
|
+
inputBuffer?: number;
|
|
3173
|
+
jumpSpeed?: number;
|
|
3174
|
+
shieldBreakStun?: number;
|
|
3175
|
+
}
|
|
3176
|
+
interface CombatInput {
|
|
3177
|
+
moveX?: number;
|
|
3178
|
+
moveY?: number;
|
|
3179
|
+
attack?: boolean;
|
|
3180
|
+
guard?: boolean;
|
|
3181
|
+
grab?: boolean;
|
|
3182
|
+
throw?: boolean;
|
|
3183
|
+
dodge?: boolean;
|
|
3184
|
+
tech?: boolean;
|
|
3185
|
+
jump?: boolean;
|
|
3186
|
+
}
|
|
3187
|
+
interface CombatHit {
|
|
3188
|
+
damage?: number;
|
|
3189
|
+
baseKnockback?: number;
|
|
3190
|
+
growth?: number;
|
|
3191
|
+
angle?: number;
|
|
3192
|
+
direction?: 1 | -1;
|
|
3193
|
+
hitstop?: number;
|
|
3194
|
+
hitstun?: number;
|
|
3195
|
+
}
|
|
3196
|
+
interface CombatAttack extends CombatHit {
|
|
3197
|
+
startup?: number;
|
|
3198
|
+
active?: number;
|
|
3199
|
+
recovery?: number;
|
|
3200
|
+
reach?: number;
|
|
3201
|
+
halfExtents?: readonly [number, number, number];
|
|
3202
|
+
chainOpen?: number;
|
|
3203
|
+
chainClose?: number;
|
|
3204
|
+
}
|
|
3205
|
+
interface CombatState {
|
|
3206
|
+
abilities: CombatAbility[];
|
|
3207
|
+
phase: (typeof COMBAT_PHASES)[number];
|
|
3208
|
+
attackIndex: number | null;
|
|
3209
|
+
actionTime: number;
|
|
3210
|
+
damage: number;
|
|
3211
|
+
shield: number;
|
|
3212
|
+
hitstop: number;
|
|
3213
|
+
hitstun: number;
|
|
3214
|
+
dodge: number;
|
|
3215
|
+
recovery: number;
|
|
3216
|
+
partnerSlot: number | null;
|
|
3217
|
+
confirmedHits: number;
|
|
3218
|
+
lastEvent: (typeof COMBAT_EVENTS)[number];
|
|
3219
|
+
launch: readonly [number, number, number];
|
|
3220
|
+
grounded: boolean;
|
|
3221
|
+
facing: 1 | -1;
|
|
3222
|
+
}
|
|
3223
|
+
declare function combatData(o: CombatOptions): number[];
|
|
3224
|
+
declare function combatHitData(o: CombatHit): number[];
|
|
3225
|
+
declare function combatAttackData(o: CombatAttack): number[];
|
|
3226
|
+
declare function combatButtons(i: CombatInput): number;
|
|
3227
|
+
|
|
3228
|
+
/** Distances in metres, time in seconds; logical heat and cold are normalized units. */
|
|
3229
|
+
declare const PUZZLE_ABILITIES: readonly ["weighted-pressure-switch", "grid-constrained-push-block", "mirror-beam-routing", "conductive-contact-network", "material-ignition-spread", "freeze-and-shatter", "stasis-impulse-storage", "magnetic-object-manipulation", "water-level-mechanism", "timed-solid-platform"];
|
|
3230
|
+
type PuzzleAbility = (typeof PUZZLE_ABILITIES)[number];
|
|
3231
|
+
type PuzzleVector = readonly [number, number, number];
|
|
3232
|
+
interface PuzzleOptions {
|
|
3233
|
+
threshold?: number;
|
|
3234
|
+
releaseDelay?: number;
|
|
3235
|
+
occupancy?: boolean;
|
|
3236
|
+
cellSize?: number;
|
|
3237
|
+
beamRole?: 'emitter' | 'mirror' | 'receiver';
|
|
3238
|
+
direction?: PuzzleVector;
|
|
3239
|
+
range?: number;
|
|
3240
|
+
maxSegments?: number;
|
|
3241
|
+
source?: boolean;
|
|
3242
|
+
contactGap?: number;
|
|
3243
|
+
ignition?: number;
|
|
3244
|
+
fuel?: number;
|
|
3245
|
+
heatRate?: number;
|
|
3246
|
+
cooling?: number;
|
|
3247
|
+
spreadRadius?: number;
|
|
3248
|
+
wetness?: number;
|
|
3249
|
+
duration?: number;
|
|
3250
|
+
coldThreshold?: number;
|
|
3251
|
+
shatterThreshold?: number;
|
|
3252
|
+
resistance?: number;
|
|
3253
|
+
maxImpulse?: number;
|
|
3254
|
+
stiffness?: number;
|
|
3255
|
+
damping?: number;
|
|
3256
|
+
maxForce?: number;
|
|
3257
|
+
low?: number;
|
|
3258
|
+
high?: number;
|
|
3259
|
+
speed?: number;
|
|
3260
|
+
halfWidth?: number;
|
|
3261
|
+
bottom?: number;
|
|
3262
|
+
halfDepth?: number;
|
|
3263
|
+
solidDuration?: number;
|
|
3264
|
+
warningDuration?: number;
|
|
3265
|
+
absentDuration?: number;
|
|
3266
|
+
}
|
|
3267
|
+
type PuzzleCommand = {
|
|
3268
|
+
type: 'push';
|
|
3269
|
+
direction: PuzzleVector;
|
|
3270
|
+
} | {
|
|
3271
|
+
type: 'aim';
|
|
3272
|
+
direction: PuzzleVector;
|
|
3273
|
+
} | {
|
|
3274
|
+
type: 'power';
|
|
3275
|
+
enabled: boolean;
|
|
3276
|
+
} | {
|
|
3277
|
+
type: 'heat' | 'cold';
|
|
3278
|
+
amount: number;
|
|
3279
|
+
} | {
|
|
3280
|
+
type: 'wetness';
|
|
3281
|
+
value: number;
|
|
3282
|
+
} | {
|
|
3283
|
+
type: 'impact';
|
|
3284
|
+
impulse: PuzzleVector;
|
|
3285
|
+
} | {
|
|
3286
|
+
type: 'activate' | 'release';
|
|
3287
|
+
} | {
|
|
3288
|
+
type: 'target';
|
|
3289
|
+
position: PuzzleVector;
|
|
3290
|
+
} | {
|
|
3291
|
+
type: 'level';
|
|
3292
|
+
high: boolean;
|
|
3293
|
+
};
|
|
3294
|
+
interface PuzzleState {
|
|
3295
|
+
ability: PuzzleAbility;
|
|
3296
|
+
active: boolean;
|
|
3297
|
+
value: number;
|
|
3298
|
+
remaining: number;
|
|
3299
|
+
blocked: boolean;
|
|
3300
|
+
transitions: number;
|
|
3301
|
+
auxiliary: number;
|
|
3302
|
+
storedImpulse: PuzzleVector;
|
|
3303
|
+
target: PuzzleVector;
|
|
3304
|
+
segmentCount: number;
|
|
3305
|
+
}
|
|
3306
|
+
interface PuzzleSegment {
|
|
3307
|
+
from: PuzzleVector;
|
|
3308
|
+
to: PuzzleVector;
|
|
3309
|
+
}
|
|
3310
|
+
/** Shared encoding, kept internal to the runtime bridge. */
|
|
3311
|
+
declare function puzzleData(a: PuzzleAbility, o: PuzzleOptions): number[];
|
|
3312
|
+
declare function puzzleCommandData(c: PuzzleCommand): [number, number, number, number];
|
|
3313
|
+
|
|
3314
|
+
/** Engine-neutral tools. Distances are metres, angles radians, durations seconds. */
|
|
3315
|
+
declare const ADVENTURE_ABILITIES: readonly ["combat-lock-on", "hookshot-pull", "grapple-swing", "morph-ball-transition", "magnetic-track-adhesion", "scanning-and-discovery", "fused-carryable-bomb", "returning-boomerang", "keyed-interaction-gate", "carry-aim-and-throw"];
|
|
3316
|
+
type AdventureAbility = (typeof ADVENTURE_ABILITIES)[number];
|
|
3317
|
+
interface AdventureOptions {
|
|
3318
|
+
speed?: number;
|
|
3319
|
+
gravity?: number;
|
|
3320
|
+
range?: number;
|
|
3321
|
+
scanDuration?: number;
|
|
3322
|
+
maxCarryMass?: number;
|
|
3323
|
+
}
|
|
3324
|
+
interface AdventureInput {
|
|
3325
|
+
moveX?: number;
|
|
3326
|
+
moveY?: number;
|
|
3327
|
+
moveZ?: number;
|
|
3328
|
+
yaw?: number;
|
|
3329
|
+
pitch?: number;
|
|
3330
|
+
lock?: boolean;
|
|
3331
|
+
cycle?: boolean;
|
|
3332
|
+
hook?: boolean;
|
|
3333
|
+
grapple?: boolean;
|
|
3334
|
+
morph?: boolean;
|
|
3335
|
+
magnet?: boolean;
|
|
3336
|
+
scan?: boolean;
|
|
3337
|
+
armBomb?: boolean;
|
|
3338
|
+
boomerang?: boolean;
|
|
3339
|
+
interact?: boolean;
|
|
3340
|
+
carry?: boolean;
|
|
3341
|
+
throw?: boolean;
|
|
3342
|
+
release?: boolean;
|
|
3343
|
+
}
|
|
3344
|
+
declare const ADVENTURE_BUTTONS: readonly ["lock", "cycle", "hook", "grapple", "morph", "magnet", "scan", "armBomb", "boomerang", "interact", "carry", "throw", "release"];
|
|
3345
|
+
declare const ADVENTURE_FLAGS: {
|
|
3346
|
+
readonly target: 1;
|
|
3347
|
+
readonly hookAnchor: 2;
|
|
3348
|
+
readonly pullable: 4;
|
|
3349
|
+
readonly grappleAnchor: 8;
|
|
3350
|
+
readonly scannable: 16;
|
|
3351
|
+
readonly carryable: 32;
|
|
3352
|
+
readonly bomb: 64;
|
|
3353
|
+
readonly gate: 128;
|
|
3354
|
+
readonly magneticTrack: 256;
|
|
3355
|
+
readonly hittable: 512;
|
|
3356
|
+
};
|
|
3357
|
+
type AdventureRole = keyof typeof ADVENTURE_FLAGS;
|
|
3358
|
+
interface AdventureObject {
|
|
3359
|
+
roles: readonly AdventureRole[];
|
|
3360
|
+
key?: number;
|
|
3361
|
+
consumeToken?: boolean;
|
|
3362
|
+
fuse?: number;
|
|
3363
|
+
blastRadius?: number;
|
|
3364
|
+
/** Track segment offset from its fixed body's origin, with an outward normal. */
|
|
3365
|
+
trackEnd?: readonly [number, number, number];
|
|
3366
|
+
trackNormal?: readonly [number, number, number];
|
|
3367
|
+
}
|
|
3368
|
+
interface AdventureState {
|
|
3369
|
+
mode: number;
|
|
3370
|
+
targetSlot: number | null;
|
|
3371
|
+
ball: boolean;
|
|
3372
|
+
scanProgress: number;
|
|
3373
|
+
discoveries: number;
|
|
3374
|
+
hits: number;
|
|
3375
|
+
unlocks: number;
|
|
3376
|
+
heldSlot: number | null;
|
|
3377
|
+
projectile: readonly [number, number, number];
|
|
3378
|
+
projectilePhase: number;
|
|
3379
|
+
ropeLength: number;
|
|
3380
|
+
blocked: boolean;
|
|
3381
|
+
detonations: number;
|
|
3382
|
+
hookPhase: number;
|
|
3383
|
+
}
|
|
3384
|
+
interface AdventureObjectState {
|
|
3385
|
+
flags: number;
|
|
3386
|
+
key: number;
|
|
3387
|
+
opened: boolean;
|
|
3388
|
+
armed: boolean;
|
|
3389
|
+
fuse: number;
|
|
3390
|
+
detonated: boolean;
|
|
3391
|
+
ownerSlot: number | null;
|
|
3392
|
+
hits: number;
|
|
3393
|
+
}
|
|
3394
|
+
declare const ADVENTURE_EVENT_KINDS: readonly ["unknown", "lockChanged", "discovered", "detonated", "toolHit", "unlocked", "pickedUp", "released", "formChanged"];
|
|
3395
|
+
|
|
3396
|
+
/** World metres, seconds, radians. No backend handles or engine types. */
|
|
3397
|
+
declare const ENVIRONMENT_ABILITIES: readonly ["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"];
|
|
3398
|
+
type EnvironmentAbility = typeof ENVIRONMENT_ABILITIES[number];
|
|
3399
|
+
type EnvironmentVector = readonly [number, number, number];
|
|
3400
|
+
interface EnvironmentOptions {
|
|
3401
|
+
gravity?: number;
|
|
3402
|
+
speed?: number;
|
|
3403
|
+
drag?: number;
|
|
3404
|
+
buoyancy?: number;
|
|
3405
|
+
turnRate?: number;
|
|
3406
|
+
breathCapacity?: number;
|
|
3407
|
+
staminaCapacity?: number;
|
|
3408
|
+
}
|
|
3409
|
+
interface EnvironmentInput {
|
|
3410
|
+
moveX?: number;
|
|
3411
|
+
moveY?: number;
|
|
3412
|
+
moveZ?: number;
|
|
3413
|
+
sailTrim?: number;
|
|
3414
|
+
stroke?: boolean;
|
|
3415
|
+
breach?: boolean;
|
|
3416
|
+
glide?: boolean;
|
|
3417
|
+
sail?: boolean;
|
|
3418
|
+
ride?: boolean;
|
|
3419
|
+
release?: boolean;
|
|
3420
|
+
}
|
|
3421
|
+
declare const ENVIRONMENT_MODES: readonly ["air", "water", "stroke", "breach", "sailing", "gliding", "tube slide"];
|
|
3422
|
+
interface EnvironmentState {
|
|
3423
|
+
mode: number;
|
|
3424
|
+
submerged: number;
|
|
3425
|
+
breath: number;
|
|
3426
|
+
stamina: number;
|
|
3427
|
+
strokes: number;
|
|
3428
|
+
breaches: number;
|
|
3429
|
+
damage: number;
|
|
3430
|
+
railDistance: number;
|
|
3431
|
+
railAngle: number;
|
|
3432
|
+
up: EnvironmentVector;
|
|
3433
|
+
velocity: EnvironmentVector;
|
|
3434
|
+
blocked: boolean;
|
|
3435
|
+
}
|
|
3436
|
+
interface VolumeBounds {
|
|
3437
|
+
min: EnvironmentVector;
|
|
3438
|
+
max: EnvironmentVector;
|
|
3439
|
+
priority?: number;
|
|
3440
|
+
}
|
|
3441
|
+
type EnvironmentVolume = VolumeBounds & ({
|
|
3442
|
+
kind: 'directional-gravity';
|
|
3443
|
+
direction: EnvironmentVector;
|
|
3444
|
+
strength?: number;
|
|
3445
|
+
} | {
|
|
3446
|
+
kind: 'point-gravity';
|
|
3447
|
+
point: EnvironmentVector;
|
|
3448
|
+
strength?: number;
|
|
3449
|
+
} | {
|
|
3450
|
+
kind: 'segment-gravity';
|
|
3451
|
+
start: EnvironmentVector;
|
|
3452
|
+
end: EnvironmentVector;
|
|
3453
|
+
strength?: number;
|
|
3454
|
+
} | {
|
|
3455
|
+
kind: 'water';
|
|
3456
|
+
current?: EnvironmentVector;
|
|
3457
|
+
density?: number;
|
|
3458
|
+
falloff?: number;
|
|
3459
|
+
waveAmplitude?: number;
|
|
3460
|
+
waveFrequency?: number;
|
|
3461
|
+
} | {
|
|
3462
|
+
kind: 'wind' | 'updraft';
|
|
3463
|
+
velocity: EnvironmentVector;
|
|
3464
|
+
strength?: number;
|
|
3465
|
+
});
|
|
3466
|
+
/** Cubic Bezier centerline. Up must remain nonparallel to every tangent. */
|
|
3467
|
+
interface TubeRail {
|
|
3468
|
+
points: readonly [EnvironmentVector, EnvironmentVector, EnvironmentVector, EnvironmentVector];
|
|
3469
|
+
radius: number;
|
|
3470
|
+
up?: EnvironmentVector;
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
/** Physics-neutral public contract; velocities are metres/second, durations seconds. */
|
|
3474
|
+
declare const TRAVERSAL_ABILITIES: readonly ["running-long-jump", "chained-jump", "crouch-backflip", "wall-kick", "ledge-hang-and-mantle", "pole-climb", "ceiling-hang-traverse", "ground-pound-impact", "dive-to-belly-slide", "temporary-actor-possession"];
|
|
3475
|
+
type AcrobaticsAbility = typeof TRAVERSAL_ABILITIES[number];
|
|
3476
|
+
interface AcrobaticsOptions {
|
|
3477
|
+
moveSpeed?: number;
|
|
3478
|
+
jumpSpeed?: number;
|
|
3479
|
+
gravity?: number;
|
|
3480
|
+
chainWindow?: number;
|
|
3481
|
+
}
|
|
3482
|
+
interface AcrobaticsInput {
|
|
3483
|
+
moveX: number;
|
|
3484
|
+
jump: boolean;
|
|
3485
|
+
crouch: boolean;
|
|
3486
|
+
moveY?: number;
|
|
3487
|
+
moveZ?: number;
|
|
3488
|
+
action?: boolean;
|
|
3489
|
+
grab?: boolean;
|
|
3490
|
+
release?: boolean;
|
|
3491
|
+
}
|
|
3492
|
+
interface AcrobaticsState {
|
|
3493
|
+
grounded: boolean;
|
|
3494
|
+
action: number;
|
|
3495
|
+
chain: number;
|
|
3496
|
+
remaining: number;
|
|
3497
|
+
facing: number;
|
|
3498
|
+
launches: number;
|
|
3499
|
+
velocity: readonly [number, number];
|
|
3500
|
+
impacts: number;
|
|
3501
|
+
phaseRemaining: number;
|
|
3502
|
+
poleAngle: number;
|
|
3503
|
+
wallWindow: number;
|
|
3504
|
+
reattachLockout: number;
|
|
3505
|
+
velocityZ: number;
|
|
3506
|
+
impactThisStep: boolean;
|
|
3507
|
+
impactSpeed: number;
|
|
3508
|
+
}
|
|
3509
|
+
declare const ACROBATICS_ACTIONS: readonly ["grounded", "jump", "long jump", "double jump", "triple jump", "backflip", "falling", "wall kick", "ledge hang", "pole climb", "ceiling hang", "pound windup", "pound descent", "impact recovery", "dive", "belly slide", "possessing", "mantle"];
|
|
3510
|
+
|
|
3511
|
+
/** Sentinel handle for "no entity / failed allocation". Mirrors `INVALID_SLOT` in Rust. */
|
|
3512
|
+
declare const STAGE_INVALID_SLOT = 4294967295;
|
|
3513
|
+
declare const StageBodyKind: {
|
|
3514
|
+
readonly Dynamic: 0;
|
|
3515
|
+
readonly Static: 1;
|
|
3516
|
+
readonly KinematicPosition: 2;
|
|
3517
|
+
readonly KinematicVelocity: 3;
|
|
3518
|
+
};
|
|
3519
|
+
type StageBodyKindValue = (typeof StageBodyKind)[keyof typeof StageBodyKind];
|
|
3520
|
+
declare const StageBoundaryDim: {
|
|
3521
|
+
readonly Two: 2;
|
|
3522
|
+
readonly Three: 3;
|
|
3523
|
+
};
|
|
3524
|
+
declare const StageRicochetDim: {
|
|
3525
|
+
readonly Two: 2;
|
|
3526
|
+
readonly Three: 3;
|
|
3527
|
+
};
|
|
3528
|
+
declare const StageRicochetReflection: {
|
|
3529
|
+
readonly Mirror: 0;
|
|
3530
|
+
readonly Angled: 1;
|
|
3531
|
+
};
|
|
3532
|
+
declare const StageTopDownPlane: {
|
|
3533
|
+
readonly Xy: 0;
|
|
3534
|
+
readonly Xz: 1;
|
|
3535
|
+
};
|
|
3536
|
+
declare const StageEventType: {
|
|
3537
|
+
readonly CollisionStarted: 1;
|
|
3538
|
+
readonly CollisionStopped: 2;
|
|
3539
|
+
readonly BoundaryHit: 3;
|
|
3540
|
+
readonly Ricochet: 4;
|
|
3541
|
+
readonly RegionEntered: 5;
|
|
3542
|
+
readonly JumpStarted: 6;
|
|
3543
|
+
readonly Landed: 7;
|
|
3544
|
+
readonly Wrapped: 8;
|
|
3545
|
+
readonly CooldownFired: 9;
|
|
3546
|
+
readonly GroundPoundImpact: 10;
|
|
3547
|
+
readonly DrowningDamage: 11;
|
|
3548
|
+
readonly Adventure: 12;
|
|
3549
|
+
readonly Puzzle: 13;
|
|
3550
|
+
readonly Combat: 14;
|
|
3551
|
+
readonly Weapon: 15;
|
|
3552
|
+
readonly Encounter: 16;
|
|
3553
|
+
readonly City: 17;
|
|
3554
|
+
readonly Survival: 18;
|
|
3555
|
+
readonly Racing: 19;
|
|
3556
|
+
readonly Skate: 20;
|
|
3557
|
+
readonly Sports: 21;
|
|
3558
|
+
readonly Rpg: 22;
|
|
3559
|
+
readonly Matching: 28;
|
|
3560
|
+
readonly Rhythm: 29;
|
|
3561
|
+
readonly Life: 27;
|
|
3562
|
+
readonly Defense: 26;
|
|
3563
|
+
readonly Squad: 25;
|
|
3564
|
+
readonly Tactics: 24;
|
|
3565
|
+
readonly Battle: 23;
|
|
3566
|
+
};
|
|
3567
|
+
type StageBoundaryDimValue = (typeof StageBoundaryDim)[keyof typeof StageBoundaryDim];
|
|
3568
|
+
type StageRicochetDimValue = (typeof StageRicochetDim)[keyof typeof StageRicochetDim];
|
|
3569
|
+
type StageRicochetReflectionValue = (typeof StageRicochetReflection)[keyof typeof StageRicochetReflection];
|
|
3570
|
+
type StageTopDownPlaneValue = (typeof StageTopDownPlane)[keyof typeof StageTopDownPlane];
|
|
3571
|
+
/** Position + rotation snapshot for one runtime slot. */
|
|
3572
|
+
interface StagePose {
|
|
3573
|
+
position: [number, number, number];
|
|
3574
|
+
rotation: [number, number, number, number];
|
|
3575
|
+
}
|
|
3576
|
+
interface StageWorldBoundaryOptions {
|
|
3577
|
+
top: number;
|
|
3578
|
+
bottom: number;
|
|
3579
|
+
left: number;
|
|
3580
|
+
right: number;
|
|
3581
|
+
front?: number;
|
|
3582
|
+
back?: number;
|
|
3583
|
+
padding?: number;
|
|
3584
|
+
}
|
|
3585
|
+
interface StageScreenWrapOptions {
|
|
3586
|
+
width: number;
|
|
3587
|
+
height: number;
|
|
3588
|
+
centerX?: number;
|
|
3589
|
+
centerY?: number;
|
|
3590
|
+
edgeThreshold?: number;
|
|
3591
|
+
}
|
|
3592
|
+
interface StageRicochetOptions {
|
|
3593
|
+
minSpeed: number;
|
|
3594
|
+
maxSpeed: number;
|
|
3595
|
+
speedMultiplier: number;
|
|
3596
|
+
maxAngleDeg: number;
|
|
3597
|
+
reflectionMode: StageRicochetReflectionValue;
|
|
3598
|
+
}
|
|
3599
|
+
interface StageThrusterOptions {
|
|
3600
|
+
maxSpeed: number;
|
|
3601
|
+
acceleration: number;
|
|
3602
|
+
turnRateRadPerSec: number;
|
|
3603
|
+
linearDamping: number;
|
|
3604
|
+
}
|
|
3605
|
+
interface StageTopDownOptions {
|
|
3606
|
+
plane: StageTopDownPlaneValue;
|
|
3607
|
+
speed: number;
|
|
3608
|
+
faceMovement?: boolean;
|
|
3609
|
+
}
|
|
3610
|
+
interface StageShooter2DOptions {
|
|
3611
|
+
fireRateHz: number;
|
|
3612
|
+
muzzleOffsetX: number;
|
|
3613
|
+
muzzleOffsetY: number;
|
|
3614
|
+
muzzleSpeed: number;
|
|
3615
|
+
}
|
|
3616
|
+
interface StageJumper2DOptions {
|
|
3617
|
+
jumpForce: number;
|
|
3618
|
+
maxJumps: number;
|
|
3619
|
+
jumpBufferTime: number;
|
|
3620
|
+
coyoteTime: number;
|
|
3621
|
+
gravity: number;
|
|
3622
|
+
}
|
|
3623
|
+
interface StageJumper3DOptions {
|
|
3624
|
+
jumpForce: number;
|
|
3625
|
+
maxJumps: number;
|
|
3626
|
+
gravity: number;
|
|
3627
|
+
/** Coyote time in seconds (default 0.1). */
|
|
3628
|
+
coyoteTime?: number;
|
|
3629
|
+
/** Jump buffer window in seconds (default 0.08). */
|
|
3630
|
+
jumpBufferTime?: number;
|
|
3631
|
+
}
|
|
3632
|
+
interface StagePlatformer3DOptions {
|
|
3633
|
+
halfHeight: number;
|
|
3634
|
+
radius: number;
|
|
3635
|
+
walkSpeed: number;
|
|
3636
|
+
runSpeed: number;
|
|
3637
|
+
jumpForce: number;
|
|
3638
|
+
maxJumps: number;
|
|
3639
|
+
gravity: number;
|
|
3640
|
+
/** Coyote time in seconds (default 0.1). */
|
|
3641
|
+
coyoteTime?: number;
|
|
3642
|
+
/** Jump buffer window in seconds (default 0.1). */
|
|
3643
|
+
jumpBufferTime?: number;
|
|
3644
|
+
/** Velocity multiplier applied on early jump release (default 0.5). */
|
|
3645
|
+
jumpCutMultiplier?: number;
|
|
3646
|
+
/** Seconds before a multi-jump becomes available (default 0.15). */
|
|
3647
|
+
multiJumpWindow?: number;
|
|
3648
|
+
/** Max slope angle in degrees the KCC can climb (default 50). */
|
|
3649
|
+
slopeClimbAngle?: number;
|
|
3650
|
+
/** Slope angle in degrees past which the character slides (default 40). */
|
|
3651
|
+
slopeSlideAngle?: number;
|
|
3652
|
+
/** Autostep max height in world units; 0 disables (default 0.3). */
|
|
3653
|
+
autostepHeight?: number;
|
|
3654
|
+
/** Minimum unobstructed width for an autostep (default 0.1). */
|
|
3655
|
+
autostepMinWidth?: number;
|
|
3656
|
+
/** Snap-to-ground distance in world units; 0 disables (default 0.3). */
|
|
3657
|
+
snapToGroundDistance?: number;
|
|
3658
|
+
/** KCC collision offset between collider and environment (default 0.05). */
|
|
3659
|
+
characterOffset?: number;
|
|
3660
|
+
/** Collider local offset X (fallback / override). */
|
|
3661
|
+
offsetX?: number;
|
|
3662
|
+
/** Collider local offset Y (fallback / override). */
|
|
3663
|
+
offsetY?: number;
|
|
3664
|
+
/** Collider local offset Z (fallback / override). */
|
|
3665
|
+
offsetZ?: number;
|
|
3666
|
+
/** 0 = auto-read attached collider; 1 = use stored shape fields. */
|
|
3667
|
+
shapeSource?: number;
|
|
3668
|
+
}
|
|
3669
|
+
declare const StagePlatformerShapeSource: {
|
|
3670
|
+
readonly Auto: 0;
|
|
3671
|
+
readonly Override: 1;
|
|
3672
|
+
};
|
|
3673
|
+
interface StagePlatformer2DOptions {
|
|
3674
|
+
halfHeight: number;
|
|
3675
|
+
radius: number;
|
|
3676
|
+
walkSpeed: number;
|
|
3677
|
+
runSpeed: number;
|
|
3678
|
+
jumpForce: number;
|
|
3679
|
+
maxJumps: number;
|
|
3680
|
+
gravity: number;
|
|
3681
|
+
/** Coyote time in seconds (default 0.1). */
|
|
3682
|
+
coyoteTime?: number;
|
|
3683
|
+
/** Jump buffer window in seconds (default 0.1). */
|
|
3684
|
+
jumpBufferTime?: number;
|
|
3685
|
+
/** Velocity multiplier applied on early jump release (default 0.5). */
|
|
3686
|
+
jumpCutMultiplier?: number;
|
|
3687
|
+
/** Seconds before a multi-jump becomes available (default 0.15). */
|
|
3688
|
+
multiJumpWindow?: number;
|
|
3689
|
+
/** Max slope angle in degrees the KCC can climb (default 50). */
|
|
3690
|
+
slopeClimbAngle?: number;
|
|
3691
|
+
/** Slope angle in degrees past which the character slides (default 40). */
|
|
3692
|
+
slopeSlideAngle?: number;
|
|
3693
|
+
/** Autostep max height in world units; 0 disables (default 0.25). */
|
|
3694
|
+
autostepHeight?: number;
|
|
3695
|
+
/** Minimum unobstructed width for an autostep (default 0.05). */
|
|
3696
|
+
autostepMinWidth?: number;
|
|
3697
|
+
/** Snap-to-ground distance in world units; 0 disables (default 0.2). */
|
|
3698
|
+
snapToGroundDistance?: number;
|
|
3699
|
+
/** KCC collision offset between collider and environment (default 0.05). */
|
|
3700
|
+
characterOffset?: number;
|
|
3701
|
+
/** Collider local offset X (fallback / override). */
|
|
3702
|
+
offsetX?: number;
|
|
3703
|
+
/** Collider local offset Y (fallback / override). */
|
|
3704
|
+
offsetY?: number;
|
|
3705
|
+
/** Collider local offset Z (fallback / override). */
|
|
3706
|
+
offsetZ?: number;
|
|
3707
|
+
/** 0 = auto-read attached collider; 1 = use stored shape fields. */
|
|
3708
|
+
shapeSource?: number;
|
|
3709
|
+
}
|
|
3710
|
+
interface StageFirstPersonOptions {
|
|
3711
|
+
walkSpeed: number;
|
|
3712
|
+
runSpeed: number;
|
|
3713
|
+
eyeHeight: number;
|
|
3714
|
+
lookSensitivity: number;
|
|
3715
|
+
}
|
|
3716
|
+
interface StageFirstPersonInput {
|
|
3717
|
+
moveX: number;
|
|
3718
|
+
moveZ: number;
|
|
3719
|
+
lookYawDelta: number;
|
|
3720
|
+
lookPitchDelta: number;
|
|
3721
|
+
run: boolean;
|
|
3722
|
+
}
|
|
3723
|
+
/** Button bits for the slot-indexed input buffer's bitmask field. */
|
|
3724
|
+
declare const STAGE_INPUT_BUTTON_JUMP = 1;
|
|
3725
|
+
declare const STAGE_INPUT_BUTTON_RUN = 2;
|
|
3726
|
+
/**
|
|
3727
|
+
* Decoded per-slot behavior snapshot written by the runtime after every
|
|
3728
|
+
* step: movement fields come from whichever character behavior the entity
|
|
3729
|
+
* has (platformer 3D/2D, jumper 3D/2D); first-person fills yaw/pitch.
|
|
3730
|
+
* Values reflect the end of the previous `step()` (one-frame read lag).
|
|
3731
|
+
*/
|
|
3732
|
+
interface StageBehaviorSnapshot {
|
|
3733
|
+
grounded: boolean;
|
|
3734
|
+
fsmState: number;
|
|
3735
|
+
jumpCount: number;
|
|
3736
|
+
verticalVelocity: number;
|
|
3737
|
+
speed: number;
|
|
3738
|
+
yaw: number;
|
|
3739
|
+
pitch: number;
|
|
3740
|
+
}
|
|
3741
|
+
/**
|
|
3742
|
+
* Wasm fast-path backrefs a behavior system stores on its `BehaviorRef` every
|
|
3743
|
+
* frame so descriptor handles can read the runtime snapshot buffer instead of
|
|
3744
|
+
* a duplicate TS FSM (or hardcoded defaults).
|
|
3745
|
+
*/
|
|
3746
|
+
interface WasmSnapshotBackref {
|
|
3747
|
+
__wasmStage?: BehaviorRuntime | null;
|
|
3748
|
+
__entity?: {
|
|
3749
|
+
runtimeHandle?: number;
|
|
3750
|
+
} | null;
|
|
3751
|
+
}
|
|
3752
|
+
/**
|
|
3753
|
+
* Read the behavior snapshot for the entity a `BehaviorRef` is linked to.
|
|
3754
|
+
* Returns `null` off the wasm fast path (no stage runtime / no
|
|
3755
|
+
* `runtimeHandle` / no snapshot yet), in which case handles should fall back
|
|
3756
|
+
* to their TS FSM.
|
|
3757
|
+
*/
|
|
3758
|
+
declare function readBehaviorSnapshot(ref: object): StageBehaviorSnapshot | null;
|
|
3759
|
+
/**
|
|
3760
|
+
* Runtime surface behavior systems rely on. `WasmStageRuntime` is the real
|
|
3761
|
+
* wasm-backed implementation; `MockBehaviorRuntime` (see
|
|
3762
|
+
* `./mock-behavior-runtime`) implements the same contract for unit tests, so
|
|
3763
|
+
* descriptors stay runtime-agnostic.
|
|
3764
|
+
*/
|
|
3765
|
+
interface BehaviorRuntime {
|
|
3766
|
+
attachRhythm(slot: number, abilities: readonly RhythmAbility[], options?: RhythmOptions): boolean;
|
|
3767
|
+
detachRhythm(slot: number): boolean;
|
|
3768
|
+
queryRhythm(slot: number): RhythmState | null;
|
|
3769
|
+
rhythmAction(slot: number, action: RhythmAction): boolean;
|
|
3770
|
+
attachMatching(slot: number, abilities: readonly MatchingAbility[], options?: MatchingOptions): boolean;
|
|
3771
|
+
detachMatching(slot: number): boolean;
|
|
3772
|
+
queryMatching(slot: number): MatchingState | null;
|
|
3773
|
+
matchingAction(slot: number, action: MatchingAction): boolean;
|
|
3774
|
+
attachLife(slot: number, abilities: readonly LifeAbility[], options?: LifeOptions): boolean;
|
|
3775
|
+
detachLife(slot: number): boolean;
|
|
3776
|
+
queryLife(slot: number): LifeState | null;
|
|
3777
|
+
lifeAction(slot: number, action: LifeAction): boolean;
|
|
3778
|
+
attachDefense(slot: number, abilities: readonly DefenseAbility[], options?: DefenseOptions): boolean;
|
|
3779
|
+
detachDefense(slot: number): boolean;
|
|
3780
|
+
queryDefense(slot: number): DefenseState | null;
|
|
3781
|
+
defenseAction(slot: number, action: DefenseAction): boolean;
|
|
3782
|
+
attachSquad(slot: number, abilities: readonly SquadAbility[], options?: SquadOptions): boolean;
|
|
3783
|
+
detachSquad(slot: number): boolean;
|
|
3784
|
+
querySquad(slot: number): SquadState | null;
|
|
3785
|
+
squadAction(slot: number, action: SquadAction): boolean;
|
|
3786
|
+
attachTactics(slot: number, abilities: readonly TacticsAbility[], options?: TacticsOptions): boolean;
|
|
3787
|
+
detachTactics(slot: number): boolean;
|
|
3788
|
+
queryTactics(slot: number): TacticsState | null;
|
|
3789
|
+
tacticsAction(slot: number, action: TacticsAction): boolean;
|
|
3790
|
+
attachBattle(slot: number, abilities: readonly BattleAbility[], options?: BattleOptions): boolean;
|
|
3791
|
+
detachBattle(slot: number): boolean;
|
|
3792
|
+
queryBattle(slot: number): BattleState | null;
|
|
3793
|
+
battleAction(slot: number, action: BattleAction): boolean;
|
|
3794
|
+
attachRpg(slot: number, abilities: readonly RpgAbility[], options?: RpgOptions): boolean;
|
|
3795
|
+
detachRpg(slot: number): boolean;
|
|
3796
|
+
queryRpg(slot: number): RpgState | null;
|
|
3797
|
+
rpgAction(slot: number, action: RpgAction): boolean;
|
|
3798
|
+
attachSports(slot: number, abilities: readonly SportsAbility[], options?: SportsOptions): boolean;
|
|
3799
|
+
detachSports(slot: number): boolean;
|
|
3800
|
+
querySports(slot: number): SportsState | null;
|
|
3801
|
+
sportsAction(slot: number, action: SportsAction): boolean;
|
|
3802
|
+
attachSkate(slot: number, abilities: readonly SkateAbility[], options?: SkateOptions): boolean;
|
|
3803
|
+
detachSkate(slot: number): boolean;
|
|
3804
|
+
querySkate(slot: number): SkateState | null;
|
|
3805
|
+
skateAction(slot: number, action: SkateAction): boolean;
|
|
3806
|
+
attachRacing(slot: number, abilities: readonly RacingAbility[], options?: RacingOptions): boolean;
|
|
3807
|
+
detachRacing(slot: number): boolean;
|
|
3808
|
+
queryRacing(slot: number): RacingState | null;
|
|
3809
|
+
racingAction(slot: number, action: RacingAction): boolean;
|
|
3810
|
+
attachSurvival(slot: number, abilities: readonly SurvivalAbility[], options?: SurvivalOptions): boolean;
|
|
3811
|
+
detachSurvival(slot: number): boolean;
|
|
3812
|
+
querySurvival(slot: number): SurvivalState | null;
|
|
3813
|
+
survivalAction(slot: number, action: SurvivalAction): boolean;
|
|
3814
|
+
attachCity(slot: number, abilities: readonly CityAbility[], options?: CityOptions): boolean;
|
|
3815
|
+
detachCity(slot: number): boolean;
|
|
3816
|
+
queryCity(slot: number): CityState | null;
|
|
3817
|
+
cityLink(slot: number, other: number, kind: number, data: readonly number[]): boolean;
|
|
3818
|
+
cityUnlink(slot: number, other: number, kind: number): boolean;
|
|
3819
|
+
cityCommand(slot: number, kind: number, data: readonly number[]): boolean;
|
|
3820
|
+
citySignal(slot: number, source: number, kind: number, sequence: number, data: readonly number[]): boolean;
|
|
3821
|
+
attachEncounters(slot: number, abilities: readonly EncounterAbility[], options?: EncounterOptions): boolean;
|
|
3822
|
+
detachEncounters(slot: number): boolean;
|
|
3823
|
+
queryEncounters(slot: number): EncounterState | null;
|
|
3824
|
+
encounterLink(slot: number, other: number, kind: number, data: readonly number[]): boolean;
|
|
3825
|
+
encounterUnlink(slot: number, other: number, kind: number): boolean;
|
|
3826
|
+
encounterCommand(slot: number, kind: number, value: number, data?: readonly number[]): boolean;
|
|
3827
|
+
encounterHit(slot: number, source: number, region: number | null, hit: EncounterHit): boolean;
|
|
3828
|
+
attachWeapons(slot: number, abilities: readonly WeaponAbility[], options?: WeaponOptions): boolean;
|
|
3829
|
+
detachWeapons(slot: number): boolean;
|
|
3830
|
+
weaponInput(slot: number, input: WeaponInput): boolean;
|
|
3831
|
+
weaponMode(slot: number, index: 0 | 1, mode: WeaponMode): boolean;
|
|
3832
|
+
weaponDamage(slot: number, amount: number, source: number | null): boolean;
|
|
3833
|
+
weaponSurface(slot: number, surface: WeaponSurface): boolean;
|
|
3834
|
+
launchWeaponProjectile(owner: number, slot: number, kind: WeaponProjectileKind, options?: WeaponProjectileOptions): boolean;
|
|
3835
|
+
queryWeapons(slot: number): WeaponState | null;
|
|
3836
|
+
queryWeaponProjectile(slot: number): WeaponProjectileState | null;
|
|
3837
|
+
weaponCameraIntent(slot: number): WeaponCameraIntent | null;
|
|
3838
|
+
attachCombat(slot: number, abilities: readonly CombatAbility[], options?: CombatOptions): boolean;
|
|
3839
|
+
detachCombat(slot: number): boolean;
|
|
3840
|
+
combatInput(slot: number, input: CombatInput): boolean;
|
|
3841
|
+
combatAttack(slot: number, index: number, attack: CombatAttack): boolean;
|
|
3842
|
+
combatHit(slot: number, hit: CombatHit, source: number | null): boolean;
|
|
3843
|
+
queryCombat(slot: number): CombatState | null;
|
|
3844
|
+
attachPuzzle(slot: number, ability: PuzzleAbility, options?: PuzzleOptions): boolean;
|
|
3845
|
+
detachPuzzle(slot: number): boolean;
|
|
3846
|
+
queryPuzzle(slot: number): PuzzleState | null;
|
|
3847
|
+
puzzleCommand(slot: number, command: PuzzleCommand): boolean;
|
|
3848
|
+
puzzleLink(slot: number, other: number | null): boolean;
|
|
3849
|
+
puzzleSegments(slot: number): PuzzleSegment[];
|
|
3850
|
+
attachAdventure(slot: number, abilities: readonly AdventureAbility[], options?: AdventureOptions): boolean;
|
|
3851
|
+
detachAdventure(slot: number): boolean;
|
|
3852
|
+
queryAdventure(slot: number): AdventureState | null;
|
|
3853
|
+
writeAdventureInput(slot: number, input: AdventureInput): void;
|
|
3854
|
+
setAdventureObject(slot: number, object: AdventureObject | null): boolean;
|
|
3855
|
+
queryAdventureObject(slot: number): AdventureObjectState | null;
|
|
3856
|
+
adventureProgress(slot: number, kind: number, key: number, value?: number): number;
|
|
3857
|
+
attachEnvironment(slot: number, abilities: readonly EnvironmentAbility[], options?: EnvironmentOptions): boolean;
|
|
3858
|
+
detachEnvironment(slot: number): boolean;
|
|
3859
|
+
queryEnvironment(slot: number): EnvironmentState | null;
|
|
3860
|
+
writeEnvironmentInput(slot: number, input: EnvironmentInput): void;
|
|
3861
|
+
setEnvironmentVolume(slot: number, volume: EnvironmentVolume | null): boolean;
|
|
3862
|
+
setTubeRail(slot: number, rail: TubeRail | null): boolean;
|
|
3863
|
+
attachAcrobatics(slot: number, abilities: readonly AcrobaticsAbility[], options?: AcrobaticsOptions): boolean;
|
|
3864
|
+
queryAcrobatics(slot: number): AcrobaticsState | null;
|
|
3865
|
+
detachAcrobatics(slot: number): boolean;
|
|
3866
|
+
setTraversalSurface(slot: number, kind: 'pole' | 'ceiling' | null): boolean;
|
|
3867
|
+
setPossessable(slot: number, enabled: boolean): boolean;
|
|
3868
|
+
startPossession(owner: number, target: number, seconds?: number): boolean;
|
|
3869
|
+
endPossession(owner: number): boolean;
|
|
3870
|
+
queryPossession(owner: number): {
|
|
3871
|
+
targetSlot: number;
|
|
3872
|
+
remaining: number;
|
|
3873
|
+
} | null;
|
|
3874
|
+
getPose(handle: number, out?: StagePose): StagePose | null;
|
|
3875
|
+
setPosition(handle: number, x: number, y: number, z: number): boolean;
|
|
3876
|
+
setRotation(handle: number, x: number, y: number, z: number, w: number): boolean;
|
|
3877
|
+
writeInputAxes(handle: number, axisA: number, axisB: number): boolean;
|
|
3878
|
+
writeInputLook(handle: number, yawDelta: number, pitchDelta: number): boolean;
|
|
3879
|
+
/** Write reserved input slots (thruster world-space vector X/Y). */
|
|
3880
|
+
writeInputReserved(handle: number, reservedA: number, reservedB: number): boolean;
|
|
3881
|
+
writeInputButton(handle: number, buttonMask: number, pressed: boolean): boolean;
|
|
3882
|
+
/** Read the per-slot behavior snapshot written at the end of the previous step. */
|
|
3883
|
+
readSnapshot(handle: number, out?: StageBehaviorSnapshot): StageBehaviorSnapshot | null;
|
|
3884
|
+
attachThruster(handle: number, opts: StageThrusterOptions): boolean;
|
|
3885
|
+
setThrusterInput(handle: number, thrust: number, rotate: number, vectorX?: number, vectorY?: number): void;
|
|
3886
|
+
attachTopDown(handle: number, opts: StageTopDownOptions): boolean;
|
|
3887
|
+
setTopDownInput(handle: number, moveX: number, moveY: number): void;
|
|
3888
|
+
attachShooter2D(handle: number, opts: StageShooter2DOptions): boolean;
|
|
3889
|
+
attachScreenWrap(handle: number, opts: StageScreenWrapOptions): boolean;
|
|
3890
|
+
queryScreenWrap(handle: number): {
|
|
3891
|
+
fsm: number;
|
|
3892
|
+
lastWrappedAxes: number;
|
|
3893
|
+
} | null;
|
|
3894
|
+
attachWorldBoundary(handle: number, dim: StageBoundaryDimValue, opts: StageWorldBoundaryOptions): boolean;
|
|
3895
|
+
queryWorldBoundary(handle: number): {
|
|
3896
|
+
hits: number;
|
|
3897
|
+
clamped: [number, number, number];
|
|
3898
|
+
} | null;
|
|
3899
|
+
attachRicochet(handle: number, dim: StageRicochetDimValue, opts: StageRicochetOptions): boolean;
|
|
3900
|
+
attachPlatformer3D(handle: number, opts: StagePlatformer3DOptions): boolean;
|
|
3901
|
+
setPlatformer3DInputAxes(handle: number, moveX: number, moveZ: number): void;
|
|
3902
|
+
setPlatformer3DInputButtons(handle: number, jump: boolean, run: boolean): void;
|
|
3903
|
+
attachPlatformer2D(handle: number, opts: StagePlatformer2DOptions): boolean;
|
|
3904
|
+
setPlatformer2DInputAxes(handle: number, moveX: number): void;
|
|
3905
|
+
setPlatformer2DInputButtons(handle: number, jump: boolean, run: boolean): void;
|
|
3906
|
+
attachFirstPerson(handle: number, opts: StageFirstPersonOptions): boolean;
|
|
3907
|
+
setFirstPersonInput(handle: number, input: StageFirstPersonInput): void;
|
|
3908
|
+
attachJumper2D(handle: number, opts: StageJumper2DOptions): boolean;
|
|
3909
|
+
setJumper2DInput(handle: number, jumpPressed: boolean): void;
|
|
3910
|
+
attachJumper3D(handle: number, opts: StageJumper3DOptions): boolean;
|
|
3911
|
+
setJumper3DInput(handle: number, jumpPressed: boolean): void;
|
|
3912
|
+
}
|
|
3913
|
+
/** Default options used when constructing a wasm-backed Stage runtime. */
|
|
3914
|
+
interface WasmStageRuntimeOptions {
|
|
3915
|
+
/** Native implementations required by the selected public behaviors. */
|
|
3916
|
+
requiredBehaviors?: readonly RuntimeBehaviorName[];
|
|
3917
|
+
initialCapacity?: number;
|
|
3918
|
+
gravity?: readonly [number, number, number];
|
|
3919
|
+
imports?: WebAssembly.Imports;
|
|
3920
|
+
/**
|
|
3921
|
+
* Custom wasm source. Defaults to the `zylem_runtime.wasm` bundled with
|
|
3922
|
+
* `@zylem/runtime`.
|
|
3923
|
+
*/
|
|
3924
|
+
source?: RequestInfo | URL | ArrayBuffer | Uint8Array;
|
|
3925
|
+
}
|
|
3926
|
+
type StageEventTypeValue = (typeof StageEventType)[keyof typeof StageEventType];
|
|
3927
|
+
/** One decoded event drained from the runtime's per-step event buffer. */
|
|
3928
|
+
interface StageEvent {
|
|
3929
|
+
type: StageEventTypeValue;
|
|
3930
|
+
primarySlot: number | null;
|
|
3931
|
+
secondarySlot: number | null;
|
|
3932
|
+
payload: [number, number, number];
|
|
3933
|
+
}
|
|
3934
|
+
/**
|
|
3935
|
+
* Decoded view of one entity's slot in the unified render buffer.
|
|
3936
|
+
*
|
|
3937
|
+
* Mirrors the `STAGE_RENDER_STRIDE` (12-float) packing documented in
|
|
3938
|
+
* `runtime/stage/render.rs`:
|
|
3939
|
+
* `[0..3]` position, `[3..7]` rotation xyzw, `[7]` uniform scale,
|
|
3940
|
+
* `[8..11]` custom0..custom2 (shading hints), `[11]` custom3 sleeping flag
|
|
3941
|
+
* (1.0 = sleeping).
|
|
3942
|
+
*/
|
|
3943
|
+
interface StageRenderSlot {
|
|
3944
|
+
position: [number, number, number];
|
|
3945
|
+
rotation: [number, number, number, number];
|
|
3946
|
+
scale: number;
|
|
3947
|
+
custom: [number, number, number, number];
|
|
3948
|
+
/** True when custom[3] indicates the body is sleeping. */
|
|
3949
|
+
isSleeping: boolean;
|
|
3950
|
+
}
|
|
3951
|
+
/**
|
|
3952
|
+
* Read a single entity slot out of a unified-Stage render buffer view.
|
|
3953
|
+
*
|
|
3954
|
+
* @param view The `Float32Array` over wasm memory (e.g. `WasmStageRuntime.render`).
|
|
3955
|
+
* @param slot The entity's wasm slot id (its `runtimeHandle`).
|
|
3956
|
+
* @param out Optional target object to write into (avoids per-call allocation).
|
|
3957
|
+
* @returns The decoded slot, or `null` when the slot is out of range.
|
|
3958
|
+
*/
|
|
3959
|
+
declare function readStageRenderSlot(view: Float32Array, slot: number, out?: StageRenderSlot): StageRenderSlot | null;
|
|
3960
|
+
interface StageBodyConfig {
|
|
3961
|
+
kind: StageBodyKindValue;
|
|
3962
|
+
position: readonly [number, number, number];
|
|
3963
|
+
rotation: readonly [number, number, number, number];
|
|
3964
|
+
linearDamping: number;
|
|
3965
|
+
angularDamping: number;
|
|
3966
|
+
gravityScale: number;
|
|
3967
|
+
canSleep: boolean;
|
|
3968
|
+
ccdEnabled: boolean;
|
|
3969
|
+
lockRotation: readonly [boolean, boolean, boolean];
|
|
3970
|
+
lockTranslation: readonly [boolean, boolean, boolean];
|
|
3971
|
+
}
|
|
3972
|
+
type StageColliderShape = {
|
|
3973
|
+
type: 'box';
|
|
3974
|
+
halfExtents: readonly [number, number, number];
|
|
3975
|
+
} | {
|
|
3976
|
+
type: 'sphere';
|
|
3977
|
+
radius: number;
|
|
3978
|
+
} | {
|
|
3979
|
+
type: 'capsule';
|
|
3980
|
+
halfHeight: number;
|
|
3981
|
+
radius: number;
|
|
3982
|
+
} | {
|
|
3983
|
+
type: 'cylinder';
|
|
3984
|
+
halfHeight: number;
|
|
3985
|
+
radius: number;
|
|
3986
|
+
} | {
|
|
3987
|
+
type: 'cone';
|
|
3988
|
+
halfHeight: number;
|
|
3989
|
+
radius: number;
|
|
3990
|
+
} | {
|
|
3991
|
+
type: 'convexHull';
|
|
3992
|
+
vertices: Float32Array;
|
|
3993
|
+
} | {
|
|
3994
|
+
type: 'trimesh';
|
|
3995
|
+
vertices: Float32Array;
|
|
3996
|
+
indices: Uint32Array;
|
|
3997
|
+
} | {
|
|
3998
|
+
type: 'heightfield';
|
|
3999
|
+
rows: number;
|
|
4000
|
+
cols: number;
|
|
4001
|
+
scale: readonly [number, number, number];
|
|
4002
|
+
heights: Float32Array;
|
|
4003
|
+
};
|
|
4004
|
+
interface StageColliderConfig {
|
|
4005
|
+
shape: StageColliderShape;
|
|
4006
|
+
offset: readonly [number, number, number];
|
|
4007
|
+
friction: number;
|
|
4008
|
+
restitution: number;
|
|
4009
|
+
sensor: boolean;
|
|
4010
|
+
/** Packed interaction-groups: high 16 bits = membership, low 16 bits = filter. */
|
|
4011
|
+
collisionGroups: number;
|
|
4012
|
+
}
|
|
4013
|
+
/** Result of a physics raycast against the stage. */
|
|
4014
|
+
interface StageRaycastHit {
|
|
4015
|
+
slot: number;
|
|
4016
|
+
distance: number;
|
|
4017
|
+
normal: [number, number, number];
|
|
4018
|
+
}
|
|
4019
|
+
/** Body introspection payload for debug tooling. */
|
|
4020
|
+
interface StageBodyInfo {
|
|
4021
|
+
bodyType: number;
|
|
4022
|
+
mass: number;
|
|
4023
|
+
isSleeping: boolean;
|
|
4024
|
+
isEnabled: boolean;
|
|
4025
|
+
linearVelocity: [number, number, number];
|
|
4026
|
+
}
|
|
4027
|
+
/** Line-list wireframe for physics debug rendering. */
|
|
4028
|
+
interface StageDebugRender {
|
|
4029
|
+
/** `[x, y, z]` per vertex, two vertices per line. */
|
|
4030
|
+
vertices: Float32Array;
|
|
4031
|
+
/** RGBA per vertex. */
|
|
4032
|
+
colors: Float32Array;
|
|
4033
|
+
}
|
|
4034
|
+
/**
|
|
4035
|
+
* Owns the wasm instance plus the live float-views over its render / event /
|
|
4036
|
+
* pose / scratch buffers. One instance per logical stage; each stage gets
|
|
4037
|
+
* its own `WebAssembly.Instance` so the singleton inside `stage_ffi.rs`
|
|
4038
|
+
* stays single-stage scoped (today's `thread_local!` contract).
|
|
4039
|
+
*/
|
|
4040
|
+
declare class WasmStageRuntime implements BehaviorRuntime {
|
|
4041
|
+
readonly exports: StageWasmExports;
|
|
4042
|
+
readonly compatibility: RuntimeCompatibility;
|
|
4043
|
+
private readonly memory;
|
|
4044
|
+
private renderView;
|
|
4045
|
+
private inputView;
|
|
4046
|
+
private snapshotView;
|
|
4047
|
+
private eventView;
|
|
4048
|
+
private poseView;
|
|
4049
|
+
private vec3View;
|
|
4050
|
+
private queryView;
|
|
4051
|
+
private scratchView;
|
|
4052
|
+
constructor(exports: StageWasmExports, options?: WasmStageRuntimeOptions);
|
|
4053
|
+
/** Recreate typed views over wasm memory. Call after step() or whenever memory may have grown. */
|
|
4054
|
+
refreshViews(): void;
|
|
4055
|
+
/** Step the simulation by `dt` seconds. Refreshes views afterwards. */
|
|
4056
|
+
step(dt: number): number;
|
|
4057
|
+
dispose(): void;
|
|
4058
|
+
get tickCount(): number;
|
|
4059
|
+
get activeCount(): number;
|
|
4060
|
+
setGravity(x: number, y: number, z: number): void;
|
|
4061
|
+
/**
|
|
4062
|
+
* Toggle per-step collision-event collection in the wasm stage. Hosts
|
|
4063
|
+
* with no collision listeners should disable it — with thousands of
|
|
4064
|
+
* touching bodies the per-step contact-pair hashing is a significant
|
|
4065
|
+
* fraction of `step()`.
|
|
4066
|
+
*/
|
|
4067
|
+
setEventsEnabled(enabled: boolean): void;
|
|
4068
|
+
/** Cap Rapier contact solver iterations (default 4). */
|
|
4069
|
+
setSolverIterations(iterations: number): void;
|
|
4070
|
+
/**
|
|
4071
|
+
* Override sleep activation thresholds for sleep-capable dynamic bodies.
|
|
4072
|
+
* Higher velocity thresholds / lower `timeUntilSleep` put piles to sleep
|
|
4073
|
+
* sooner.
|
|
4074
|
+
*/
|
|
4075
|
+
setSleepThresholds(normalizedLinearThreshold: number, angularThreshold: number, timeUntilSleep: number): void;
|
|
4076
|
+
/** Number of awake (non-sleeping) dynamic rigid bodies. */
|
|
4077
|
+
awakeDynamicCount(): number;
|
|
4078
|
+
createEntity(): number;
|
|
4079
|
+
destroyEntity(slot: number): boolean;
|
|
4080
|
+
attachBody(slot: number, config: StageBodyConfig): boolean;
|
|
4081
|
+
addCollider(slot: number, config: StageColliderConfig): boolean;
|
|
4082
|
+
private stageScratch;
|
|
4083
|
+
private stageScratchIndices;
|
|
4084
|
+
getPose(slot: number, out?: StagePose): StagePose | null;
|
|
4085
|
+
setPosition(slot: number, x: number, y: number, z: number): boolean;
|
|
4086
|
+
setRotation(slot: number, x: number, y: number, z: number, w: number): boolean;
|
|
4087
|
+
setLinearVelocity(slot: number, x: number, y: number, z: number): boolean;
|
|
4088
|
+
getLinearVelocity(slot: number, out?: [number, number, number]): [number, number, number] | null;
|
|
4089
|
+
setAngularVelocity(slot: number, x: number, y: number, z: number): boolean;
|
|
4090
|
+
getAngularVelocity(slot: number, out?: [number, number, number]): [number, number, number] | null;
|
|
4091
|
+
applyImpulse(slot: number, x: number, y: number, z: number): boolean;
|
|
4092
|
+
/** Cast a ray against the physics world. Returns the closest hit or `null`. */
|
|
4093
|
+
castRay(origin: readonly [number, number, number], dir: readonly [number, number, number], maxDistance: number, solidOnly?: boolean): StageRaycastHit | null;
|
|
4094
|
+
/** Body introspection for debug tooling. */
|
|
4095
|
+
getBodyInfo(slot: number): StageBodyInfo | null;
|
|
4096
|
+
/** Wireframe debug render of every collider (all shapes). */
|
|
4097
|
+
getDebugRender(): StageDebugRender | null;
|
|
4098
|
+
/** Read-only view over the render buffer; one slot occupies {@link STAGE_RENDER_STRIDE} floats. */
|
|
4099
|
+
get render(): Float32Array;
|
|
4100
|
+
get renderStride(): number;
|
|
4101
|
+
/**
|
|
4102
|
+
* Decode a single entity slot from the live render buffer. Convenience
|
|
4103
|
+
* wrapper over {@link readStageRenderSlot} bound to this runtime's view.
|
|
4104
|
+
*/
|
|
4105
|
+
readRenderSlot(slot: number, out?: StageRenderSlot): StageRenderSlot | null;
|
|
4106
|
+
/** Drain the wasm event buffer into a fresh array of typed events. */
|
|
4107
|
+
drainEvents(): StageEvent[];
|
|
4108
|
+
/** Writable view over the slot-indexed input buffer ({@link STAGE_INPUT_STRIDE} floats/slot). */
|
|
4109
|
+
get input(): Float32Array;
|
|
4110
|
+
get inputStride(): number;
|
|
4111
|
+
/** Read-only view over the per-slot behavior snapshot buffer ({@link STAGE_SNAPSHOT_STRIDE} floats/slot). */
|
|
4112
|
+
get snapshot(): Float32Array;
|
|
4113
|
+
get snapshotStride(): number;
|
|
4114
|
+
/**
|
|
4115
|
+
* Write the primary movement axes for a slot into the slot-indexed input
|
|
4116
|
+
* buffer and mark the slot dirty. Field-scoped (doesn't touch look
|
|
4117
|
+
* deltas or buttons) so multiple behaviors composed on one entity can
|
|
4118
|
+
* each write their part.
|
|
4119
|
+
*/
|
|
4120
|
+
writeInputAxes(slot: number, axisA: number, axisB: number): boolean;
|
|
4121
|
+
/** Write the look deltas (first-person yaw/pitch) for a slot. */
|
|
4122
|
+
writeInputLook(slot: number, yawDelta: number, pitchDelta: number): boolean;
|
|
4123
|
+
/** Write reserved input slots (thruster world-space vector X/Y). */
|
|
4124
|
+
writeInputReserved(slot: number, reservedA: number, reservedB: number): boolean;
|
|
4125
|
+
/**
|
|
4126
|
+
* Set or clear one button bit ({@link STAGE_INPUT_BUTTON_JUMP} /
|
|
4127
|
+
* {@link STAGE_INPUT_BUTTON_RUN}) in a slot's input bitmask.
|
|
4128
|
+
*/
|
|
4129
|
+
writeInputButton(slot: number, buttonMask: number, pressed: boolean): boolean;
|
|
4130
|
+
/**
|
|
4131
|
+
* Decode a slot's behavior snapshot from the buffer written at the end of
|
|
4132
|
+
* the previous step. Returns `null` when the slot has no behavior data.
|
|
4133
|
+
*/
|
|
4134
|
+
readSnapshot(slot: number, out?: StageBehaviorSnapshot): StageBehaviorSnapshot | null;
|
|
4135
|
+
get queryScratch(): Float32Array;
|
|
4136
|
+
attachCooldown(slot: number): boolean;
|
|
4137
|
+
registerCooldown(slot: number, id: number, durationSeconds: number, immediate?: boolean): boolean;
|
|
4138
|
+
fireCooldown(slot: number, id: number): boolean;
|
|
4139
|
+
resetCooldown(slot: number, id: number): boolean;
|
|
4140
|
+
cooldownRemaining(slot: number, id: number): number;
|
|
4141
|
+
attachWorldBoundary(slot: number, dim: StageBoundaryDimValue, bounds: StageWorldBoundaryOptions): boolean;
|
|
4142
|
+
queryWorldBoundary(slot: number): {
|
|
4143
|
+
hits: number;
|
|
4144
|
+
clamped: [number, number, number];
|
|
4145
|
+
} | null;
|
|
4146
|
+
attachScreenWrap(slot: number, opts: StageScreenWrapOptions): boolean;
|
|
4147
|
+
queryScreenWrap(slot: number): {
|
|
4148
|
+
fsm: number;
|
|
4149
|
+
lastWrappedAxes: number;
|
|
4150
|
+
} | null;
|
|
4151
|
+
attachRicochet(slot: number, dim: StageRicochetDimValue, opts: StageRicochetOptions): boolean;
|
|
4152
|
+
queryRicochet(slot: number): {
|
|
4153
|
+
bounces: number;
|
|
4154
|
+
lastKind: number;
|
|
4155
|
+
} | null;
|
|
4156
|
+
attachThruster(slot: number, opts: StageThrusterOptions): boolean;
|
|
4157
|
+
setThrusterInput(slot: number, thrust: number, turn: number, vectorX?: number, vectorY?: number): void;
|
|
4158
|
+
queryThruster(slot: number): {
|
|
4159
|
+
headingRad: number;
|
|
4160
|
+
speed: number;
|
|
4161
|
+
} | null;
|
|
4162
|
+
attachRhythm(slot: number, abilities: readonly RhythmAbility[], options?: RhythmOptions): boolean;
|
|
4163
|
+
detachRhythm(slot: number): boolean;
|
|
4164
|
+
rhythmAction(slot: number, action: RhythmAction): boolean;
|
|
4165
|
+
queryRhythm(slot: number): RhythmState | null;
|
|
4166
|
+
attachMatching(slot: number, abilities: readonly MatchingAbility[], options?: MatchingOptions): boolean;
|
|
4167
|
+
detachMatching(slot: number): boolean;
|
|
4168
|
+
matchingAction(slot: number, action: MatchingAction): boolean;
|
|
4169
|
+
queryMatching(slot: number): MatchingState | null;
|
|
4170
|
+
attachLife(slot: number, abilities: readonly LifeAbility[], options?: LifeOptions): boolean;
|
|
4171
|
+
detachLife(slot: number): boolean;
|
|
4172
|
+
lifeAction(slot: number, action: LifeAction): boolean;
|
|
4173
|
+
queryLife(slot: number): LifeState | null;
|
|
4174
|
+
attachDefense(slot: number, abilities: readonly DefenseAbility[], options?: DefenseOptions): boolean;
|
|
4175
|
+
detachDefense(slot: number): boolean;
|
|
4176
|
+
defenseAction(slot: number, action: DefenseAction): boolean;
|
|
4177
|
+
queryDefense(slot: number): DefenseState | null;
|
|
4178
|
+
attachSquad(slot: number, abilities: readonly SquadAbility[], options?: SquadOptions): boolean;
|
|
4179
|
+
detachSquad(slot: number): boolean;
|
|
4180
|
+
squadAction(slot: number, action: SquadAction): boolean;
|
|
4181
|
+
querySquad(slot: number): SquadState | null;
|
|
4182
|
+
attachTactics(slot: number, abilities: readonly TacticsAbility[], options?: TacticsOptions): boolean;
|
|
4183
|
+
detachTactics(slot: number): boolean;
|
|
4184
|
+
tacticsAction(slot: number, action: TacticsAction): boolean;
|
|
4185
|
+
queryTactics(slot: number): TacticsState | null;
|
|
4186
|
+
attachBattle(slot: number, abilities: readonly BattleAbility[], options?: BattleOptions): boolean;
|
|
4187
|
+
detachBattle(slot: number): boolean;
|
|
4188
|
+
battleAction(slot: number, action: BattleAction): boolean;
|
|
4189
|
+
queryBattle(slot: number): BattleState | null;
|
|
4190
|
+
attachRpg(slot: number, abilities: readonly RpgAbility[], options?: RpgOptions): boolean;
|
|
4191
|
+
detachRpg(slot: number): boolean;
|
|
4192
|
+
rpgAction(slot: number, action: RpgAction): boolean;
|
|
4193
|
+
queryRpg(slot: number): RpgState | null;
|
|
4194
|
+
attachSports(slot: number, abilities: readonly SportsAbility[], options?: SportsOptions): boolean;
|
|
4195
|
+
detachSports(slot: number): boolean;
|
|
4196
|
+
sportsAction(slot: number, action: SportsAction): boolean;
|
|
4197
|
+
querySports(slot: number): SportsState | null;
|
|
4198
|
+
attachSkate(slot: number, abilities: readonly SkateAbility[], options?: SkateOptions): boolean;
|
|
4199
|
+
detachSkate(slot: number): boolean;
|
|
4200
|
+
skateAction(slot: number, action: SkateAction): boolean;
|
|
4201
|
+
querySkate(slot: number): SkateState | null;
|
|
4202
|
+
attachRacing(slot: number, abilities: readonly RacingAbility[], options?: RacingOptions): boolean;
|
|
4203
|
+
detachRacing(slot: number): boolean;
|
|
4204
|
+
racingAction(slot: number, action: RacingAction): boolean;
|
|
4205
|
+
queryRacing(slot: number): RacingState | null;
|
|
4206
|
+
attachSurvival(slot: number, abilities: readonly SurvivalAbility[], options?: SurvivalOptions): boolean;
|
|
4207
|
+
detachSurvival(slot: number): boolean;
|
|
4208
|
+
survivalAction(slot: number, action: SurvivalAction): boolean;
|
|
4209
|
+
querySurvival(slot: number): SurvivalState | null;
|
|
4210
|
+
attachCity(slot: number, abilities: readonly CityAbility[], options?: CityOptions): boolean;
|
|
4211
|
+
detachCity(slot: number): boolean;
|
|
4212
|
+
private cityData;
|
|
4213
|
+
cityLink(slot: number, other: number, kind: number, data: readonly number[]): boolean;
|
|
4214
|
+
cityUnlink(slot: number, other: number, kind: number): boolean;
|
|
4215
|
+
cityCommand(slot: number, kind: number, data: readonly number[]): boolean;
|
|
4216
|
+
citySignal(slot: number, source: number, kind: number, sequence: number, data: readonly number[]): boolean;
|
|
4217
|
+
queryCity(slot: number): CityState | null;
|
|
4218
|
+
attachEncounters(slot: number, abilities: readonly EncounterAbility[], options?: EncounterOptions): boolean;
|
|
4219
|
+
detachEncounters(slot: number): boolean;
|
|
4220
|
+
encounterLink(slot: number, other: number, kind: number, data: readonly number[]): boolean;
|
|
4221
|
+
encounterUnlink(slot: number, other: number, kind: number): boolean;
|
|
4222
|
+
encounterCommand(slot: number, kind: number, value: number, data?: readonly number[]): boolean;
|
|
4223
|
+
encounterHit(slot: number, source: number, region: number | null, hit: EncounterHit): boolean;
|
|
4224
|
+
queryEncounters(slot: number): EncounterState | null;
|
|
4225
|
+
attachWeapons(slot: number, abilities: readonly WeaponAbility[], options?: WeaponOptions): boolean;
|
|
4226
|
+
detachWeapons(slot: number): boolean;
|
|
4227
|
+
weaponInput(slot: number, input: WeaponInput): boolean;
|
|
4228
|
+
weaponMode(slot: number, index: 0 | 1, mode: WeaponMode): boolean;
|
|
4229
|
+
weaponDamage(slot: number, amount: number, source: number | null): boolean;
|
|
4230
|
+
weaponSurface(slot: number, surface: WeaponSurface): boolean;
|
|
4231
|
+
launchWeaponProjectile(owner: number, slot: number, kind: WeaponProjectileKind, options?: WeaponProjectileOptions): boolean;
|
|
4232
|
+
queryWeapons(slot: number): WeaponState | null;
|
|
4233
|
+
queryWeaponProjectile(slot: number): WeaponProjectileState | null;
|
|
4234
|
+
weaponCameraIntent(slot: number): WeaponCameraIntent | null;
|
|
4235
|
+
attachCombat(slot: number, abilities: readonly CombatAbility[], options?: CombatOptions): boolean;
|
|
4236
|
+
detachCombat(slot: number): boolean;
|
|
4237
|
+
combatInput(slot: number, input: CombatInput): boolean;
|
|
4238
|
+
combatAttack(slot: number, index: number, attack: CombatAttack): boolean;
|
|
4239
|
+
combatHit(slot: number, hit: CombatHit, source: number | null): boolean;
|
|
4240
|
+
queryCombat(slot: number): CombatState | null;
|
|
4241
|
+
attachPuzzle(slot: number, ability: PuzzleAbility, options?: PuzzleOptions): boolean;
|
|
4242
|
+
detachPuzzle(slot: number): boolean;
|
|
4243
|
+
queryPuzzle(slot: number): PuzzleState | null;
|
|
4244
|
+
puzzleCommand(slot: number, command: PuzzleCommand): boolean;
|
|
4245
|
+
puzzleLink(slot: number, other: number | null): boolean;
|
|
4246
|
+
puzzleSegments(slot: number): PuzzleSegment[];
|
|
4247
|
+
attachAdventure(slot: number, abilities: readonly AdventureAbility[], o?: AdventureOptions): boolean;
|
|
4248
|
+
detachAdventure(slot: number): boolean;
|
|
4249
|
+
queryAdventure(slot: number): AdventureState | null;
|
|
4250
|
+
writeAdventureInput(slot: number, input: AdventureInput): void;
|
|
4251
|
+
setAdventureObject(slot: number, object: AdventureObject | null): boolean;
|
|
4252
|
+
queryAdventureObject(slot: number): AdventureObjectState | null;
|
|
4253
|
+
adventureProgress(slot: number, kind: number, key: number, value?: number): number;
|
|
4254
|
+
private refreshEnvironmentViews;
|
|
4255
|
+
attachEnvironment(slot: number, abilities: readonly EnvironmentAbility[], o?: EnvironmentOptions): boolean;
|
|
4256
|
+
detachEnvironment(slot: number): boolean;
|
|
4257
|
+
queryEnvironment(slot: number): EnvironmentState | null;
|
|
4258
|
+
writeEnvironmentInput(slot: number, input: EnvironmentInput): void;
|
|
4259
|
+
setEnvironmentVolume(slot: number, volume: EnvironmentVolume | null): boolean;
|
|
4260
|
+
setTubeRail(slot: number, rail: TubeRail | null): boolean;
|
|
4261
|
+
attachAcrobatics(slot: number, abilities: readonly AcrobaticsAbility[], opts?: AcrobaticsOptions): boolean;
|
|
4262
|
+
queryAcrobatics(slot: number): AcrobaticsState | null;
|
|
4263
|
+
detachAcrobatics(slot: number): boolean;
|
|
4264
|
+
setTraversalSurface(slot: number, kind: 'pole' | 'ceiling' | null): boolean;
|
|
4265
|
+
setPossessable(slot: number, enabled: boolean): boolean;
|
|
4266
|
+
startPossession(owner: number, target: number, seconds?: number): boolean;
|
|
4267
|
+
endPossession(owner: number): boolean;
|
|
4268
|
+
queryPossession(owner: number): {
|
|
4269
|
+
targetSlot: number;
|
|
4270
|
+
remaining: number;
|
|
4271
|
+
} | null;
|
|
4272
|
+
attachTopDown(slot: number, opts: StageTopDownOptions): boolean;
|
|
4273
|
+
setTopDownInput(slot: number, axisA: number, axisB: number): void;
|
|
4274
|
+
attachJumper2D(slot: number, opts: StageJumper2DOptions): boolean;
|
|
4275
|
+
setJumper2DInput(slot: number, jumpPressed: boolean): void;
|
|
4276
|
+
queryJumper2D(slot: number): {
|
|
4277
|
+
grounded: boolean;
|
|
4278
|
+
jumpCount: number;
|
|
4279
|
+
coyote: number;
|
|
4280
|
+
jumpBuffer: number;
|
|
4281
|
+
} | null;
|
|
4282
|
+
attachJumper3D(slot: number, opts: StageJumper3DOptions): boolean;
|
|
4283
|
+
setJumper3DInput(slot: number, jump: boolean): void;
|
|
4284
|
+
queryJumper3D(slot: number): {
|
|
4285
|
+
grounded: boolean;
|
|
4286
|
+
jumpCount: number;
|
|
4287
|
+
verticalVelocity: number;
|
|
4288
|
+
} | null;
|
|
4289
|
+
attachShooter2D(slot: number, opts: StageShooter2DOptions): boolean;
|
|
4290
|
+
fireShooter2D(slot: number, x: number, y: number, z: number, yaw: number): boolean;
|
|
4291
|
+
queryShooter2D(slot: number): {
|
|
4292
|
+
cooldown: number;
|
|
4293
|
+
firedCount: number;
|
|
4294
|
+
} | null;
|
|
4295
|
+
attachPlatformer3D(slot: number, opts: StagePlatformer3DOptions): boolean;
|
|
4296
|
+
setPlatformer3DInputAxes(slot: number, moveX: number, moveZ: number): void;
|
|
4297
|
+
setPlatformer3DInputButtons(slot: number, jump: boolean, run: boolean): void;
|
|
4298
|
+
queryPlatformer3D(slot: number): {
|
|
4299
|
+
grounded: boolean;
|
|
4300
|
+
jumpCount: number;
|
|
4301
|
+
fsmState: number;
|
|
4302
|
+
speed: number;
|
|
4303
|
+
} | null;
|
|
4304
|
+
attachPlatformer2D(slot: number, opts: StagePlatformer2DOptions): boolean;
|
|
4305
|
+
setPlatformer2DInputAxes(slot: number, moveX: number): void;
|
|
4306
|
+
setPlatformer2DInputButtons(slot: number, jump: boolean, run: boolean): void;
|
|
4307
|
+
queryPlatformer2D(slot: number): {
|
|
4308
|
+
grounded: boolean;
|
|
4309
|
+
jumpCount: number;
|
|
4310
|
+
fsmState: number;
|
|
4311
|
+
verticalVelocity: number;
|
|
4312
|
+
} | null;
|
|
4313
|
+
attachFirstPerson(slot: number, opts: StageFirstPersonOptions): boolean;
|
|
4314
|
+
setFirstPersonInput(slot: number, input: StageFirstPersonInput): void;
|
|
4315
|
+
queryFirstPerson(slot: number): {
|
|
4316
|
+
yaw: number;
|
|
4317
|
+
pitch: number;
|
|
4318
|
+
speed: number;
|
|
4319
|
+
eyeHeight: number;
|
|
4320
|
+
} | null;
|
|
4321
|
+
}
|
|
4322
|
+
/**
|
|
4323
|
+
* Load the bundled `@zylem/runtime` wasm (or a custom `source`), instantiate
|
|
4324
|
+
* it, and construct a `WasmStageRuntime` around the exports.
|
|
4325
|
+
*/
|
|
4326
|
+
declare function createWasmStageRuntime(options?: WasmStageRuntimeOptions): Promise<WasmStageRuntime>;
|
|
4327
|
+
|
|
4328
|
+
/**
|
|
4329
|
+
* Structural stand-in for the engine world wrapper. The engine's world
|
|
4330
|
+
* delegate exposes an entity lookup map; behaviors only rely on this slice.
|
|
4331
|
+
*
|
|
4332
|
+
* The map value is intentionally `unknown` (not the `GameEntity` stub class):
|
|
4333
|
+
* the engine's concrete entity class is a different nominal type, and systems
|
|
4334
|
+
* that iterate the map narrow entities themselves.
|
|
4335
|
+
*/
|
|
4336
|
+
interface ZylemWorld {
|
|
4337
|
+
collisionMap?: Map<string, unknown>;
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
/**
|
|
4341
|
+
* BehaviorSystem Interface
|
|
4342
|
+
*
|
|
4343
|
+
* Legacy behavior systems reserved the first `update` argument for an ECS world
|
|
4344
|
+
* handle; it is always `undefined` now.
|
|
4345
|
+
*/
|
|
4346
|
+
/**
|
|
4347
|
+
* A behavior system that processes entities with specific components.
|
|
4348
|
+
*
|
|
4349
|
+
* @example
|
|
4350
|
+
* ```typescript
|
|
4351
|
+
* class ThrusterSystem implements BehaviorSystem {
|
|
4352
|
+
* update(_ecs: unknown, delta: number): void {
|
|
4353
|
+
* // Iterate behavior links, push intent into wasm runtime, etc.
|
|
4354
|
+
* }
|
|
4355
|
+
* }
|
|
4356
|
+
* ```
|
|
4357
|
+
*/
|
|
4358
|
+
interface BehaviorSystem {
|
|
4359
|
+
/** Optional eager initialization when a behavior link is registered on a live entity */
|
|
4360
|
+
attach?(link: BehaviorEntityLink): void;
|
|
4361
|
+
/** Called once per frame. The first argument is always `undefined` (reserved legacy slot). */
|
|
4362
|
+
update(ecs: unknown, delta: number): void;
|
|
4363
|
+
/**
|
|
4364
|
+
* Called once per frame after the simulation has stepped and before the
|
|
4365
|
+
* host syncs render poses. Systems that need this frame's post-step state
|
|
4366
|
+
* (e.g. wasm-side teleports) run here instead of in `update`.
|
|
4367
|
+
*/
|
|
4368
|
+
postUpdate?(ecs: unknown, delta: number): void;
|
|
4369
|
+
/** Optional cleanup when a behavior link is detached from a live entity */
|
|
4370
|
+
detach?(link: BehaviorEntityLink): void;
|
|
4371
|
+
/** Optional cleanup when stage is destroyed */
|
|
4372
|
+
destroy?(ecs?: unknown): void;
|
|
4373
|
+
}
|
|
4374
|
+
/**
|
|
4375
|
+
* Runtime link between a spawned entity and one of its behavior refs.
|
|
4376
|
+
* Systems can iterate these links to avoid scanning all world entities.
|
|
4377
|
+
*/
|
|
4378
|
+
interface BehaviorEntityLink {
|
|
4379
|
+
entity: any;
|
|
4380
|
+
ref: any;
|
|
4381
|
+
}
|
|
4382
|
+
/**
|
|
4383
|
+
* Context provided to behavior-system factories.
|
|
4384
|
+
*
|
|
4385
|
+
* After the runtime-only stage migration, `wasmStage` is the source of
|
|
4386
|
+
* truth — descriptors should call `wasmStage.attach<X>(handle, opts)` /
|
|
4387
|
+
* `wasmStage.query<X>(handle)` from inside the system instead of touching
|
|
4388
|
+
* `entity.body` directly. The legacy `world` / `scene` fields remain for
|
|
4389
|
+
* unmigrated descriptors.
|
|
4390
|
+
*/
|
|
4391
|
+
interface BehaviorSystemContext {
|
|
4392
|
+
world: ZylemWorld | null;
|
|
4393
|
+
/** Host scene wrapper (engine-specific); behaviors only call `add`/`remove`-style methods on it. */
|
|
4394
|
+
scene: any;
|
|
4395
|
+
/** Wasm-driven Stage runtime; omitted when the stage has no wasm module. */
|
|
4396
|
+
wasmStage?: BehaviorRuntime | null;
|
|
4397
|
+
/**
|
|
4398
|
+
* Returns live behavior links for a descriptor key.
|
|
4399
|
+
* O(1) lookup into a pre-built stage index.
|
|
4400
|
+
*/
|
|
4401
|
+
getBehaviorLinks?: (key: symbol) => Iterable<BehaviorEntityLink>;
|
|
4402
|
+
/**
|
|
4403
|
+
* Host-injected entity factory. Behaviors that spawn entities at runtime
|
|
4404
|
+
* (e.g. destructible-3d fragments) use this instead of importing the engine
|
|
4405
|
+
* entity factory directly, keeping the behavior layer decoupled.
|
|
4406
|
+
*/
|
|
4407
|
+
createEntity?: CreateEntityFn;
|
|
4408
|
+
/**
|
|
4409
|
+
* Host-injected accessor for the global game-state bag, passed to entity
|
|
4410
|
+
* lifecycle hooks (e.g. `nodeDestroy`).
|
|
4411
|
+
*/
|
|
4412
|
+
getGlobals?: () => any;
|
|
4413
|
+
}
|
|
4414
|
+
/**
|
|
4415
|
+
* Factory function that creates a BehaviorSystem.
|
|
4416
|
+
* Receives the stage for access to world, scene, etc.
|
|
4417
|
+
*/
|
|
4418
|
+
type BehaviorSystemFactory<T extends BehaviorSystem = BehaviorSystem> = (stage: BehaviorSystemContext) => T;
|
|
4419
|
+
|
|
4420
|
+
/**
|
|
4421
|
+
* BehaviorDescriptor
|
|
4422
|
+
*
|
|
4423
|
+
* Type-safe behavior descriptors that provide options inference.
|
|
4424
|
+
* Used with entity.use() to declaratively attach behaviors to entities.
|
|
4425
|
+
*
|
|
4426
|
+
* Each behavior can define its own handle type via `createHandle`,
|
|
4427
|
+
* providing behavior-specific methods with full type safety.
|
|
4428
|
+
*/
|
|
4429
|
+
|
|
4430
|
+
/**
|
|
4431
|
+
* Base handle returned by entity.use() for lazy access to behavior runtime.
|
|
4432
|
+
* FSM is null until entity is spawned and components are initialized.
|
|
4433
|
+
*/
|
|
4434
|
+
interface BaseBehaviorHandle<O extends Record<string, any> = Record<string, any>> {
|
|
4435
|
+
/** Get the FSM instance (null until entity is spawned) */
|
|
4436
|
+
getFSM(): any | null;
|
|
4437
|
+
/** Get the current options */
|
|
4438
|
+
getOptions(): O;
|
|
4439
|
+
/** Access the underlying behavior ref */
|
|
4440
|
+
readonly ref: BehaviorRef<O>;
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Reference to a behavior stored on an entity
|
|
4444
|
+
*/
|
|
4445
|
+
interface BehaviorRef<O extends Record<string, any> = Record<string, any>> {
|
|
4446
|
+
/** The behavior descriptor */
|
|
4447
|
+
descriptor: BehaviorDescriptor<O, any>;
|
|
4448
|
+
/** Merged options (defaults + overrides) */
|
|
4449
|
+
options: O;
|
|
4450
|
+
/** Optional FSM instance - set lazily when entity is spawned */
|
|
4451
|
+
fsm?: any;
|
|
4452
|
+
}
|
|
4453
|
+
/**
|
|
4454
|
+
* A typed behavior descriptor that associates a symbol key with:
|
|
4455
|
+
* - Default options (providing type inference)
|
|
4456
|
+
* - A system factory to create the behavior system
|
|
4457
|
+
* - An optional handle factory for behavior-specific methods
|
|
4458
|
+
*/
|
|
4459
|
+
interface BehaviorDescriptor<O extends Record<string, any> = Record<string, any>, H extends Record<string, any> = Record<string, never>, I = unknown> {
|
|
4460
|
+
/** Unique symbol identifying this behavior */
|
|
4461
|
+
readonly key: symbol;
|
|
4462
|
+
/** Stable identity and build requirements; optional for existing custom descriptors. */
|
|
4463
|
+
readonly metadata?: BehaviorMetadata;
|
|
4464
|
+
/** Default options (used for type inference) */
|
|
4465
|
+
readonly defaultOptions: O;
|
|
4466
|
+
/** Factory to create the behavior system */
|
|
4467
|
+
readonly systemFactory: any;
|
|
4468
|
+
/**
|
|
4469
|
+
* Optional factory to create behavior-specific handle methods.
|
|
4470
|
+
* These methods are merged into the handle returned by entity.use().
|
|
4471
|
+
*/
|
|
4472
|
+
readonly createHandle?: (ref: any) => H;
|
|
4473
|
+
}
|
|
4474
|
+
/**
|
|
4475
|
+
* The full handle type returned by entity.use().
|
|
4476
|
+
* Combines base handle with behavior-specific methods.
|
|
4477
|
+
*/
|
|
4478
|
+
type BehaviorHandle<O extends Record<string, any> = Record<string, any>, H extends Record<string, any> = Record<string, never>> = BaseBehaviorHandle<O> & H;
|
|
4479
|
+
/**
|
|
4480
|
+
* Configuration for defining a new behavior
|
|
4481
|
+
*/
|
|
4482
|
+
interface DefineBehaviorConfig<O extends Record<string, any>, H extends Record<string, any> = Record<string, never>, I = unknown> {
|
|
4483
|
+
/** Human-readable name for debugging */
|
|
4484
|
+
name: string;
|
|
4485
|
+
metadata?: BehaviorMetadata;
|
|
4486
|
+
/** Default options - these define the type */
|
|
4487
|
+
defaultOptions: O;
|
|
4488
|
+
/** Factory function to create the system */
|
|
4489
|
+
systemFactory: BehaviorSystemFactory;
|
|
4490
|
+
/**
|
|
4491
|
+
* Optional factory to create behavior-specific handle methods.
|
|
4492
|
+
* The returned object is merged into the handle returned by entity.use().
|
|
4493
|
+
*
|
|
4494
|
+
* @example
|
|
4495
|
+
* ```typescript
|
|
4496
|
+
* createHandle: (ref) => ({
|
|
4497
|
+
* getLastHits: () => ref.fsm?.getLastHits() ?? null,
|
|
4498
|
+
* getMovement: (moveX, moveY) => ref.fsm?.getMovement(moveX, moveY) ?? { moveX, moveY },
|
|
4499
|
+
* }),
|
|
4500
|
+
* ```
|
|
4501
|
+
*/
|
|
4502
|
+
createHandle?: (ref: BehaviorRef<O>) => H;
|
|
4503
|
+
}
|
|
4504
|
+
/**
|
|
4505
|
+
* Define a typed behavior descriptor.
|
|
4506
|
+
*
|
|
4507
|
+
* @example
|
|
4508
|
+
* ```typescript
|
|
4509
|
+
* export const WorldBoundary2DBehavior = defineBehavior({
|
|
4510
|
+
* name: 'world-boundary-2d',
|
|
4511
|
+
* defaultOptions: { boundaries: { top: 0, bottom: 0, left: 0, right: 0 } },
|
|
4512
|
+
* systemFactory: (ctx) => new WorldBoundary2DSystem(ctx.world),
|
|
4513
|
+
* createHandle: (ref) => ({
|
|
4514
|
+
* getLastHits: () => ref.fsm?.getLastHits() ?? null,
|
|
4515
|
+
* getMovement: (moveX: number, moveY: number) =>
|
|
4516
|
+
* ref.fsm?.getMovement(moveX, moveY) ?? { moveX, moveY },
|
|
4517
|
+
* }),
|
|
4518
|
+
* });
|
|
4519
|
+
*
|
|
4520
|
+
* // Usage - handle has getLastHits and getMovement with full types
|
|
4521
|
+
* const boundary = ship.use(WorldBoundary2DBehavior, { ... });
|
|
4522
|
+
* const hits = boundary.getLastHits(); // Fully typed!
|
|
4523
|
+
* ```
|
|
4524
|
+
*/
|
|
4525
|
+
declare function defineBehavior<O extends Record<string, any>, H extends Record<string, any> = Record<string, never>, I = unknown>(config: DefineBehaviorConfig<O, H, I>): BehaviorDescriptor<O, H, I>;
|
|
4526
|
+
|
|
4527
|
+
export { type CombatState as $, ACROBATICS_ACTIONS as A, BATTLE_ABILITIES as B, type BehaviorRef as C, type BehaviorSystem as D, type BehaviorSystemFactory as E, CITY_ABILITIES as F, CITY_EVENTS as G, CITY_INTENTS as H, CITY_LINKS as I, COMBAT_ABILITIES as J, COMBAT_EVENTS as K, COMBAT_PHASES as L, type CityAbility as M, type CityDanger as N, type CityFootprint as O, type CityLinkKind as P, type CityNoise as Q, type CityOptions as R, type CityPoint as S, type CityState as T, type CityTarget as U, type CityTraffic as V, type CombatAbility as W, type CombatAttack as X, type CombatHit as Y, type CombatInput as Z, type CombatOptions as _, ADVENTURE_ABILITIES as a, RHYTHM_ABILITIES as a$, DEFENSE_ABILITIES as a0, DEFENSE_EVENTS as a1, type DefenseAbility as a2, type DefenseAction as a3, type DefenseEvent as a4, type DefenseOptions as a5, type DefenseReceipt as a6, type DefenseState as a7, type DefenseTarget as a8, type DefenseTile as a9, type LifeAction as aA, type LifeAnimal as aB, type LifeEvent as aC, type LifeFurniture as aD, type LifeMemory as aE, type LifeOptions as aF, type LifePerson as aG, type LifePlot as aH, type LifeSchedule as aI, type LifeState as aJ, type LifeTree as aK, MATCHING_ABILITIES as aL, MATCHING_EVENTS as aM, type MatchingAbility as aN, type MatchingAction as aO, type MatchingCell as aP, type MatchingEvent as aQ, type MatchingOptions as aR, type MatchingState as aS, PUZZLE_ABILITIES as aT, type PuzzleAbility as aU, type PuzzleCommand as aV, type PuzzleOptions as aW, type PuzzleSegment as aX, type PuzzleState as aY, type PuzzleVector as aZ, RACING_ABILITIES as a_, type DefineBehaviorConfig as aa, ENCOUNTER_ABILITIES as ab, ENCOUNTER_EVENTS as ac, ENCOUNTER_INTENTS as ad, ENCOUNTER_LINKS as ae, ENVIRONMENT_ABILITIES as af, ENVIRONMENT_MODES as ag, type EncounterAbility as ah, type EncounterCandidate as ai, type EncounterCover as aj, type EncounterHazard as ak, type EncounterHit as al, type EncounterLinkKind as am, type EncounterOptions as an, type EncounterPhase as ao, type EncounterRegion as ap, type EncounterState as aq, type EnvironmentAbility as ar, type EnvironmentInput as as, type EnvironmentOptions as at, type EnvironmentState as au, type EnvironmentVector as av, type EnvironmentVolume as aw, LIFE_ABILITIES as ax, LIFE_EVENTS as ay, type LifeAbility as az, ADVENTURE_BUTTONS as b, type TacticsUnit as b$, RHYTHM_EVENTS as b0, RPG_ABILITIES as b1, RPG_EVENTS as b2, type RacingAbility as b3, type RacingAction as b4, type RacingOptions as b5, type RacingPoint as b6, type RacingState as b7, type RhythmAbility as b8, type RhythmAction as b9, type SportsPoint as bA, type SportsState as bB, type SquadAbility as bC, type SquadAction as bD, type SquadEvent as bE, type SquadOptions as bF, type SquadState as bG, type SquadTask as bH, type SquadWorker as bI, type SurvivalAbility as bJ, type SurvivalAction as bK, type SurvivalCheckpoint as bL, type SurvivalItem as bM, type SurvivalOptions as bN, type SurvivalPoint as bO, type SurvivalState as bP, TACTICS_ABILITIES as bQ, TACTICS_EVENTS as bR, TRAVERSAL_ABILITIES as bS, type TacticsAbility as bT, type TacticsAction as bU, type TacticsCell as bV, type TacticsEvent as bW, type TacticsOptions as bX, type TacticsPower as bY, type TacticsState as bZ, type TacticsStructure as b_, type RhythmEvent as ba, type RhythmNote as bb, type RhythmOptions as bc, type RhythmState as bd, type RpgAbility as be, type RpgAction as bf, type RpgAffix as bg, type RpgEvent as bh, type RpgItem as bi, type RpgOptions as bj, type RpgPoint as bk, type RpgState as bl, SKATE_ABILITIES as bm, SPORTS_ABILITIES as bn, SQUAD_ABILITIES as bo, SQUAD_EVENTS as bp, SURVIVAL_ABILITIES as bq, type SkateAbility as br, type SkateAction as bs, type SkateOptions as bt, type SkatePhase as bu, type SkatePoint as bv, type SkateState as bw, type SportsAbility as bx, type SportsAction as by, type SportsOptions as bz, ADVENTURE_EVENT_KINDS as c, type StageWorldBoundaryOptions as c$, type TubeRail as c0, WEAPON_ABILITIES as c1, WEAPON_EVENTS as c2, WEAPON_PHASES as c3, type WeaponAbility as c4, type WeaponCameraIntent as c5, type WeaponInput as c6, type WeaponMode as c7, type WeaponOptions as c8, type WeaponProjectileKind as c9, rpgData as cA, rpgOperation as cB, skateData as cC, skateOperation as cD, sportsData as cE, sportsOperation as cF, squadData as cG, squadOperation as cH, survivalData as cI, survivalOperation as cJ, tacticsData as cK, tacticsOperation as cL, weaponButtons as cM, weaponData as cN, weaponModeData as cO, weaponProjectileData as cP, type TransformState as cQ, GameEntity as cR, type VelocityIntentMode as cS, type BehaviorRuntime as cT, type StagePose as cU, type StageBehaviorSnapshot as cV, type StageThrusterOptions as cW, type StageTopDownOptions as cX, type StageShooter2DOptions as cY, type StageScreenWrapOptions as cZ, type StageBoundaryDimValue as c_, type WeaponProjectileOptions as ca, type WeaponProjectileState as cb, type WeaponShot as cc, type WeaponState as cd, type WeaponSurface as ce, battleData as cf, battleOperation as cg, cityData as ch, combatAttackData as ci, combatButtons as cj, combatData as ck, combatHitData as cl, defenseData as cm, defenseOperation as cn, defineBehavior as co, encounterData as cp, lifeData as cq, lifeOperation as cr, matchingData as cs, matchingOperation as ct, puzzleCommandData as cu, puzzleData as cv, racingData as cw, racingOperation as cx, rhythmData as cy, rhythmOperation as cz, ADVENTURE_FLAGS as d, type StageRicochetDimValue as d0, type StageRicochetOptions as d1, type StagePlatformer3DOptions as d2, type StagePlatformer2DOptions as d3, type StageFirstPersonOptions as d4, type StageFirstPersonInput as d5, type StageJumper2DOptions as d6, type StageJumper3DOptions as d7, WasmStageRuntime as d8, type WasmStageRuntimeOptions as d9, StageTopDownPlane as dA, type StageTopDownPlaneValue as dB, type VelocityIntent as dC, type WasmSnapshotBackref as dD, createTransformStore as dE, createWasmStageRuntime as dF, readBehaviorSnapshot as dG, readStageRenderSlot as dH, type StageBodyKindValue as da, type StageColliderShape as db, type StageRenderSlot as dc, type StageRaycastHit as dd, type StageBodyInfo as de, type StageDebugRender as df, type BaseBehaviorHandle as dg, type BehaviorEntityLink as dh, type BehaviorSystemContext as di, type CreateEntityFn as dj, type GameEntityOptions as dk, STAGE_INPUT_BUTTON_JUMP as dl, STAGE_INPUT_BUTTON_RUN as dm, STAGE_INVALID_SLOT as dn, type StageBodyConfig as dp, StageBodyKind as dq, StageBoundaryDim as dr, type StageColliderConfig as ds, type StageEvent as dt, StageEventType as du, type StageEventTypeValue as dv, StagePlatformerShapeSource as dw, StageRicochetDim as dx, StageRicochetReflection as dy, type StageRicochetReflectionValue as dz, type AcrobaticsAbility as e, type AcrobaticsInput as f, type AcrobaticsOptions as g, type AcrobaticsState as h, type AdventureAbility as i, type AdventureInput as j, type AdventureObject as k, type AdventureObjectState as l, type AdventureOptions as m, type AdventureRole as n, type AdventureState as o, BATTLE_EVENTS as p, type BattleAbility as q, type BattleAction as r, type BattleEight as s, type BattleEvent as t, type BattleFour as u, type BattleOptions as v, type BattleState as w, type BattleTriple as x, type BehaviorDescriptor as y, type BehaviorHandle as z };
|