@onimaxxing/worldgen 0.21.3 → 0.23.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 CHANGED
@@ -143,15 +143,12 @@ touch the cluster cache.
143
143
 
144
144
  `opts.worlds` selects by placement index or world path (full path or
145
145
  last segment, matched after mixing). Selectors that match nothing come
146
- back in `absent` rather than erroring. `opts.omit` drops payload
147
- blocks (`'cells'`, `'biomes'`, `'spawners'`). Cell grids are
148
- pre-settle; for settled state use `worldgen.generate` +
149
- `worldgen.advance`.
146
+ back in `absent` rather than erroring. Cell grids are pre-settle; for
147
+ settled state use `worldgen.generate` + `worldgen.advance`.
150
148
 
151
149
  ```ts
152
150
  const r = worldgen.partials('V-SNDST-C-42-0-4A-MUWF1', {
153
151
  worlds: ['VanillaSandstoneDefault'],
154
- omit: ['cells', 'biomes', 'spawners'],
155
152
  });
156
153
  for (const g of r.worlds[0]?.geysers ?? []) console.log(g.type, g.x, g.y);
157
154
  ```
package/index.d.ts CHANGED
@@ -467,18 +467,11 @@ export interface PartialsOptions {
467
467
  worlds: Array<number | string>;
468
468
  /** `"templates"` (default) or `"notemplates"` (skip template placement). */
469
469
  mode?: 'templates' | 'notemplates';
470
- /**
471
- * Payload blocks to drop. Serialization only; generation cost is
472
- * identical. Geysers and traits are always included.
473
- */
474
- omit?: Array<'cells' | 'biomes' | 'spawners'>;
475
470
  }
476
471
 
477
472
  /**
478
- * One generated world from `worldgen.partials`. Grid fields arrive as
479
- * plain JSON arrays (not the typed arrays `generate` uses), hold
480
- * pre-settle state, and are present unless the corresponding `omit`
481
- * block was requested.
473
+ * One generated world from `worldgen.partials`. Grid fields are the
474
+ * same typed arrays `generate` returns and hold pre-settle state.
482
475
  */
483
476
  export interface PartialWorld {
484
477
  /** Placement index in the cluster layout (stable slot identity). */
@@ -504,22 +497,22 @@ export interface PartialWorld {
504
497
  geyser_spawns_count: number;
505
498
  geyser_stats_sha: string;
506
499
  geyser_stats_count: number;
507
- element_idx?: number[];
508
- mass?: number[];
509
- temperature?: number[];
510
- disease_idx?: number[];
511
- disease_count?: number[];
512
- backwall_element_idx?: number[];
513
- backwall_mass?: number[];
514
- backwall_temperature?: number[];
515
- zone_idx?: number[];
516
- zone_table?: string[];
517
- subworld_idx?: number[];
518
- subworld_table?: string[];
519
- biome_cells?: BiomeCell[];
520
- buildings?: EntitySpawn[];
521
- pickupables?: EntitySpawn[];
522
- other_entities?: EntitySpawn[];
500
+ element_idx: Uint16Array;
501
+ mass: Float32Array;
502
+ temperature: Float32Array;
503
+ disease_idx: Uint8Array;
504
+ disease_count: Int32Array;
505
+ backwall_element_idx: Uint16Array;
506
+ backwall_mass: Float32Array;
507
+ backwall_temperature: Float32Array;
508
+ zone_idx: Uint16Array;
509
+ zone_table: string[];
510
+ subworld_idx: Uint16Array;
511
+ subworld_table: string[];
512
+ biome_cells: BiomeCell[];
513
+ buildings: EntitySpawn[];
514
+ pickupables: EntitySpawn[];
515
+ other_entities: EntitySpawn[];
523
516
  }
524
517
 
525
518
  export interface PartialsMixingApplied {
package/index.js CHANGED
@@ -172,9 +172,7 @@ export const worldgen = {
172
172
  // See PartialsOptions/PartialsResult in index.d.ts and the README.
173
173
  // Stateless; does not populate the cache used by advance()/entities().
174
174
  partials(coord, opts) {
175
- return JSON.parse(
176
- _requireInit('partials').partials_from_coordinate(coord, JSON.stringify(opts ?? {}))
177
- );
175
+ return _requireInit('partials').partials_from_coordinate(coord, JSON.stringify(opts ?? {}));
178
176
  },
179
177
  clear() {
180
178
  _requireInit('clear').clear_cluster_cache();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@onimaxxing/worldgen",
3
3
  "type": "module",
4
4
  "description": "WASM entry point for ONI worldgen",
5
- "version": "0.21.3",
5
+ "version": "0.23.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -98,7 +98,8 @@ export function noise_node_kinds(): string;
98
98
  * Partial worldgen: generate only the selected worlds of a cluster.
99
99
  * Cluster-level pre-passes (mixing, trait selection) run over every
100
100
  * placement; per-world phases run only for the selected slots.
101
- * Stateless; does not touch `CLUSTER_CACHE`.
101
+ * Stateless; does not touch `CLUSTER_CACHE`. Per-cell grids ship as
102
+ * typed arrays on the returned value, as with `generate_map_data`.
102
103
  *
103
104
  * Geyser output matches a full generate exactly, and each world
104
105
  * carries the digest-format geyser hashes. Verified element-wise by
@@ -111,7 +112,7 @@ export function noise_node_kinds(): string;
111
112
  * grids are pre-settle, as with `generate`; there is no partial
112
113
  * settle (use `generate` + `advance` for settled state).
113
114
  */
114
- export function partials_from_coordinate(coordinate: string, options_json: string): string;
115
+ export function partials_from_coordinate(coordinate: string, options_json: string): any;
115
116
 
116
117
  /**
117
118
  * Toggle template placement. WASM-side counterpart of the native
@@ -318,7 +319,7 @@ export interface InitOutput {
318
319
  readonly generate_map_data: (a: number, b: number) => any;
319
320
  readonly get_entity_spawners: () => [number, number];
320
321
  readonly noise_node_kinds: () => [number, number];
321
- readonly partials_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
322
+ readonly partials_from_coordinate: (a: number, b: number, c: number, d: number) => any;
322
323
  readonly set_skip_templates: (a: number) => void;
323
324
  readonly settings_reset: () => void;
324
325
  readonly settle_cluster_advance: (a: number) => [number, number];
@@ -253,7 +253,8 @@ export function noise_node_kinds() {
253
253
  * Partial worldgen: generate only the selected worlds of a cluster.
254
254
  * Cluster-level pre-passes (mixing, trait selection) run over every
255
255
  * placement; per-world phases run only for the selected slots.
256
- * Stateless; does not touch `CLUSTER_CACHE`.
256
+ * Stateless; does not touch `CLUSTER_CACHE`. Per-cell grids ship as
257
+ * typed arrays on the returned value, as with `generate_map_data`.
257
258
  *
258
259
  * Geyser output matches a full generate exactly, and each world
259
260
  * carries the digest-format geyser hashes. Verified element-wise by
@@ -267,23 +268,15 @@ export function noise_node_kinds() {
267
268
  * settle (use `generate` + `advance` for settled state).
268
269
  * @param {string} coordinate
269
270
  * @param {string} options_json
270
- * @returns {string}
271
+ * @returns {any}
271
272
  */
272
273
  export function partials_from_coordinate(coordinate, options_json) {
273
- let deferred3_0;
274
- let deferred3_1;
275
- try {
276
- const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
- const len0 = WASM_VECTOR_LEN;
278
- const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
279
- const len1 = WASM_VECTOR_LEN;
280
- const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
281
- deferred3_0 = ret[0];
282
- deferred3_1 = ret[1];
283
- return getStringFromWasm0(ret[0], ret[1]);
284
- } finally {
285
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
286
- }
274
+ const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
275
+ const len0 = WASM_VECTOR_LEN;
276
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
+ const len1 = WASM_VECTOR_LEN;
278
+ const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
279
+ return ret;
287
280
  }
288
281
 
289
282
  /**
Binary file
@@ -10,7 +10,7 @@ export const generate_layout_cells: (a: number, b: number, c: number) => [number
10
10
  export const generate_map_data: (a: number, b: number) => any;
11
11
  export const get_entity_spawners: () => [number, number];
12
12
  export const noise_node_kinds: () => [number, number];
13
- export const partials_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
13
+ export const partials_from_coordinate: (a: number, b: number, c: number, d: number) => any;
14
14
  export const set_skip_templates: (a: number) => void;
15
15
  export const settings_reset: () => void;
16
16
  export const settle_cluster_advance: (a: number) => [number, number];
@@ -96,7 +96,8 @@ export function noise_node_kinds(): string;
96
96
  * Partial worldgen: generate only the selected worlds of a cluster.
97
97
  * Cluster-level pre-passes (mixing, trait selection) run over every
98
98
  * placement; per-world phases run only for the selected slots.
99
- * Stateless; does not touch `CLUSTER_CACHE`.
99
+ * Stateless; does not touch `CLUSTER_CACHE`. Per-cell grids ship as
100
+ * typed arrays on the returned value, as with `generate_map_data`.
100
101
  *
101
102
  * Geyser output matches a full generate exactly, and each world
102
103
  * carries the digest-format geyser hashes. Verified element-wise by
@@ -109,7 +110,7 @@ export function noise_node_kinds(): string;
109
110
  * grids are pre-settle, as with `generate`; there is no partial
110
111
  * settle (use `generate` + `advance` for settled state).
111
112
  */
112
- export function partials_from_coordinate(coordinate: string, options_json: string): string;
113
+ export function partials_from_coordinate(coordinate: string, options_json: string): any;
113
114
 
114
115
  /**
115
116
  * Toggle template placement. WASM-side counterpart of the native
@@ -306,7 +307,7 @@ export interface InitOutput {
306
307
  readonly generate_map_data: (a: number, b: number) => any;
307
308
  readonly get_entity_spawners: () => [number, number];
308
309
  readonly noise_node_kinds: () => [number, number];
309
- readonly partials_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
310
+ readonly partials_from_coordinate: (a: number, b: number, c: number, d: number) => any;
310
311
  readonly set_skip_templates: (a: number) => void;
311
312
  readonly settings_reset: () => void;
312
313
  readonly settle_cluster_advance: (a: number) => [number, number];
@@ -243,7 +243,8 @@ export function noise_node_kinds() {
243
243
  * Partial worldgen: generate only the selected worlds of a cluster.
244
244
  * Cluster-level pre-passes (mixing, trait selection) run over every
245
245
  * placement; per-world phases run only for the selected slots.
246
- * Stateless; does not touch `CLUSTER_CACHE`.
246
+ * Stateless; does not touch `CLUSTER_CACHE`. Per-cell grids ship as
247
+ * typed arrays on the returned value, as with `generate_map_data`.
247
248
  *
248
249
  * Geyser output matches a full generate exactly, and each world
249
250
  * carries the digest-format geyser hashes. Verified element-wise by
@@ -257,23 +258,15 @@ export function noise_node_kinds() {
257
258
  * settle (use `generate` + `advance` for settled state).
258
259
  * @param {string} coordinate
259
260
  * @param {string} options_json
260
- * @returns {string}
261
+ * @returns {any}
261
262
  */
262
263
  export function partials_from_coordinate(coordinate, options_json) {
263
- let deferred3_0;
264
- let deferred3_1;
265
- try {
266
- const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
267
- const len0 = WASM_VECTOR_LEN;
268
- const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
- const len1 = WASM_VECTOR_LEN;
270
- const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
271
- deferred3_0 = ret[0];
272
- deferred3_1 = ret[1];
273
- return getStringFromWasm0(ret[0], ret[1]);
274
- } finally {
275
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
276
- }
264
+ const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
267
+ const len1 = WASM_VECTOR_LEN;
268
+ const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
269
+ return ret;
277
270
  }
278
271
 
279
272
  /**
Binary file
@@ -11,7 +11,7 @@ export const generate_layout_cells: (a: number, b: number, c: number) => [number
11
11
  export const generate_map_data: (a: number, b: number) => any;
12
12
  export const get_entity_spawners: () => [number, number];
13
13
  export const noise_node_kinds: () => [number, number];
14
- export const partials_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
14
+ export const partials_from_coordinate: (a: number, b: number, c: number, d: number) => any;
15
15
  export const set_skip_templates: (a: number) => void;
16
16
  export const settings_reset: () => void;
17
17
  export const settle_cluster_advance: (a: number) => [number, number];