Resource capping tweak and comm reminders

* Marines will now get close initially to a resource node they want to cap, before guarding it. This fixes the issue in Hera where bots would wait for the RT in cargo to drop but never actually open the door so the commander could drop it
* Disabled AI commander reissuing orders to players as a reminder. It was annoying for humans, and pointless for bots since they should always obey it right away anyway
This commit is contained in:
RGreenlees 2024-05-13 09:36:17 +01:00 committed by pierow
parent 4736cdcc53
commit fcddb5b6c3
3 changed files with 17 additions and 6 deletions

View file

@ -379,6 +379,9 @@ bool AICOMM_IsOrderStillValid(AvHAIPlayer* pBot, ai_commander_order* Order)
bool AICOMM_DoesPlayerOrderNeedReminder(AvHAIPlayer* pBot, ai_commander_order* Order) bool AICOMM_DoesPlayerOrderNeedReminder(AvHAIPlayer* pBot, ai_commander_order* Order)
{ {
// For now, disable reminders as it is annoying for humans and pointless for bots who should obey it always anyway
return false;
float NewDist = vDist2DSq(Order->Assignee->v.origin, Order->OrderLocation); float NewDist = vDist2DSq(Order->Assignee->v.origin, Order->OrderLocation);
float OldDist = Order->LastPlayerDistance; float OldDist = Order->LastPlayerDistance;
Order->LastPlayerDistance = NewDist; Order->LastPlayerDistance = NewDist;

View file

@ -3106,7 +3106,7 @@ edict_t* UTIL_GetDoorBlockingPathPoint(const Vector FromLocation, const Vector T
if (MovementFlag == SAMPLE_POLYFLAGS_LADDER || MovementFlag == SAMPLE_POLYFLAGS_WALLCLIMB) if (MovementFlag == SAMPLE_POLYFLAGS_LADDER || MovementFlag == SAMPLE_POLYFLAGS_WALLCLIMB)
{ {
Vector TargetLoc = Vector(FromLoc.x, FromLoc.y, ToLocation.z); Vector TargetLoc = (ToLocation.z > FromLocation.z) ? Vector(FromLoc.x, FromLoc.y, ToLoc.z) : Vector(ToLoc.x, ToLoc.y, FromLoc.z);
if (!FNullEnt(SearchDoor)) if (!FNullEnt(SearchDoor))
{ {
@ -3134,11 +3134,9 @@ edict_t* UTIL_GetDoorBlockingPathPoint(const Vector FromLocation, const Vector T
} }
} }
Vector TargetLoc2 = Vector(ToLoc.x, ToLoc.y, ToLocation.z);
if (!FNullEnt(SearchDoor)) if (!FNullEnt(SearchDoor))
{ {
if (vlineIntersectsAABB(FromLoc, TargetLoc2, SearchDoor->v.absmin, SearchDoor->v.absmax)) if (vlineIntersectsAABB(TargetLoc, ToLoc, SearchDoor->v.absmin, SearchDoor->v.absmax))
{ {
return SearchDoor; return SearchDoor;
} }
@ -3147,7 +3145,7 @@ edict_t* UTIL_GetDoorBlockingPathPoint(const Vector FromLocation, const Vector T
{ {
for (auto it = NavDoors.begin(); it != NavDoors.end(); it++) for (auto it = NavDoors.begin(); it != NavDoors.end(); it++)
{ {
if (vlineIntersectsAABB(FromLoc, TargetLoc2, it->DoorEdict->v.absmin, it->DoorEdict->v.absmax)) if (vlineIntersectsAABB(TargetLoc, ToLoc, it->DoorEdict->v.absmin, it->DoorEdict->v.absmax))
{ {
return it->DoorEdict; return it->DoorEdict;
} }
@ -3155,7 +3153,7 @@ edict_t* UTIL_GetDoorBlockingPathPoint(const Vector FromLocation, const Vector T
for (auto it = NavWeldableObstacles.begin(); it != NavWeldableObstacles.end(); it++) for (auto it = NavWeldableObstacles.begin(); it != NavWeldableObstacles.end(); it++)
{ {
if (vlineIntersectsAABB(FromLoc, TargetLoc2, it->WeldableEdict->v.absmin, it->WeldableEdict->v.absmax)) if (vlineIntersectsAABB(TargetLoc, ToLoc, it->WeldableEdict->v.absmin, it->WeldableEdict->v.absmax))
{ {
return it->WeldableEdict; return it->WeldableEdict;
} }

View file

@ -2978,9 +2978,19 @@ void MarineProgressCapResNodeTask(AvHAIPlayer* pBot, AvHAIPlayerTask* Task)
// Empty res node with nothing to do but wait, stick around for 30 seconds and then move on if the commander doesn't drop an RT to build // Empty res node with nothing to do but wait, stick around for 30 seconds and then move on if the commander doesn't drop an RT to build
if (Task->TaskLength == 0.0f) if (Task->TaskLength == 0.0f)
{ {
const AvHAIResourceNode* ResNode = AITAC_GetNearestResourceNodeToLocation(Task->TaskLocation);
// If we're not at our destination yet, go there
if (vDist2DSq(pBot->Edict->v.origin, ResNode->Location) > sqrf(UTIL_MetresToGoldSrcUnits(1.0f)))
{
MoveTo(pBot, ResNode->Location, MOVESTYLE_NORMAL);
return;
}
Task->TaskStartedTime = gpGlobals->time; Task->TaskStartedTime = gpGlobals->time;
Task->TaskLength = 30.0f; Task->TaskLength = 30.0f;
} }
BotGuardLocation(pBot, Task->TaskLocation); BotGuardLocation(pBot, Task->TaskLocation);
} }