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

Allow flag-based blacklisting and whitelisting of overmap locations on a per-region basis #27767

Conversation

ralreegorganon
Copy link
Contributor

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.

@ralreegorganon ralreegorganon added <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` labels Jan 22, 2019
@ralreegorganon ralreegorganon force-pushed the region-map-flag-whitelist-blacklist branch from 1bbf85a to 62fe9b0 Compare January 22, 2019 08:29
@ZhilkinSerg ZhilkinSerg self-assigned this Jan 22, 2019
Add new section to the regional map settings which allows for operations
based on the flags that overmap features have.

Initially supports a whitelist and blacklist such that features with
matching flags are either excluded (blacklist) or exclusively used
(whitelist) during overmap generation.

Only overmap special placement currently evaluates these lists, but
any overmap-based placement routine can read them and be updated to use
them. Generally speaking the hardcoded placements of features are a bit
less open to external modification via JSON, hence why they're not part
of this initial pass.
@ralreegorganon ralreegorganon force-pushed the region-map-flag-whitelist-blacklist branch from 62fe9b0 to c039309 Compare January 22, 2019 09:52
@ZhilkinSerg
Copy link
Contributor

Great change. A huge step to move CLASSIC_ZOMBIES from world options into a mod.

@ZhilkinSerg ZhilkinSerg merged commit 66ea2e7 into CleverRaven:master Jan 22, 2019
@ZhilkinSerg ZhilkinSerg removed their assignment Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display Mods Issues related to mods or modding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants