Skip to content

Commit 40e0a28

Browse files
Greet the user with a message and create the project directory.
1 parent b8fec37 commit 40e0a28

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

extensions/includes/pull.mjs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ import { addToPromise, isImageBackground } from './util.mjs';
77
// Conflict with the DOM File type.
88
const TiledFile = /** @type {any} */ (File);
99

10+
const PROJECT_FOLDER = tiled.project.folders[0];
11+
const IMAGES_FOLDER = FileInfo.joinPaths(PROJECT_FOLDER, 'images');
12+
1013
/**
1114
* Gets the path to a map file based on its metadata.
1215
* @param {DataMaps} map Map for which to get the path
1316
* @returns {string} Path to the map file
1417
*/
1518
function getMapPath(map) {
16-
return FileInfo.joinPaths(tiled.project.folders[0], `${
19+
return FileInfo.joinPaths(PROJECT_FOLDER, `${
1720
map.en.custom?.fileName ||
1821
map.en.custom?.interwiki?.en.mapName
1922
}.mw-datamaps`);
@@ -26,9 +29,7 @@ function getMapPath(map) {
2629
* @returns {string} Path to the background image
2730
*/
2831
function getBackgroundPath(fileName) {
29-
const imagesDir = FileInfo.joinPaths(tiled.project.folders[0], 'images');
30-
TiledFile.makePath(imagesDir);
31-
return FileInfo.joinPaths(imagesDir, fileName);
32+
return FileInfo.joinPaths(IMAGES_FOLDER, fileName);
3233
}
3334

3435
/**
@@ -319,6 +320,20 @@ tiled.assetOpened.connect(asset => {
319320
});
320321
});
321322

323+
if (!TiledFile.exists(PROJECT_FOLDER)) {
324+
tiled.alert(`Looks like you are just setting up this Tiled project. Welcome! This is a message from the Tiled-DataMaps extension that allows for easy publishing of interactive maps to MediaWiki wikis from Tiled (https://github.com/utdrwiki/maps).
325+
326+
Maps from the wiki will download in a few seconds - please use Project > Refresh Folders or restart Tiled to see them in the map sidebar.
327+
328+
If you have any questions, please read the instructions at https://undertale.wiki/d/t/interactive-maps-project/318 first! You can leave any questions over there, or at the Undertale/Deltarune Wiki Discord server (https://undertale.wiki/UT:D, channel #wiki-discussion, thread "Interactive Maps Project").
329+
330+
This extension is primarily meant for Undertale, Deltarune and Undertale Yellow wikis. You can ask for support over Discord or Discussions even if you're editing some other wiki, but when implementing features or fixes our own wikis take priority.
331+
`);
332+
}
333+
334+
TiledFile.makePath(PROJECT_FOLDER);
335+
TiledFile.makePath(IMAGES_FOLDER);
336+
322337
Promise.all(getLanguageCodes().map(language => addToPromise(getAllMaps(language), language)))
323338
.then(mapsByLanguage => {
324339
const diffMaps = getDiffMaps(collectMaps(mapsByLanguage))

0 commit comments

Comments
 (0)