Weld tweak

This commit is contained in:
RGreenlees 2024-03-25 23:37:14 +00:00 committed by pierow
parent c6344df589
commit 67903b598e
2 changed files with 19 additions and 8 deletions

View file

@ -8643,9 +8643,11 @@ void NAV_ProgressMovementTask(AvHAIPlayer* pBot)
{
Vector AimLocation;
if (MoveTask->TaskTarget->v.size.Length2D() < 100.0f)
Vector EntityCentre = UTIL_GetCentreOfEntity(MoveTask->TaskTarget);
if (MoveTask->TaskTarget->v.size.Length() < 100.0f)
{
AimLocation = UTIL_GetCentreOfEntity(MoveTask->TaskTarget);
AimLocation = EntityCentre;
}
else
{
@ -8655,9 +8657,16 @@ void NAV_ProgressMovementTask(AvHAIPlayer* pBot)
vScaleBB(BBMin, BBMax, 0.75f);
AimLocation = vClosestPointOnBB(pBot->CurrentEyePosition, BBMin, BBMax);
if (MoveTask->TaskTarget->v.absmax.z - MoveTask->TaskTarget->v.absmin.z < 100.0f)
{
AimLocation.z = EntityCentre.z;
}
UTIL_DrawLine(INDEXENT(1), pBot->CurrentEyePosition, AimLocation);
}
BotLookAt(pBot, AimLocation);
BotMoveLookAt(pBot, AimLocation);
pBot->DesiredCombatWeapon = WEAPON_MARINE_WELDER;
if (GetPlayerCurrentWeapon(pBot->Player) != WEAPON_MARINE_WELDER)
@ -8673,10 +8682,6 @@ void NAV_ProgressMovementTask(AvHAIPlayer* pBot)
}
}
MoveTo(pBot, MoveTask->TaskLocation, MOVESTYLE_NORMAL);
}

View file

@ -2472,7 +2472,8 @@ void BotProgressWeldTask(AvHAIPlayer* pBot, AvHAIPlayerTask* Task)
if (IsPlayerInUseRange(pBot->Edict, Task->TaskTarget))
{
Vector AimLocation = UTIL_GetCentreOfEntity(Task->TaskTarget);
Vector EntityCentre = UTIL_GetCentreOfEntity(Task->TaskTarget);
Vector AimLocation = EntityCentre;
// If we're targeting a func_weldable, then the centre of the entity might be in a wall or out of reach
// so instead aim at the closest point on the func_weldable to us.
@ -2490,6 +2491,11 @@ void BotProgressWeldTask(AvHAIPlayer* pBot, AvHAIPlayerTask* Task)
vScaleBB(BBMin, BBMax, 0.75f);
AimLocation = vClosestPointOnBB(pBot->CurrentEyePosition, BBMin, BBMax);
if (Task->TaskTarget->v.absmax.z - Task->TaskTarget->v.absmin.z < 100.0f)
{
AimLocation.z = EntityCentre.z;
}
}
}