Skip to content
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

Implemented scaffolding for System Settings and implemented configurable Saving Throw names. #77

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

DC23
Copy link
Collaborator

@DC23 DC23 commented Nov 27, 2024

The basic approach is entirely data-driven

  • The settings data object is built for the saving throws, with default values pulled from the localisation database
  • The Actor sheet reads values from the system settings object instead of from localisation strings, using the same key as before.
  • Default behaviour is identical: localised saving throw names identical to whatever is in the language files
  • A GM-only settings menu allows the saving throw names to be overridden for the entire world in a small settings form. Form validation prevents empty strings. I apply simple string cleaning to strip whitespace from the start and end of the string.
  • There is commented out code that uses a regex to strip HTML tags from the strings, but given that Foundry allows GM and players to execute arbitrary client-side JS code anyway, I don't see that allowing unsanitised strings as saving throw names is really a problem. If it is, then I'd suggest that rather than rolling our own dodgy regex, we'd import a JS library and call that.
  • Settings menus like I've used give good control over validation, but unfortunately they mean we don't get the free "reset defaults" function. I implemented this manually. It's not hard and it works.
  • I'm quite happy with the overall approach. Everything is data-driven and agnostic with respect to the number of string items being handled in the settings. I think there's a nice general pattern emerging that could be abstracted further if this needs to be repeated for other things.

DC23 added 17 commits November 23, 2024 15:09
Added a setting for auto rolling token HP.
orffen#18
Fixes orffen#75
It's the wrong interpretation of the feature.
orffen#18
Formatted saves-settings with new prettier config
orffen#69
fixed required attribute bug for when it is passed into the template as false (it was correct for values of true).
orffen#69
@DC23
Copy link
Collaborator Author

DC23 commented Nov 27, 2024

Will fix #75 and #69

@DC23 DC23 marked this pull request as draft November 27, 2024 07:14
@DC23 DC23 changed the title Implement scaffolding for System Settings, and implemented configurable Saving Throw names. Implemented scaffolding for System Settings and implemented configurable Saving Throw names. Nov 28, 2024
@DC23 DC23 marked this pull request as ready for review November 28, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add System Settings plumbing Saving Throw Name Customization Option
2 participants