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

Mapgen can test for mutable special joins #51848

Conversation

jbytheway
Copy link
Contributor

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 in overmap.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.
ant-slope-up-sometimes

@Maleclypse Maleclypse added the Map / Mapgen Overmap, Mapgen, Map extras, Map display label Sep 24, 2021
@jbytheway jbytheway force-pushed the mapgen_can_test_for_mutable_special_joins branch 2 times, most recently from 66af18b to 0eee76e Compare September 25, 2021 11:19
To be able to use these types in regular mapgen they need to be promoted
to headers.
When a mutable special is placed, keep a record of every join used and
store that in the overmap.  Display this information in the overmap
editor to aid with debugging.
We want you to be able to specify the chosen chunk as a mapgen value.
Similarly to neighbourhood checks in chunk placement, add join checks to
chunk placement.
@jbytheway jbytheway force-pushed the mapgen_can_test_for_mutable_special_joins branch from 0eee76e to bdd9f5c Compare September 25, 2021 17:23
@jbytheway
Copy link
Contributor Author

jbytheway commented Sep 27, 2021

The above-mentioned bug with rotated terrain not handling joins correctly is fixed in the follow-up PR #51913 (which includes all the changes from this PR and more).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants