pixelkiln 0.53.1 → 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 +18 -5
- 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 +33 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15672,6 +15672,11 @@ function exportTileset(entry, spec, options) {
|
|
|
15672
15672
|
`${options.format} export cannot infer adjacency from outline/stamp-only rules; use --format generic`
|
|
15673
15673
|
);
|
|
15674
15674
|
}
|
|
15675
|
+
if (options.format === "godot" && rules?.ruleType === "edge" && godotTileShape(spec.tileType ?? "isometric") !== 0) {
|
|
15676
|
+
throw new Error(
|
|
15677
|
+
"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"
|
|
15678
|
+
);
|
|
15679
|
+
}
|
|
15675
15680
|
if (options.format === "tiled") {
|
|
15676
15681
|
return {
|
|
15677
15682
|
png: packed.png,
|
|
@@ -15760,6 +15765,7 @@ function tiledWangId(rules, mask) {
|
|
|
15760
15765
|
}
|
|
15761
15766
|
function buildGodot(generic, spec) {
|
|
15762
15767
|
const rules = generic.rules;
|
|
15768
|
+
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
15763
15769
|
const lines = [
|
|
15764
15770
|
`[gd_resource type="TileSet" load_steps=3 format=3]`,
|
|
15765
15771
|
"",
|
|
@@ -15774,7 +15780,7 @@ function buildGodot(generic, spec) {
|
|
|
15774
15780
|
const y = Math.floor(tile.id / generic.sheet.columns);
|
|
15775
15781
|
lines.push(`${x}:${y}/0 = 0`);
|
|
15776
15782
|
if (!rules || tile.bitmask === void 0 || rules.ruleType === "outline") continue;
|
|
15777
|
-
const values = godotTerrainBits(rules, tile.bitmask);
|
|
15783
|
+
const values = godotTerrainBits(rules, tile.bitmask, shape);
|
|
15778
15784
|
lines.push(`${x}:${y}/0/terrain_set = 0`);
|
|
15779
15785
|
lines.push(`${x}:${y}/0/terrain = ${dominantTerrain(values)}`);
|
|
15780
15786
|
for (const [side, value] of Object.entries(values)) {
|
|
@@ -15783,7 +15789,6 @@ function buildGodot(generic, spec) {
|
|
|
15783
15789
|
}
|
|
15784
15790
|
lines.push("", "[resource]");
|
|
15785
15791
|
lines.push(`tile_size = Vector2i(${generic.tile.width}, ${generic.tile.height})`);
|
|
15786
|
-
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
15787
15792
|
if (shape !== 0) lines.push(`tile_shape = ${shape}`);
|
|
15788
15793
|
if (rules && rules.ruleType !== "outline") {
|
|
15789
15794
|
lines.push(`terrain_set_0/mode = ${rules.ruleType === "corner" ? 1 : 2}`);
|
|
@@ -15797,9 +15802,17 @@ function buildGodot(generic, spec) {
|
|
|
15797
15802
|
lines.push(`sources/0 = SubResource("TileSetAtlasSource_pixelkiln")`, "");
|
|
15798
15803
|
return lines.join("\n");
|
|
15799
15804
|
}
|
|
15800
|
-
function godotTerrainBits(rules, mask) {
|
|
15805
|
+
function godotTerrainBits(rules, mask, shape) {
|
|
15801
15806
|
const terrain = (bit) => (mask & 1 << bit) !== 0 ? 0 : 1;
|
|
15802
15807
|
if (rules.ruleType === "corner") {
|
|
15808
|
+
if (shape === 1) {
|
|
15809
|
+
return {
|
|
15810
|
+
top_corner: terrain(3),
|
|
15811
|
+
right_corner: terrain(2),
|
|
15812
|
+
left_corner: terrain(1),
|
|
15813
|
+
bottom_corner: terrain(0)
|
|
15814
|
+
};
|
|
15815
|
+
}
|
|
15803
15816
|
return {
|
|
15804
15817
|
top_left_corner: terrain(3),
|
|
15805
15818
|
top_right_corner: terrain(2),
|
|
@@ -16117,13 +16130,13 @@ async function runExport(args) {
|
|
|
16117
16130
|
const format = args.format ?? "generic";
|
|
16118
16131
|
const manifestDir = path38.dirname(path38.resolve(args.manifest));
|
|
16119
16132
|
const selected = specs.filter((spec) => {
|
|
16120
|
-
if (spec.generator !== "tiles") return false;
|
|
16133
|
+
if (spec.generator !== "tiles" && spec.generator !== "terrain") return false;
|
|
16121
16134
|
if (args.styles.length && !args.styles.includes(spec.styleId)) return false;
|
|
16122
16135
|
if (args.assets.length && !args.assets.includes(spec.assetId)) return false;
|
|
16123
16136
|
return Boolean(lock.entries[lockKey(spec.styleId, spec.assetId)]);
|
|
16124
16137
|
});
|
|
16125
16138
|
if (!selected.length) {
|
|
16126
|
-
throw new Error("No downloaded tiles entries match the requested --style/--only filters.");
|
|
16139
|
+
throw new Error("No downloaded tiles/terrain entries match the requested --style/--only filters.");
|
|
16127
16140
|
}
|
|
16128
16141
|
if (args.out && selected.length > 1) {
|
|
16129
16142
|
throw new Error("--out can name one tileset only; add --style/--only to select one asset.");
|