Skip to content

Commit a6368f0

Browse files
ti360ghMaleclypsegithub-actions[bot]
authored
JSONize mission-related topic IDs (TALK_MISSION_INQUIRE / TALK_MISSION_DESCRIBE_URGENT) (#82879)
* add custom mission_inquire/mission_describe_urgent * documentation * Update src/npc.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Maleclypse <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 231a2e5 commit a6368f0

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

doc/JSON/NPCs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ Field | Default topic ID | Uses for...
222222
`talk_stranger_wary` | `TALK_STRANGER_WARY` | see "success and failure" section
223223
`talk_stranger_friendly` | `TALK_STRANGER_FRIENDLY` | see "success and failure" section
224224
`talk_stranger_neutral` | `TALK_STRANGER_NEUTRAL` | see "success and failure" section
225+
`talk_mission_inqure` | `TALK_MISSION_INQUIRE` | see [the missions docs](MISSIONS_JSON.md)
226+
`talk_mission_describe_urgent` | `TALK_MISSION_DESCRIBE_URGENT` | see [the missions docs](MISSIONS_JSON.md)
225227

226228
---
227229

src/dialogue_chatbin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ struct dialogue_chatbin {
7676
std::string talk_stranger_friendly = "TALK_STRANGER_FRIENDLY";
7777
std::string talk_stranger_neutral = "TALK_STRANGER_NEUTRAL";
7878
std::string talk_friend_guard = "TALK_FRIEND_GUARD";
79+
std::string talk_mission_inquire = "TALK_MISSION_INQUIRE";
80+
std::string talk_mission_describe_urgent = "TALK_MISSION_DESCRIBE_URGENT";
7981
};
8082

8183
struct dialogue_chatbin_snippets {

src/npc.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ void npc_template::load( const JsonObject &jsobj, std::string_view src )
385385
if( jsobj.has_string( "talk_friend_guard" ) ) {
386386
guy.chatbin.talk_friend_guard = jsobj.get_string( "talk_friend_guard" );
387387
}
388+
if( jsobj.has_string( "talk_mission_inquire" ) ) {
389+
guy.chatbin.talk_mission_inquire = jsobj.get_string( "talk_mission_inquire" );
390+
}
391+
if( jsobj.has_string( "talk_mission_describe_urgent" ) ) {
392+
guy.chatbin.talk_mission_describe_urgent = jsobj.get_string( "talk_mission_describe_urgent" );
393+
}
388394
jsobj.read( "<acknowledged>", tem.snippets.snip_acknowledged );
389395
jsobj.read( "<camp_food_thanks>", tem.snippets.snip_camp_food_thanks );
390396
jsobj.read( "<camp_larder_empty>", tem.snippets.snip_camp_larder_empty );
@@ -565,6 +571,8 @@ void npc::load_npc_template( const string_id<npc_template> &ident )
565571
chatbin.talk_stranger_friendly = tguy.chatbin.talk_stranger_friendly;
566572
chatbin.talk_stranger_neutral = tguy.chatbin.talk_stranger_neutral;
567573
chatbin.talk_friend_guard = tguy.chatbin.talk_friend_guard;
574+
chatbin.talk_mission_inquire = tguy.chatbin.talk_mission_inquire;
575+
chatbin.talk_mission_describe_urgent = tguy.chatbin.talk_mission_describe_urgent;
568576

569577
for( const mission_type_id &miss_id : tguy.miss_ids ) {
570578
add_new_mission( mission::reserve_new( miss_id, getID() ) );

src/npctalk.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8743,7 +8743,9 @@ std::string const &npc::get_specified_talk_topic( std::string const &topic_id )
87438743
{default_chatbin.talk_stranger_wary, chatbin.talk_stranger_wary},
87448744
{default_chatbin.talk_stranger_friendly, chatbin.talk_stranger_friendly},
87458745
{default_chatbin.talk_stranger_neutral, chatbin.talk_stranger_neutral},
8746-
{default_chatbin.talk_friend_guard, chatbin.talk_friend_guard}
8746+
{default_chatbin.talk_friend_guard, chatbin.talk_friend_guard},
8747+
{default_chatbin.talk_mission_inquire, chatbin.talk_mission_inquire},
8748+
{default_chatbin.talk_mission_describe_urgent, chatbin.talk_mission_describe_urgent}
87478749
};
87488750

87498751
const auto iter = std::find_if( talk_topics.begin(), talk_topics.end(),

src/talker_npc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ std::vector<std::string> talker_npc::get_topics( bool radio_contact ) const
130130
for( mission *&mission : me_npc->chatbin.missions ) {
131131
const mission_type &type = mission->get_type();
132132
if( type.urgent && type.difficulty > most_difficult_mission ) {
133-
add_topics.emplace_back( "TALK_MISSION_DESCRIBE_URGENT" );
133+
add_topics.emplace_back( me_npc->chatbin.talk_mission_describe_urgent );
134134
me_npc->chatbin.mission_selected = mission;
135135
most_difficult_mission = type.difficulty;
136136
}
@@ -146,7 +146,7 @@ std::vector<std::string> talker_npc::get_topics( bool radio_contact ) const
146146
if( ( type.urgent && !chosen_urgent ) || ( type.difficulty > most_difficult_mission &&
147147
( type.urgent || !chosen_urgent ) ) ) {
148148
chosen_urgent = type.urgent;
149-
add_topics.emplace_back( "TALK_MISSION_INQUIRE" );
149+
add_topics.emplace_back( me_npc->chatbin.talk_mission_inquire );
150150
me_npc->chatbin.mission_selected = mission;
151151
most_difficult_mission = type.difficulty;
152152
}

0 commit comments

Comments
 (0)