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

[Doesn't work, pls help] Json connection origins #67736

Closed
wants to merge 5 commits into from

Conversation

Procyonae
Copy link
Contributor

@Procyonae Procyonae commented Aug 17, 2023

Summary

None

Purpose of change

Unhardcoding good
The hardcoded function needs changing for sub_connector unhardcoding Makes #68496 alot less wonky
Allows for adding custom connections like a new rural_road connection that paths to the nearest road.
Allows separating z-2 and z-4 subway into different connections, with the z-4 pathing to ramps and z-2 pathing to surface subway stations, with fallbacks to join to the closest subway if none found.
Potentially could allow streams to path to rivers if reworked into a connection.

Describe the solution

Connection targets can be defined in JSON in their respective overmap_connection object under a new "origin" field
Accepts om_terrains optionally with accompanying match types (defaults to type), city true/false (defaults to false) and a max distance that specifies how far it should look for each origin point. Atm it just picks the closest one it finds.
If it fails to find any of the specified origins or there aren't any it tries to find the nearest connection subtype terrain within 50 tiles and joins to that.
(I presume I need to make it select an appropriate adjacent tile to the target but I just want it to work first, it'll need #67723 to work reliably with specials anyway)

Describe alternatives you've considered

Ideally boundary joins would be selectable too (and jsonified themselves)
Ideally you'd be able to join all of one type together to ensure full connectivity where desired (like cities join rn)

Testing

Currently doesn't work, adding "origin": [ { "city": true } ] to local_road loads but doesn't function properly and anything else (eg { "om_terrain": "forest_thick" }) hangs the game when building a world.

Additional context

@github-actions github-actions bot added Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` labels Aug 17, 2023
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap.cpp Outdated Show resolved Hide resolved
src/overmap_connection.cpp Outdated Show resolved Hide resolved
src/overmap_connection.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Aug 17, 2023
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Aug 17, 2023
@Maleclypse
Copy link
Member

@jbytheway this seems like something you would probably understand better than most others. Sorry if I’m incorrect.

@jbytheway
Copy link
Contributor

Yes, I would like to take a look at this, but I probably won't get the chance until next weekend.

@Procyonae it would be helpful if you could make one JSON change demonstrating the expected use of this new feature. Or maybe more than one change if necessary to demonstrate the different ways it can be used.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display stale Closed for lack of activity, but still valid.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants