This commit is contained in:
in0finite 2021-09-13 02:04:21 +02:00
parent 8231dd2424
commit 37a7246a71

View file

@ -132,7 +132,7 @@ namespace SanAndreasUnity.Behaviours
}
void OnOtherPedDamaged(Ped otherPed, DamageInfo dmgInfo, Ped.DamageResult dmgResult)
void OnOtherPedDamaged(Ped damagedPed, DamageInfo dmgInfo, Ped.DamageResult dmgResult)
{
Ped attackerPed = dmgInfo.GetAttackerPed();
if (null == attackerPed)
@ -144,17 +144,17 @@ namespace SanAndreasUnity.Behaviours
return;
bool isAttackerPedMember = this.IsMemberOfOurGroup(attackerPed);
bool isDamagedPedMember = this.IsMemberOfOurGroup(otherPed);
bool isDamagedPedMember = this.IsMemberOfOurGroup(damagedPed);
if (attackerPed == this.TargetPed && !isDamagedPedMember && dmgInfo.damageType != DamageType.Explosion)
{
// our leader attacked someone, not as part of explosion
// make that someone our enemy
_enemyPeds.AddIfNotPresent(otherPed);
_enemyPeds.AddIfNotPresent(damagedPed);
return;
}
if (this.TargetPed == otherPed && !isAttackerPedMember)
if (this.TargetPed == damagedPed && !isAttackerPedMember)
{
// our leader was attacked
// his enemies are also our enemies