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

basecamps: Basecamps anywhere #34184

Merged
merged 6 commits into from
Sep 24, 2019

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Sep 22, 2019

Summary

SUMMARY: Features "basecamps: Basecamps anywhere"

Purpose of change

Add support for #34181 and allow faction camps to be built in any z-level location that has a recipe group, not just fields.

Describe the solution

Adjust recipe_groups to match terrains by the root terrain id, not including any directional suffix.

Add a new keyword to the at_om_location dialogue condition, FACTION_CAMP_START, which returns true if there is a faction camp recipe group that matches the om terrain id.

Adjust start_camp() to not fail if there are less than 4 fields adjacent to the camp. Also, remove the warning if there aren't any swamps nearby because that warning was irrelevant and confusing.

Adjust the faction camp start response to check the NPC position and FACTION_CAMP_START instead of the player position and if the player was in a field.

Remove the Old Camp from the list of options; no one should be starting those anymore.

Additional context

Tested by applying #34181 and confirming that I could start a camp in a fire station. I also confirmed that I still couldn't start a camp in a ranch camp field (which is ranch_camp_#, not field) and could still start a camp in an actual field.

Merging this is a prerequesite for testing and merging #34181

@mlangsdorf mlangsdorf added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site labels Sep 22, 2019
base_om_ter_id = om_terrain_id.substr( 0, om_ter_len - 6 );
}
}
if( om_ter_len > 6 ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice of you to split this check for length 7 and length 6 here, but why did you not keep this up in the checks below? (The below won't catch a terrain named "tt_east" is has not more than 7 characters).

As I've often seen this kind of code around the mapgen code, it should really be put into a separate function, instead of repeating it (partially wrong) over and over again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions added, thanks for the suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please don't add sarcastic comments in another commit instead of fixing a problem; you just caused an unnecessary merge conflict.

Add the special return string "FACTION_CAMP_START" to the at_om_location
condition, which returns true if the player or NPC is standing on an
overmap tile where a basecamp can be built.
Strip any suffix off of an overmap terrain id before attempting to find
it in the list of terrains that are valid for a recipe.
Remove the confusing and unnecessary check for swamps, and convert the
check for nearby fields to be a warning, instead of a failure, so that
players can build camps in cities if that's something they want to do.
Adjust the faction camp start dialogue to appear if the NPC, not the
player, is standing at a valid location and allow the valid locations
to be places other than fields.

Update the tutorial text to reflect this change.
The modular field camp does everything that the primitive field camp
does, but is a better design.  Remove the "Old Camp" from the list
of available camps.  Existing camps will not be affected, but people
will not be able to start new camps using the Old Camp mapgen.
Add some functions to parse oter_id and return the base string
without any directional suffixes, or the rotation int for the
the suffix, or the directional suffix itself.

Use these functions to make some code in recipe_groups, conditions,
and mapgen a little more correct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants