added yb_camping_allowed.
partially fixed bot freeze when no ammo left in his guns. now bots' should switch to knife and rush enemy.
This commit is contained in:
parent
4c0c921efc
commit
18b4636500
5 changed files with 28 additions and 30 deletions
|
|
@ -18,6 +18,7 @@ ConVar yb_jasonmode ("yb_jasonmode", "0");
|
||||||
ConVar yb_communication_type ("yb_communication_type", "2");
|
ConVar yb_communication_type ("yb_communication_type", "2");
|
||||||
ConVar yb_economics_rounds ("yb_economics_rounds", "1");
|
ConVar yb_economics_rounds ("yb_economics_rounds", "1");
|
||||||
ConVar yb_walking_allowed ("yb_walking_allowed", "1");
|
ConVar yb_walking_allowed ("yb_walking_allowed", "1");
|
||||||
|
ConVar yb_camping_allowed ("yb_camping_allowed", "1");
|
||||||
|
|
||||||
ConVar yb_tkpunish ("yb_tkpunish", "1");
|
ConVar yb_tkpunish ("yb_tkpunish", "1");
|
||||||
ConVar yb_freeze_bots ("yb_freeze_bots", "0");
|
ConVar yb_freeze_bots ("yb_freeze_bots", "0");
|
||||||
|
|
@ -3051,7 +3052,7 @@ void Bot::RunTask_Normal (void)
|
||||||
PushTask (TASK_SPRAY, TASKPRI_SPRAYLOGO, -1, GetWorldTime () + 1.0f, false);
|
PushTask (TASK_SPRAY, TASKPRI_SPRAYLOGO, -1, GetWorldTime () + 1.0f, false);
|
||||||
|
|
||||||
// reached waypoint is a camp waypoint
|
// reached waypoint is a camp waypoint
|
||||||
if ((m_currentPath->flags & FLAG_CAMP) && !yb_csdm_mode.GetBool ())
|
if ((m_currentPath->flags & FLAG_CAMP) && !yb_csdm_mode.GetBool () && yb_camping_allowed.GetBool ())
|
||||||
{
|
{
|
||||||
// check if bot has got a primary weapon and hasn't camped before
|
// check if bot has got a primary weapon and hasn't camped before
|
||||||
if (HasPrimaryWeapon () && m_timeCamping + 10.0f < GetWorldTime () && !HasHostage ())
|
if (HasPrimaryWeapon () && m_timeCamping + 10.0f < GetWorldTime () && !HasHostage ())
|
||||||
|
|
@ -3497,11 +3498,17 @@ void Bot::RunTask_Blinded (void)
|
||||||
|
|
||||||
void Bot::RunTask_Camp (void)
|
void Bot::RunTask_Camp (void)
|
||||||
{
|
{
|
||||||
|
if (!yb_camping_allowed.GetBool ())
|
||||||
|
{
|
||||||
|
TaskComplete ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_aimFlags |= AIM_CAMP;
|
m_aimFlags |= AIM_CAMP;
|
||||||
m_checkTerrain = false;
|
m_checkTerrain = false;
|
||||||
m_moveToGoal = false;
|
m_moveToGoal = false;
|
||||||
|
|
||||||
if (g_bombPlanted && m_defendedBomb && !IsBombDefusing (waypoints.GetBombPosition ()) && !OutOfBombTimer () && m_team == TEAM_CF)
|
if (m_team == TEAM_CF && g_bombPlanted && m_defendedBomb && !IsBombDefusing (waypoints.GetBombPosition ()) && !OutOfBombTimer ())
|
||||||
{
|
{
|
||||||
m_defendedBomb = false;
|
m_defendedBomb = false;
|
||||||
TaskComplete ();
|
TaskComplete ();
|
||||||
|
|
|
||||||
|
|
@ -906,17 +906,6 @@ WeaponSelectEnd:
|
||||||
m_zoomCheckTime = GetWorldTime ();
|
m_zoomCheckTime = GetWorldTime ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectId != WEAPON_KNIFE && HasPrimaryWeapon () && GetAmmoInClip () <= 0)
|
|
||||||
{
|
|
||||||
if (GetAmmo () <= 0 && !(m_states &= ~(STATE_THROW_HE | STATE_THROW_FB | STATE_THROW_SG)))
|
|
||||||
SelectPistol();
|
|
||||||
|
|
||||||
pev->button |= IN_RELOAD;
|
|
||||||
pev->button &= ~IN_ATTACK;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to care for burst fire?
|
// need to care for burst fire?
|
||||||
if (distance < 256.0f || m_blindTime > GetWorldTime ())
|
if (distance < 256.0f || m_blindTime > GetWorldTime ())
|
||||||
{
|
{
|
||||||
|
|
@ -934,7 +923,7 @@ WeaponSelectEnd:
|
||||||
{
|
{
|
||||||
LookupEnemy ();
|
LookupEnemy ();
|
||||||
|
|
||||||
if (selectTab[chosenWeaponIndex].primaryFireHold && m_ammo[g_weaponDefs[selectTab[selectIndex].id].ammo1] >= selectTab[selectIndex].minPrimaryAmmo) // if automatic weapon, just press attack
|
if (selectTab[chosenWeaponIndex].primaryFireHold && m_ammo[g_weaponDefs[selectTab[selectIndex].id].ammo1] > selectTab[selectIndex].minPrimaryAmmo) // if automatic weapon, just press attack
|
||||||
pev->button |= IN_ATTACK;
|
pev->button |= IN_ATTACK;
|
||||||
else // if not, toggle buttons
|
else // if not, toggle buttons
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,21 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (stricmp (arg0, "bot_takedamage") == 0 && !IsNullString (arg1))
|
||||||
|
{
|
||||||
|
bool isOn = !!(atoi (arg1) == 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < GetMaxClients (); i++)
|
||||||
|
{
|
||||||
|
Bot *bot = bots.GetBot (i);
|
||||||
|
|
||||||
|
if (bot != NULL)
|
||||||
|
{
|
||||||
|
bot->pev->takedamage = isOn ? 0.0f : 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// displays main bot menu
|
// displays main bot menu
|
||||||
else if (stricmp (arg0, "botmenu") == 0 || stricmp (arg0, "menu") == 0)
|
else if (stricmp (arg0, "botmenu") == 0 || stricmp (arg0, "menu") == 0)
|
||||||
DisplayMenuToClient (ent, &g_menus[0]);
|
DisplayMenuToClient (ent, &g_menus[0]);
|
||||||
|
|
@ -1410,7 +1425,7 @@ void ClientCommand (edict_t *ent)
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
if (waypoints.NodesValid ())
|
if (waypoints.NodesValid ())
|
||||||
CenterPrint ("Nodes work Find");
|
CenterPrint ("Nodes works fine");
|
||||||
else
|
else
|
||||||
CenterPrint ("There are errors, see console");
|
CenterPrint ("There are errors, see console");
|
||||||
break;
|
break;
|
||||||
|
|
@ -3018,20 +3033,6 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
||||||
convars.PushRegisteredConVarsToEngine ();
|
convars.PushRegisteredConVarsToEngine ();
|
||||||
|
|
||||||
#ifdef PLATFORM_ANDROID
|
#ifdef PLATFORM_ANDROID
|
||||||
// ensure data & learned directory are created (as we can download waypoints from the net), do this
|
|
||||||
// only under the android platform, in case user forget to install bot extras into the mod directory
|
|
||||||
|
|
||||||
const char *path = GetWaypointDir ();
|
|
||||||
|
|
||||||
// ensure data path exists
|
|
||||||
CreatePath (const_cast <char *> (path));
|
|
||||||
|
|
||||||
char learnedPath[256];
|
|
||||||
snprintf (learnedPath, SIZEOF_CHAR (learnedPath), "%s/learned", path);
|
|
||||||
|
|
||||||
// ensure data/learned path exists
|
|
||||||
CreatePath (learnedPath);
|
|
||||||
|
|
||||||
g_gameVersion = CSV_OLD; // temporary, until opensource client dll get BotVoice message
|
g_gameVersion = CSV_OLD; // temporary, until opensource client dll get BotVoice message
|
||||||
|
|
||||||
if (g_isMetamod)
|
if (g_isMetamod)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ void BotManager::TouchWithKillerEntity (Bot *bot)
|
||||||
MDLL_ClientKill (bot->GetEntity ());
|
MDLL_ClientKill (bot->GetEntity ());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_killerEntity->v.classname = MAKE_STRING (g_weaponDefs[bot->m_currentWeapon].className);
|
m_killerEntity->v.classname = MAKE_STRING (g_weaponDefs[bot->m_currentWeapon].className);
|
||||||
m_killerEntity->v.dmg_inflictor = bot->GetEntity ();
|
m_killerEntity->v.dmg_inflictor = bot->GetEntity ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue