vtt-lair / token-replacer

Foundry VTT - Automatically replace NPC actor tokens and/or portraits dependent on token assets saved in a defined folder structure
MIT License
5 stars 4 forks source link

[Compatibility] Token Replacer and Item Piles don't work together #86

Closed brunocalado closed 2 years ago

brunocalado commented 2 years ago

Hi. Great module!

Item Piles don't work with Token Replacer. They generate an error together. image

I don't know which module should patch it. But, I'm reporting.

Thank you.

Issue on item piles: https://github.com/fantasycalendar/FoundryVTT-ItemPiles/issues/36

Haxxer commented 2 years ago

Hi - creator of Item Piles here. Do you think it would best for me to add the token-replacer disabled flag on my end?

vtt-lair commented 2 years ago

@Haxxer do you mean, set it as disabled on your side and then re-enable it after the pile has been created?

That could work, but we'll have to make sure that the setting is enabled again and that my hook is called after yours. Alternatively, I can also wrap my check to check if the token being created is an item pile token. Would checking the item-piles flag on the document.data be enough (if enabled is true)? Is the item-piles flag only set for item-piles tokens?

Haxxer commented 2 years ago

Yeah, that's what I meant, disable it for the creation, and then re-enable it after it's done. As for Item Piles flags, yep, it's only set for the specific item pile tokens, usually directly configured by the user. If you need to know if a token is an item pile, you'll want to check data.flags.item-piles.data.enabled, which will be true if it's an item pile.

vtt-lair commented 2 years ago

The fix for this has been released.