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/cli.js +16 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/docs/TILES.md +25 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10563,6 +10563,11 @@ function exportTileset(entry, spec, options) {
|
|
|
10563
10563
|
`${options.format} export cannot infer adjacency from outline/stamp-only rules; use --format generic`
|
|
10564
10564
|
);
|
|
10565
10565
|
}
|
|
10566
|
+
if (options.format === "godot" && rules?.ruleType === "edge" && godotTileShape(spec.tileType ?? "isometric") !== 0) {
|
|
10567
|
+
throw new Error(
|
|
10568
|
+
"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"
|
|
10569
|
+
);
|
|
10570
|
+
}
|
|
10566
10571
|
if (options.format === "tiled") {
|
|
10567
10572
|
return {
|
|
10568
10573
|
png: packed.png,
|
|
@@ -10651,6 +10656,7 @@ function tiledWangId(rules, mask) {
|
|
|
10651
10656
|
}
|
|
10652
10657
|
function buildGodot(generic, spec) {
|
|
10653
10658
|
const rules = generic.rules;
|
|
10659
|
+
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
10654
10660
|
const lines = [
|
|
10655
10661
|
`[gd_resource type="TileSet" load_steps=3 format=3]`,
|
|
10656
10662
|
"",
|
|
@@ -10665,7 +10671,7 @@ function buildGodot(generic, spec) {
|
|
|
10665
10671
|
const y = Math.floor(tile.id / generic.sheet.columns);
|
|
10666
10672
|
lines.push(`${x}:${y}/0 = 0`);
|
|
10667
10673
|
if (!rules || tile.bitmask === void 0 || rules.ruleType === "outline") continue;
|
|
10668
|
-
const values = godotTerrainBits(rules, tile.bitmask);
|
|
10674
|
+
const values = godotTerrainBits(rules, tile.bitmask, shape);
|
|
10669
10675
|
lines.push(`${x}:${y}/0/terrain_set = 0`);
|
|
10670
10676
|
lines.push(`${x}:${y}/0/terrain = ${dominantTerrain(values)}`);
|
|
10671
10677
|
for (const [side, value] of Object.entries(values)) {
|
|
@@ -10674,7 +10680,6 @@ function buildGodot(generic, spec) {
|
|
|
10674
10680
|
}
|
|
10675
10681
|
lines.push("", "[resource]");
|
|
10676
10682
|
lines.push(`tile_size = Vector2i(${generic.tile.width}, ${generic.tile.height})`);
|
|
10677
|
-
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
10678
10683
|
if (shape !== 0) lines.push(`tile_shape = ${shape}`);
|
|
10679
10684
|
if (rules && rules.ruleType !== "outline") {
|
|
10680
10685
|
lines.push(`terrain_set_0/mode = ${rules.ruleType === "corner" ? 1 : 2}`);
|
|
@@ -10688,9 +10693,17 @@ function buildGodot(generic, spec) {
|
|
|
10688
10693
|
lines.push(`sources/0 = SubResource("TileSetAtlasSource_pixelkiln")`, "");
|
|
10689
10694
|
return lines.join("\n");
|
|
10690
10695
|
}
|
|
10691
|
-
function godotTerrainBits(rules, mask) {
|
|
10696
|
+
function godotTerrainBits(rules, mask, shape) {
|
|
10692
10697
|
const terrain = (bit) => (mask & 1 << bit) !== 0 ? 0 : 1;
|
|
10693
10698
|
if (rules.ruleType === "corner") {
|
|
10699
|
+
if (shape === 1) {
|
|
10700
|
+
return {
|
|
10701
|
+
top_corner: terrain(3),
|
|
10702
|
+
right_corner: terrain(2),
|
|
10703
|
+
left_corner: terrain(1),
|
|
10704
|
+
bottom_corner: terrain(0)
|
|
10705
|
+
};
|
|
10706
|
+
}
|
|
10694
10707
|
return {
|
|
10695
10708
|
top_left_corner: terrain(3),
|
|
10696
10709
|
top_right_corner: terrain(2),
|