Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
add setting for disable the token configuratiob check
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Feb 15, 2023
1 parent 02fc493 commit 7acfe97
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"name": "Enable 'can move constrained'",
"hint": "Enable the new 'Can Move Constrained' feature from Token Attacher"
},
"disableTokenConfigurationCheck": {
"name": "Disable token configuration check",
"hint": "I don't quite understand why, but some people have problems getting the flags on the token configuration to work .... after hundreds of tests from my high successfully I give up to understand why , enabling this module settings ignores the setting control on the token configuration and uses those at the module level (as it was for the pre 3.4.X version)."
},
"enableDragAndDropMountUp": {
"name": "Enable drag and drop token for mountup",
"hint": "If Enabled when dragging and dropped a token it will try to mount the below token if present and if you have owner permissions on that token"
Expand Down
8 changes: 6 additions & 2 deletions src/scripts/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ const API = {
}

if (!(String(mountToken.actor?.getFlag(CONSTANTS.MODULE_NAME, MountUpFlags.IsAMount)) === "true")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return;
if(game.settings.get(CONSTANTS.MODULE_NAME,"disableTokenConfigurationCheck")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }));
} else {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return;
}
}

const mountName = mountToken.name;
Expand Down
16 changes: 12 additions & 4 deletions src/scripts/mountManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ export class MountManager {
return;
}
if (!(String(mountToken.actor?.getFlag(CONSTANTS.MODULE_NAME, MountUpFlags.IsAMount)) === "true")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return;
if(game.settings.get(CONSTANTS.MODULE_NAME,"disableTokenConfigurationCheck")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }));
} else {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return;
}
}
const tokensToCheck = canvas.tokens?.controlled || [];
for (const riderToken of tokensToCheck) {
Expand Down Expand Up @@ -127,8 +131,12 @@ export class MountManager {
return false;
}
if (!(String(mountToken.actor?.getFlag(CONSTANTS.MODULE_NAME, MountUpFlags.IsAMount)) === "true")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return false;
if(game.settings.get(CONSTANTS.MODULE_NAME,"disableTokenConfigurationCheck")) {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }));
} else {
warn(i18nFormat(`${CONSTANTS.MODULE_NAME}.isNotAMount`, { mount: mountToken.name }), true);
return false;
}
}
let riders = <string[]>mountToken.actor?.getFlag(CONSTANTS.MODULE_NAME, MountUpFlags.Riders);
if (riders === undefined) riders = [];
Expand Down
9 changes: 9 additions & 0 deletions src/scripts/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ export const registerSettings = function () {
default: "{rider} has dismounted from {mount}.",
});

game.settings.register(CONSTANTS.MODULE_NAME, "disableTokenConfigurationCheck", {
name: `${CONSTANTS.MODULE_NAME}.setting.disableTokenConfigurationCheck.name`,
hint: `${CONSTANTS.MODULE_NAME}.setting.disableTokenConfigurationCheck.hint`,
scope: "client",
config: true,
default: false,
type: Boolean,
});

game.settings.register(CONSTANTS.MODULE_NAME, "enableDragAndDropMountUp", {
name: `${CONSTANTS.MODULE_NAME}.setting.enableDragAndDropMountUp.name`,
hint: `${CONSTANTS.MODULE_NAME}.setting.enableDragAndDropMountUp.hint`,
Expand Down

0 comments on commit 7acfe97

Please sign in to comment.