diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 25ac92a17d..542b66f9f5 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -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) { diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 4ace5ebd7f..787e41faa7 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -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,