Create 'push_initiate_invite' function

This commit is contained in:
Dr. Dystopia 2022-01-26 21:23:37 +01:00
parent 027154a5be
commit b0d6a68e8c
2 changed files with 6 additions and 8 deletions

View File

@ -288,6 +288,10 @@ impl Controller {
self.push_event(ControlEvent::InviteResponse(invite_response));
}
pub fn push_initiate_invite(&mut self, uid: Uid, invite: InviteKind) {
self.push_event(ControlEvent::InitiateInvite(uid, invite));
}
pub fn push_action(&mut self, action: ControlAction) { self.actions.push(action); }
pub fn push_basic_input(&mut self, input: InputKind) {

View File

@ -1015,10 +1015,7 @@ impl<'a> AgentData<'a> {
self.chat_npc(msg, event_emitter);
} else if agent.behavior.can_trade() {
if !agent.behavior.is(BehaviorState::TRADING) {
controller.push_event(ControlEvent::InitiateInvite(
by,
InviteKind::Trade,
));
controller.push_initiate_invite(by, InviteKind::Trade);
self.chat_npc(
"npc.speech.merchant_advertisement",
event_emitter,
@ -1036,10 +1033,7 @@ impl<'a> AgentData<'a> {
Subject::Trade => {
if agent.behavior.can_trade() {
if !agent.behavior.is(BehaviorState::TRADING) {
controller.push_event(ControlEvent::InitiateInvite(
by,
InviteKind::Trade,
));
controller.push_initiate_invite(by, InviteKind::Trade);
self.chat_npc(
"npc.speech.merchant_advertisement",
event_emitter,