Skip to content

Commit

Permalink
Fix token selector again
Browse files Browse the repository at this point in the history
  • Loading branch information
dmrickey committed Jul 25, 2024
1 parent 28b06e8 commit e5b8da5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class TokenSelectorApp extends DocumentSheet {
game.i18n.localize('TOKEN.DISPOSITION.' + Object.entries(CONST.TOKEN_DISPOSITIONS).find(([ /** @type{string */_, value]) => value === disposition)?.[0] || '');

const currentTargetUuids = [...game.user.targets].map(x => x.document.uuid);
const availableTargets = game.user.viewedScene.tokens
const availableTargets = game.scenes.get(game.user.viewedScene)?.tokens
.filter((token) => token.actor && token.object.isVisible && token.actor.id !== item.actor?.id)
.map((token) => ({
id: token.id,
Expand All @@ -55,7 +55,7 @@ export class TokenSelectorApp extends DocumentSheet {
uuid: token.uuid,
dispositionLabel: getDispositionLabel(token.disposition),
checked: currentTargetUuids.includes(token.uuid),
}));
})) ?? [];

availableTargets.sort((a, b) => {
const first = a.disposition - b.disposition;
Expand Down
2 changes: 1 addition & 1 deletion types/foundry/client/data/documents/user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ declare global {
*/
targets: UserTargets;
isGM: boolean;
viewedScene: Scene;
viewedScene: string;
}
}

0 comments on commit e5b8da5

Please sign in to comment.