Check for existing target before initiating interaction

This commit is contained in:
Bryant Deters 2021-08-21 22:28:26 -05:00
parent 4d62b9b937
commit 5983c87120

View File

@ -87,12 +87,14 @@ pub fn handle_npc_interaction(server: &mut Server, interactor: EcsEntity, npc_en
.write_storage::<comp::Agent>() .write_storage::<comp::Agent>()
.get_mut(npc_entity) .get_mut(npc_entity)
{ {
if agent.target.is_none() {
if let Some(interactor_uid) = state.ecs().uid_from_entity(interactor) { if let Some(interactor_uid) = state.ecs().uid_from_entity(interactor) {
agent agent
.inbox .inbox
.push_back(AgentEvent::Talk(interactor_uid, Subject::Regular)); .push_back(AgentEvent::Talk(interactor_uid, Subject::Regular));
} }
} }
}
} }
/// FIXME: Make mounting more robust, avoid bidirectional links. /// FIXME: Make mounting more robust, avoid bidirectional links.