[Feature] Transform Linked Actors (#2046)

* Added ability to transform linked actors
* Updated to use the utils getWorldActor function
* Animate change and fix error when converting to unlinked
---------

Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
WBHarry 2026-07-03 11:14:25 +02:00 committed by GitHub
parent 44dd3bd2e1
commit 98fedf3990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 101 additions and 32 deletions

View file

@ -1,6 +1,10 @@
import { diceTypes, getDiceSoNicePresets, getDiceSoNicePreset, range } from '../config/generalConfig.mjs';
import Tagify from '@yaireo/tagify';
/**
* @import DhpActor from '../documents/actor.mjs';
*/
export const capitalize = string => {
return string.charAt(0).toUpperCase() + string.slice(1);
};
@ -891,6 +895,13 @@ export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
return (!game.user.isGM || options.gmAsPlayer) ? hopeFear.players : hopeFear.gm;
}
/**
* Returns the given actor if its a world actor,
* finds a world actor equivalent,
* or imports the actor and returns the imported actor.
* @param {DhpActor} baseActor
* @returns {Promise<DhpActor>} a world actor
*/
export async function getWorldActor(baseActor) {
if (baseActor.inCompendium) {
const worldActorCandidates = game.actors.filter(x =>