Shadowrun6eUltimaniaSys/module/documents/actor.mjs

46 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2024-05-20 09:59:52 +00:00
/**
* Extend the base Actor document by defining a custom roll data structure which is ideal for the Simple system.
* @extends {Actor}
*/
export class Shadowrun6Actor extends Actor {
/** @override */
prepareData() {
// Prepare data for the actor. Calling the super version of this executes
// the following, in order: data reset (to clear active effects),
// prepareBaseData(), prepareEmbeddedDocuments() (including active effects),
// prepareDerivedData().
super.prepareData();
}
/** @override */
prepareBaseData() {
// Data modifications in this step occur before processing embedded
// documents or derived data.
}
/**
* @override
* Augment the actor source data with additional dynamic data that isn't
* handled by the actor's DataModel. Data calculated in this step should be
* available both inside and outside of character sheets (such as if an actor
* is queried and has a roll executed directly from it).
*/
prepareDerivedData() {
const actorData = this;
const flags = actorData.flags.shadowrun6eultimate || {};
}
/**
*
* @override
* Augment the actor's default getRollData() method by appending the data object
* generated by the its DataModel's getRollData(), or null. This polymorphic
* approach is useful when you have actors & items that share a parent Document,
* but have slightly different data preparation needs.
*/
getRollData() {
return { ...super.getRollData(), ...this.system.getRollData?.() ?? null };
}
}