@onimaxxing/worldgen-node 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.cjs CHANGED
@@ -89,7 +89,7 @@ const worldgen = {
89
89
  },
90
90
  // Partial worldgen; see index.js for the full contract notes.
91
91
  partials(coord, opts) {
92
- return JSON.parse(_wasm.partials_from_coordinate(coord, JSON.stringify(opts ?? {})));
92
+ return _wasm.partials_from_coordinate(coord, JSON.stringify(opts ?? {}));
93
93
  },
94
94
  clear() {
95
95
  _wasm.clear_cluster_cache();
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/oni_wasm.d.ts CHANGED
@@ -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
package/oni_wasm.js CHANGED
@@ -254,7 +254,8 @@ exports.noise_node_kinds = noise_node_kinds;
254
254
  * Partial worldgen: generate only the selected worlds of a cluster.
255
255
  * Cluster-level pre-passes (mixing, trait selection) run over every
256
256
  * placement; per-world phases run only for the selected slots.
257
- * Stateless; does not touch `CLUSTER_CACHE`.
257
+ * Stateless; does not touch `CLUSTER_CACHE`. Per-cell grids ship as
258
+ * typed arrays on the returned value, as with `generate_map_data`.
258
259
  *
259
260
  * Geyser output matches a full generate exactly, and each world
260
261
  * carries the digest-format geyser hashes. Verified element-wise by
@@ -268,23 +269,15 @@ exports.noise_node_kinds = noise_node_kinds;
268
269
  * settle (use `generate` + `advance` for settled state).
269
270
  * @param {string} coordinate
270
271
  * @param {string} options_json
271
- * @returns {string}
272
+ * @returns {any}
272
273
  */
273
274
  function partials_from_coordinate(coordinate, options_json) {
274
- let deferred3_0;
275
- let deferred3_1;
276
- try {
277
- const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
- const len0 = WASM_VECTOR_LEN;
279
- const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
- const len1 = WASM_VECTOR_LEN;
281
- const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
282
- deferred3_0 = ret[0];
283
- deferred3_1 = ret[1];
284
- return getStringFromWasm0(ret[0], ret[1]);
285
- } finally {
286
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
287
- }
275
+ const ptr0 = passStringToWasm0(coordinate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
+ const len0 = WASM_VECTOR_LEN;
277
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len1 = WASM_VECTOR_LEN;
279
+ const ret = wasm.partials_from_coordinate(ptr0, len0, ptr1, len1);
280
+ return ret;
288
281
  }
289
282
  exports.partials_from_coordinate = partials_from_coordinate;
290
283
 
package/oni_wasm_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onimaxxing/worldgen-node",
3
3
  "description": "WASM entry point for ONI worldgen",
4
- "version": "0.21.3",
4
+ "version": "0.23.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",