pixelkiln 0.53.2 → 0.53.4

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/index.d.cts CHANGED
@@ -9064,6 +9064,14 @@ interface ResolvedSpec {
9064
9064
  /** `tiles` generator only. See StyleSchema for what each one means. */
9065
9065
  tileSize?: number;
9066
9066
  tileHeight?: number;
9067
+ /**
9068
+ * `tiles` generator: author-set, from the style. `terrain` generator: always
9069
+ * `"square_topdown"`, set internally (not an author-facing field on
9070
+ * `terrain`) so exporters read the real tile shape instead of falling back
9071
+ * to `tiles`' own "isometric" default, which does not apply to terrain's
9072
+ * `/create-tileset` output (a rectangular vertex grid regardless of
9073
+ * `terrainView`'s camera angle).
9074
+ */
9067
9075
  tileType?: string;
9068
9076
  tileView?: string;
9069
9077
  tileViewAngle?: number;
package/dist/index.d.ts CHANGED
@@ -9064,6 +9064,14 @@ interface ResolvedSpec {
9064
9064
  /** `tiles` generator only. See StyleSchema for what each one means. */
9065
9065
  tileSize?: number;
9066
9066
  tileHeight?: number;
9067
+ /**
9068
+ * `tiles` generator: author-set, from the style. `terrain` generator: always
9069
+ * `"square_topdown"`, set internally (not an author-facing field on
9070
+ * `terrain`) so exporters read the real tile shape instead of falling back
9071
+ * to `tiles`' own "isometric" default, which does not apply to terrain's
9072
+ * `/create-tileset` output (a rectangular vertex grid regardless of
9073
+ * `terrainView`'s camera angle).
9074
+ */
9067
9075
  tileType?: string;
9068
9076
  tileView?: string;
9069
9077
  tileViewAngle?: number;
package/dist/index.js CHANGED
@@ -6105,7 +6105,14 @@ async function resolveSpecs(loaded, filter) {
6105
6105
  noBackground: style.noBackground,
6106
6106
  tileSize: generator === "tiles" ? tileSize : void 0,
6107
6107
  tileHeight: generator === "tiles" ? style.tileHeight : void 0,
6108
- tileType: generator === "tiles" ? style.tileType : void 0,
6108
+ // `/create-tileset` places tiles on a rectangular vertex grid (its own
6109
+ // docs: "a map of W×H cells has (W+1)×(H+1) vertices"), the same
6110
+ // square Wang-tiling math as `square_topdown` tiles-pro, regardless of
6111
+ // `terrainView`'s camera-angle setting. `tileType` otherwise defaults
6112
+ // to undefined and falls through to the exporter's own "isometric"
6113
+ // fallback, which is `tiles`' own real API default, not terrain's —
6114
+ // this is set explicitly so that fallback is never reached for terrain.
6115
+ tileType: generator === "tiles" ? style.tileType : generator === "terrain" ? "square_topdown" : void 0,
6109
6116
  tileView: generator === "tiles" ? style.tileView : void 0,
6110
6117
  tileViewAngle: generator === "tiles" ? style.tileViewAngle : void 0,
6111
6118
  tileDepthRatio: generator === "tiles" ? style.tileDepthRatio : void 0,
@@ -10261,6 +10268,11 @@ function exportTileset(entry, spec, options) {
10261
10268
  `${options.format} export cannot infer adjacency from outline/stamp-only rules; use --format generic`
10262
10269
  );
10263
10270
  }
10271
+ if (options.format === "godot" && rules?.ruleType === "edge" && godotTileShape(spec.tileType ?? "isometric") !== 0) {
10272
+ throw new Error(
10273
+ "godot export does not yet map edge/side adjacency onto an isometric or oblique tile's diagonal peering bits safely; use --format generic or --format tiled"
10274
+ );
10275
+ }
10264
10276
  if (options.format === "tiled") {
10265
10277
  return {
10266
10278
  png: packed.png,
@@ -10349,6 +10361,7 @@ function tiledWangId(rules, mask) {
10349
10361
  }
10350
10362
  function buildGodot(generic, spec) {
10351
10363
  const rules = generic.rules;
10364
+ const shape = godotTileShape(spec.tileType ?? "isometric");
10352
10365
  const lines = [
10353
10366
  `[gd_resource type="TileSet" load_steps=3 format=3]`,
10354
10367
  "",
@@ -10363,7 +10376,7 @@ function buildGodot(generic, spec) {
10363
10376
  const y = Math.floor(tile.id / generic.sheet.columns);
10364
10377
  lines.push(`${x}:${y}/0 = 0`);
10365
10378
  if (!rules || tile.bitmask === void 0 || rules.ruleType === "outline") continue;
10366
- const values = godotTerrainBits(rules, tile.bitmask);
10379
+ const values = godotTerrainBits(rules, tile.bitmask, shape);
10367
10380
  lines.push(`${x}:${y}/0/terrain_set = 0`);
10368
10381
  lines.push(`${x}:${y}/0/terrain = ${dominantTerrain(values)}`);
10369
10382
  for (const [side, value] of Object.entries(values)) {
@@ -10372,7 +10385,6 @@ function buildGodot(generic, spec) {
10372
10385
  }
10373
10386
  lines.push("", "[resource]");
10374
10387
  lines.push(`tile_size = Vector2i(${generic.tile.width}, ${generic.tile.height})`);
10375
- const shape = godotTileShape(spec.tileType ?? "isometric");
10376
10388
  if (shape !== 0) lines.push(`tile_shape = ${shape}`);
10377
10389
  if (rules && rules.ruleType !== "outline") {
10378
10390
  lines.push(`terrain_set_0/mode = ${rules.ruleType === "corner" ? 1 : 2}`);
@@ -10386,9 +10398,17 @@ function buildGodot(generic, spec) {
10386
10398
  lines.push(`sources/0 = SubResource("TileSetAtlasSource_pixelkiln")`, "");
10387
10399
  return lines.join("\n");
10388
10400
  }
10389
- function godotTerrainBits(rules, mask) {
10401
+ function godotTerrainBits(rules, mask, shape) {
10390
10402
  const terrain = (bit) => (mask & 1 << bit) !== 0 ? 0 : 1;
10391
10403
  if (rules.ruleType === "corner") {
10404
+ if (shape === 1) {
10405
+ return {
10406
+ top_corner: terrain(3),
10407
+ right_corner: terrain(2),
10408
+ left_corner: terrain(1),
10409
+ bottom_corner: terrain(0)
10410
+ };
10411
+ }
10392
10412
  return {
10393
10413
  top_left_corner: terrain(3),
10394
10414
  top_right_corner: terrain(2),