diff --git a/src/chat.rs b/src/chat.rs index f906d5e..0017807 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -112,6 +112,7 @@ pub struct Talker { pub chat_name: String, pub actor_id: String, pub name: Option, + pub counts_towards_achievement: bool, pub pronoun: Option, pub talking_speed: f32, } @@ -654,8 +655,10 @@ pub fn handle_new_conversations( } match (*chatdb).get_chat_by_id(&event.talker.chat_name) { Ok(chat_id) => { - if let Some(name) = &event.talker.name { - ew_achievement.send(game::AchievementEvent::TalkTo(name.clone())); + if event.talker.counts_towards_achievement { + if let Some(name) = &event.talker.name { + ew_achievement.send(game::AchievementEvent::TalkTo(name.clone())); + } } let mut chat = Chat { internal_id: chat_id, diff --git a/src/cmd.rs b/src/cmd.rs index 5bc99d6..b4d8f73 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -80,6 +80,7 @@ struct ParserState { angular_momentum: DVec3, pronoun: Option, message_on_entry: Option, + chat_counts_towards_achievements: bool, is_sphere: bool, is_player: bool, is_lifeform: bool, @@ -140,6 +141,7 @@ impl Default for ParserState { angular_momentum: DVec3::new(0.03, 0.3, 0.09), pronoun: None, message_on_entry: None, + chat_counts_towards_achievements: true, is_sphere: false, is_player: false, is_lifeform: false, @@ -482,6 +484,9 @@ pub fn load_defs(mut ew_spawn: EventWriter) { ["chatid", chat] => { state.chat = chat.to_string(); } + ["chat_achievement", "no"] => { + state.chat_counts_towards_achievements = false; + } ["scale", scale] => { if let Ok(scale_float) = scale.parse::() { state.model_scale = scale_float; @@ -835,6 +840,9 @@ fn spawn_scenes( // command: chatid OxygenTank state.chat = String::from("OxygenTank"); + // command: chat_achievement no + state.chat_counts_towards_achievements = false; + // command: pointofinterest yes ew_spawn.send(SpawnEvent(state)); } @@ -1082,16 +1090,19 @@ fn spawn_entities( actor.insert(actor::Identifier(state.id.clone())); id2pos.0.insert(state.id.clone(), absolute_pos); } - if !state.chat.is_empty() { + if !state.chat.is_empty() { actor.insert(chat::Talker { actor_id: state.id.clone(), chat_name: state.chat.clone(), name: state.name.clone(), pronoun: state.pronoun.clone(), + counts_towards_achievement: state.chat_counts_towards_achievements, talking_speed: 1.0, }); - if let Some(name) = &state.name { - achievement_tracker.all_people.insert(name.clone()); + if state.chat_counts_towards_achievements { + if let Some(name) = &state.name { + achievement_tracker.all_people.insert(name.clone()); + } } } if state.is_vehicle {