Add improved capabilities to the Player actor type
This commit is contained in:
parent
02a553e6c9
commit
fec638cb22
2 changed files with 3 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { __ID__, filePath } from "../consts.mjs";
|
import { __ID__, filePath } from "../consts.mjs";
|
||||||
import { AttributeManager } from "./AttributeManager.mjs";
|
import { AttributeManager } from "./AttributeManager.mjs";
|
||||||
|
import { attributeSorter } from "../utils/attributeSort.mjs";
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||||
const { ActorSheetV2 } = foundry.applications.sheets;
|
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
@ -88,7 +89,7 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
path: `system.attr.${id}`,
|
path: `system.attr.${id}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
ctx.attrs = attrs.toSorted((a, b) => a.name.localeCompare(b.name));
|
ctx.attrs = attrs.toSorted(attributeSorter);
|
||||||
};
|
};
|
||||||
|
|
||||||
async _prepareContent(ctx) {
|
async _prepareContent(ctx) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export class PlayerData extends foundry.abstract.TypeDataModel {
|
||||||
attr: new fields.TypedObjectField(
|
attr: new fields.TypedObjectField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
name: new fields.StringField({ blank: false, trim: true }),
|
name: new fields.StringField({ blank: false, trim: true }),
|
||||||
|
sort: new fields.NumberField({ min: 1, initial: 1, integer: true, nullable: false }),
|
||||||
value: new fields.NumberField({ min: 0, initial: 0, integer: true, nullable: false }),
|
value: new fields.NumberField({ min: 0, initial: 0, integer: true, nullable: false }),
|
||||||
max: new fields.NumberField({ min: 0, initial: null, integer: true, nullable: true }),
|
max: new fields.NumberField({ min: 0, initial: null, integer: true, nullable: true }),
|
||||||
isRange: new fields.BooleanField({ initial: false, nullable: false }),
|
isRange: new fields.BooleanField({ initial: false, nullable: false }),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue