mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19: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) {
|
export async function getWorldActor(baseActor) {
|
||||||
if (baseActor.inCompendium) {
|
if (baseActor.inCompendium) {
|
||||||
const worldActorCopy = game.actors.find(x =>
|
const worldActorCandidates = game.actors.filter(x =>
|
||||||
x._stats.compendiumSource === baseActor.uuid &&
|
x._stats.compendiumSource === baseActor.uuid &&
|
||||||
(!x.prototypeToken.actorLink || x.name === baseActor.name)
|
x.prototypeToken.actorLink === baseActor.prototypeToken.actorLink
|
||||||
);
|
);
|
||||||
|
const worldActorCopy = worldActorCandidates.find(a => a.name === baseActor.name) ?? worldActorCandidates[0];
|
||||||
if (worldActorCopy)
|
if (worldActorCopy) return worldActorCopy;
|
||||||
return worldActorCopy;
|
|
||||||
|
|
||||||
const baseActorData = baseActor;
|
const baseActorData = baseActor;
|
||||||
return await game.system.api.documents.DhpActor.create({
|
return await game.system.api.documents.DhpActor.create({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue