Merge branch 'ubruntu/npcs-ignore-when-busy' into 'master'

Prevent NPCs from being chat spammed

Closes #1301

See merge request veloren/veloren!2780
This commit is contained in:
Marcel 2021-08-23 07:48:34 +00:00
commit 30c446f8ee

View File

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