Mapgen can test for mutable special joins #51848
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
Infrastructure "Mapgen can test for the use of joins adjacent to an OMT"
Purpose of change
We already have the ability to check for neighbours and adjust mapgen accordingly. But sometimes knowing the neighbour is not enough, or is difficult.
For mutable overmaps, we have another option: checking which joins were used.
Describe the solution
Allow mapgen to vary depending on the adjacent joins used to place an overmap special.
The syntax in JSON is effectively the same as for the existing neighbour checking.
This requires saving all the used joins in the overmap, which weren't there before, so it will only work properly for new overmaps spawned after this is merged.
Use this new feature to add slopes to get out of anthills, finally fixing that longstanding bug with anthill generation I noticed when I started working on mutable specials.
Add debugging output to the overmap editor so you can see what joins were used.
cube_direction
has been promoted to a header, now it's needed inovermap.h
.I suspect this code is not correctly handling rotations. I think the neighbour check code is also broken in that regard. Luckily that doesn't affect the one use case I've put it to already. I want to look into that but I don't think it's critical that it be part of this PR.
Describe alternatives you've considered
Making the test for neighbours be part of the mapgen value syntax. This would be more flexible, but more verbose in common use cases and I don't see the need for it elsewhere. We can always add it if we need.
Testing
Spawning anthills and visiting them.
Additional context
Here are two crossroads in an anthill, one with the slopes upward and one without them.