fix: allow to plant bomb only when icon blinking (ref #323)

fix: random bots shoots and enemy ignorance on es_industrial (ref #323)
This commit is contained in:
jeefo 2024-02-27 12:31:37 +03:00
commit 9201daf9f9
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
8 changed files with 19 additions and 14 deletions

@ -1 +1 @@
Subproject commit 12a6dbd1388052c0d98cd892ccd9d61e6b043854 Subproject commit 49b1311349cdb002c7630e6d00d62eb9f5bcd010

View file

@ -29,7 +29,7 @@ public:
public: public:
using Planes = Plane[static_cast <int> (PlaneSide::Num)]; using Planes = Plane[static_cast <int> (PlaneSide::Num)];
private: public:
static constexpr float kFov = 75.0f; static constexpr float kFov = 75.0f;
static constexpr float kAspectRatio = 16.0f / 9.0f; static constexpr float kAspectRatio = 16.0f / 9.0f;
static constexpr float kMaxViewDistance = 4096.0f; static constexpr float kMaxViewDistance = 4096.0f;

View file

@ -1012,7 +1012,7 @@ void Bot::checkMsgQueue () {
} }
// prevent terrorists from buying on es maps // prevent terrorists from buying on es maps
if (game.mapIs (MapFlags::Escape) && m_team == Team::Terrorist) { if (game.mapIs (MapFlags::Escape) && m_team == Team::Terrorist && !m_inBuyZone) {
m_buyState = BuyState::Done; m_buyState = BuyState::Done;
} }
@ -3475,7 +3475,12 @@ void Bot::takeBlind (int alpha) {
// this function gets called by network message handler, when screenfade message get's send // this function gets called by network message handler, when screenfade message get's send
// it's used to make bot blind from the grenade. // it's used to make bot blind from the grenade.
m_maxViewDistance = rg.get (10.0f, 20.0f); m_viewDistance = rg.get (10.0f, 20.0f);
// do not take in effect some unique map effects on round start
if (bots.getRoundStartTime () + 5.0f < game.time ()) {
m_viewDistance = m_maxViewDistance;
}
m_blindTime = game.time () + static_cast <float> (alpha - 200) / 16.0f; m_blindTime = game.time () + static_cast <float> (alpha - 200) / 16.0f;
if (m_blindTime < game.time ()) { if (m_blindTime < game.time ()) {

View file

@ -327,7 +327,7 @@ bool Bot::lookupEnemies () {
continue; continue;
} }
// extra skill player can see thru smoke... if beeing attacked // extra skill player can see through smoke... if being attacked
if (cv_whose_your_daddy.bool_ () && (player->v.button & (IN_ATTACK | IN_ATTACK2)) && m_viewDistance < m_maxViewDistance) { if (cv_whose_your_daddy.bool_ () && (player->v.button & (IN_ATTACK | IN_ATTACK2)) && m_viewDistance < m_maxViewDistance) {
nearestDistanceSq = cr::sqrf (m_maxViewDistance); nearestDistanceSq = cr::sqrf (m_maxViewDistance);
} }

View file

@ -9,10 +9,10 @@
ConVar cv_version ("version", product.version.chars (), Var::ReadOnly); ConVar cv_version ("version", product.version.chars (), Var::ReadOnly);
gamefuncs_t dllapi; gamefuncs_t dllapi {};
newgamefuncs_t newapi; newgamefuncs_t newapi {};
enginefuncs_t engfuncs; enginefuncs_t engfuncs {};
gamedll_funcs_t dllfuncs; gamedll_funcs_t dllfuncs {};
meta_globals_t *gpMetaGlobals = nullptr; meta_globals_t *gpMetaGlobals = nullptr;
gamedll_funcs_t *gpGamedllFuncs = nullptr; gamedll_funcs_t *gpGamedllFuncs = nullptr;

View file

@ -1265,7 +1265,7 @@ int BotManager::getPlayerPriority (edict_t *ent) {
} }
// give bots some priority // give bots some priority
if (bot->m_hasC4 || bot->m_isVIP || bot->m_hasHostage || bot->m_healthValue < ent->v.health) { if (bot->m_hasC4 || bot->m_isVIP || bot->m_hasHostage || bot->m_healthValue < ent->v.health || (bot->m_currentTravelFlags & PathFlag::Jump)) {
return bot->entindex () + kHighPriority; return bot->entindex () + kHighPriority;
} }
auto task = bot->getCurrentTaskId (); auto task = bot->getCurrentTaskId ();
@ -1452,8 +1452,8 @@ void Bot::newRound () {
m_changeViewTime = game.time () + (rg.chance (25) ? mp_freezetime.float_ () : 0.0f); m_changeViewTime = game.time () + (rg.chance (25) ? mp_freezetime.float_ () : 0.0f);
m_aimErrorTime = game.time (); m_aimErrorTime = game.time ();
m_viewDistance = 4096.0f; m_viewDistance = Frustum::kMaxViewDistance;
m_maxViewDistance = 4096.0f; m_maxViewDistance = Frustum::kMaxViewDistance;
m_liftEntity = nullptr; m_liftEntity = nullptr;
m_pickupItem = nullptr; m_pickupItem = nullptr;

View file

@ -264,7 +264,7 @@ AStarResult AStarAlgo::find (int botTeam, int srcIndex, int destIndex, NodeAdder
auto rsRandomizer = 1.0f; auto rsRandomizer = 1.0f;
// randomize path on round start now and then // randomize path on round start now and then
if (cv_path_randomize_on_round_start.bool_ () && bots.getRoundStartTime () + mp_freezetime.float_ () + 2.0f > game.time ()) { if (cv_path_randomize_on_round_start.bool_ () && bots.getRoundStartTime () + 4.0f > game.time ()) {
rsRandomizer = rg.get (0.5f, static_cast <float> (botTeam) * 2.0f + 5.0f); rsRandomizer = rg.get (0.5f, static_cast <float> (botTeam) * 2.0f + 5.0f);
} }

View file

@ -176,7 +176,7 @@ void Bot::normal_ () {
pushChatterMessage (Chatter::GoingToGuardVIPSafety); // play info about that pushChatterMessage (Chatter::GoingToGuardVIPSafety); // play info about that
} }
} }
else if (game.mapIs (MapFlags::Demolition) && ((m_pathFlags & NodeFlag::Goal) || m_inBombZone)) { else if (game.mapIs (MapFlags::Demolition) && ((m_pathFlags & NodeFlag::Goal) && m_inBombZone)) {
// is it a terrorist carrying the bomb? // is it a terrorist carrying the bomb?
if (m_hasC4) { if (m_hasC4) {
if ((m_states & Sense::SeeingEnemy) && numFriendsNear (pev->origin, 768.0f) == 0) { if ((m_states & Sense::SeeingEnemy) && numFriendsNear (pev->origin, 768.0f) == 0) {