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

Commit

Permalink
version 0.5.29
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Apr 1, 2022
1 parent d04befc commit bc4ad9b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 ???
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.5.28",
"version": "0.5.29",
"scripts": {
"package": "gulp package",
"build": "gulp build && gulp link",
Expand Down
8 changes: 4 additions & 4 deletions src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.5.28",
"version": "0.5.29",
"author": "Greg Ludington, p4535992, Szefo09, Teshynil",
"type": "module",
"socket": true,
Expand Down Expand Up @@ -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": [
Expand Down
8 changes: 6 additions & 2 deletions src/module/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Token[]>canvas.tokens?.placeables;
if(priorityToControlledIfGM){
return <Token[]>canvas.tokens?.controlled;
}else{
return <Token[]>canvas.tokens?.placeables;
}
}
let ownedTokens = <Token[]>canvas.tokens?.placeables.filter((token) => token.isOwner && (!token.data.hidden || gm));
if (ownedTokens.length === 0 || !canvas.tokens?.controlled[0]) {
Expand Down
16 changes: 9 additions & 7 deletions src/module/libwrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Token[]>canvas.tokens?.controlled;
const ownedTokens = getOwnedTokens(true);
const someoneIsSelected = <number>canvas.tokens?.controlled?.length > 0;
if (ownedTokens && ownedTokens.length > 0) {
for (const token of <Token[]>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;
Expand Down

0 comments on commit bc4ad9b

Please sign in to comment.