Dialogue: JSON fields for displaying hidden responses #76804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Features "dialogue: JSON fields for displaying hidden responses"
Purpose of change
Closes #56925
Describe the solution
Fully implemented as described. There are three new JSON fields for responses, and debug support for showing all hidden responses. Quoting the docs I updated for an easy summary:
show_condition
An optional key that, if defined and evaluates to true, will allow the response to be displayed even if it has a condition evaluating false. The response still will not be selectable if its condition is false, unless debug mode is ON. Cannot be defined if
show_always: true
. Note: do not confuseshow_condition
withcondition
. Empty by default.show_always
Shorthand for "show_condition": takes a boolean instead of a condition. False by default.
show_reason
An optional key that, if defined, will append its contents to the end of a response displayed because of
show_always
orshow_condition
.Also fixes an apparent segfault bug from #76681
Describe alternatives you've considered
#76792 was my initial attempt and broke npc_talk_test.cpp, which was not ideal. This PR is smaller and less convoluted, and doesn't break any tests.
Testing
I wrote some new
talk_topic
test cases forshow_always
,show_reason
, andshow_conditional
, made sure they work.I also made sure that talking to NPCs, Rubik, and Hub01 was normal. Made sure my last debug PR was compatible with this one; as with that PR, this functionality is not exhaustively tested by any means.
Additional context
Talking to Rubik, all responses shown
toggling responses off
An example of show_condition/show_reason