@rpgjs/tiledmap 5.0.0-alpha.4 → 5.0.0-alpha.6
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/client/index.js +9 -3
- package/dist/client/index3.js +4649 -12
- package/dist/client/index4.js +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/server/index.js +1 -1
- package/dist/server/index2.js +1 -1
- package/dist/server/index3.js +5232 -0
- package/dist/server.d.ts +1 -1
- package/package.json +9 -7
- package/src/index.ts +26 -17
- package/src/server.ts +1 -4
- package/src/tiled.ce +1 -1
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import client from "./index2.js";
|
|
2
2
|
import { createModule } from "@rpgjs/common";
|
|
3
3
|
import { provideLoadMap } from "@rpgjs/client";
|
|
4
|
-
import { TiledParser } from "
|
|
5
|
-
import component from "./
|
|
4
|
+
import { TiledParser } from "./index3.js";
|
|
5
|
+
import component from "./index4.js";
|
|
6
6
|
const server = null;
|
|
7
7
|
function provideTiledMap(options) {
|
|
8
8
|
var _a;
|
|
@@ -13,7 +13,10 @@ function provideTiledMap(options) {
|
|
|
13
13
|
},
|
|
14
14
|
(_a = provideLoadMap) == null ? void 0 : _a(async (map) => {
|
|
15
15
|
const response = await fetch(`${options.basePath}/${map}.tmx`);
|
|
16
|
-
const mapData = (await response.text()).replace(
|
|
16
|
+
const mapData = (await response.text()).replace(
|
|
17
|
+
/source="([^"]+)"/g,
|
|
18
|
+
`source="${options.basePath}/$1"`
|
|
19
|
+
);
|
|
17
20
|
const parser = new TiledParser(mapData);
|
|
18
21
|
const parsedMap = parser.parseMap();
|
|
19
22
|
const tilesets = [];
|
|
@@ -37,6 +40,9 @@ function provideTiledMap(options) {
|
|
|
37
40
|
parsedMap,
|
|
38
41
|
id: map
|
|
39
42
|
};
|
|
43
|
+
if (options.onLoadMap) {
|
|
44
|
+
await options.onLoadMap(map);
|
|
45
|
+
}
|
|
40
46
|
return obj;
|
|
41
47
|
})
|
|
42
48
|
]);
|