Skip to content

Commit

Permalink
Fixed hidden item piles being openable (fixes #83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Apr 11, 2022
1 parent ca041f4 commit 39584f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Updated German localization (Thank you, gsterling on GitHub)
- Added Starfinder system support (Thank you, dizko on GitHub)
- Updated Tormenta20 system configuration (Thank you, mclemente on GitHub)
- Fixed hidden item piles being able to be opened

## Version 1.4.7
- Fixed issue in latest PF2 update which changed the attribute path for quantities
Expand Down
7 changes: 6 additions & 1 deletion scripts/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export function registerHotkeysPost() {
if (event.button !== 0) return;

const pos = canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(canvas.app.stage);
const tokens = lib.getTokensAtLocation(pos).filter(token => !token._canView(game.user));
const tokens = lib.getTokensAtLocation(pos)
.filter(token => {
const canView = token._canView(game.user);
const canSee = !token.data.hidden || game.user.isGM;
return !canView && canSee;
});
if (!tokens.length) return;
tokens.sort((a, b) => b.zIndex - a.zIndex);
const token = tokens[0].document;
Expand Down

0 comments on commit 39584f0

Please sign in to comment.