Add regional terrain/furniture resolution to mapgen #35627
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.
Summary
SUMMARY: Infrastructure "Add regional terrain/furniture resolution to mapgen"
Purpose of change
Adds functionality to the regional map settings and mapgen so that regional terrains like a "t_region_shrub" can be used in JSON mapgen to denote regional appropriate terrain/furniture should be used, and the actual weighted list of valid terrain/furniture can be defined in the
region settings and resolved from the regional "pseudo terrain" to an actual terrain/furniture during mapgen.
This is more groundwork for allowing multiple regions and region overlays to better impact the overall content of a region, while also allowing map developers to defer some specifics of terrain/furniture selection to the region (e.g. "I want some fruit trees here, of whatever fruit tree type is appropriate for this region").
Describe the solution
Describe alternatives you've considered
I'd actually like for the resolution of the terrain/furniture to not have to be explicitly invoked the way it is, but to do that requires something like making the map ter/furn set methods aware of their current region, or further abstracting away how mapgen invokes those methods, but both are refactoring tasks in and of themselves.
There's also nothing particularly special about the pseudo terrain entries--I contemplated adding some flags to them, but decided against it since they'd only be used in validation and by allowing this functionality to work with any terrain/furniture, it leaves the door open for more manipulation via JSON only. For example, if you REALLY hate the
t_grass_long
andt_grass_tall
terrains, you can make a mod with a region overlay that says those two both resolve tot_grass
and then you will not get anyt_grass_long
ort_grass_tall
via JSON mapgen, justt_grass
.Testing
As part of developing this, I updated the trailhead mapgen to use this functionality, then teleported around until I found a trailhead and confirmed it worked as expected.
This functionality will work just fine with existing worlds, but note that it only gets applied during mapgen so it won't affect any overmap terrains that have already had mapgen run.
I also did some non-sensical but visually obvious things like updating the
t_region_groundcover
entry to instead resolve tot_lava
, which gives this nightmare: