-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Missions: Move some start functions into JSON #27037
Conversation
c4404b3
to
5a98da9
Compare
src/dialogue.h
Outdated
*/ | ||
struct talk_response { | ||
struct effect_t { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
5a98da9
to
5ce3921
Compare
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.
5ce3921
to
ffbbb44
Compare
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.