BotLib: Attempt to duck when we're between 512 and 1024 units

This commit is contained in:
Marco Cawthorne 2021-05-16 23:08:41 +02:00
parent 448b9bd20d
commit fbbcfd5d5f
1 changed files with 7 additions and 1 deletions

View File

@ -404,13 +404,19 @@ bot::RunAI(void)
}
/* now we'll set the movevalues relative to the input_angle */
if (m_iCurNode >= 0 && m_pRoute[m_iCurNode].m_iFlags & LF_WALK)
if ((m_iCurNode >= 0 && m_pRoute[m_iCurNode].m_iFlags & LF_WALK) || m_eTarget && enemyvisible && vlen(aimpos-origin) < 512)
vecDirection = normalize(aimpos - origin) * 120;
else
vecDirection = normalize(aimpos - origin) * 240;
makevectors(input_angles);
input_movevalues = [v_forward * vecDirection, v_right * vecDirection, v_up * vecDirection];
/* duck and stand still when our enemy is far away */
if (m_eTarget && enemyvisible && vlen(aimpos-origin) > 512) {
input_buttons |= INPUT_BUTTON8;
input_movevalues = [0,0,0];
}
}
/* press any buttons needed */