Fixed so character dice rolls await the DiceSoNice animation before consuming resources (#1024)

This commit is contained in:
WBHarry 2025-08-20 02:56:00 +02:00 committed by GitHub
parent 85111648aa
commit 774b6dbdcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,7 +84,7 @@ export default class DHRoll extends Roll {
static async toMessage(roll, config) { static async toMessage(roll, config) {
const cls = getDocumentClass('ChatMessage'), const cls = getDocumentClass('ChatMessage'),
msg = { msgData = {
type: this.messageType, type: this.messageType,
user: game.user.id, user: game.user.id,
title: roll.title, title: roll.title,
@ -94,8 +94,16 @@ export default class DHRoll extends Roll {
rolls: [roll] rolls: [roll]
}; };
config.selectedRollMode ??= game.settings.get('core', 'rollMode'); config.selectedRollMode ??= game.settings.get('core', 'rollMode');
if (roll._evaluated) return await cls.create(msg, { rollMode: config.selectedRollMode });
return msg; if (roll._evaluated) {
const message = await cls.create(msgData, { rollMode: config.selectedRollMode });
if (game.modules.get('dice-so-nice')?.active) {
await game.dice3d.waitFor3DAnimationByMessageID(message.id);
}
return message;
} else return msgData;
} }
/** @inheritDoc */ /** @inheritDoc */