Add ability to let players who own a document edit the attributes for it via the UI

This commit is contained in:
Oliver-Akins 2025-06-29 15:56:03 -06:00
parent 0cc202e48d
commit e1f173dde7
4 changed files with 40 additions and 10 deletions

View file

@ -18,16 +18,6 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
},
window: {
resizable: true,
controls: [
{
icon: `fa-solid fa-at`,
label: `Manage Attributes`,
action: `manageAttributes`,
visible: () => {
return game.user.isGM;
},
},
],
},
form: {
submitOnChange: true,
@ -46,6 +36,23 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
// #endregion Options
// #region Lifecycle
_getHeaderControls() {
const controls = super._getHeaderControls();
controls.push({
icon: `fa-solid fa-at`,
label: `Manage Attributes`,
action: `manageAttributes`,
visible: () => {
const isGM = game.user.isGM;
const allowPlayerEdits = game.settings.get(__ID__, `canPlayersManageAttributes`);
const editable = this.isEditable;
return isGM || (allowPlayerEdits && editable);
},
});
return controls;
};
// #endregion Lifecycle
// #region Data Prep