Fixed so that already destroyed companion tokens that foundry still lists are not considered (#1901)

This commit is contained in:
WBHarry 2026-05-19 10:14:03 +02:00 committed by GitHub
parent 98049bd76b
commit d78c6b1183
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,7 +124,9 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
const animationDuration = 500;
const scene = game.scenes.get(game.user.viewedScene);
/* getDependentTokens returns already removed tokens with id = null. Need to filter that until it's potentially fixed from Foundry */
const activeTokens = actors.flatMap(member => member.getDependentTokens({ scenes: scene }).filter(x => x._id));
const activeTokens = actors.flatMap(member =>
member.getDependentTokens({ scenes: scene }).filter(x => x._id && !x._destroyed)
);
const { x: actorX, y: actorY } = this.document;
if (activeTokens.length > 0) {
for (let token of activeTokens) {