-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#342] Turn senses into full object, rework how config apps are called
- Loading branch information
Showing
14 changed files
with
163 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
export {default as CreatureTypeField} from "./creature-type-field.mjs"; | ||
export {default as CurrencyTemplate} from "./currency.mjs"; | ||
export {default as MovementField} from "./movement-field.mjs"; | ||
export {default as SensesField} from "./senses-field.mjs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Field for storing creature type data. | ||
*/ | ||
export default class CreatureTypeField extends foundry.data.fields.SchemaField { | ||
constructor(fields={}, options={}) { | ||
fields = { | ||
value: new foundry.data.fields.StringField({blank: true, label: "DND5E.CreatureType"}), | ||
subtype: new foundry.data.fields.StringField({label: "DND5E.CreatureTypeSelectorSubtype"}), | ||
swarm: new foundry.data.fields.StringField({blank: true, label: "DND5E.CreatureSwarmSize"}), | ||
custom: new foundry.data.fields.StringField({label: "DND5E.CreatureTypeSelectorCustom"}), | ||
...fields | ||
}; | ||
Object.entries(fields).forEach(([k, v]) => !v ? delete fields[k] : null); | ||
super(fields, { label: "DND5E.CreatureType", ...options }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Field for storing movement data. | ||
*/ | ||
export default class MovementField extends foundry.data.fields.SchemaField { | ||
constructor(fields={}, options={}) { | ||
const numberConfig = { nullable: false, min: 0, step: 0.1, initial: 0 }; | ||
fields = { | ||
burrow: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.MovementBurrow" }), | ||
climb: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.MovementClimb" }), | ||
fly: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.MovementFly" }), | ||
swim: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.MovementSwim" }), | ||
walk: new foundry.data.fields.NumberField({ ...numberConfig, initial: 30, label: "DND5E.MovementWalk" }), | ||
units: new foundry.data.fields.StringField({initial: "ft", label: "DND5E.MovementUnits"}), | ||
hover: new foundry.data.fields.BooleanField({label: "DND5E.MovementHover"}), | ||
...fields | ||
}; | ||
Object.entries(fields).forEach(([k, v]) => !v ? delete fields[k] : null); | ||
super(fields, { label: "DND5E.Movement", ...options }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Field for storing senses data. | ||
*/ | ||
export default class SensesField extends foundry.data.fields.SchemaField { | ||
constructor(fields={}, options={}) { | ||
const numberConfig = { required: true, nullable: false, integer: true, min: 0, initial: 0 }; | ||
fields = { | ||
darkvision: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.SenseDarkvision" }), | ||
blindsight: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.SenseBlindsight" }), | ||
tremorsense: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.SenseTremorsense" }), | ||
truesight: new foundry.data.fields.NumberField({ ...numberConfig, label: "DND5E.SenseTruesight" }), | ||
units: new foundry.data.fields.StringField({required: true, initial: "ft", label: "DND5E.SenseUnits"}), | ||
special: new foundry.data.fields.StringField({required: true, label: "DND5E.SenseSpecial"}), | ||
...fields | ||
}; | ||
Object.entries(fields).forEach(([k, v]) => !v ? delete fields[k] : null); | ||
super(fields, { label: "DND5E.Senses", ...options }); | ||
} | ||
} |
Oops, something went wrong.