Allow IfSpecies to accept an array of species#1184
Open
Wexit11 wants to merge 4 commits into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This change allows IfSpecies to accept a single string species or an array of string species. The logic has been updated to evaluate to true if any of the species match.
The existing functionality when a species is invalid/can't be found is that NULL_OPERATOR is returned, causing the IfSpecies branch always return 0. I've maintained this functionality, but only in the event that there are no valid species in the list.
Justification
This is purely a quality of life change to allow a subset of trees to be represented with less verbose json. Effectively, these two json objects accomplish the same result:
Testing
IfSpecies with array of valid species



Showing that the array of species is using a different chance value from the rest of the species
Bushes have 100% chance, all others use a noise function to place clusters.
Bushes shown to be using a non-noise based chance.
IfSpecies with single string species



Regression for single entry species
Regression for invalid species in array


Testing with only one species that is invalid - all species in array are invalid