Snapshot pre-AE data on actors (closes #178)
This commit is contained in:
parent
d479ef7559
commit
ec6378092f
3 changed files with 28 additions and 13 deletions
|
|
@ -1,4 +1,15 @@
|
|||
export class DotDungeonActor extends Actor {
|
||||
|
||||
/*
|
||||
Using this to take a "snapshot" of the system data prior to applying AE's so
|
||||
that the inputs can still have the non-modified value in them, while we still
|
||||
provide all that data to AE's without needing to disable any inputs.
|
||||
*/
|
||||
prepareEmbeddedDocuments() {
|
||||
this.preAE = foundry.utils.deepClone(this.system);
|
||||
super.prepareEmbeddedDocuments();
|
||||
};
|
||||
|
||||
async createEmbeddedItem(defaults, opts = {}) {
|
||||
let items = await this.createEmbeddedDocuments(`Item`, defaults);
|
||||
if (!Array.isArray(items)) items = items ? [items] : [];
|
||||
|
|
|
|||
|
|
@ -5,11 +5,16 @@ export class Player extends DotDungeonActor {
|
|||
applyActiveEffects() {
|
||||
super.applyActiveEffects();
|
||||
|
||||
// These are the (groups of) fields that ActiveEffects may modify safely
|
||||
// and remain editable in the sheet. This needs to be done because of default
|
||||
// Foundry behaviour that otherwise prevents these fields from being edited
|
||||
delete this.overrides.system.stats;
|
||||
delete this.overrides.system.skills;
|
||||
/*
|
||||
These are the (groups of) fields that ActiveEffects may modify safely and
|
||||
remain editable in the sheet. This needs to be done because of default
|
||||
Foundry behaviour that otherwise prevents these fields from being edited.
|
||||
The deletes must use optional chaining otherwise they can cause issues
|
||||
during the document preparation lifecycle as an actor with no AE's affecting
|
||||
anything in one of these areas will result in these paths being undefined.
|
||||
*/
|
||||
delete this.overrides.system?.stats;
|
||||
delete this.overrides.system?.skills;
|
||||
};
|
||||
|
||||
async createCustomPet() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue