From 36d3cfcd7eb9485adc2d1d49ce7869755f820b08 Mon Sep 17 00:00:00 2001 From: in0finite Date: Mon, 13 Sep 2021 01:51:36 +0200 Subject: [PATCH] make enemies of peds which are attacked by our leader --- Assets/Scripts/Behaviours/Ped/PedAI.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Scripts/Behaviours/Ped/PedAI.cs b/Assets/Scripts/Behaviours/Ped/PedAI.cs index abbfac43..15f52286 100644 --- a/Assets/Scripts/Behaviours/Ped/PedAI.cs +++ b/Assets/Scripts/Behaviours/Ped/PedAI.cs @@ -140,6 +140,17 @@ namespace SanAndreasUnity.Behaviours if (this.Action == PedAIAction.Following) { + if (null == this.TargetPed) // we are not in a group + return; + + if (attackerPed == this.TargetPed && !this.IsMemberOfOurGroup(otherPed) && dmgInfo.damageType != DamageType.Explosion) + { + // our leader attacked someone, not as part of explosion + // make that someone our enemy + _enemyPeds.AddIfNotPresent(otherPed); + return; + } + if (this.IsMemberOfOurGroup(attackerPed)) return;