parse-tmx 1.30.0 → 1.31.0
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 +8 -9
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -258,13 +258,13 @@ const parseTileset = (node) => {
|
|
|
258
258
|
throw new InvalidOperationError(Operation.Read, parseTileset.name, $.name);
|
|
259
259
|
};
|
|
260
260
|
|
|
261
|
-
// We will
|
|
261
|
+
// We will match phaser's tmx => json tilemap export transformation
|
|
262
262
|
// but also support extra functionality like using external tilesets
|
|
263
263
|
const parseTmx = async (xmlString, translateFlips = false) => {
|
|
264
264
|
const { map: { $, $$ }, } = (await parseXmlString(xmlString));
|
|
265
|
-
const map = new TMXMapParsed(
|
|
265
|
+
const map = new TMXMapParsed($);
|
|
266
266
|
const expectedCount = map.width * map.height * 4;
|
|
267
|
-
|
|
267
|
+
for (const node of $$) {
|
|
268
268
|
const tmxNodeType = node["#name"];
|
|
269
269
|
switch (tmxNodeType) {
|
|
270
270
|
case TMXNodeType.EditorSettings:
|
|
@@ -280,12 +280,11 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
280
280
|
case TMXNodeType.Group:
|
|
281
281
|
case TMXNodeType.ImageLayer:
|
|
282
282
|
case TMXNodeType.Layer:
|
|
283
|
-
case TMXNodeType.Objectgroup:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
map.layers.push(layer);
|
|
287
|
-
}
|
|
283
|
+
case TMXNodeType.Objectgroup: {
|
|
284
|
+
const layer = await parseNode(node, expectedCount, translateFlips);
|
|
285
|
+
map.layers.push(layer);
|
|
288
286
|
break;
|
|
287
|
+
}
|
|
289
288
|
case TMXNodeType.Properties:
|
|
290
289
|
if (!node.$$)
|
|
291
290
|
break;
|
|
@@ -299,7 +298,7 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
299
298
|
default:
|
|
300
299
|
exhaustiveGuard(tmxNodeType);
|
|
301
300
|
}
|
|
302
|
-
}
|
|
301
|
+
}
|
|
303
302
|
return { map };
|
|
304
303
|
};
|
|
305
304
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "A parser for tmx.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"export:gen": "ctix build --config ../configuration/.ctirc-ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@esposter/shared": "1.
|
|
33
|
+
"@esposter/shared": "1.31.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@esposter/configuration": "1.
|
|
37
|
-
"@types/node": "^22.10.
|
|
36
|
+
"@esposter/configuration": "1.31.0",
|
|
37
|
+
"@types/node": "^22.10.1"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "848061661d6b9a37a0d4a403e9030baea491db63"
|
|
40
40
|
}
|