Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator into ai-assistant

This commit is contained in:
Azgaar 2024-09-22 13:24:42 +02:00
commit dadb0cad8c
61 changed files with 2831 additions and 2928 deletions

View file

@ -7,12 +7,13 @@
*
* Update the version MANUALLY on each merge to main:
* 1. MAJOR version: Incompatible changes that break existing maps
* 2. MINOR version: Backwards-compatible changes requiring old .map files to be updated
* 3. PATCH version: Backwards-compatible bug fixes not affecting .map file format
* 2. MINOR version: Additions or changes that are backward-compatible but may require old .map files to be updated
* 3. PATCH version: Backward-compatible bug fixes and small features that do not affect the .map file format
*
* Example: 1.102.0 -> Major version 1, Minor version 102, Patch version 0
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
*/
const VERSION = "1.102.00";
const VERSION = "1.105.0";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
{
document.title += " v" + VERSION;
@ -20,7 +21,9 @@ const VERSION = "1.102.00";
if (loadingScreenVersion) loadingScreenVersion.innerText = `v${VERSION}`;
const storedVersion = localStorage.getItem("version");
if (compareVersions(storedVersion, VERSION, {patch: false}).isOlder) setTimeout(showUpdateWindow, 6000);
if (compareVersions(storedVersion, VERSION, {major: true, minor: true, patch: false}).isOlder) {
setTimeout(showUpdateWindow, 6000);
}
function showUpdateWindow() {
const changelog = "https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog";
@ -33,7 +36,7 @@ const VERSION = "1.102.00";
<ul>
<strong>Latest changes:</strong>
<li>Style: ability to set letter spacing</li>
<li>Labels: ability to set letter spacing</li>
<li>Zones update</li>
<li>Notes Editor: on-demand AI text generation</li>
<li>New style preset: Dark Seas</li>
@ -43,41 +46,55 @@ const VERSION = "1.102.00";
<li>Preview villages map</li>
<li>Ability to render ocean heightmap</li>
<li>Scale bar styling features</li>
<li>Vignette visual layer and vignette styling options</li>
</ul>
<p>Join our <a href="${discord}" target="_blank">Discord server</a> and <a href="${reddit}" target="_blank">Reddit community</a> to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.</p>
<span><i>Thanks for all supporters on <a href="${patreon}" target="_blank">Patreon</a>!</i></span>`;
const buttons = {
Ok: function () {
$(this).dialog("close");
localStorage.setItem("version", VERSION);
}
};
if (storedVersion) {
buttons.Cleanup = () => {
clearCache();
localStorage.clear();
localStorage.setItem("version", VERSION);
location.reload();
};
}
$("#alert").dialog({
resizable: false,
title: "Fantasy Map Generator update",
width: "28em",
position: {my: "center center-4em", at: "center", of: "svg"},
buttons
buttons: {
"Cleanup data": () => cleanupData(),
"Don't show again": function () {
$(this).dialog("close");
localStorage.setItem("version", VERSION);
}
}
});
}
}
async function clearCache() {
const cacheNames = await caches.keys();
return Promise.all(cacheNames.map(cacheName => caches.delete(cacheName)));
async function cleanupData() {
await clearCache();
localStorage.clear();
localStorage.setItem("version", VERSION);
localStorage.setItem("disable_click_arrow_tooltip", "true");
location.reload();
}
async function clearCache() {
const cacheNames = await caches.keys();
return Promise.all(cacheNames.map(cacheName => caches.delete(cacheName)));
}
function parseMapVersion(version) {
let [major, minor, patch] = version.split(".");
if (patch === undefined) {
// e.g. 1.732
minor = minor.slice(0, 2);
patch = minor.slice(2);
}
// e.g. 0.7b
major = parseInt(major) || 0;
minor = parseInt(minor) || 0;
patch = parseInt(patch) || 0;
return `${major}.${minor}.${patch}`;
}
function isValidVersion(versionString) {