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

Missions: Move some start functions into JSON #27037

Merged
merged 3 commits into from
Dec 15, 2018

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Dec 10, 2018

Summary

SUMMARY: Infrastructure "Missions: Move some start functions into JSON"

Purpose of change

Make it easier for people to add new missions by adding the ability to define more mission start
functions in JSON instead of C++. Specifically, create a structure for calling the npctalk functions
used for dialogue effects from a mission start, and add some structure to create a JSON interface
for calling the existing om_target_ter() and reveal_ter() functions.

Describe the solution

Move the effect_t and effect_fun_t classes out of talk_response:: so other pieces of code can use them.

Add a JSON object parser that can take an object instead of a string for the "start" value in a mission_definition. If that objects has an "effects" member, invoke the existing dialogue effects parser and capture the resulting lambdas. Add a similar parser for some overmap terrain functions, and update some of the mission_definitions to take advantage of these new features.

Document the new structure in doc/MISSION_JSON.md.

Describe alternatives you've considered

Pretty happy with this design for now.

Additional context

This code depends on #27050 setting up the zombie kill missions correctly. See #26794 for general context.

@mlangsdorf mlangsdorf added NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Missions Quests and missions [C++] Changes (can be) made in C++. Previously named `Code` labels Dec 10, 2018
@mlangsdorf mlangsdorf force-pushed the missionstart_json_1 branch 3 times, most recently from c4404b3 to 5a98da9 Compare December 10, 2018 20:01
@mlangsdorf mlangsdorf changed the title [WIP] Missions: Move some start functions into JSON Missions: Move some start functions into JSON Dec 10, 2018
src/mission_start.cpp Outdated Show resolved Hide resolved
src/dialogue.h Outdated
*/
struct talk_response {
struct effect_t {
Copy link
Contributor

Choose a reason for hiding this comment

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

This in the global scope can be a bit confusing as there are already completely unrelated classes effect_type and effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to talk_effect_t and talk_effect_fun_t, thanks for pointing that out.

doc/VEHICLES_CODE.md Outdated Show resolved Hide resolved
src/mission.h Outdated Show resolved Hide resolved
mlangsdorf and others added 3 commits December 13, 2018 08:30
In order to move mission start functions into JSON, it would be
useful to be have access to the dialogue system's effect
infrastructure.  Move that code outside of talk_response:: and
to the top level.
start adding the infrastructure to move the mission "start" value
from hardcoded C++ functions to a more flexible JSON interface.

As a first step, add a way to invoke dialogue effects.  Also add
a way to call the reveal overmap terrain and target overmap
terrain functions.

Fix the MGOAL_KILL_MONSTER_TYPE and MGOAL_KILL_MONSTER_SPECIES
goals to not need a hardcoded function to set the goal count.
Now that these mission start functions are replaced by generic JSON,
they can be removed.
@ZhilkinSerg ZhilkinSerg self-assigned this Dec 14, 2018
@kevingranade kevingranade merged commit a60280a into CleverRaven:master Dec 15, 2018
@ZhilkinSerg ZhilkinSerg removed their assignment Dec 15, 2018
@mlangsdorf mlangsdorf deleted the missionstart_json_1 branch December 15, 2018 13:35
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` [JSON] Changes (can be) made in JSON Missions Quests and missions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants