-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#342] Add Race type, update Movement & Type config to work with items #2503
Conversation
2192449
to
8a76cd7
Compare
The different display of Darkvision being its own line instead of a title and box, like Type and Movement looks just a little off to me. Even though all official races only provide Darkvision as an additional sense, perhaps it should be a title of Senses, then the specified sense in a box, for more consistency/flexibility for homebrew? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, some suggested changes from my end. Will defer final review and approval to @Fyorl
module/data/item/race.mjs
Outdated
units: new foundry.data.fields.StringField({initial: "ft", label: "DND5E.MovementUnits"}) | ||
}), | ||
type: new foundry.data.fields.SchemaField({ | ||
value: new foundry.data.fields.StringField({initial: "humanoid", label: "DND5E.CreatureType"}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type.value
field should specify a valid set of choices
I think. While we're here, do we like value
as this attribute path? I know we've used it before, but maybe something like type.primary
or type.category
would be more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's unfortunately a bit of tension with regards to putting explicit choices
in the DataModel while still allowing the system to be configurable. If we set choices
to something like CONFIG.creatureTypes
, and a module adds something to that, any Actors that are subsequently configured with that creature type will become invalid if the module is ever disabled.
There are a few things we've thought about doing here: Deferring to preparation to strip out 'unconfigured' values, or writing custom validators to do something similar. At the moment we've opted to just not use choices
for now, until we either implement some of the aforementioned options, or there is some core API solution in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with setting a choices
is it easily leads to entire actors/items being invalid. If a module or script adds a choice and is then disabled, any actors or items that use that choice will just disappear entirely from the world and the only way a user can know what went wrong is through the inspector. I'd prefer to avoid choices
and just degrade more gracefully when creating labels and whatnot.
Renaming would work, but would we also want to migrate the NPC data structure to match?
0c9da9b
to
039b026
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just caught one errant logging statement, otherwise I think this is good to go so I am marking it as approved, but please hold off on merging this just yet until we can decide whether we want to incur the migration burden when the 'race' game term changes.
e77a69a
to
e541716
Compare
e541716
to
c5abf7e
Compare
Add Race item type with data structure to handle advancement, movement, darkvision, and creature type. This required some changes to the
ActorTypeConfig
andActorMovementConfig
to handle editing items.