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

Dialogue: JSON fields for displaying hidden responses #76804

Merged
merged 2 commits into from
Oct 5, 2024

Conversation

ShnitzelX2
Copy link
Contributor

@ShnitzelX2 ShnitzelX2 commented Oct 3, 2024

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 confuse show_condition with condition. 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 or show_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 for show_always, show_reason, and show_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
all_resp1_1

toggling responses off
all_resp2_1

An example of show_condition/show_reason
all_resp3_1

includes debug support to toggle hidden conditions on/off
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs <Bugfix> This is a fix for a bug (or closes open issue) <Enhancement / Feature> New features, or enhancements on existing json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Oct 3, 2024
@PatrikLundell
Copy link
Contributor

I assume the show_always case doesn't actually disable access to the option unless debug_mode is on, but rather disables access only if conditions evaluate to false and debug mode is off. Thus, the text may need some adjustment.

Ditto for show_condition.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 4, 2024
@Maleclypse Maleclypse merged commit 6815c0c into CleverRaven:master Oct 5, 2024
23 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialogue option to display hidden response items
3 participants