mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Tweak retrieving world actor (#2052)
This commit is contained in:
parent
489f62a379
commit
d36c141d36
1 changed files with 5 additions and 6 deletions
|
|
@ -893,13 +893,12 @@ export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
|
|||
|
||||
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)
|
||||
const worldActorCandidates = game.actors.filter(x =>
|
||||
x._stats.compendiumSource === baseActor.uuid &&
|
||||
x.prototypeToken.actorLink === baseActor.prototypeToken.actorLink
|
||||
);
|
||||
|
||||
if (worldActorCopy)
|
||||
return worldActorCopy;
|
||||
const worldActorCopy = worldActorCandidates.find(a => a.name === baseActor.name) ?? worldActorCandidates[0];
|
||||
if (worldActorCopy) return worldActorCopy;
|
||||
|
||||
const baseActorData = baseActor;
|
||||
return await game.system.api.documents.DhpActor.create({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue