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 find_or_create_om_terrain to make new overmaps #36009

Conversation

ralreegorganon
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Allow find_or_create_om_terrain to make new overmaps"

Purpose of change

Fixes #35994

When searching for a mission target, we currently search existing overmaps within the specified range, and if we don't find the target and the parameters allow it, we'll try to create the target within the same overmaps.

This generally has worked, but if we can't place the target in any of the existing overmaps, we currently just error out. This updates it to then allow the creation of new overmaps within the range, which gives us more opportunities to find the target either naturally spawned or to attempt to create it.

Describe the solution

Push the existing logic for finding and creating the target into a lambda unchanged, call it once as we did previously, and if that fails to find a target, flip the flag that allows it to create new overmaps and run it again.

Describe alternatives you've considered

Specifically regarding this mission, the Refugee Center is very hard to place on an existing overmap because it occupies so much space--it's 15x15 overmap terrains in width and height, which is pretty rough but not insurmountable, but then it also extends from z+2 to z-4, and almost always ends up in a collision with some subsurface feature (e.g. sewers, subways, ant tunnels), particularly given that we don't try every single one of the 32400 possible points in a overmap z0 for placement, but instead divide it up into sectors. You can see this in the save from the related issue--I've rendered out z0 to z-4 in this image below:

result

Testing

Loaded the save from #35994, nuked the existing mission via debug, and then replicated the error using the steps from the issue. Then applied the changes here, repeated the process, and had it succeed.

Also replicated the issue in my own saves, and confirmed they're resolved after applying the changes.

There is still always going to be the chance that it fails to find or place the target within the radius, but in this particular case it ends up searching and creating up to 25 overmaps for the target, so failure is unlikely unless the world settings extremely reduce available space for placement.

@ralreegorganon ralreegorganon added Missions Quests and missions <Bugfix> This is a fix for a bug (or closes open issue) labels Dec 10, 2019
@ZhilkinSerg ZhilkinSerg merged commit f47111a into CleverRaven:master Dec 11, 2019
@ralreegorganon ralreegorganon deleted the more-permissive-mission-target-finding branch April 7, 2020 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Missions Quests and missions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot get the location of the Refugee Center
2 participants