Skip to content

Commit

Permalink
version 2.2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Sep 29, 2022
1 parent 9452f22 commit f3b8031
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 36 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CHANGELOG
### 2.2.10
### 2.2.10-11

- Bug fix : [[BUG] PF2e LootSheet Characters still able to be interacted with from distance ](https://github.com/p4535992/foundryvtt-arms-reach/issues/65)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "foundryvtt-arms-reach",
"title": "FoundryVTT Arms Reach",
"description": "Allows the GM to limit the distance that a player can interacted with a placeable object like door, journal, stairway, token, ecc..",
"version": "2.2.10",
"version": "2.2.11",
"main": "foundryvtt-arms-reach.js",
"scripts": {
"publish": "gulp publish --update",
Expand Down
24 changes: 24 additions & 0 deletions src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,30 @@
"foundryvtt-arms-reach.settingNameTaggerIntegrationFeature": "Enable/Disable Tagger Module integration",
"foundryvtt-arms-reach.settingHintTaggerIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerStairwayIntegrationFeature": "Enable/Disable Tagger Stairway Module integration",
"foundryvtt-arms-reach.settingHintTaggerStairwayIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerTokenIntegrationFeature": "Enable/Disable Tagger Token Module integration",
"foundryvtt-arms-reach.settingHintTaggerTokenIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerNoteIntegrationFeature": "Enable/Disable Tagger Note Module integration",
"foundryvtt-arms-reach.settingHintTaggerNoteIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerLightIntegrationFeature": "Enable/Disable Tagger Light Module integration",
"foundryvtt-arms-reach.settingHintTaggerLightIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerSoundIntegrationFeature": "Enable/Disable Tagger Sound Module integration",
"foundryvtt-arms-reach.settingHintTaggerSoundIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerDrawingIntegrationFeature": "Enable/Disable Tagger Drawing Module integration",
"foundryvtt-arms-reach.settingHintTaggerDrawingIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerTileIntegrationFeature": "Enable/Disable Tagger Tile Module integration",
"foundryvtt-arms-reach.settingHintTaggerTileIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameTaggerWallIntegrationFeature": "Enable/Disable Tagger Wall Module integration",
"foundryvtt-arms-reach.settingHintTaggerWallIntegrationFeature": "All the distance calculation are limited now to placeable object with the 'armsreach' tag on it. Remember you need to activate the tagger module for this",

"foundryvtt-arms-reach.settingNameResetDoorsAndFogFeature": "Reset Doors And Fog Feature",
"foundryvtt-arms-reach.settingHintResetDoorsAndFogFeature": "Add a voice on context menu for close all the doors and reset the fog on a scene",

Expand Down
6 changes: 3 additions & 3 deletions src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "foundryvtt-arms-reach",
"title": "FoundryVTT Arms Reach",
"description": "Allows the GM to limit the distance that a player can interacted with a placeable object like door, journal, stairway, token, ecc..",
"version": "2.2.10",
"version": "2.2.11",
"authors": [
{
"name": "Psyny"
Expand Down Expand Up @@ -83,8 +83,8 @@
"url": "https://github.com/p4535992/foundryvtt-arms-reach",
"manifest": "https://github.com/p4535992/foundryvtt-arms-reach/releases/latest/download/module.json",
"download": "https://github.com/p4535992/foundryvtt-arms-reach/releases/latest/download/module.zip",
"readme": "https://github.com/p4535992/foundryvtt-arms-reach/blob/v2.2.10/README.md",
"changelog": "https://github.com/p4535992/foundryvtt-arms-reach/blob/v2.2.10/changelog.md",
"readme": "https://github.com/p4535992/foundryvtt-arms-reach/blob/v2.2.11/README.md",
"changelog": "https://github.com/p4535992/foundryvtt-arms-reach/blob/v2.2.11/changelog.md",
"bugs": "https://github.com/p4535992/foundryvtt-arms-reach/issues",
"allowBugReporter": true,
"relationships": {
Expand Down
106 changes: 105 additions & 1 deletion src/scripts/ArmsReachHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,101 @@ export const reselectTokenAfterInteraction = function (character: Token): void {
}
};

export const checkTaggerForAmrsreach = function (placeable: PlaceableObject) {
export const checkTaggerForAmrsreachForStairway = function (placeable: PlaceableObject) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerStairwayIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForToken = function (placeable: Token) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerTokenIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForNote = function (placeable: Note) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerNoteIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForLight = function (placeable: AmbientLight) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerLightIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForSound = function (placeable: AmbientSound) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerSoundIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForDrawing = function (placeable: Drawing) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerDrawingIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForTile = function (placeable: Tile) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerTileIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
return true;
} else {
return false;
}
};

export const checkTaggerForAmrsreachForWall = function (placeable: Wall) {
if (!(<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerWallIntegration"))) {
return true;
}
//@ts-ignore
const tags = <string[]>Tagger?.getTags(placeable) || [];
if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
Expand All @@ -389,6 +483,16 @@ export const checkTaggerForAmrsreach = function (placeable: PlaceableObject) {
}
};

// export const checkTaggerForAmrsreach = function (placeable: PlaceableObject) {
// //@ts-ignore
// const tags = <string[]>Tagger?.getTags(placeable) || [];
// if (tags.includes(CONSTANTS.TAGGER_FLAG)) {
// return true;
// } else {
// return false;
// }
// };

export const getMousePosition = function (canvas: Canvas, event): { x: number; y: number } {
// const transform = <PIXI.Matrix>canvas?.tokens?.worldTransform;
// return {
Expand Down
33 changes: 19 additions & 14 deletions src/scripts/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { warn, error, debug, i18n, i18nFormat, getCharacterName } from "./lib/li
import { StairwaysReach } from "./StairwaysReach";
import { ResetDoorsAndFog } from "./resetdoorsandfog";
import {
checkTaggerForAmrsreach,
checkTaggerForAmrsreachForDrawing,
checkTaggerForAmrsreachForLight,
checkTaggerForAmrsreachForNote,
checkTaggerForAmrsreachForSound,
checkTaggerForAmrsreachForTile,
checkTaggerForAmrsreachForToken,
checkTaggerForAmrsreachForWall,
getFirstPlayerToken,
getFirstPlayerTokenNo,
getFirstPlayerTokenSelected,
Expand Down Expand Up @@ -36,9 +42,8 @@ export const initHooks = () => {
warn("Init Hooks processing");
Hooks.once("socketlib.ready", registerSocket);

taggerModuleActive =
<boolean>game.modules.get(CONSTANTS.TAGGER_MODULE_NAME)?.active &&
<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerIntegration");
taggerModuleActive = <boolean>game.modules.get(CONSTANTS.TAGGER_MODULE_NAME)?.active;
// <boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableTaggerIntegration");

if (<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableArmsReach")) {
if (<boolean>game.settings.get(CONSTANTS.MODULE_NAME, "enableDoorsIntegration")) {
Expand Down Expand Up @@ -272,7 +277,7 @@ export const readyHooks = async () => {
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(drawing)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForDrawing(drawing)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -308,7 +313,7 @@ export const readyHooks = async () => {
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(tile)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForTile(tile)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -344,7 +349,7 @@ export const readyHooks = async () => {
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(wall)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForWall(wall)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -528,7 +533,7 @@ export const TokenPrototypeOnClickLeft2Handler = async function (wrapped, ...arg
if (
isTokenNameChecked ||
(isNPCLootSheet && enableNPCLootSheet) ||
(taggerModuleActive && checkTaggerForAmrsreach(token))
(taggerModuleActive && checkTaggerForAmrsreachForToken(token))
) {
const nameSourceToken = <string>game.settings.get(CONSTANTS.MODULE_NAME, "tokensIntegrationExplicitName");
let tokenSelected;
Expand Down Expand Up @@ -563,7 +568,7 @@ export const TokenPrototypeOnClickLeft2Handler = async function (wrapped, ...arg
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(token)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForToken(token)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -630,7 +635,7 @@ export const NotePrototypeOnClickLeft2Handler = async function (wrapped, ...args
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(note)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForNote(note)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -671,7 +676,7 @@ export const DoorControlPrototypeOnMouseDownHandler = async function (wrapped, .
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(doorControl.wall)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForWall(doorControl.wall)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -734,7 +739,7 @@ export const DoorControlPrototypeOnRightDownHandler = async function (wrapped, .
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(doorControl.wall)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForWall(doorControl.wall)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -771,7 +776,7 @@ export const AmbientLightPrototypeOnClickRightHandler = async function (wrapped,
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(light)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForLight(light)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down Expand Up @@ -808,7 +813,7 @@ export const AmbientSoundPrototypeOnClickRightHandler = async function (wrapped,
) {
doNotReselectIfGM = true;
}
if (taggerModuleActive && !checkTaggerForAmrsreach(sound)) {
if (taggerModuleActive && !checkTaggerForAmrsreachForSound(sound)) {
if (!doNotReselectIfGM) {
reselectTokenAfterInteraction(tokenSelected);
}
Expand Down
Loading

0 comments on commit f3b8031

Please sign in to comment.