fix agent aggression when not recieving damage from attack

This commit is contained in:
Isse 2022-07-13 19:46:48 +02:00
parent 80d491f003
commit 9edfbaa29d

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))
}