diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b7310f..b02b7e4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+### 0.5.29
+
+- Solved hidden door ???
+
### 0.5.28
- Solved starnge loop case by forcing a check during the update of the active effect ???
diff --git a/package.json b/package.json
index 382f999..1f7bf5f 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by Freepik, from www.flaticon.com. Moon icon made by iconixar from www.flaticon.com",
- "version": "0.5.28",
+ "version": "0.5.29",
"scripts": {
"package": "gulp package",
"build": "gulp build && gulp link",
diff --git a/src/module.json b/src/module.json
index 64e82ac..c9b3979 100644
--- a/src/module.json
+++ b/src/module.json
@@ -2,7 +2,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by Freepik, from www.flaticon.com. Moon icon made by iconixar from www.flaticon.com",
- "version": "0.5.28",
+ "version": "0.5.29",
"author": "Greg Ludington, p4535992, Szefo09, Teshynil",
"type": "module",
"socket": true,
@@ -61,9 +61,9 @@
"manifestPlusVersion": "1.2.0",
"url": "https://github.com/p4535992/conditional-visibility",
"manifest": "https://github.com/p4535992/conditional-visibility/releases/latest/download/module.json",
- "download": "https://github.com/p4535992/conditional-visibility/releases/download/v0.5.28/module.zip",
- "readme": "https://github.com/p4535992/conditional-visibility/blob/v0.5.28/README.md",
- "changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.5.28/changelog.md",
+ "download": "https://github.com/p4535992/conditional-visibility/releases/download/v0.5.29/module.zip",
+ "readme": "https://github.com/p4535992/conditional-visibility/blob/v0.5.29/README.md",
+ "changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.5.29/changelog.md",
"bugs": "https://github.com/p4535992/conditional-visibility/issues",
"allowBugReporter": true,
"dependencies": [
diff --git a/src/module/lib/lib.ts b/src/module/lib/lib.ts
index 3d690ef..35620d2 100644
--- a/src/module/lib/lib.ts
+++ b/src/module/lib/lib.ts
@@ -29,10 +29,14 @@ export async function getToken(documentUuid) {
return document?.token ?? document;
}
-export function getOwnedTokens(): Token[] {
+export function getOwnedTokens(priorityToControlledIfGM:boolean): Token[] {
const gm = game.user?.isGM;
if (gm) {
- return canvas.tokens?.placeables;
+ if(priorityToControlledIfGM){
+ return canvas.tokens?.controlled;
+ }else{
+ return canvas.tokens?.placeables;
+ }
}
let ownedTokens = canvas.tokens?.placeables.filter((token) => token.isOwner && (!token.data.hidden || gm));
if (ownedTokens.length === 0 || !canvas.tokens?.controlled[0]) {
diff --git a/src/module/libwrapper.ts b/src/module/libwrapper.ts
index 3b9f2db..a854609 100644
--- a/src/module/libwrapper.ts
+++ b/src/module/libwrapper.ts
@@ -163,17 +163,19 @@ export function sightLayerPrototypeTokenVisionHandlerNoLevels(wrapped, ...args)
// return true;
// }
const gm = game.user?.isGM;
- if (gm) {
- return true;
- }
+ // if (gm) {
+ // return wrapped(...args);
+ // }
- const ownedTokens = getOwnedTokens();
- // const ownedTokens = canvas.tokens?.controlled;
+ const ownedTokens = getOwnedTokens(true);
+ const someoneIsSelected = canvas.tokens?.controlled?.length > 0;
if (ownedTokens && ownedTokens.length > 0) {
for (const token of canvas.tokens?.placeables) {
if (ownedTokens.includes(token)) {
- token.visible = true;
- continue;
+ if(gm && !someoneIsSelected){
+ token.visible = true;
+ continue;
+ }
}
// eslint-disable-next-line prefer-const
let tokenVisible = canvas.scene?.data.tokenVision ? false : gm || !token.data.hidden;