Refactor/275 actor sheets simplification (#291)

* FEAT: create isNPC geeter and add the prop on metada on actors
FEAT: create common method for documents sheets
FEAT: create BaseActorSheet and implementation

* FIX: tabs label

* REFACTOR: remove unused methods
REFACTOR: simplify CharacterSheet's click actions methods
REFACTOR: minor fix on DHActor class

* REFACTOR: remove unused methods
REFACTOR: create method on BaseActorSheet
REFACTOR: make Datamodel metadata getter

* REFACTOR: remove unused method on setting sheet
FEAT: create BaseActorSetting
FIX: add type="button" to button on actor's sheet

* FIX jsdoc

* PRETTIER

---------

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-07-07 20:27:21 -03:00 committed by GitHub
parent 7d7fb88035
commit 87b3677956
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 723 additions and 1253 deletions

View file

@ -22,6 +22,11 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
};
}
/**@returns {ItemDataModelMetadata}*/
get metadata() {
return this.constructor.metadata;
}
/** @inheritDoc */
static defineSchema() {
const schema = {};
@ -60,9 +65,9 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
/**@inheritdoc */
async _preCreate(data, options, user) {
// Skip if no initial action is required or actions already exist
if (!this.constructor.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
if (!this.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
const metadataType = this.constructor.metadata.type;
const metadataType = this.metadata.type;
const actionType = { weapon: 'attack' }[metadataType];
const ActionClass = game.system.api.models.actions.actionsTypes[actionType];