Skip to content

Commit

Permalink
Convert HazardSystemData to data model (#18349)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFdez authored Feb 24, 2025
1 parent 91a6a57 commit beaee83
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 182 deletions.
13 changes: 11 additions & 2 deletions src/module/actor/data/model.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { ActorPF2e } from "@actor";
import type { MigrationDataField } from "@module/data.ts";
import type { AutoChangeEntry } from "@module/rules/rule-element/ae-like.ts";
import fields = foundry.data.fields;

abstract class ActorSystemModel<TParent extends ActorPF2e, TSchema extends ActorSystemSchema> extends foundry.abstract
.TypeDataModel<TParent, TSchema> {
declare autoChanges: Record<string, AutoChangeEntry[] | undefined>;

static override defineSchema(): ActorSystemSchema {
const fields = foundry.data.fields;
return {
_migration: new fields.SchemaField({
version: new fields.NumberField({
Expand Down Expand Up @@ -38,4 +38,13 @@ type ActorSystemSchema = {
_migration: MigrationDataField;
};

export { ActorSystemModel, type ActorSystemSchema };
/** Schema definition for actor hit points, though not all actors have hit points */
type ActorHitPointsSchema = {
value: fields.NumberField<number, number, true, false, true>;
max: fields.NumberField<number, number, true, false, true>;
temp: fields.NumberField<number, number, true, false, true>;
details: fields.StringField<string, string, true, false, true>;
};

export { ActorSystemModel };
export type { ActorHitPointsSchema, ActorSystemSchema };
Loading

0 comments on commit beaee83

Please sign in to comment.