boardzilla / boardzilla-core

Boardzilla core library
GNU Affero General Public License v3.0
180 stars 3 forks source link

Move validation #24

Closed aghull closed 8 months ago

aghull commented 8 months ago

WIP

currently action#validate is simply an additional means to prune options from the choice tree or present errors on submission for selections that cannot be simply pruned.

this change enhances the meaning of action#validate to not only prune options from choice tree but also flag the pruned choice with the resultant error message which is displayed to the player if they attempt the invalid selection. this behaviour is in addition to normal tree-shaking, but takes precedence, so an author can choose to provide custom error messages for invalid options, before the tree-shaker removes them.