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 multiple overmap terrains in start location #38151

Merged

Conversation

ZhilkinSerg
Copy link
Contributor

@ZhilkinSerg ZhilkinSerg commented Feb 19, 2020

Summary

SUMMARY: Infrastructure "Allow multiple overmap terrains in start location"

Purpose of change

Allow multiple overmap terrains in start location without cluttering UI for each distinct terrain.

Describe the solution

Code was changed to allow multiple terrains be defined for start locations, they all would occupy a single line in UI and be selected randomly on game start. From players perspective this would allow players to start in any house type instead of only 6 predefined houses. Thanks to overmap match type support it is still possible to create a mod that allow starting in specific terrains.

Screenshot:

image

Syntax:

  {
    "type": "start_location",
    "id": "sloc_police",
    "name": "Police Station",
    "terrain": [ { "om_terrain": "police", "om_terrain_match_type": "PREFIX" } ]
  },
  {
    "type": "start_location",
    "id": "sloc_restaraunt_foodplace_break_room",
    "name": "Foodplace Break Room",
    "terrain": [ "s_restaurant_foodplace_roof" ]
  },
  {
    "type": "start_location",
    "id": "sloc_school",
    "name": "School",
    "terrain": [ { "om_terrain": "school", "om_terrain_match_type": "CONTAINS" } ]
  },
  {
    "type": "start_location",
    "id": "sloc_campground",
    "name": "Campground",
    "terrain": [ "campground_1a", "campground_1b", "campground_2a", "campground_2b" ]
  },

I've also updated names of some start locations for consistency.

Testing

Try various scenarios and see that player character is put to correct start locations.

Additional context

  1. I've updated start locations and scenarios in all in-repo mods, but it could possibly break third party mods that add/expand start locations. These mods need to use new syntax:
  • replace target string node with terrain array node (e.g. "target": "s_bunker_shop_g" -> "terrain": [ "s_bunker_shop_g" ] );
  • optionally utilize overmap terrain match type nodes (e.g. "terrain": [ { "om_terrain": "house", "om_terrain_match_type": "PREFIX" } ] to reduce UI cluttering).
  1. We would probably like to cleanup and expand start locations using new syntax in later PRs (as current PR could possibly allow spawning players in undesired location - e.g. house roof).

@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding [C++] Changes (can be) made in C++. Previously named `Code` Scenarios New Scenarios, balancing, bugs with scenarios Mods: Magiclysm Anything to do with the Magiclysm mod labels Feb 19, 2020
@ZhilkinSerg ZhilkinSerg changed the title Allow multiple targets overmap terrains for start locations Allow multiple overmap terrains in start location Feb 19, 2020
@ZhilkinSerg ZhilkinSerg force-pushed the start-location-multiple-terrain branch 4 times, most recently from 001037e to dd27ca8 Compare February 19, 2020 14:36
src/start_location.cpp Outdated Show resolved Hide resolved
src/start_location.h Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg force-pushed the start-location-multiple-terrain branch from dd27ca8 to 022da8c Compare February 19, 2020 15:04
@AMurkin
Copy link
Contributor

AMurkin commented Feb 19, 2020

Could the first option of that list be a Random location? (Looking at the #38110)

@ZhilkinSerg
Copy link
Contributor Author

Could the first option of that list be a Random location? (Looking at the #38110)

Sure. It is unrelated though and can be done in a separate PR.

@ZhilkinSerg ZhilkinSerg force-pushed the start-location-multiple-terrain branch from 9a5d3b2 to 611ccdb Compare April 3, 2020 12:37
@ZhilkinSerg
Copy link
Contributor Author

Could the first option of that list be a Random location? (Looking at the #38110)

It was done in #38544.

@ZhilkinSerg
Copy link
Contributor Author

ZhilkinSerg commented Apr 3, 2020

There is a strange bug I cannot grok by myself:

When you select Evacuee scenario (only it as far as I see) you cannot select a second entry in starting location selection menu.

Also in this scenario starting location defaults to this second entry (shelter), while in other scenarios it correctly defaults to first entry (random location).

Okay, that is actually something from #38544, so it should be fixed separately.

@kevingranade kevingranade merged commit 7afe3c1 into CleverRaven:master Apr 7, 2020
@ZhilkinSerg ZhilkinSerg deleted the start-location-multiple-terrain branch April 7, 2020 08:47
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 [JSON] Changes (can be) made in JSON Mods: Magiclysm Anything to do with the Magiclysm mod Mods Issues related to mods or modding Scenarios New Scenarios, balancing, bugs with scenarios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants