Check if all required dependencies are present and show an error if this is not the case

This commit is contained in:
Manuel Vögele
2021-04-14 16:37:46 +02:00
parent ff5d46ebbe
commit b734257515
4 changed files with 33 additions and 1 deletions
+17
View File
@@ -34,3 +34,20 @@ export function measureDistances(segments, token, shape, gridSpaces=true, option
}
}
export function checkDependencies() {
if (!game.modules.get("socketlib")?.active) {
console.error("Drag Ruler | The `socketlib` module isn't enabled, but it's required for Drag Ruler to operate properly.");
if (game.user.isGM) {
new Dialog({
title: game.i18n.localize("drag-ruler.dependencies.socketlib.title"),
content: `<h2>${game.i18n.localize("drag-ruler.dependencies.socketlib.title")}</h2><p>${game.i18n.localize("drag-ruler.dependencies.socketlib.text")}</p>`,
buttons: {
ok: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("drag-ruler.dependencies.ok")
}
},
}).render(true);
}
}
}