@onimaxxing/worldgen 0.15.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.
Binary file
@@ -0,0 +1,99 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const bench_cluster_phases: (a: number, b: number, c: number) => [number, number];
4
+ export const bench_profile_dump: () => [number, number];
5
+ export const compute_digest_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
6
+ export const compute_digest_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
7
+ export const compute_digest_with_overrides: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
8
+ export const compute_geyser_stats: (a: number, b: number, c: number) => [number, number];
9
+ export const debug_dump_backwall_distribution: (a: number, b: number, c: number) => [number, number];
10
+ export const debug_dump_cluster_pd_seed_state: (a: number, b: number) => [number, number];
11
+ export const debug_dump_noise_channel_hashes: (a: number, b: number) => [number, number];
12
+ export const debug_dump_noise_channels: (a: number, b: number, c: number) => [number, number];
13
+ export const debug_dump_placed_templates: (a: number, b: number) => [number, number];
14
+ export const debug_dump_tc_backwall_lookup: (a: number, b: number, c: number) => [number, number];
15
+ export const debug_dump_tc_backwall_noise: (a: number, b: number, c: number, d: number, e: number) => [number, number];
16
+ export const debug_dump_tc_details: (a: number, b: number, c: number) => [number, number];
17
+ export const debug_dump_tc_rng_states: (a: number, b: number) => [number, number];
18
+ export const debug_dump_world_mobs: (a: number, b: number, c: number) => [number, number];
19
+ export const debug_settings_element_overrides: () => [number, number];
20
+ export const drain_debug_capture: () => [number, number];
21
+ export const dump_cluster_placements: (a: number, b: number) => [number, number];
22
+ export const dump_tc_polys_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
23
+ export const dump_tc_positions_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
24
+ export const dump_terrain_cell_node_types: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
25
+ export const dump_transcendental_test: () => [number, number];
26
+ export const dump_world_cells: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
27
+ export const dump_world_cells_at_tick: (a: number, b: number, c: number, d: number) => [number, number];
28
+ export const dump_world_cells_for_cluster: (a: number, b: number, c: number, d: number) => [number, number];
29
+ export const dump_world_cells_for_cluster_coord: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
30
+ export const dump_world_cells_settled: (a: number, b: number, c: number) => [number, number];
31
+ export const dump_world_tcs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
32
+ export const dump_world_traits: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
33
+ export const evaluate_noise: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
34
+ export const extract_overrideable_state: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
35
+ export const game_version: () => [number, number];
36
+ export const generate_cluster: (a: number, b: number, c: number) => [number, number];
37
+ export const generate_cluster_cells: (a: number, b: number, c: number) => [number, number];
38
+ export const generate_cluster_rendered: (a: number, b: number, c: number) => [number, number];
39
+ export const generate_cluster_with_configs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
40
+ export const generate_from_coordinate: (a: number, b: number) => [number, number];
41
+ export const generate_layout_cells: (a: number, b: number, c: number) => [number, number];
42
+ export const generate_map_data: (a: number, b: number) => any;
43
+ export const generate_rendered_from_coordinate: (a: number, b: number) => [number, number];
44
+ export const generate_sandstone_default: (a: number) => [number, number];
45
+ export const generate_terrain_cells: (a: number, b: number, c: number) => [number, number];
46
+ export const generate_vanilla_sandstone_cluster: (a: number) => [number, number];
47
+ export const get_entity_spawners: () => [number, number];
48
+ export const noise_node_kinds: () => [number, number];
49
+ export const probe_settings_fingerprint: () => [number, number];
50
+ export const probe_subworld_raw_json: (a: number, b: number) => [number, number];
51
+ export const probe_subworlds_iteration_order_hash: () => [number, number];
52
+ export const set_skip_templates: (a: number) => void;
53
+ export const set_voronoi_debug_capture: (a: number) => void;
54
+ export const settings_reset: () => void;
55
+ export const settle_cluster_advance: (a: number) => [number, number];
56
+ export const sim_env_drain_log: (a: number, b: number) => [number, number];
57
+ export const sim_env_set: (a: number, b: number, c: number, d: number) => void;
58
+ export const snapshot_checksum: (a: number, b: number) => [number, number, number, number];
59
+ export const snapshot_checksum_bytes: (a: number, b: number) => [number, number];
60
+ export const snapshot_from_files: (a: number, b: number) => [number, number, number, number];
61
+ export const snapshot_from_files_extensions: (a: number, b: number) => [number, number, number, number];
62
+ export const snapshot_load_vanilla: () => [number, number, number, number];
63
+ export const snapshot_load_vanilla_extensions: () => [number, number, number, number];
64
+ export const snapshot_merge_files: (a: number, b: number, c: number, d: number) => [number, number, number, number];
65
+ export const snapshot_remove_paths: (a: number, b: number, c: number, d: number) => [number, number, number, number];
66
+ export const snapshot_state_checksum: () => [number, number, number, number];
67
+ export const snapshot_state_drop_paths: (a: number, b: number) => [number, number, number];
68
+ export const snapshot_state_files: () => [number, number, number, number];
69
+ export const snapshot_state_load: (a: number, b: number) => [number, number, number];
70
+ export const snapshot_state_load_extensions: (a: number, b: number) => [number, number, number];
71
+ export const snapshot_state_merge: (a: number, b: number) => [number, number, number];
72
+ export const snapshot_state_reset: () => void;
73
+ export const snapshot_state_vanilla: () => number;
74
+ export const snapshot_state_vanilla_extensions: () => number;
75
+ export const snapshot_to_files: (a: number, b: number) => [number, number, number, number];
76
+ export const take_thermal_pair_trace: () => [number, number];
77
+ export const test_cos_sin: (a: bigint) => [number, number];
78
+ export const ucrt_logf_batch: (a: number, b: number) => [number, number];
79
+ export const bench_profile_enable: () => void;
80
+ export const snapshot_checksum_canonical: (a: number, b: number) => [number, number, number, number];
81
+ export const clear_cluster_cache: () => void;
82
+ export const snapshot_state_version: () => number;
83
+ export const arm_thermal_pair_trace: (a: number, b: number) => void;
84
+ export const __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
85
+ export const initThreadPool: (a: number) => any;
86
+ export const wbg_rayon_poolbuilder_build: (a: number) => void;
87
+ export const wbg_rayon_poolbuilder_numThreads: (a: number) => number;
88
+ export const wbg_rayon_poolbuilder_receiver: (a: number) => number;
89
+ export const wbg_rayon_start_worker: (a: number) => void;
90
+ export const memory: WebAssembly.Memory;
91
+ export const __wbindgen_malloc: (a: number, b: number) => number;
92
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
93
+ export const __wbindgen_exn_store: (a: number) => void;
94
+ export const __externref_table_alloc: () => number;
95
+ export const __wbindgen_externrefs: WebAssembly.Table;
96
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
97
+ export const __externref_table_dealloc: (a: number) => void;
98
+ export const __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
99
+ export const __wbindgen_start: (a: number) => void;
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Copyright 2022 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
15
+ // we can handle bundling into other files, which might happen to have their
16
+ // own `postMessage`/`onmessage` communication channels.
17
+ //
18
+ // If we didn't take that into the account, we could send much simpler signals
19
+ // like just `0` or whatever, but the code would be less resilient.
20
+
21
+ function waitForMsgType(target, type) {
22
+ return new Promise(resolve => {
23
+ target.addEventListener('message', function onMsg({ data }) {
24
+ if (data?.type !== type) return;
25
+ target.removeEventListener('message', onMsg);
26
+ resolve(data);
27
+ });
28
+ });
29
+ }
30
+
31
+ waitForMsgType(self, 'wasm_bindgen_worker_init').then(async ({ init, receiver }) => {
32
+ // # Note 1
33
+ // Our JS should have been generated in
34
+ // `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
35
+ // resolve the main module via `../../..`.
36
+ //
37
+ // This might need updating if the generated structure changes on wasm-bindgen
38
+ // side ever in the future, but works well with bundlers today. The whole
39
+ // point of this crate, after all, is to abstract away unstable features
40
+ // and temporary bugs so that you don't need to deal with them in your code.
41
+ //
42
+ // # Note 2
43
+ // This could be a regular import, but then some bundlers complain about
44
+ // circular deps.
45
+ //
46
+ // Dynamic import could be cheap if this file was inlined into the parent,
47
+ // which would require us just using `../../..` in `new Worker` below,
48
+ // but that doesn't work because wasm-pack unconditionally adds
49
+ // "sideEffects":false (see below).
50
+ //
51
+ // OTOH, even though it can't be inlined, it should be still reasonably
52
+ // cheap since the requested file is already in cache (it was loaded by
53
+ // the main thread).
54
+ const pkg = await import('../../../index.js');
55
+ await pkg.default(init);
56
+ postMessage({ type: 'wasm_bindgen_worker_ready' });
57
+ pkg.wbg_rayon_start_worker(receiver);
58
+ });
59
+
60
+ // Note: this is never used, but necessary to prevent a bug in Firefox
61
+ // (https://bugzilla.mozilla.org/show_bug.cgi?id=1702191) where it collects
62
+ // Web Workers that have a shared WebAssembly memory with the main thread,
63
+ // but are not explicitly rooted via a `Worker` instance.
64
+ //
65
+ // By storing them in a variable, we can keep `Worker` objects around and
66
+ // prevent them from getting GC-d.
67
+ let _workers;
68
+
69
+ export async function startWorkers(module, memory, builder) {
70
+ if (builder.numThreads() === 0) {
71
+ throw new Error(`num_threads must be > 0.`);
72
+ }
73
+
74
+ const workerInit = {
75
+ type: 'wasm_bindgen_worker_init',
76
+ init: { module_or_path: module, memory },
77
+ receiver: builder.receiver()
78
+ };
79
+
80
+ _workers = await Promise.all(
81
+ Array.from({ length: builder.numThreads() }, async () => {
82
+ // Self-spawn into a new Worker.
83
+ //
84
+ // TODO: while `new URL('...', import.meta.url) becomes a semi-standard
85
+ // way to get asset URLs relative to the module across various bundlers
86
+ // and browser, ideally we should switch to `import.meta.resolve`
87
+ // once it becomes a standard.
88
+ //
89
+ // Note: we could use `../../..` as the URL here to inline workerHelpers.js
90
+ // into the parent entry instead of creating another split point -
91
+ // this would be preferable from optimization perspective -
92
+ // however, Webpack then eliminates all message handler code
93
+ // because wasm-pack produces "sideEffects":false in package.json
94
+ // unconditionally.
95
+ //
96
+ // The only way to work around that is to have side effect code
97
+ // in an entry point such as Worker file itself.
98
+ const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
99
+ type: 'module'
100
+ });
101
+ worker.postMessage(workerInit);
102
+ await waitForMsgType(worker, 'wasm_bindgen_worker_ready');
103
+ return worker;
104
+ })
105
+ );
106
+ builder.build();
107
+ }
package/serial/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tigin-backwards
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,346 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Drop the cached cluster. Snapshot edits persist.
6
+ */
7
+ export function clear_cluster_cache(): void;
8
+
9
+ /**
10
+ * Evaluate a noise tree over a `width × height` 2D grid and return
11
+ * one `f32` per cell, row-major (`y * width + x`). Values are
12
+ * unnormalised; the consumer applies any colour ramp.
13
+ *
14
+ * `tree_kind`:
15
+ * - `"named"`: look up `tree_value` in the live `SettingsCache.noise`
16
+ * map (the same map the editor mutates).
17
+ * - `"inline"`: parse `tree_value` as a YAML document in isolation.
18
+ *
19
+ * Output is bit-identical to the engine's own evaluation at the
20
+ * given seed. Sample coords map `width × height` linearly onto the
21
+ * tree's `settings.lowerBound..upperBound` rectangle (cell-centred),
22
+ * at `z = 0` (worldgen samples the XZ plane at y = 0).
23
+ */
24
+ export function evaluate_noise(tree_kind: string, tree_value: string, width: number, height: number, seed: number): Float32Array;
25
+
26
+ /**
27
+ * The ONI game build this WASM was parity-baselined against (e.g.
28
+ * `"737195"`).
29
+ */
30
+ export function game_version(): string;
31
+
32
+ /**
33
+ * Generate a cluster by cluster id + seed. Returns a `ClusterResult`
34
+ * JSON envelope. For the coordinate-string form (story traits +
35
+ * mixing) use `generate_from_coordinate`.
36
+ */
37
+ export function generate_cluster(seed: number, cluster_id: string): string;
38
+
39
+ /**
40
+ * Generate all worlds in a cluster and return per-cell polygon data for each.
41
+ *
42
+ * Returns JSON: `{ "cluster_id", "seed", "worlds": [{ "name", "width", "height", "is_starting", "cells": [...] }] }`
43
+ */
44
+ export function generate_cluster_cells(seed: number, cluster_id: string): string;
45
+
46
+ /**
47
+ * Generate a cluster with provided cluster YAML config override.
48
+ */
49
+ export function generate_cluster_with_configs(seed: number, cluster_id: string, cluster_yaml: string, _world_yamls: string): string;
50
+
51
+ /**
52
+ * Generate a cluster from a game coordinate string (e.g.
53
+ * `"SNDST-A-42-0-4A-MUWF1"`). Returns a `ClusterResult` JSON
54
+ * envelope; for the typed-array `MapData` shape use
55
+ * `generate_map_data`.
56
+ */
57
+ export function generate_from_coordinate(coordinate: string): string;
58
+
59
+ /**
60
+ * Generate the layout for a cluster's starting world and return
61
+ * per-cell data as JSON: `{ cells: [{ site_id, x, y, type }, ...] }`.
62
+ * Used for cell-level comparison against C# reference snapshots.
63
+ */
64
+ export function generate_layout_cells(seed: number, cluster_id: string): string;
65
+
66
+ /**
67
+ * Generate a cluster from a game coordinate and return a `MapData`
68
+ * value: per-world element grids, biome cell polygons, entity spawns,
69
+ * and starmap locations. Caches the cluster for the two-phase API
70
+ * (`settle_cluster_advance`, `get_entity_spawners`).
71
+ *
72
+ * Per-cell grids ship as typed arrays (`Uint16Array`, `Float32Array`,
73
+ * etc.) on `JsValue` so JS consumers don't pay a JSON parse.
74
+ */
75
+ export function generate_map_data(coordinate: string): any;
76
+
77
+ /**
78
+ * Re-run ambient mob spawning against the cached cluster's current
79
+ * cell state and return the refreshed entity lists. Call after
80
+ * `settle_cluster_advance` chunks when settled liquid/gas flow may
81
+ * have invalidated earlier mob placements. Requires a prior
82
+ * `generate_map_data`. Template-placed entities (geysers, oil wells,
83
+ * props) persist across calls.
84
+ */
85
+ export function get_entity_spawners(): string;
86
+
87
+ /**
88
+ * Returns a JSON-encoded `NoiseNodeKindSpec[]` enumerating every
89
+ * noise node variant the engine recognises (primitives, filters,
90
+ * modifiers, transformers, selectors, combiners) plus its param
91
+ * schema. Static across the lifetime of the build.
92
+ */
93
+ export function noise_node_kinds(): string;
94
+
95
+ /**
96
+ * Toggle template placement. WASM-side counterpart of the native
97
+ * `SKIP_TEMPLATES` env var.
98
+ */
99
+ export function set_skip_templates(skip: boolean): void;
100
+
101
+ /**
102
+ * Drop both the SettingsCache and the cluster cache. The next
103
+ * `generate_*` call reloads the embedded stock defaults.
104
+ */
105
+ export function settings_reset(): void;
106
+
107
+ /**
108
+ * Advance the cached cluster's settle sim to `target_tick` and
109
+ * return a binary snapshot at that tick covering every world. Call
110
+ * repeatedly with increasing ticks to paint intermediate frames;
111
+ * `target_tick = 499` finalises the cluster.
112
+ *
113
+ * `target_tick` must be in `1..=499`. A tick `<=` the current cached
114
+ * tick re-emits the current frame. Returns an empty buffer on
115
+ * out-of-range tick or empty/stale cache; call `generate_map_data`
116
+ * first to populate.
117
+ *
118
+ * Binary format (all little-endian, v5):
119
+ * - `u32` version tag (= 5)
120
+ * - `u32` tick
121
+ * - `u32` world count
122
+ * - per world: `u32` width, `u32` height, then `width * height`
123
+ * cells of 25 bytes each: `u16 elem, f32 mass, f32 temp, u8 dis,
124
+ * i32 dis_count, u16 bw_elem, f32 bw_mass, f32 bw_temp`. Worlds
125
+ * without `backwallNoise` emit Vacuum + 0 mass + 0 temp.
126
+ */
127
+ export function settle_cluster_advance(target_tick: number): Uint8Array;
128
+
129
+ /**
130
+ * Drain the in-memory log buffer for `channel` (e.g. `"ppc_prng"`).
131
+ * WASM-side stand-in for native diag sites that would write to
132
+ * `std::fs::*`.
133
+ */
134
+ export function sim_env_drain_log(channel: string): string;
135
+
136
+ /**
137
+ * Set a `(key, value)` in the cross-target env overlay read by
138
+ * `oni_sim::sim_env::var`. WASM-side stand-in for the `SIM_*_PATH` /
139
+ * `SIM_*_TICK` env vars used by native diag sites.
140
+ */
141
+ export function sim_env_set(key: string, value: string): void;
142
+
143
+ /**
144
+ * Stable hex hash of a snapshot JSON. Alias of
145
+ * `snapshot_checksum_canonical`; same content always hashes to the
146
+ * same value regardless of HashMap/IndexMap iteration order.
147
+ */
148
+ export function snapshot_checksum(snapshot_json: string): string;
149
+
150
+ /**
151
+ * Byte-hash variant: FNV-1a-64 over the raw input bytes. Weak
152
+ * contract; same logical content with different HashMap/IndexMap
153
+ * iteration orders produces different hashes. Only safe when the
154
+ * consumer caches the exact bytes it hashed.
155
+ */
156
+ export function snapshot_checksum_bytes(snapshot_json: string): string;
157
+
158
+ /**
159
+ * Canonical-form variant: parses to a `serde_json::Value` (sorted
160
+ * keys at every level), then FNV-1a-64 with type tags + length
161
+ * prefixes. Same logical content always produces the same hash;
162
+ * what `snapshot_checksum` (the default) and `snapshot_state_checksum`
163
+ * route through.
164
+ */
165
+ export function snapshot_checksum_canonical(snapshot_json: string): string;
166
+
167
+ /**
168
+ * Build a `WorldgenSnapshot` from a `{path: JSON-string}` files map,
169
+ * apply it to SETTINGS, and return the resulting snapshot JSON.
170
+ * Strict mode.
171
+ */
172
+ export function snapshot_from_files(files_json: string): string;
173
+
174
+ /**
175
+ * Extensions-mode counterpart of `snapshot_from_files`.
176
+ */
177
+ export function snapshot_from_files_extensions(files_json: string): string;
178
+
179
+ /**
180
+ * Reset SETTINGS to the embedded U59 vanilla baseline and return the
181
+ * vanilla snapshot as a JSON string. Strict mode.
182
+ */
183
+ export function snapshot_load_vanilla(): string;
184
+
185
+ /**
186
+ * Extensions-mode counterpart of `snapshot_load_vanilla`. Subsequent
187
+ * `merge_files` calls accept mod-defined enum extensions.
188
+ */
189
+ export function snapshot_load_vanilla_extensions(): string;
190
+
191
+ /**
192
+ * Merge a `{path: JSON-string}` files map into an existing snapshot
193
+ * JSON. Last-wins on duplicate paths. Applies the merged snapshot to
194
+ * SETTINGS as a side effect.
195
+ */
196
+ export function snapshot_merge_files(snapshot_json: string, files_json: string): string;
197
+
198
+ /**
199
+ * Drop `paths_json` (a JSON array of path strings) from a snapshot
200
+ * JSON, apply the result to SETTINGS, and return the updated
201
+ * snapshot JSON. Paths not present are silently ignored; mode and
202
+ * element overrides are preserved.
203
+ */
204
+ export function snapshot_remove_paths(snapshot_json: string, paths_json: string): string;
205
+
206
+ /**
207
+ * Stable hex hash of the resident snapshot. Same content produces
208
+ * the same hash regardless of HashMap/IndexMap iteration order or
209
+ * load history. Auto-loads vanilla if empty.
210
+ */
211
+ export function snapshot_state_checksum(): string;
212
+
213
+ /**
214
+ * Drop the listed paths from the resident snapshot. `paths_json` is
215
+ * a JSON array of path strings; paths not present are silently
216
+ * ignored.
217
+ */
218
+ export function snapshot_state_drop_paths(paths_json: string): number;
219
+
220
+ /**
221
+ * Return the resident snapshot as a JSON-encoded
222
+ * `{path: JSON-string}` files map. Auto-loads vanilla if empty.
223
+ */
224
+ export function snapshot_state_files(): string;
225
+
226
+ /**
227
+ * Replace the resident snapshot from a `{path: JSON-string}` files
228
+ * map. Strict; atomic. Throws and leaves the snapshot untouched on
229
+ * invalid input.
230
+ */
231
+ export function snapshot_state_load(files_json: string): number;
232
+
233
+ /**
234
+ * Extensions-mode counterpart of `snapshot_state_load`. Subsequent
235
+ * merges inherit the Extensions mode from the loaded snapshot.
236
+ */
237
+ export function snapshot_state_load_extensions(files_json: string): number;
238
+
239
+ /**
240
+ * Merge a `{path: JSON-string}` files map into the resident snapshot.
241
+ * Last-wins on duplicate paths. Auto-loads vanilla if empty; atomic
242
+ * on parse failure. Mode is inherited from the resident snapshot.
243
+ */
244
+ export function snapshot_state_merge(files_json: string): number;
245
+
246
+ /**
247
+ * Clear the resident snapshot and bump the version. The next
248
+ * `snapshot_state_*` call auto-loads vanilla.
249
+ */
250
+ export function snapshot_state_reset(): void;
251
+
252
+ /**
253
+ * Reset the resident snapshot to the embedded vanilla baseline.
254
+ * Strict mode.
255
+ */
256
+ export function snapshot_state_vanilla(): number;
257
+
258
+ /**
259
+ * Same as `snapshot_state_vanilla`, Extensions mode. Subsequent
260
+ * merges accept mod-defined enum extensions.
261
+ */
262
+ export function snapshot_state_vanilla_extensions(): number;
263
+
264
+ /**
265
+ * Monotonic mutation counter. Bumps on every successful mutation;
266
+ * 0 if the slot has never been touched.
267
+ */
268
+ export function snapshot_state_version(): number;
269
+
270
+ /**
271
+ * Convert a snapshot JSON into a `{path: JSON-string}` files map.
272
+ * Round-trips back through `snapshot_from_files`.
273
+ */
274
+ export function snapshot_to_files(snapshot_json: string): string;
275
+
276
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
277
+
278
+ export interface InitOutput {
279
+ readonly memory: WebAssembly.Memory;
280
+ readonly evaluate_noise: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
281
+ readonly game_version: () => [number, number];
282
+ readonly generate_cluster: (a: number, b: number, c: number) => [number, number];
283
+ readonly generate_cluster_cells: (a: number, b: number, c: number) => [number, number];
284
+ readonly generate_cluster_with_configs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
285
+ readonly generate_from_coordinate: (a: number, b: number) => [number, number];
286
+ readonly generate_layout_cells: (a: number, b: number, c: number) => [number, number];
287
+ readonly generate_map_data: (a: number, b: number) => any;
288
+ readonly get_entity_spawners: () => [number, number];
289
+ readonly noise_node_kinds: () => [number, number];
290
+ readonly set_skip_templates: (a: number) => void;
291
+ readonly settings_reset: () => void;
292
+ readonly settle_cluster_advance: (a: number) => [number, number];
293
+ readonly sim_env_drain_log: (a: number, b: number) => [number, number];
294
+ readonly sim_env_set: (a: number, b: number, c: number, d: number) => void;
295
+ readonly snapshot_checksum: (a: number, b: number) => [number, number, number, number];
296
+ readonly snapshot_checksum_bytes: (a: number, b: number) => [number, number];
297
+ readonly snapshot_from_files: (a: number, b: number) => [number, number, number, number];
298
+ readonly snapshot_from_files_extensions: (a: number, b: number) => [number, number, number, number];
299
+ readonly snapshot_load_vanilla: () => [number, number, number, number];
300
+ readonly snapshot_load_vanilla_extensions: () => [number, number, number, number];
301
+ readonly snapshot_merge_files: (a: number, b: number, c: number, d: number) => [number, number, number, number];
302
+ readonly snapshot_remove_paths: (a: number, b: number, c: number, d: number) => [number, number, number, number];
303
+ readonly snapshot_state_checksum: () => [number, number, number, number];
304
+ readonly snapshot_state_drop_paths: (a: number, b: number) => [number, number, number];
305
+ readonly snapshot_state_files: () => [number, number, number, number];
306
+ readonly snapshot_state_load: (a: number, b: number) => [number, number, number];
307
+ readonly snapshot_state_load_extensions: (a: number, b: number) => [number, number, number];
308
+ readonly snapshot_state_merge: (a: number, b: number) => [number, number, number];
309
+ readonly snapshot_state_reset: () => void;
310
+ readonly snapshot_state_vanilla: () => number;
311
+ readonly snapshot_state_vanilla_extensions: () => number;
312
+ readonly snapshot_to_files: (a: number, b: number) => [number, number, number, number];
313
+ readonly snapshot_checksum_canonical: (a: number, b: number) => [number, number, number, number];
314
+ readonly clear_cluster_cache: () => void;
315
+ readonly snapshot_state_version: () => number;
316
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
317
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
318
+ readonly __wbindgen_exn_store: (a: number) => void;
319
+ readonly __externref_table_alloc: () => number;
320
+ readonly __wbindgen_externrefs: WebAssembly.Table;
321
+ readonly __externref_table_dealloc: (a: number) => void;
322
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
323
+ readonly __wbindgen_start: () => void;
324
+ }
325
+
326
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
327
+
328
+ /**
329
+ * Instantiates the given `module`, which can either be bytes or
330
+ * a precompiled `WebAssembly.Module`.
331
+ *
332
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
333
+ *
334
+ * @returns {InitOutput}
335
+ */
336
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
337
+
338
+ /**
339
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
340
+ * for everything else, calls `WebAssembly.instantiate` directly.
341
+ *
342
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
343
+ *
344
+ * @returns {Promise<InitOutput>}
345
+ */
346
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;