Allow flag-based blacklisting and whitelisting of overmap locations on a per-region basis #27767
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.
Summary
SUMMARY: Infrastructure "Allow flag-based blacklisting and whitelisting of overmap locations on a per-region basis"
Purpose of change
Provides a JSON-based mechanism that allows overmap locations to be blacklisted and whitelisted on a per-region basis based on the flags that those locations have. This will let regions exclude and include certain location types without the locations themselves having to opt in and out of every region.
It allows mods that attempt to suppress certain types of locations to more cleanly specify their intent, e.g. specifying a flag as blacklisted rather than doing a
copy-from
for every overmap special they want to exclude and updating its occurrences to 0 (though that path is still available if a single instance needs to be excluded while retaining others of a similar class).Describe the solution
Added new section to the regional map settings which allows for operations based on the flags that overmap features have, and the code to load these settings.
Initially supports a whitelist and blacklist such that features with matching flags are either excluded (blacklist) or exclusively used (whitelist) during overmap generation.
Updated overmap special placement to evaluate these lists when building the default batches of overmap specials for placement. Hard coded terrain placements were not adjusted in this initial pass, as generally speaking the hardcoded placements of features are a bit less open to external modification via JSON and more tightly coupled to their placement algorithms. Any overmap-based placement routine can read these settings and be updated to use them, however.
Updated the No_Fungi, No_Anthills, No_Beehives, and No_Triffids mods to use this mechanism for blacklisting locations rather than copying overmap_special entries and overriding the occurrences values.
Update the REGION_SETTINGS and JSON_FLAGS documentation.
Describe alternatives you've considered
We could make new sections in the regional settings for specifying allowed overmap terrains and specials directly by id, as is currently done for the locations that make up cities, but I don't particularly care for that since it makes it more difficult for new content to be included, must be manually maintained when there are changes, and misses out on the flag part of this that allows operating on a broad range of features just based on common attributes.