pixelkiln 0.53.2 → 0.53.3

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.js CHANGED
@@ -10261,6 +10261,11 @@ function exportTileset(entry, spec, options) {
10261
10261
  `${options.format} export cannot infer adjacency from outline/stamp-only rules; use --format generic`
10262
10262
  );
10263
10263
  }
10264
+ if (options.format === "godot" && rules?.ruleType === "edge" && godotTileShape(spec.tileType ?? "isometric") !== 0) {
10265
+ throw new Error(
10266
+ "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"
10267
+ );
10268
+ }
10264
10269
  if (options.format === "tiled") {
10265
10270
  return {
10266
10271
  png: packed.png,
@@ -10349,6 +10354,7 @@ function tiledWangId(rules, mask) {
10349
10354
  }
10350
10355
  function buildGodot(generic, spec) {
10351
10356
  const rules = generic.rules;
10357
+ const shape = godotTileShape(spec.tileType ?? "isometric");
10352
10358
  const lines = [
10353
10359
  `[gd_resource type="TileSet" load_steps=3 format=3]`,
10354
10360
  "",
@@ -10363,7 +10369,7 @@ function buildGodot(generic, spec) {
10363
10369
  const y = Math.floor(tile.id / generic.sheet.columns);
10364
10370
  lines.push(`${x}:${y}/0 = 0`);
10365
10371
  if (!rules || tile.bitmask === void 0 || rules.ruleType === "outline") continue;
10366
- const values = godotTerrainBits(rules, tile.bitmask);
10372
+ const values = godotTerrainBits(rules, tile.bitmask, shape);
10367
10373
  lines.push(`${x}:${y}/0/terrain_set = 0`);
10368
10374
  lines.push(`${x}:${y}/0/terrain = ${dominantTerrain(values)}`);
10369
10375
  for (const [side, value] of Object.entries(values)) {
@@ -10372,7 +10378,6 @@ function buildGodot(generic, spec) {
10372
10378
  }
10373
10379
  lines.push("", "[resource]");
10374
10380
  lines.push(`tile_size = Vector2i(${generic.tile.width}, ${generic.tile.height})`);
10375
- const shape = godotTileShape(spec.tileType ?? "isometric");
10376
10381
  if (shape !== 0) lines.push(`tile_shape = ${shape}`);
10377
10382
  if (rules && rules.ruleType !== "outline") {
10378
10383
  lines.push(`terrain_set_0/mode = ${rules.ruleType === "corner" ? 1 : 2}`);
@@ -10386,9 +10391,17 @@ function buildGodot(generic, spec) {
10386
10391
  lines.push(`sources/0 = SubResource("TileSetAtlasSource_pixelkiln")`, "");
10387
10392
  return lines.join("\n");
10388
10393
  }
10389
- function godotTerrainBits(rules, mask) {
10394
+ function godotTerrainBits(rules, mask, shape) {
10390
10395
  const terrain = (bit) => (mask & 1 << bit) !== 0 ? 0 : 1;
10391
10396
  if (rules.ruleType === "corner") {
10397
+ if (shape === 1) {
10398
+ return {
10399
+ top_corner: terrain(3),
10400
+ right_corner: terrain(2),
10401
+ left_corner: terrain(1),
10402
+ bottom_corner: terrain(0)
10403
+ };
10404
+ }
10392
10405
  return {
10393
10406
  top_left_corner: terrain(3),
10394
10407
  top_right_corner: terrain(2),