Update the ArmourSheets to allow for the equipped toggle to be present and work
This commit is contained in:
parent
b72c9d9739
commit
3c582c77bb
4 changed files with 45 additions and 6 deletions
|
|
@ -5,6 +5,7 @@ import { Logger } from "../../utils/Logger.mjs";
|
|||
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
const { getProperty, hasProperty, setProperty } = foundry.utils;
|
||||
|
||||
export class ArmourSheet extends GenericAppMixin(HandlebarsApplicationMixin(ItemSheetV2)) {
|
||||
|
||||
|
|
@ -58,6 +59,27 @@ export class ArmourSheet extends GenericAppMixin(HandlebarsApplicationMixin(Item
|
|||
await this.render(false);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Customize how form data is extracted into an expanded object.
|
||||
* @param {SubmitEvent|null} event The originating form submission event
|
||||
* @param {HTMLFormElement} form The form element that was submitted
|
||||
* @param {FormDataExtended} formData Processed data for the submitted form
|
||||
* @returns {object} An expanded object of processed form data
|
||||
* @throws {Error} Subclasses may throw validation errors here to prevent form submission
|
||||
* @protected
|
||||
*/
|
||||
_processFormData(event, form, formData) {
|
||||
const data = super._processFormData(event, form, formData);
|
||||
|
||||
if (hasProperty(data, `system.location`)) {
|
||||
let locations = getProperty(data, `system.location`);
|
||||
locations = locations.filter(value => value != null);
|
||||
setProperty(data, `system.location`, locations);
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
// #endregion
|
||||
|
||||
// #region Data Prep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue