Open DrMcCoy opened 1 year ago
And for completeness's sake, DF Chat Enhancement doesn't build with the code that's in repo right now, because of the @league-of-foundry-developers/foundry-vtt-types dependency. It misses members that DF Chat Enhancement uses.
I'm attaching a ZIP with a modified version, for other people who might stumble over this. After running "npm install", you ZIP. foundry-vtt-types.zip
When writing the WorldTime into the chat message data flags structure, DF Chat Enhancement would straight out overwrite the whole flags structure, wiping away all previously written flags. Since DF Chat Enhancement is often very late in the Hooks chain, this would mean most flags are destroyed.
This poses a problem when other modules would want to read from the flags, for example data written by the system. One such example is the Pathfinder 1e integration for https://github.com/otigon/automated-jb2a-animations . It would read the flags added by the system to determine when an attack (or spell cast) has taken place and use the attached source item name to match again a list of animations to play, as well as the attacker and attacke. So it can, for example, see that an attack with a crossbow has taken place and animate a crossbow bolt flying towards the target.
If, however, the system flags are wiped away by DF Chat Enhancements, Automated Animations fails to play any animations for any attacks, because it can't determine anything about the attack (or that, in fact, an attack has taken place). See https://github.com/otigon/automated-jb2a-animations/issues/669 .
This PR fixes the situation by using
foundry.utils.mergeObject()
to merge the DF Chat Enhancements flags into the existing chat message data object instead.This also fixes #387, if I understand it correctly.