Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/game/server/neo/bot/neo_bot_path_cost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CNEOBotPathCost::CNEOBotPathCost(CNEOBot* me, RouteType routeType)
m_maxJumpHeight = me->GetLocomotionInterface()->GetMaxJumpHeight();
m_maxDropHeight = me->GetLocomotionInterface()->GetDeathDropHeight();
m_bIgnoreReservations = !neo_bot_path_reservation_enable.GetBool();
m_bIgnoreHazards = (me->m_hCommandingPlayer.Get() != nullptr);
}

//-------------------------------------------------------------------------------------------------
Expand All @@ -61,7 +62,7 @@ float CNEOBotPathCost::operator()(CNavArea* baseArea, CNavArea* fromArea, const
return -1.0f;
}

if ( CNEOBotPathReservations()->IsAreaHazardous(area->GetID(), m_me) )
if ( !m_bIgnoreHazards && CNEOBotPathReservations()->IsAreaHazardous(area->GetID(), m_me) )
{
if ( m_routeType == DEFAULT_ROUTE )
{
Expand Down
1 change: 1 addition & 0 deletions src/game/server/neo/bot/neo_bot_path_cost.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CNEOBotPathCost : public IPathCost
bool m_bIgnoreReservations;

private:
bool m_bIgnoreHazards;
CNEOBot* m_me;
RouteType m_routeType;
float m_stepHeight;
Expand Down
8 changes: 8 additions & 0 deletions src/game/server/neo/bot/neo_bot_path_reservation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ void CNEOBotPathReservationSystem::AddDeadlyHazard(int navAreaID, float expireTi
HazardInfo blank;
blank.hazardExpireTime = expireTime;
blank.smokeExpireTime = 0.0f;
blank.smokePropagateTime = 0.0f;
index = m_HazardAreas[teamID].Insert(navAreaID, blank);
}
else
Expand Down Expand Up @@ -466,6 +467,7 @@ void CNEOBotPathReservationSystem::AddSmokeHazard(int navAreaID, float expireTim
HazardInfo blank;
blank.hazardExpireTime = 0.0f;
blank.smokeExpireTime = expireTime;
blank.smokePropagateTime = 0.0f;
index = m_HazardAreas[teamID].Insert(navAreaID, blank);
}
else
Expand All @@ -475,13 +477,19 @@ void CNEOBotPathReservationSystem::AddSmokeHazard(int navAreaID, float expireTim
// May also work for resetting an area to be non-hazardous early
existing.smokeExpireTime = expireTime;

if (propagatePVS && (existing.smokePropagateTime == expireTime))
{
return;
}
}

if (propagatePVS)
{
CNavArea *area = TheNavMesh->GetNavAreaByID(navAreaID);
if (area)
{
m_HazardAreas[teamID][index].smokePropagateTime = expireTime;

CNEOFunctorPropagatePVSSmokeHazard propagate(expireTime, teamID);
// CompletelyVisible: fewer areas to iterate through and definitely exposed
// vs PotentiallyVisible: for narrow corridors, some areas would count even if only a sliver was exposed
Expand Down
1 change: 1 addition & 0 deletions src/game/server/neo/bot/neo_bot_path_reservation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct HazardInfo
{
float smokeExpireTime; // when the smoke hazard risk expires
float hazardExpireTime; // when a general deadly hazard risk expires
float smokePropagateTime; // expiry this area has already propagated to its visible set
};

struct BotReservedAreas_t
Expand Down