feat: Add Lua bindings to toggle mutations on/off #5762
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Required
main
so it won't cause conflict when updatingmain
branch later.Purpose of change
Current Lua bindings for Creature objects are somewhat incomplete. In particular, there is no way to cleanly disable a mutation, or enable one at all.
Describe the solution
Added a couple of lines in
src/catalua_bindings_creature.cpp
. Now we can do this:I also added a few lines in
src/mutation.cpp
. Its corresponding activate/deactivate_mutation functions now check if the player has the necessary target—i.e., they have the mutation and it is (in)active.Describe alternatives you've considered
The alternative looks roughly like this:
It is exactly as awful as it seems.
Testing
See "Describe the solution", but also:
These should no longer error on a character without the specified mutations.
Additional context
If there's any code that needed to activate mutations multiple times without de-'
power
'-ing them...sorry! I don't know of anything else this could possibly break.