mirror of
https://github.com/ENSL/NS.git
synced 2024-11-09 23:01:34 +00:00
Update editor docs and crouch fix
* Bots now properly crouch in crouch areas rather than relying on their stuck detection to do it * Updated Nav Editor docs to reflect recent changes
This commit is contained in:
parent
290ad067eb
commit
b1bcdd2f70
5 changed files with 49 additions and 9 deletions
Binary file not shown.
|
@ -5605,7 +5605,7 @@ bool AICOMM_BuildOutOutpost(AvHAIPlayer* pBot, AvHAIMarineBase* BaseToBuildOut)
|
|||
return pBot->Player->GetResources() <= 15;
|
||||
}
|
||||
|
||||
Vector BuildLocation = AITAC_GetRandomBuildHintInLocation(StructureToDeploy, BaseToBuildOut->BaseLocation, UTIL_MetresToGoldSrcUnits(10.0f));
|
||||
Vector BuildLocation = AITAC_GetRandomBuildHintInLocation(StructureToDeploy, BaseToBuildOut->BaseLocation, UTIL_MetresToGoldSrcUnits(15.0f));
|
||||
|
||||
if (!vIsZero(BuildLocation))
|
||||
{
|
||||
|
|
|
@ -342,7 +342,17 @@ void AIDEBUG_DrawPath(edict_t* OutputPlayer, vector<bot_path_node>& path, float
|
|||
UTIL_DrawLine(OutputPlayer, FromLoc, ToLoc, DrawTime, 255, 128, 128);
|
||||
break;
|
||||
default:
|
||||
UTIL_DrawLine(OutputPlayer, FromLoc, ToLoc, DrawTime);
|
||||
{
|
||||
if (it->area == SAMPLE_POLYAREA_CROUCH)
|
||||
{
|
||||
UTIL_DrawLine(OutputPlayer, FromLoc, ToLoc, DrawTime, 255, 150, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
UTIL_DrawLine(OutputPlayer, FromLoc, ToLoc, DrawTime);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2386,24 +2386,27 @@ bool HasBotReachedPathPoint(const AvHAIPlayer* pBot)
|
|||
bot_path_node CurrentPathNode = pBot->BotNavInfo.CurrentPath[pBot->BotNavInfo.CurrentPathPoint];
|
||||
|
||||
SamplePolyFlags CurrentNavFlag = (SamplePolyFlags)CurrentPathNode.flag;
|
||||
SamplePolyAreas CurrentNavArea = (SamplePolyAreas)CurrentPathNode.area;
|
||||
Vector MoveFrom = CurrentPathNode.FromLocation;
|
||||
Vector MoveTo = CurrentPathNode.Location;
|
||||
float RequiredClimbHeight = CurrentPathNode.requiredZ;
|
||||
|
||||
Vector NextMoveLocation = ZERO_VECTOR;
|
||||
SamplePolyFlags NextMoveFlag = SAMPLE_POLYFLAGS_DISABLED;
|
||||
SamplePolyAreas NextMoveArea = SAMPLE_POLYAREA_GROUND;
|
||||
|
||||
if ((pBot->BotNavInfo.CurrentPathPoint + 1) < pBot->BotNavInfo.CurrentPath.size())
|
||||
{
|
||||
bot_path_node NextPathNode = pBot->BotNavInfo.CurrentPath[pBot->BotNavInfo.CurrentPathPoint + 1];
|
||||
NextMoveLocation = NextPathNode.Location;
|
||||
NextMoveFlag = (SamplePolyFlags)NextPathNode.flag;
|
||||
NextMoveArea = (SamplePolyAreas)NextPathNode.area;
|
||||
}
|
||||
|
||||
switch (CurrentNavFlag)
|
||||
{
|
||||
case SAMPLE_POLYFLAGS_WALK:
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, NextMoveLocation, NextMoveFlag);
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, CurrentNavArea, NextMoveLocation, NextMoveFlag, NextMoveArea);
|
||||
case SAMPLE_POLYFLAGS_WELD:
|
||||
case SAMPLE_POLYFLAGS_DOOR:
|
||||
case SAMPLE_POLYFLAGS_TEAM1STRUCTURE:
|
||||
|
@ -2425,17 +2428,17 @@ bool HasBotReachedPathPoint(const AvHAIPlayer* pBot)
|
|||
case SAMPLE_POLYFLAGS_LIFT:
|
||||
return HasBotCompletedLiftMove(pBot, MoveFrom, MoveTo, NextMoveLocation, NextMoveFlag);
|
||||
default:
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, NextMoveLocation, NextMoveFlag);
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, CurrentNavArea, NextMoveLocation, NextMoveFlag, NextMoveArea);
|
||||
}
|
||||
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, NextMoveLocation, NextMoveFlag);
|
||||
return HasBotCompletedWalkMove(pBot, MoveFrom, MoveTo, CurrentNavArea, NextMoveLocation, NextMoveFlag, NextMoveArea);
|
||||
}
|
||||
|
||||
bool HasBotCompletedWalkMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag)
|
||||
bool HasBotCompletedWalkMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, SamplePolyAreas MoveArea, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag, SamplePolyAreas NextMoveArea)
|
||||
{
|
||||
bool bNextPointReachable = false;
|
||||
|
||||
if (NextMoveFlag != SAMPLE_POLYFLAGS_DISABLED)
|
||||
if (NextMoveFlag != SAMPLE_POLYFLAGS_DISABLED && MoveArea == NextMoveArea)
|
||||
{
|
||||
bNextPointReachable = UTIL_PointIsDirectlyReachable(pBot->CurrentFloorPosition, NextMoveDestination, GetPlayerRadius(pBot->Edict));
|
||||
}
|
||||
|
@ -3571,6 +3574,8 @@ void GroundMove(AvHAIPlayer* pBot, const Vector StartPoint, const Vector EndPoin
|
|||
|
||||
Vector vForward = UTIL_GetVectorNormal2D(EndPoint - CurrentPos);
|
||||
|
||||
bool bShouldCrouch = false;
|
||||
|
||||
// If we are over our current path point and can't get to it, try walking towards the next path point if we have one, or just directly forwards
|
||||
if (vIsZero(vForward))
|
||||
{
|
||||
|
@ -3586,6 +3591,31 @@ void GroundMove(AvHAIPlayer* pBot, const Vector StartPoint, const Vector EndPoin
|
|||
}
|
||||
}
|
||||
|
||||
if (CanPlayerCrouch(pBot->Edict))
|
||||
{
|
||||
if (CurrentPathNode.area == SAMPLE_POLYAREA_CROUCH)
|
||||
{
|
||||
bShouldCrouch = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pBot->BotNavInfo.CurrentPathPoint < pBot->BotNavInfo.CurrentPath.size() - 1)
|
||||
{
|
||||
bot_path_node NextPathNode = pBot->BotNavInfo.CurrentPath[pBot->BotNavInfo.CurrentPathPoint + 1];
|
||||
|
||||
if (NextPathNode.area == SAMPLE_POLYAREA_CROUCH && vDist2DSq(pBot->Edict->v.origin, NextPathNode.FromLocation) < sqrf(64.0f))
|
||||
{
|
||||
bShouldCrouch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bShouldCrouch)
|
||||
{
|
||||
pBot->Button |= IN_DUCK;
|
||||
}
|
||||
|
||||
// Same goes for the right vector, might not be the same as the bot's right
|
||||
Vector vRight = UTIL_GetVectorNormal(UTIL_GetCrossProduct(vForward, UP_VECTOR));
|
||||
|
||||
|
@ -3667,7 +3697,7 @@ void GroundMove(AvHAIPlayer* pBot, const Vector StartPoint, const Vector EndPoin
|
|||
|
||||
pBot->desiredMovementDir = UTIL_GetVectorNormal2D(pBot->desiredMovementDir);
|
||||
|
||||
if (CanPlayerCrouch(pEdict))
|
||||
if (!bShouldCrouch && CanPlayerCrouch(pEdict))
|
||||
{
|
||||
Vector HeadLocation = GetPlayerTopOfCollisionHull(pEdict, false);
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ void NewMove(AvHAIPlayer* pBot);
|
|||
// Returns true if the bot has completed the current movement along their path
|
||||
bool HasBotReachedPathPoint(const AvHAIPlayer* pBot);
|
||||
bool HasBotCompletedLadderMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag);
|
||||
bool HasBotCompletedWalkMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag);
|
||||
bool HasBotCompletedWalkMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, SamplePolyAreas MoveArea, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag, SamplePolyAreas NextMoveArea);
|
||||
bool HasBotCompletedFallMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag);
|
||||
bool HasBotCompletedClimbMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, float RequiredClimbHeight, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag);
|
||||
bool HasBotCompletedJumpMove(const AvHAIPlayer* pBot, Vector MoveStart, Vector MoveEnd, Vector NextMoveDestination, SamplePolyFlags NextMoveFlag);
|
||||
|
|
Loading…
Reference in a new issue