mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 21:08:28 +00:00
if ped has no weapon or no ammo, stop attacking and go to leader
This commit is contained in:
parent
51545ef571
commit
dad217f9b2
1 changed files with 10 additions and 7 deletions
|
@ -46,6 +46,16 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
if (null == this.LeaderPed)
|
||||
return;
|
||||
|
||||
_chaseState.ChooseBestWeapon();
|
||||
|
||||
if (null == _ped.CurrentWeapon)
|
||||
{
|
||||
// we have no weapon to attack with, or no ammo
|
||||
// remove current target and go to leader
|
||||
_currentlyEngagedPed = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// try to find new target, or remove the current one if needed
|
||||
if (this.IsFarAwayFromLeader())
|
||||
{
|
||||
|
@ -117,13 +127,6 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
|
|||
if (this.MyPed.IsInVehicle || this.LeaderPed.IsInVehicle)
|
||||
this.UpdateFollowing_MovementPart();
|
||||
|
||||
// this we do every frame: if we are close enough to leader and have no target, find one.
|
||||
// this is done so that we quickly choose another target after previous one was killed.
|
||||
if (!this.IsFarAwayFromLeader() && null == _currentlyEngagedPed)
|
||||
{
|
||||
_currentlyEngagedPed = this.GetNextPedToAttack();
|
||||
}
|
||||
|
||||
// update attacking or following
|
||||
|
||||
if (_currentlyEngagedPed != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue