mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Allow AI to shoot with lower aim if out of AP for current aim level
This commit is contained in:
@@ -2299,6 +2299,17 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
|||||||
usHandItem = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]);
|
usHandItem = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]);
|
||||||
|
|
||||||
iRetCode = HandleItem( pSoldier, pSoldier->aiData.usActionData, pSoldier->bTargetLevel, usHandItem, FALSE );
|
iRetCode = HandleItem( pSoldier, pSoldier->aiData.usActionData, pSoldier->bTargetLevel, usHandItem, FALSE );
|
||||||
|
// If AI cannot shoot because of lack of APs, attempt to try again with lower aim.
|
||||||
|
// Usually happens when they have to turn before shooting. Without this, the game would cancel soldier's whole turn
|
||||||
|
if (iRetCode == ITEM_HANDLE_NOAPS && pSoldier->aiData.bAimTime > 0)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
pSoldier->aiData.bAimTime -= 1;
|
||||||
|
iRetCode = HandleItem(pSoldier, pSoldier->aiData.usActionData, pSoldier->bTargetLevel, usHandItem, FALSE);
|
||||||
|
} while (iRetCode == ITEM_HANDLE_NOAPS && pSoldier->aiData.bAimTime > 0);
|
||||||
|
}
|
||||||
|
|
||||||
if ( iRetCode != ITEM_HANDLE_OK)
|
if ( iRetCode != ITEM_HANDLE_OK)
|
||||||
{
|
{
|
||||||
if ( iRetCode != ITEM_HANDLE_BROKEN ) // if the item broke, this is 'legal' and doesn't need reporting
|
if ( iRetCode != ITEM_HANDLE_BROKEN ) // if the item broke, this is 'legal' and doesn't need reporting
|
||||||
|
|||||||
Reference in New Issue
Block a user