Fixed deletion of characters in the world locking up the party actor

This commit is contained in:
WBHarry 2025-11-13 19:24:15 +01:00
parent 63e66bd0d3
commit 013085299f
5 changed files with 36 additions and 4 deletions

View file

@ -195,6 +195,14 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
const { actor: actorData, trait } = foundry.utils.getProperty(message.system, path);
const actor = game.actors.get(actorData._id);
if (!actor) {
return ui.notifications.error(
game.i18n.format('DAGGERHEART.UI.Notifications.documentIsMissing', {
documentType: game.i18n.localize('TYPES.Actor.character')
})
);
}
if (!actor.testUserPermission(game.user, 'OWNER')) {
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.noActorOwnership'));
}
@ -225,6 +233,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
})
});
if (!result) return;
const newMessageData = foundry.utils.deepClone(message.system);
foundry.utils.setProperty(newMessageData, `${path}.result`, result.roll);
const renderData = { system: new game.system.api.models.chatMessages.config.groupRoll(newMessageData) };