[Feature] Add Default Icons for Document Subtypes (#584)

Fixes #458

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-08-04 22:38:56 -03:00 committed by GitHub
parent 481652bf3f
commit 0feec77512
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 206 additions and 13 deletions

View file

@ -22,6 +22,23 @@ export default class DhpActor extends Actor {
return this.system.metadata.isNPC;
}
/* -------------------------------------------- */
/**@inheritdoc */
static getDefaultArtwork(actorData) {
const { type } = actorData;
const Model = CONFIG.Actor.dataModels[type];
const img = Model.DEFAULT_ICON ?? this.DEFAULT_ICON;
return {
img,
texture: {
src: img
}
};
}
/* -------------------------------------------- */
/** @inheritDoc */
getEmbeddedDocument(embeddedName, id, options) {
let doc;
@ -39,6 +56,7 @@ export default class DhpActor extends Actor {
return doc;
}
/**@inheritdoc */
async _preCreate(data, options, user) {
if ((await super._preCreate(data, options, user)) === false) return false;
@ -455,6 +473,7 @@ export default class DhpActor extends Actor {
return ActiveEffect.implementation.create(effect, { parent: this, keepId: true });
}
/**@inheritdoc */
getRollData() {
const rollData = super.getRollData();
rollData.system = this.system.getRollData();
@ -540,8 +559,8 @@ export default class DhpActor extends Actor {
updates.forEach(
u =>
(u.value =
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
(u.value =
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
);
await this.modifyResource(updates);
@ -587,9 +606,9 @@ export default class DhpActor extends Actor {
updates.forEach(
u =>
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
? u.value * -1
: u.value)
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
? u.value * -1
: u.value)
);
await this.modifyResource(updates);