Skip to content

Commit

Permalink
disable map optimizations for playerbots if sPlayerbotAIConfig.disabl…
Browse files Browse the repository at this point in the history
…eBotOptimizations (default off - optimizations enabled) to allow full activity at all times
  • Loading branch information
Redbu11 authored and killerwife committed Nov 12, 2024
1 parent f8fe0a8 commit dc062a5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,14 @@ void Map::Update(const uint32& t_diff)
plr->Update(t_diff);

#ifdef ENABLE_PLAYERBOTS
plr->UpdateAI(t_diff, !shouldUpdateBot);
if (sPlayerbotAIConfig.disableBotOptimizations)
{
plr->UpdateAI(t_diff, false);
}
else
{
plr->UpdateAI(t_diff, !shouldUpdateBot);
}
#endif
}
}
Expand All @@ -881,7 +888,7 @@ void Map::Update(const uint32& t_diff)

#ifdef ENABLE_PLAYERBOTS
// For non-players only load the grid
if (!player->isRealPlayer())
if (!sPlayerbotAIConfig.disableBotOptimizations && !player->isRealPlayer())
{
CellPair center = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()).normalize();
uint32 cell_id = (center.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + center.x_coord;
Expand Down Expand Up @@ -938,7 +945,7 @@ void Map::Update(const uint32& t_diff)

#ifdef ENABLE_PLAYERBOTS
// Skip objects on locations away from real players if world is laggy
if (IsContinent() && avgDiff > 100)
if (!sPlayerbotAIConfig.disableBotOptimizations && IsContinent() && avgDiff > 100)
{
const bool isInActiveZone = IsContinent() ? HasActiveZone(obj->GetZoneId()) : HasRealPlayers();
if (!isInActiveZone && !shouldUpdateObjects)
Expand Down Expand Up @@ -1415,7 +1422,7 @@ void Map::UpdateObjectVisibility(WorldObject* obj, Cell cell, const CellPair& ce
if (Player* player = GetPlayer(guid))
{
#ifdef ENABLE_PLAYERBOTS
if (player->isRealPlayer())
if (sPlayerbotAIConfig.disableBotOptimizations || player->isRealPlayer())
#endif
player->UpdateVisibilityOf(player->GetCamera().GetBody(), obj);
}
Expand Down

0 comments on commit dc062a5

Please sign in to comment.