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/cli.js +24 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/docs/TILES.md +38 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8267,7 +8267,14 @@ async function resolveSpecs(loaded, filter) {
|
|
|
8267
8267
|
noBackground: style.noBackground,
|
|
8268
8268
|
tileSize: generator === "tiles" ? tileSize : void 0,
|
|
8269
8269
|
tileHeight: generator === "tiles" ? style.tileHeight : void 0,
|
|
8270
|
-
|
|
8270
|
+
// `/create-tileset` places tiles on a rectangular vertex grid (its own
|
|
8271
|
+
// docs: "a map of W×H cells has (W+1)×(H+1) vertices"), the same
|
|
8272
|
+
// square Wang-tiling math as `square_topdown` tiles-pro, regardless of
|
|
8273
|
+
// `terrainView`'s camera-angle setting. `tileType` otherwise defaults
|
|
8274
|
+
// to undefined and falls through to the exporter's own "isometric"
|
|
8275
|
+
// fallback, which is `tiles`' own real API default, not terrain's —
|
|
8276
|
+
// this is set explicitly so that fallback is never reached for terrain.
|
|
8277
|
+
tileType: generator === "tiles" ? style.tileType : generator === "terrain" ? "square_topdown" : void 0,
|
|
8271
8278
|
tileView: generator === "tiles" ? style.tileView : void 0,
|
|
8272
8279
|
tileViewAngle: generator === "tiles" ? style.tileViewAngle : void 0,
|
|
8273
8280
|
tileDepthRatio: generator === "tiles" ? style.tileDepthRatio : void 0,
|
|
@@ -15672,6 +15679,11 @@ function exportTileset(entry, spec, options) {
|
|
|
15672
15679
|
`${options.format} export cannot infer adjacency from outline/stamp-only rules; use --format generic`
|
|
15673
15680
|
);
|
|
15674
15681
|
}
|
|
15682
|
+
if (options.format === "godot" && rules?.ruleType === "edge" && godotTileShape(spec.tileType ?? "isometric") !== 0) {
|
|
15683
|
+
throw new Error(
|
|
15684
|
+
"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"
|
|
15685
|
+
);
|
|
15686
|
+
}
|
|
15675
15687
|
if (options.format === "tiled") {
|
|
15676
15688
|
return {
|
|
15677
15689
|
png: packed.png,
|
|
@@ -15760,6 +15772,7 @@ function tiledWangId(rules, mask) {
|
|
|
15760
15772
|
}
|
|
15761
15773
|
function buildGodot(generic, spec) {
|
|
15762
15774
|
const rules = generic.rules;
|
|
15775
|
+
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
15763
15776
|
const lines = [
|
|
15764
15777
|
`[gd_resource type="TileSet" load_steps=3 format=3]`,
|
|
15765
15778
|
"",
|
|
@@ -15774,7 +15787,7 @@ function buildGodot(generic, spec) {
|
|
|
15774
15787
|
const y = Math.floor(tile.id / generic.sheet.columns);
|
|
15775
15788
|
lines.push(`${x}:${y}/0 = 0`);
|
|
15776
15789
|
if (!rules || tile.bitmask === void 0 || rules.ruleType === "outline") continue;
|
|
15777
|
-
const values = godotTerrainBits(rules, tile.bitmask);
|
|
15790
|
+
const values = godotTerrainBits(rules, tile.bitmask, shape);
|
|
15778
15791
|
lines.push(`${x}:${y}/0/terrain_set = 0`);
|
|
15779
15792
|
lines.push(`${x}:${y}/0/terrain = ${dominantTerrain(values)}`);
|
|
15780
15793
|
for (const [side, value] of Object.entries(values)) {
|
|
@@ -15783,7 +15796,6 @@ function buildGodot(generic, spec) {
|
|
|
15783
15796
|
}
|
|
15784
15797
|
lines.push("", "[resource]");
|
|
15785
15798
|
lines.push(`tile_size = Vector2i(${generic.tile.width}, ${generic.tile.height})`);
|
|
15786
|
-
const shape = godotTileShape(spec.tileType ?? "isometric");
|
|
15787
15799
|
if (shape !== 0) lines.push(`tile_shape = ${shape}`);
|
|
15788
15800
|
if (rules && rules.ruleType !== "outline") {
|
|
15789
15801
|
lines.push(`terrain_set_0/mode = ${rules.ruleType === "corner" ? 1 : 2}`);
|
|
@@ -15797,9 +15809,17 @@ function buildGodot(generic, spec) {
|
|
|
15797
15809
|
lines.push(`sources/0 = SubResource("TileSetAtlasSource_pixelkiln")`, "");
|
|
15798
15810
|
return lines.join("\n");
|
|
15799
15811
|
}
|
|
15800
|
-
function godotTerrainBits(rules, mask) {
|
|
15812
|
+
function godotTerrainBits(rules, mask, shape) {
|
|
15801
15813
|
const terrain = (bit) => (mask & 1 << bit) !== 0 ? 0 : 1;
|
|
15802
15814
|
if (rules.ruleType === "corner") {
|
|
15815
|
+
if (shape === 1) {
|
|
15816
|
+
return {
|
|
15817
|
+
top_corner: terrain(3),
|
|
15818
|
+
right_corner: terrain(2),
|
|
15819
|
+
left_corner: terrain(1),
|
|
15820
|
+
bottom_corner: terrain(0)
|
|
15821
|
+
};
|
|
15822
|
+
}
|
|
15803
15823
|
return {
|
|
15804
15824
|
top_left_corner: terrain(3),
|
|
15805
15825
|
top_right_corner: terrain(2),
|