Skip to content

Commit

Permalink
refactor: Data model cleanup
Browse files Browse the repository at this point in the history
- address review comments
  • Loading branch information
Shourn committed Jan 19, 2025
1 parent 19d1110 commit 617a074
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions module/documents/items/heroic/heroic-skill-data-model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class HeroicSkillDataModel extends foundry.abstract.TypeDataModel {
deprecationNotice(this, 'damage.value');
deprecationNotice(this, 'damage.type.value');
deprecationNotice(this, 'impdamage.hasImpDamage.value');
deprecationNotice(this, 'impdamage.value');
deprecationNotice(this, 'impdamage.impType.value');
deprecationNotice(this, 'impdamage.type.value');
}
Expand Down
8 changes: 8 additions & 0 deletions module/helpers/deprecation-helper.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/**
* Track which deprecated method has already been logged.
* @type {Set<string>}
*/
const alreadyPrinted = new Set();

/**
* Add a log message to a removed field in a data model.
* For nested fields the required nested objects will be defined on the class.
* If the field has no replacement its value will be undefined, and it cannot be set to any other value.
* If the field has a designated replacement it will reflect the value of its replacement and will set the value of its replacement.
* @param {typeof foundry.abstract.DataModel} root the DataModel subclass
* @param {string} key
* @param {string} [replacementKey]
Expand Down

0 comments on commit 617a074

Please sign in to comment.