Merge branch 'isse/agent-aggro-fix' into 'master'

Fix agent aggression when not recieving damage from attack

Closes #1597

See merge request veloren/veloren!3473
This commit is contained in:
Isse 2022-07-13 21:01:26 +00:00
commit 4bcf7c7010

View File

@ -198,6 +198,7 @@ pub fn get_attacker(entity: EcsEntity, read_data: &ReadData) -> Option<EcsEntity
read_data
.healths
.get(entity)
.filter(|health| health.last_change.amount < 0.0)
.and_then(|health| health.last_change.damage_by())
.and_then(|damage_contributor| get_entity_by_id(damage_contributor.uid().0, read_data))
}