After rethinking the problem and the logic the conclusion is:
the first idea was correct (and the comparator direction). I have added yet some code to depand the shoot back time on the current bot's aggression level. Finaly - after limited testing time - the code should look like this:
PHP Code:
if (!FNullEnt (tr.pHit))
{
i = ENTINDEX (tr.pHit) - 1;
if ((i >= 0) && (i < gpGlobals->maxClients)) // KWo - 13.03.2006
{
if ((clients[i].iTeam == pBot->bot_team)
&& ((pEdict->v.dmg_inflictor != clients[i].pEdict) || ((pEdict->v.dmgtime + 1.5 * pBot->fAgressionLevel) <= gpGlobals->time))
&& ((clients[i].iFlags & CLIENT_ALIVE) || (clients[i].fDeathTime >= gpGlobals->time))) // KWo - 13.06.2018
{
if (g_b_DebugCombat)
ALERT (at_logged,"[DEBUG] FireHurtsFriend - Bot %s cannot fire because it may hurt its friend %s (1).\n", pBot->name, STRING (clients[i].pEdict->v.netname));
return (TRUE);
}
}
}
Sorry for confusion and the useless work with compliling and uploading binaries. The code should be tested first by the author, then - by users. Unfortunately I don't have enough time to do it so.
I have also added a code to increase the bot aggessivity when the teamnate is shooting at it. In botclient.cpp in the function BotClient_CS_Damage
PHP Code:
if ((UTIL_GetTeam (pEnt) == pBot->bot_team) && (!g_b_cv_ffa)) // KWo - 05.10.2006
{
// FIXFIXFIXFIXFIXME: THIS IS BLATANTLY CHEATING!!!!
// KWo - No - it's when Your teamnate is attacking You, then the bot may consider You as an enemy
// but BotHurtsFriends function doesn't let him to shoot at You...
if (RANDOM_LONG (1, 100) < 10)
{
if (FNullEnt (pBot->pLastEnemy) && FNullEnt (pBot->pBotEnemy)
&& (pBot->f_bot_see_enemy_time + 3.0 < gpGlobals->time)
&& (pBot->f_blind_time < gpGlobals->time)) // KWo - 23.03.2008
{
// pBot->iAimFlags |= AIM_ENEMY; // KWo - 27.08.2006
// pBot->iAimFlags |= AIM_LASTENEMY; // KWo - 27.08.2006
pBot->f_heard_sound_time = gpGlobals->time;
// pBot->pBotEnemy = pEnt;
pBot->pLastEnemy = pEnt;
pBot->vecLastEnemyOrigin = pEnt->v.origin;
pBot->vecLastEnemyOrigin.x += RANDOM_FLOAT(-200.0,200.0); // KWo - 12.08.2007
pBot->vecLastEnemyOrigin.y += RANDOM_FLOAT(-200.0,200.0); // KWo - 12.08.2007
pBot->fLastHeardEnOrgUpdateTime = gpGlobals->time + 1.0;
pBot->fAgressionLevel += 0.1; // KWo - 14.06.2018
if (pBot->fAgressionLevel > 1.0) // KWo - 14.06.2018
pBot->fAgressionLevel = 1.0;
}
}
}
That should do the job correctly.