[Fix] SummonAction Actor Choice (#2045)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run

* Fixed logic for picking which actor to summon

* Moved getWorldActor function to utils and updated logic

* .

* Improved logic
This commit is contained in:
WBHarry 2026-06-30 13:05:35 +02:00 committed by GitHub
parent 2cc52fae1f
commit 70388dbd73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 15 deletions

View file

@ -889,4 +889,27 @@ export async function triggerChatRollFx(rolls, options = { whisper: false, blind
export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
const { hopeFear } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
return (!game.user.isGM || options.gmAsPlayer) ? hopeFear.players : hopeFear.gm;
}
export async function getWorldActor(baseActor) {
if (baseActor.inCompendium) {
const worldActorCopy = game.actors.find(x =>
x._stats.compendiumSource === baseActor.uuid &&
(!x.prototypeToken.actorLink || x.name === baseActor.name)
);
if (worldActorCopy)
return worldActorCopy;
const baseActorData = baseActor;
return await game.system.api.documents.DhpActor.create({
...baseActorData,
_stats: {
...baseActorData._stats,
compendiumSource: baseActor.uuid
}
});
}
return baseActor;
}