Create 'push_invite_response' function

This commit is contained in:
Dr. Dystopia 2022-01-26 21:16:29 +01:00
parent 0516526985
commit 027154a5be
2 changed files with 7 additions and 4 deletions

View File

@ -284,6 +284,10 @@ impl Controller {
self.push_event(ControlEvent::Utterance(utterance));
}
pub fn push_invite_response(&mut self, invite_response: InviteResponse) {
self.push_event(ControlEvent::InviteResponse(invite_response));
}
pub fn push_action(&mut self, action: ControlAction) { self.actions.push(action); }
pub fn push_basic_input(&mut self, input: InputKind) {

View File

@ -1173,12 +1173,11 @@ impl<'a> AgentData<'a> {
agent.target =
Some(Target::new(target, false, read_data.time.0, false));
}
controller.push_event(ControlEvent::InviteResponse(InviteResponse::Accept));
controller.push_invite_response(InviteResponse::Accept);
agent.behavior.unset(BehaviorState::TRADING_ISSUER);
agent.behavior.set(BehaviorState::TRADING);
} else {
controller
.push_event(ControlEvent::InviteResponse(InviteResponse::Decline));
controller.push_invite_response(InviteResponse::Decline);
self.chat_npc_if_allowed_to_speak(
"npc.speech.merchant_busy",
agent,
@ -1187,7 +1186,7 @@ impl<'a> AgentData<'a> {
}
} else {
// TODO: Provide a hint where to find the closest merchant?
controller.push_event(ControlEvent::InviteResponse(InviteResponse::Decline));
controller.push_invite_response(InviteResponse::Decline);
self.chat_npc_if_allowed_to_speak(
"npc.speech.villager_decline_trade",
agent,