hayao 0.1.0 → 0.2.0
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/README.md +29 -12
- package/dist/art/autotile.d.ts +77 -0
- package/dist/art/bitmapFont.d.ts +113 -0
- package/dist/art/font5.d.ts +11 -0
- package/dist/art/palette.d.ts +38 -0
- package/dist/art/texture.d.ts +78 -0
- package/dist/audio/audio.d.ts +7 -0
- package/dist/content/dsl.d.ts +61 -0
- package/dist/core/dmath.d.ts +20 -0
- package/dist/core/math.d.ts +2 -0
- package/dist/index.d.ts +37 -1
- package/dist/index.js +4549 -69
- package/dist/index.js.map +4 -4
- package/dist/logic/fsm.d.ts +85 -0
- package/dist/logic/graph.d.ts +88 -0
- package/dist/logic/history.d.ts +54 -0
- package/dist/logic/random.d.ts +32 -0
- package/dist/net/browser.d.ts +37 -0
- package/dist/net/inputBuffer.d.ts +27 -0
- package/dist/net/lockstep.d.ts +79 -0
- package/dist/net/players.d.ts +27 -0
- package/dist/net/protocol.d.ts +100 -0
- package/dist/net/rollback.d.ts +89 -0
- package/dist/net/room.d.ts +78 -0
- package/dist/net/transport.d.ts +78 -0
- package/dist/persist/codec.d.ts +4 -0
- package/dist/persist/save.d.ts +32 -0
- package/dist/persist/storage.d.ts +46 -0
- package/dist/physics/rigidBody.d.ts +104 -0
- package/dist/physics/rigidCollide.d.ts +16 -0
- package/dist/physics/rigidJoints.d.ts +65 -0
- package/dist/physics/rigidQueries.d.ts +15 -0
- package/dist/physics/rigidStep.d.ts +14 -0
- package/dist/procgen/cave.d.ts +21 -0
- package/dist/procgen/grid.d.ts +21 -0
- package/dist/procgen/rooms.d.ts +34 -0
- package/dist/procgen/scatter.d.ts +32 -0
- package/dist/procgen/terrain.d.ts +24 -0
- package/dist/render/nineSlice.d.ts +32 -0
- package/dist/scene/floatingText.d.ts +51 -0
- package/dist/scene/particles.d.ts +64 -0
- package/dist/scene/pool.d.ts +16 -0
- package/dist/scene/tween.d.ts +26 -0
- package/dist/ui/transition.d.ts +107 -0
- package/dist/verify/layout.d.ts +39 -0
- package/docs/API.md +247 -8
- package/package.json +31 -9
package/docs/API.md
CHANGED
|
@@ -3,23 +3,46 @@
|
|
|
3
3
|
> Auto-generated by `npm run api`. Everything importable from `@hayao`.
|
|
4
4
|
> Grep here for the real surface — never guess an API from memory.
|
|
5
5
|
|
|
6
|
-
**
|
|
6
|
+
**440 exports.**
|
|
7
7
|
|
|
8
|
-
## classs (
|
|
8
|
+
## classs (47)
|
|
9
9
|
|
|
10
|
+
- `AmbientField`
|
|
10
11
|
- `AnimationPlayer`
|
|
11
12
|
- `AudioBus`
|
|
13
|
+
- `BitmapText`
|
|
14
|
+
- `BroadcastChannelTransport`
|
|
12
15
|
- `Camera2D`
|
|
13
16
|
- `Canvas2DRenderer`
|
|
17
|
+
- `CinematicPlayer`
|
|
14
18
|
- `Clock`
|
|
15
19
|
- `EventBus`
|
|
20
|
+
- `FloatingText`
|
|
21
|
+
- `Fsm`
|
|
16
22
|
- `HeadlessRenderer`
|
|
23
|
+
- `InputBuffer`
|
|
17
24
|
- `InputRecorder`
|
|
18
25
|
- `InputState`
|
|
19
26
|
- `KeyboardSource`
|
|
27
|
+
- `LocalStorageAdapter`
|
|
28
|
+
- `LockstepSession`
|
|
29
|
+
- `LoopbackHub`
|
|
30
|
+
- `LoopbackTransport`
|
|
31
|
+
- `LootTable`
|
|
32
|
+
- `MemoryStorage`
|
|
20
33
|
- `Node`
|
|
34
|
+
- `NodePool`
|
|
35
|
+
- `NullStorage`
|
|
21
36
|
- `Particles`
|
|
37
|
+
- `PhaseClock`
|
|
38
|
+
- `PixelBuffer`
|
|
39
|
+
- `PlayerInput`
|
|
40
|
+
- `RingBuffer`
|
|
22
41
|
- `Rng`
|
|
42
|
+
- `RollbackSession`
|
|
43
|
+
- `RoomHost`
|
|
44
|
+
- `SaveManager`
|
|
45
|
+
- `ScreenTransition`
|
|
23
46
|
- `Shaker`
|
|
24
47
|
- `Shell`
|
|
25
48
|
- `Signal`
|
|
@@ -27,112 +50,263 @@
|
|
|
27
50
|
- `Sprite`
|
|
28
51
|
- `SvgRenderer`
|
|
29
52
|
- `Text`
|
|
53
|
+
- `TextureSprite`
|
|
30
54
|
- `Timer`
|
|
55
|
+
- `UndoStack`
|
|
31
56
|
- `World`
|
|
32
57
|
|
|
33
|
-
## functions (
|
|
58
|
+
## functions (185)
|
|
34
59
|
|
|
60
|
+
- `addBody`: (rw: RigidWorld, def: RigidBodyDef) => number
|
|
61
|
+
- `addDistanceJoint`: (rw: RigidWorld, def: DistanceJointDef) => number
|
|
62
|
+
- `addRevoluteJoint`: (rw: RigidWorld, def: RevoluteJointDef) => number
|
|
63
|
+
- `addTransition`: (parent: Node, config?: TransitionConfig) => ScreenTransition
|
|
64
|
+
- `applyImpulse`: (rw: RigidWorld, id: number, ix: number, iy: number, px?: number | undefined, py?: number | undefined) => void
|
|
35
65
|
- `applyTransform`: (m: Transform, p: Vec2) => Vec2
|
|
36
66
|
- `asciiEntities`: (rowsAscii: string[], tileSize?: number, chars?: Record<string, TileId>) => { char: string; tx: number; ty: number; x: number; y: number; }[]
|
|
37
67
|
- `assertDeterministic`: (makeWorld: WorldFactory, log: InputLog) => DeterminismReport
|
|
38
68
|
- `assertSnapshotStable`: (makeWorld: WorldFactory, log: InputLog, warmup: number) => { ok: boolean; hashA: string; hashB: string; }
|
|
39
69
|
- `assertSolvable`: <State, Move>(puzzle: Puzzle<State, Move>, options?: SolveOptions) => SolveResult<Move>
|
|
70
|
+
- `astar`: <N>(start: N, isGoal: (n: N) => boolean, neighbours: WeightedNeighbours<N>, key: NodeKey<N>, opts?: { heuristic?: ((n: N) => number) | undefined; maxNodes?: …
|
|
71
|
+
- `astarGrid`: (start: Cell, goal: Cell, passable: Passable, opts: { cols: number; rows: number; diagonal?: boolean | undefined; cost?: ((x: number, y: number) => number) |…
|
|
72
|
+
- `autotile4`: (grid: BoolGrid) => (WangTile | null)[][]
|
|
73
|
+
- `autotileToCommands`: (grid: BoolGrid, options?: AutotileDrawOptions) => (RectCommand | PolyCommand)[]
|
|
74
|
+
- `availableUpgrades`: (defs: readonly UpgradeDef[], owned: readonly string[]) => UpgradeDef[]
|
|
75
|
+
- `bfs`: <N>(start: N, neighbours: Neighbours<N>, key: NodeKey<N>, opts?: { goal?: ((n: N) => boolean) | undefined; maxNodes?: number | undefined; }) => BfsResult<N>
|
|
40
76
|
- `blobPath`: (rng: Rng, radius: number, wobble?: number, lobes?: number) => string
|
|
77
|
+
- `bodyAABB`: (b: RigidBody) => Rect
|
|
78
|
+
- `bodyContains`: (b: RigidBody, x: number, y: number) => boolean
|
|
79
|
+
- `cellFloat`: (x: number, y: number, seed?: number) => number
|
|
80
|
+
- `cellHash`: (x: number, y: number, seed?: number) => number
|
|
81
|
+
- `cellInt`: (x: number, y: number, n: number, seed?: number) => number
|
|
41
82
|
- `changeFrames`: (timeline: ProbeFrame[], key: string) => number[]
|
|
42
83
|
- `checkDeterministic`: (makeWorld: WorldFactory, log: InputLog) => DeterminismReport
|
|
84
|
+
- `collide`: (a: RigidBody, b: RigidBody) => Manifold | null
|
|
43
85
|
- `commandsToSVGInner`: (commands: DrawCommand[]) => string
|
|
44
86
|
- `composeTransform`: (m: Transform, n: Transform) => Transform
|
|
87
|
+
- `connectedComponents`: (cols: number, rows: number, passable: Passable, diagonal?: boolean) => Components
|
|
88
|
+
- `connectWebSocket`: (url: string) => Promise<Transport>
|
|
89
|
+
- `contourToCommands`: (grid: BoolGrid, options?: AutotileDrawOptions) => PolyCommand[]
|
|
45
90
|
- `createPlanBot`: <Step extends { kind: string; }, Probe>(plan: Step[], execs: Record<string, StepExec<Step, Probe>>) => PlanBot<Probe>
|
|
46
91
|
- `createPlatformerState`: (x: number, y: number) => PlatformerState
|
|
92
|
+
- `createRigidWorld`: (opts?: RigidWorldOpts) => RigidWorld
|
|
47
93
|
- `createWorld`: (def: GameDefinition, seedOverride?: number | undefined) => World
|
|
48
94
|
- `dashJumpDistance`: (cfg?: PlatformerConfig) => number
|
|
49
|
-
- `
|
|
95
|
+
- `datan`: (x: number) => number
|
|
96
|
+
- `datan2`: (y: number, x: number) => number
|
|
97
|
+
- `dcos`: (x: number) => number
|
|
98
|
+
- `decode2bit`: (source: string | bigint, width: number, height: number) => PixelBuffer
|
|
99
|
+
- `decodeBits`: (source: string | bigint, width: number, height: number) => PixelBuffer
|
|
100
|
+
- `decodeMessage`: (data: string) => NetMessage | null
|
|
101
|
+
- `decodeRLE`: (runs: readonly number[], width: number, height: number) => PixelBuffer
|
|
102
|
+
- `defaultStorage`: (prefix?: string | undefined) => StorageAdapter
|
|
103
|
+
- `defineGame`: (def: GameDefinition) => Required<Pick<GameDefinition, "seed" | "width" | "height" | "inputMap" | "background">> & GameDefinition
|
|
50
104
|
- `deserializeNode`: (data: SerializedNode) => Node
|
|
105
|
+
- `dexp`: (x: number) => number
|
|
106
|
+
- `dexp2`: (x: number) => number
|
|
107
|
+
- `dhypot`: (x: number, y: number) => number
|
|
108
|
+
- `dlog`: (x: number) => number
|
|
51
109
|
- `drive`: (world: World, script: InputScript, until?: ((probe: Record<string, unknown>) => boolean) | undefined) => DriveResult
|
|
110
|
+
- `dsin`: (x: number) => number
|
|
111
|
+
- `encodeMessage`: (msg: NetMessage) => string
|
|
112
|
+
- `encodeRLE`: (buf: PixelBuffer) => number[]
|
|
52
113
|
- `firstFrame`: (timeline: ProbeFrame[], pred: (p: ProbeFrame) => boolean) => number
|
|
114
|
+
- `floodFill`: (start: Cell, passable: Passable, opts: { cols: number; rows: number; diagonal?: boolean | undefined; }) => Cell[]
|
|
115
|
+
- `fractalNoise`: (x: number, y: number, seed?: number, opts?: FractalOptions) => number
|
|
53
116
|
- `frameActions`: (log: InputLog, i: number) => string[]
|
|
54
117
|
- `gameInputMap`: (def: GameDefinition) => InputMap
|
|
118
|
+
- `generateCave`: (rng: Rng, opts: CaveOptions) => Grid
|
|
119
|
+
- `generateDungeon`: (rng: Rng, opts: DungeonOptions) => Dungeon
|
|
120
|
+
- `getBody`: (rw: RigidWorld, id: number) => RigidBody | undefined
|
|
121
|
+
- `getJoint`: (rw: RigidWorld, id: number) => Joint | undefined
|
|
122
|
+
- `gradient`: (stops: readonly string[], n: number) => string[]
|
|
123
|
+
- `gridAt`: (g: Grid, x: number, y: number) => number
|
|
124
|
+
- `gridFromRows`: (rows: readonly string[], solid?: string) => boolean[][]
|
|
125
|
+
- `gridSet`: (g: Grid, x: number, y: number, v: number) => void
|
|
126
|
+
- `gridToTilemap`: (g: Grid, tileSize?: number) => TilemapData
|
|
55
127
|
- `groundAt`: (map: TilemapData, x: number, y: number, w: number, h: number, solids?: SolidRect[], dropThrough?: boolean) => { grounded: boolean; solid: number; }
|
|
56
128
|
- `hashString`: (str: string) => number
|
|
57
129
|
- `hashValue`: (value: unknown) => string
|
|
130
|
+
- `hexToHsl`: (hex: string) => HSL
|
|
58
131
|
- `hideScreen`: () => void
|
|
59
132
|
- `hold`: (actions: string[], frames: number) => Segment
|
|
133
|
+
- `hostRoom`: (opts: RoomHostOptions) => RoomHost
|
|
134
|
+
- `hsl`: (h: number, s: number, l: number) => string
|
|
135
|
+
- `hsv`: (h: number, s: number, v: number) => string
|
|
136
|
+
- `initDirector`: (waves: readonly WaveDef[]) => DirectorState
|
|
60
137
|
- `inputDensity`: (frames: string[][]) => number
|
|
61
138
|
- `installCapture`: (target: CaptureTarget) => HayaoCapture
|
|
62
139
|
- `invertTransform`: (m: Transform) => Transform
|
|
63
140
|
- `inVisionCone`: (map: TilemapData, ex: number, ey: number, faceX: number, faceY: number, fov: number, range: number, tx: number, ty: number) => boolean
|
|
64
141
|
- `isCaptureMode`: () => boolean
|
|
142
|
+
- `isGround`: (col: number, row: number, opts: TerrainOptions) => boolean
|
|
65
143
|
- `isMonotonic`: (values: number[], dir: "up" | "down", slack?: number) => boolean
|
|
144
|
+
- `joinRoom`: (opts: RoomClientOptions) => Promise<NetGame>
|
|
66
145
|
- `jumpAirtime`: (cfg?: PlatformerConfig) => number
|
|
67
146
|
- `jumpDistance`: (cfg?: PlatformerConfig) => number
|
|
68
147
|
- `jumpHeight`: (cfg?: PlatformerConfig) => number
|
|
148
|
+
- `keyMentions`: (code: string) => string[]
|
|
69
149
|
- `keysToActions`: (map: InputMap, keysDown: Set<string>) => string[]
|
|
150
|
+
- `layoutIssues`: (commands: DrawCommand[], opts?: LayoutOptions) => string[]
|
|
151
|
+
- `layoutText`: (font: BitmapFont, input: string | readonly RichChar[], options?: TextLayoutOptions) => TextLayout
|
|
70
152
|
- `lineOfSight`: (map: TilemapData, ax: number, ay: number, bx: number, by: number) => boolean
|
|
71
153
|
- `longestLull`: (eventFrames: number[], totalFrames: number) => number
|
|
154
|
+
- `makeGrid`: (cols: number, rows: number, fill?: number) => Grid
|
|
155
|
+
- `makeReach`: (start?: number, settle?: number) => (target: number, dt: number) => number
|
|
72
156
|
- `makeTransform`: (pos: Vec2, rotation: number, scale: Vec2) => Transform
|
|
157
|
+
- `marchingSquaresCases`: (grid: BoolGrid) => number[][]
|
|
158
|
+
- `marchingSquaresContours`: (grid: BoolGrid, options?: ContourOptions) => ContourSegment[]
|
|
159
|
+
- `mask4`: (grid: BoolGrid, x: number, y: number) => number
|
|
160
|
+
- `mask8`: (grid: BoolGrid, x: number, y: number) => number
|
|
161
|
+
- `measureLine`: (font: BitmapFont, chars: readonly RichChar[]) => number
|
|
162
|
+
- `measureText`: (font: BitmapFont, text: string) => number
|
|
163
|
+
- `mergePlayerFrames`: (players: readonly string[], inputs: ReadonlyMap<string, readonly string[]>) => string[]
|
|
164
|
+
- `missingControlHints`: (world: World, inputMap: InputMap) => string[]
|
|
73
165
|
- `mix`: (a: string, b: string, t: number) => string
|
|
166
|
+
- `mixLinear`: (a: string, b: string, t: number) => string
|
|
74
167
|
- `moveRect`: (map: TilemapData, rect: Rect, dx: number, dy: number, opts?: MoveOpts) => MoveResult
|
|
168
|
+
- `mutateColor`: (rng: Rng, hex: string, amounts?: DriftAmounts) => string
|
|
169
|
+
- `netMessage`: <T extends Omit<NetMessage, "v">>(msg: T) => T & { v: number; }
|
|
170
|
+
- `nineSlice`: (rect: Rect, style: NineSliceStyle, z?: number, transform?: Transform) => DrawCommand[]
|
|
171
|
+
- `packVarints`: (nums: readonly number[]) => string
|
|
172
|
+
- `parseRich`: (markup: string, colorMap?: Record<string, string>) => RichChar[]
|
|
173
|
+
- `parseSnapshot`: (text: string | null) => WorldSnapshot | null
|
|
174
|
+
- `passableFromTilemap`: (map: TilemapData) => Passable
|
|
175
|
+
- `pickEntry`: <T>(rng: Rng, entries: readonly WeightedEntry<T>[]) => T
|
|
176
|
+
- `pixelsToCommands`: (buf: PixelBuffer, palette: readonly Swatch[], options?: PixelDrawOptions) => RectCommand[]
|
|
177
|
+
- `playerIds`: (count: number) => string[]
|
|
178
|
+
- `pointQuery`: (rw: RigidWorld, x: number, y: number, mask?: number) => RigidBody | undefined
|
|
179
|
+
- `pollDirector`: (waves: readonly WaveDef[], state: DirectorState, time: number, rng?: Rng | undefined) => SpawnEvent[]
|
|
180
|
+
- `polygonBox`: (w: number, h: number) => RigidShape
|
|
75
181
|
- `pump`: (world: World, frames: number, actions?: string[]) => void
|
|
182
|
+
- `rayCastRigid`: (rw: RigidWorld, x0: number, y0: number, x1: number, y1: number, mask?: number) => RigidRayHit | null
|
|
76
183
|
- `raycastTiles`: (map: TilemapData, x0: number, y0: number, x1: number, y1: number) => RayHit
|
|
184
|
+
- `reconstructPath`: <N>(cameFrom: Map<string, N>, key: NodeKey<N>, start: N, goal: N) => N[]
|
|
77
185
|
- `recordTimeline`: (world: World, frames: string[][]) => ProbeFrame[]
|
|
78
186
|
- `rectBlocked`: (map: TilemapData, x: number, y: number, w: number, h: number, solids?: SolidRect[]) => boolean
|
|
79
187
|
- `rectContains`: (r: Rect, p: Vec2) => boolean
|
|
80
188
|
- `rectsOverlap`: (a: Rect, b: Rect) => boolean
|
|
81
189
|
- `registerNode`: (type: string, factory: NodeFactory) => void
|
|
82
190
|
- `regularPolygon`: (sides: number, radius: number, rotation?: number) => number[]
|
|
191
|
+
- `removeBody`: (rw: RigidWorld, id: number) => void
|
|
192
|
+
- `removeJoint`: (rw: RigidWorld, id: number) => void
|
|
83
193
|
- `renderFilmstrip`: (world: World, frames: string[][], opts: FilmstripOptions) => string
|
|
84
194
|
- `renderToSVGString`: (commands: DrawCommand[], width: number, height: number, background?: string) => string
|
|
85
195
|
- `replay`: (makeWorld: WorldFactory, log: InputLog) => { finalHash: string; hashes: string[]; }
|
|
86
196
|
- `resetNodeIds`: (start?: number) => void
|
|
197
|
+
- `rigidStep`: (rw: RigidWorld, dt: number) => ContactEvent[]
|
|
198
|
+
- `rleDecode`: (input: string) => string
|
|
199
|
+
- `rleEncode`: (input: string) => string
|
|
200
|
+
- `roomCenter`: (r: Room) => { x: number; y: number; }
|
|
87
201
|
- `runBrowser`: (def: GameDefinition, mount: HTMLElement, opts?: RunOptions) => GameHandle
|
|
202
|
+
- `runBrowserNet`: (def: GameDefinition, mount: HTMLElement, opts: NetRunOptions) => NetGameHandle
|
|
88
203
|
- `runHeadless`: (def: GameDefinition, inputLog?: InputLog | undefined) => HeadlessResult
|
|
204
|
+
- `sampleGradient`: (stops: readonly string[], t: number) => string
|
|
205
|
+
- `scatter`: (x: number, y: number, probability: number, seed?: number) => boolean
|
|
206
|
+
- `scatterCells`: (x0: number, y0: number, cols: number, rows: number, probability: number, seed?: number) => { x: number; y: number; }[]
|
|
89
207
|
- `scriptedPlaythrough`: (world: World, script: Segment[]) => PlaythroughResult
|
|
90
208
|
- `scriptToFrames`: (script: InputScript) => string[][]
|
|
209
|
+
- `serializeSnapshot`: (snap: WorldSnapshot) => string
|
|
91
210
|
- `series`: (timeline: ProbeFrame[], key: string) => unknown[]
|
|
92
211
|
- `setOverlayHost`: (el: HTMLElement) => void
|
|
212
|
+
- `shapeBox`: (cmd: DrawCommand) => { x: number; y: number; w: number; h: number; } | null
|
|
93
213
|
- `showScreen`: (spec: ScreenSpec) => ScreenHandle
|
|
94
214
|
- `smoothClosedPath`: (points: Vec2[], tension?: number) => string
|
|
95
215
|
- `smoothOpenPath`: (points: Vec2[], tension?: number) => string
|
|
216
|
+
- `solidNeighbours`: (g: Grid, x: number, y: number) => number
|
|
96
217
|
- `solve`: <State, Move>(puzzle: Puzzle<State, Move>, options?: SolveOptions) => SolveResult<Move>
|
|
218
|
+
- `solveJoint`: (j: Joint, A: RigidBody, B: RigidBody, dt: number, scratch: JointScratch) => void
|
|
97
219
|
- `sortCommands`: (cmds: DrawCommand[]) => DrawCommand[]
|
|
220
|
+
- `springStep`: (s: SpringState, target: number, omega: number, dt: number) => SpringState
|
|
98
221
|
- `star`: (points: number, outer: number, inner: number, rotation?: number) => number[]
|
|
99
222
|
- `steer2D`: (px: number, py: number, tx: number, ty: number, out: string[], dead?: number) => void
|
|
100
223
|
- `stepPlatformer`: (s: PlatformerState, input: PadInput, dt: number, map: TilemapData, cfg?: PlatformerConfig, platforms?: Platform[]) => PlatformerEvents
|
|
224
|
+
- `terrainHeight`: (col: number, opts: TerrainOptions) => number
|
|
225
|
+
- `terrainSlice`: (startCol: number, count: number, opts: TerrainOptions) => number[]
|
|
226
|
+
- `textBox`: (cmd: TextCommand) => TextBox
|
|
227
|
+
- `textToCommands`: (font: BitmapFont, layout: TextLayout, options?: TextDrawOptions) => RectCommand[]
|
|
101
228
|
- `tileAt`: (map: TilemapData, tx: number, ty: number) => number
|
|
102
229
|
- `tileAtPoint`: (map: TilemapData, x: number, y: number) => number
|
|
103
230
|
- `tilemapFromAscii`: (rowsAscii: string[], tileSize?: number, chars?: Record<string, TileId>) => TilemapData
|
|
104
231
|
- `toggleFullscreen`: () => void
|
|
232
|
+
- `typewriterCount`: (total: number, elapsedSec: number, charsPerSec: number) => number
|
|
233
|
+
- `unpackVarints`: (input: string) => number[]
|
|
234
|
+
- `valueNoise`: (x: number, y: number, seed?: number) => number
|
|
105
235
|
- `vnorm`: (a: Vec2) => Vec2
|
|
106
236
|
- `wait`: (frames: number) => Segment
|
|
237
|
+
- `wakeBody`: (b: RigidBody) => void
|
|
238
|
+
- `wangTile`: (mask: number) => WangTile
|
|
239
|
+
- `weatherEnvelope`: (t: number, keys: readonly WeatherKey[]) => number
|
|
240
|
+
- `weightedIndex`: (rng: Rng, weights: readonly number[]) => number
|
|
241
|
+
- `weightedPick`: <T>(rng: Rng, items: readonly T[], weights: readonly number[]) => T
|
|
242
|
+
- `wipeStep`: (transition: ScreenTransition, opts?: WipeOptions & { name?: string | undefined; }) => CinematicStep
|
|
107
243
|
- `withAlpha`: (hex: string, alpha: number) => string
|
|
244
|
+
- `worldPoints`: (b: RigidBody) => number[]
|
|
108
245
|
|
|
109
|
-
## interfaces (
|
|
246
|
+
## interfaces (132)
|
|
110
247
|
|
|
248
|
+
- `AmbientStyle`
|
|
249
|
+
- `AutotileDrawOptions`
|
|
111
250
|
- `Behavior`
|
|
251
|
+
- `BfsResult`
|
|
252
|
+
- `BitmapFont`
|
|
253
|
+
- `BitmapTextConfig`
|
|
112
254
|
- `BotCtx`
|
|
113
255
|
- `CameraConfig`
|
|
114
256
|
- `CaptureTarget`
|
|
257
|
+
- `CaveOptions`
|
|
258
|
+
- `Cell`
|
|
259
|
+
- `CinematicStep`
|
|
115
260
|
- `CircleCommand`
|
|
116
261
|
- `ClockConfig`
|
|
262
|
+
- `Components`
|
|
263
|
+
- `ContactEvent`
|
|
264
|
+
- `ContactPoint`
|
|
265
|
+
- `ContourOptions`
|
|
266
|
+
- `ContourSegment`
|
|
117
267
|
- `CoreEvents`
|
|
268
|
+
- `DesyncInfo`
|
|
118
269
|
- `DeterminismReport`
|
|
270
|
+
- `DirectorState`
|
|
271
|
+
- `DistanceJoint`
|
|
272
|
+
- `DistanceJointDef`
|
|
273
|
+
- `DriftAmounts`
|
|
119
274
|
- `DriveResult`
|
|
275
|
+
- `Dungeon`
|
|
276
|
+
- `DungeonOptions`
|
|
120
277
|
- `FilmstripOptions`
|
|
278
|
+
- `FloatStyle`
|
|
279
|
+
- `FractalOptions`
|
|
121
280
|
- `GameDefinition`
|
|
122
281
|
- `GameHandle`
|
|
282
|
+
- `Grid`
|
|
123
283
|
- `HayaoCapture`
|
|
124
284
|
- `HeadlessResult`
|
|
285
|
+
- `HSL`
|
|
125
286
|
- `ImageCommand`
|
|
126
287
|
- `InputLog`
|
|
288
|
+
- `JointScratch`
|
|
289
|
+
- `LayoutOptions`
|
|
290
|
+
- `LockstepOptions`
|
|
291
|
+
- `LoopbackOptions`
|
|
292
|
+
- `Manifold`
|
|
127
293
|
- `MenuAction`
|
|
128
294
|
- `MoveOpts`
|
|
129
295
|
- `MoveResult`
|
|
296
|
+
- `NetGame`
|
|
297
|
+
- `NetGameHandle`
|
|
298
|
+
- `NetRunOptions`
|
|
299
|
+
- `NetSessionConfig`
|
|
300
|
+
- `NineSliceStyle`
|
|
130
301
|
- `NodeConfig`
|
|
131
302
|
- `PadInput`
|
|
132
303
|
- `Paint`
|
|
133
304
|
- `Palette`
|
|
134
305
|
- `ParticleStyle`
|
|
135
306
|
- `PathCommand`
|
|
307
|
+
- `PhaseDef`
|
|
308
|
+
- `PixelDrawOptions`
|
|
309
|
+
- `PlacedGlyph`
|
|
136
310
|
- `PlanBot`
|
|
137
311
|
- `Platform`
|
|
138
312
|
- `PlatformerConfig`
|
|
@@ -146,7 +320,20 @@
|
|
|
146
320
|
- `RectCommand`
|
|
147
321
|
- `Renderer`
|
|
148
322
|
- `RendererConfig`
|
|
323
|
+
- `RevoluteJoint`
|
|
324
|
+
- `RevoluteJointDef`
|
|
325
|
+
- `RichChar`
|
|
326
|
+
- `RigidBody`
|
|
327
|
+
- `RigidBodyDef`
|
|
328
|
+
- `RigidRayHit`
|
|
329
|
+
- `RigidWorld`
|
|
330
|
+
- `RigidWorldOpts`
|
|
149
331
|
- `RngState`
|
|
332
|
+
- `RollbackOptions`
|
|
333
|
+
- `Room`
|
|
334
|
+
- `RoomCallbacks`
|
|
335
|
+
- `RoomClientOptions`
|
|
336
|
+
- `RoomHostOptions`
|
|
150
337
|
- `RunOptions`
|
|
151
338
|
- `ScreenHandle`
|
|
152
339
|
- `ScreenSpec`
|
|
@@ -158,64 +345,116 @@
|
|
|
158
345
|
- `SolidRect`
|
|
159
346
|
- `SolveOptions`
|
|
160
347
|
- `SolveResult`
|
|
348
|
+
- `SpawnEvent`
|
|
349
|
+
- `SpringState`
|
|
161
350
|
- `SpriteConfig`
|
|
351
|
+
- `StateHandlers`
|
|
352
|
+
- `StorageAdapter`
|
|
353
|
+
- `TerrainOptions`
|
|
354
|
+
- `TextBox`
|
|
162
355
|
- `TextCommand`
|
|
163
356
|
- `TextConfig`
|
|
357
|
+
- `TextDrawOptions`
|
|
358
|
+
- `TextLayout`
|
|
359
|
+
- `TextLayoutOptions`
|
|
360
|
+
- `TextureSpriteConfig`
|
|
164
361
|
- `TilemapData`
|
|
165
362
|
- `TimerConfig`
|
|
166
363
|
- `Tone`
|
|
167
364
|
- `Transform`
|
|
365
|
+
- `Transition`
|
|
366
|
+
- `TransitionConfig`
|
|
367
|
+
- `Transport`
|
|
368
|
+
- `UpgradeDef`
|
|
168
369
|
- `Vec2`
|
|
169
370
|
- `Volumes`
|
|
371
|
+
- `WangTile`
|
|
372
|
+
- `WaveDef`
|
|
373
|
+
- `WeatherKey`
|
|
374
|
+
- `WeightedEdge`
|
|
375
|
+
- `WeightedEntry`
|
|
376
|
+
- `WipeOptions`
|
|
170
377
|
- `WorldConfig`
|
|
171
378
|
- `WorldContext`
|
|
172
379
|
- `WorldSnapshot`
|
|
173
380
|
|
|
174
|
-
## types (
|
|
381
|
+
## types (27)
|
|
175
382
|
|
|
383
|
+
- `BodyKind`
|
|
384
|
+
- `BoolGrid`
|
|
176
385
|
- `DrawCommand`
|
|
386
|
+
- `Ease`
|
|
177
387
|
- `Easing`
|
|
388
|
+
- `Edge`
|
|
178
389
|
- `InputMap`
|
|
179
390
|
- `InputScript`
|
|
391
|
+
- `Joint`
|
|
180
392
|
- `Listener`
|
|
393
|
+
- `Neighbours`
|
|
394
|
+
- `NetMessage`
|
|
181
395
|
- `NodeFactory`
|
|
396
|
+
- `NodeKey`
|
|
397
|
+
- `Passable`
|
|
398
|
+
- `PlayerId`
|
|
182
399
|
- `ProbeFrame`
|
|
400
|
+
- `RigidShape`
|
|
183
401
|
- `Shape`
|
|
184
402
|
- `StepExec`
|
|
403
|
+
- `Swatch`
|
|
185
404
|
- `TextAlign`
|
|
186
405
|
- `TileId`
|
|
406
|
+
- `WangFrame`
|
|
407
|
+
- `WeightedNeighbours`
|
|
408
|
+
- `WipeKind`
|
|
187
409
|
- `WorldFactory`
|
|
188
410
|
|
|
189
|
-
## consts (
|
|
411
|
+
## consts (48)
|
|
190
412
|
|
|
413
|
+
- `AMBIENT_PRESETS`: { readonly snow: (colors?: string[]) => AmbientStyle; readonly rain: (colors?: string[]) => AmbientStyle; readonly ash: (colors?: string[]) => AmbientStyle; }
|
|
191
414
|
- `audio`: AudioBus
|
|
192
415
|
- `clamp`: (v: number, lo: number, hi: number) => number
|
|
193
416
|
- `DEFAULT_INPUT_MAP`: InputMap
|
|
194
417
|
- `DEFAULT_PLATFORMER`: PlatformerConfig
|
|
418
|
+
- `DEFAULT_SESSION_CONFIG`: NetSessionConfig
|
|
195
419
|
- `DEFAULT_TILE_CHARS`: Record<string, TileId>
|
|
196
420
|
- `deg2rad`: (d: number) => number
|
|
421
|
+
- `dlog10`: (x: number) => number
|
|
422
|
+
- `dlog2`: (x: number) => number
|
|
197
423
|
- `DUSK`: Palette
|
|
198
424
|
- `EASINGS`: Record<string, Easing>
|
|
425
|
+
- `FLOAT_PRESETS`: { readonly damage: (color?: string) => FloatStyle; readonly crit: (color?: string) => FloatStyle; readonly heal: (color?: string) => FloatStyle; readonly lab…
|
|
426
|
+
- `FONT_5`: BitmapFont
|
|
199
427
|
- `IDENTITY`: Transform
|
|
200
428
|
- `invLerp`: (a: number, b: number, v: number) => number
|
|
201
429
|
- `lerp`: (a: number, b: number, t: number) => number
|
|
430
|
+
- `lerpDamp`: (current: number, target: number, lambda: number, dt: number) => number
|
|
202
431
|
- `mapHeight`: (map: TilemapData) => number
|
|
203
432
|
- `mapWidth`: (map: TilemapData) => number
|
|
204
433
|
- `MEADOW`: Palette
|
|
434
|
+
- `NEIGHBORS_4`: readonly Cell[]
|
|
435
|
+
- `NEIGHBORS_8`: readonly Cell[]
|
|
436
|
+
- `NET_PROTOCOL_VERSION`: 1
|
|
205
437
|
- `PAD_NEUTRAL`: PadInput
|
|
206
438
|
- `PALETTES`: Record<string, Palette>
|
|
439
|
+
- `PANEL_PRESETS`: { readonly parchment: () => NineSliceStyle; readonly slate: () => NineSliceStyle; }
|
|
207
440
|
- `PAPER`: Palette
|
|
208
441
|
- `PARTICLE_PRESETS`: { readonly dust: (colors?: string[]) => ParticleStyle; readonly burst: (colors?: string[]) => ParticleStyle; readonly hit: (colors?: string[]) => ParticleSty…
|
|
442
|
+
- `playerAction`: (player: string, action: string) => string
|
|
443
|
+
- `playerInput`: (world: World, player: string) => PlayerInput
|
|
209
444
|
- `rad2deg`: (r: number) => number
|
|
210
445
|
- `remap`: (v: number, a0: number, a1: number, b0: number, b1: number) => number
|
|
446
|
+
- `SAVE_FORMAT_VERSION`: 1
|
|
447
|
+
- `screenRect`: (w: number, h: number) => Rect
|
|
211
448
|
- `settings`: SettingsStore
|
|
449
|
+
- `smoothstep`: (edge0: number, edge1: number, v: number) => number
|
|
450
|
+
- `spring`: (value?: number) => SpringState
|
|
212
451
|
- `TAU`: number
|
|
213
452
|
- `TILE`: { readonly EMPTY: 0; readonly SOLID: 1; readonly ONEWAY: 2; readonly HAZARD: 3; }
|
|
214
453
|
- `vadd`: (a: Vec2, b: Vec2) => Vec2
|
|
215
454
|
- `vdist`: (a: Vec2, b: Vec2) => number
|
|
216
455
|
- `vdot`: (a: Vec2, b: Vec2) => number
|
|
217
456
|
- `vec2`: (x?: number, y?: number) => Vec2
|
|
218
|
-
- `VERSION`: "0.
|
|
457
|
+
- `VERSION`: "0.2.0"
|
|
219
458
|
- `vlen`: (a: Vec2) => number
|
|
220
459
|
- `vscale`: (a: Vec2, s: number) => Vec2
|
|
221
460
|
- `vsub`: (a: Vec2, b: Vec2) => Vec2
|
package/package.json
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hayao",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An AI-first game engine: a deterministic, headless-native simulation kernel with a Godot-style scene tree, pluggable renderers (SVG/Canvas/headless), and a built-in verification harness — designed so an LLM can author, test, and prove correct a whole game without ever opening a browser.",
|
|
6
|
-
"keywords": [
|
|
6
|
+
"keywords": [
|
|
7
|
+
"game-engine",
|
|
8
|
+
"ai-first",
|
|
9
|
+
"deterministic",
|
|
10
|
+
"typescript",
|
|
11
|
+
"svg",
|
|
12
|
+
"godot-like",
|
|
13
|
+
"headless",
|
|
14
|
+
"simulation"
|
|
15
|
+
],
|
|
7
16
|
"author": "hellojanpacan",
|
|
8
17
|
"license": "MIT",
|
|
9
|
-
"repository": {
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/hellojanpacan/hayao-js.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://hayao.dev/",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/hellojanpacan/hayao-js/issues"
|
|
25
|
+
},
|
|
12
26
|
"main": "./dist/index.js",
|
|
13
27
|
"module": "./dist/index.js",
|
|
14
28
|
"types": "./dist/index.d.ts",
|
|
@@ -18,9 +32,16 @@
|
|
|
18
32
|
"import": "./dist/index.js"
|
|
19
33
|
}
|
|
20
34
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"docs/API.md"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
24
45
|
"scripts": {
|
|
25
46
|
"dev": "vite",
|
|
26
47
|
"build": "tsc --noEmit && vite build",
|
|
@@ -31,7 +52,8 @@
|
|
|
31
52
|
"api": "tsx scripts/api-digest.ts",
|
|
32
53
|
"invariants": "tsx scripts/invariants.ts",
|
|
33
54
|
"verify": "tsx scripts/invariants.ts && tsx scripts/verify.ts",
|
|
34
|
-
"prepublishOnly": "npm run check && npm test && npm run build:lib"
|
|
55
|
+
"prepublishOnly": "npm run check && npm test && npm run build:lib",
|
|
56
|
+
"relay": "node scripts/relay.mjs"
|
|
35
57
|
},
|
|
36
58
|
"devDependencies": {
|
|
37
59
|
"@types/node": "^22.10.0",
|