BG BotFill : bots contournent l eau + verrou anti ping-pong des objectifs
- Filtre navmesh des bots sans NAV_WATER : fini l effet de glisse/vol sur les lacs (UpdateFilter reajoute l eau si le bot y est plonge, pour en sortir) - AcceptCommand : un bot conserve sa cible tant qu elle n est pas atteinte (15 s max), sauf ordre drapeau. Le commandant realloue tout toutes les 500 ms : les bots a mi-chemin oscillaient entre deux objectifs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -184,13 +184,27 @@ void BotBGAIMovement::ClearMovement()
|
||||
|
||||
void BotBGAIMovement::AcceptCommand(AIWaypoint* targetAIWP, bool isFlag)
|
||||
{
|
||||
static uint32 s_dbgAccept = 0;
|
||||
if (++s_dbgAccept % 50 == 1)
|
||||
TC_LOG_ERROR("server.worldserver", "BGF-DBG: AcceptCommand #%u wp=%s", s_dbgAccept, targetAIWP ? "oui" : "NULL");
|
||||
if (!targetAIWP)
|
||||
return;
|
||||
if (pTargetAIWP)
|
||||
{
|
||||
if (targetAIWP->entry == pTargetAIWP->entry && m_IsFlagTarget == isFlag)
|
||||
return;
|
||||
// SylvaniaCore (module BG BotFill): anti ping-pong. Le commandant realloue les
|
||||
// objectifs toutes les 500 ms : un bot a mi-chemin entre deux cibles oscillait.
|
||||
// On conserve la cible courante tant qu elle n est pas atteinte (15 s max),
|
||||
// sauf ordre lie au drapeau, toujours prioritaire.
|
||||
if (!isFlag && !m_IsFlagTarget)
|
||||
{
|
||||
bool arrived = m_Player->GetDistance(pTargetAIWP->GetPosition()) < 15.0f;
|
||||
if (!arrived && m_TargetLockTick && GetMSTimeDiffToNow(m_TargetLockTick) < 15000)
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_TargetLockTick = getMSTime();
|
||||
m_IsFlagTarget = isFlag;
|
||||
pTargetAIWP = targetAIWP;
|
||||
m_MovementTick = 0;
|
||||
|
||||
@@ -90,6 +90,7 @@ private:
|
||||
ObjectGuid targetGuid;
|
||||
AIWaypoint* pTargetAIWP;
|
||||
int32 m_MovementTick;
|
||||
uint32 m_TargetLockTick = 0;
|
||||
uint32 lastPathfindSure;
|
||||
uint32 m_LastSyncTick;
|
||||
};
|
||||
|
||||
@@ -75,6 +75,11 @@ bool Pathfinding::CalculatePath(float destX, float destY, float destZ, bool forc
|
||||
// check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?)
|
||||
if (!_navMesh || !_navMeshQuery || !HaveTile(start) || !HaveTile(dest))
|
||||
{
|
||||
static uint32 s_dbgSc = 0;
|
||||
if (++s_dbgSc % 20 == 1)
|
||||
TC_LOG_ERROR("server.worldserver", "BGF-DBG: Shortcut #%u map=%u inst=%u mesh=%u query=%u tuileDep=%u tuileArr=%u",
|
||||
s_dbgSc, _pathParameter->mapID, _pathParameter->instID, uint32(_navMesh != nullptr), uint32(_navMeshQuery != nullptr),
|
||||
uint32(_navMesh ? HaveTile(start) : 0), uint32(_navMesh ? HaveTile(dest) : 0));
|
||||
BuildShortcut();
|
||||
_type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH);
|
||||
return true;
|
||||
@@ -680,8 +685,10 @@ void Pathfinding::CreateFilter()
|
||||
}
|
||||
else // assume Player
|
||||
{
|
||||
// perfect support not possible, just stay 'safe'
|
||||
includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA_SLIME);
|
||||
// SylvaniaCore (module BG BotFill): les bots contournent l eau plutot que de glisser
|
||||
// sur la surface (spline sans animation de nage = effet de vol). UpdateFilter
|
||||
// reajoute les flags eau si le bot y est deja plonge, pour lui permettre d en sortir.
|
||||
includeFlags |= NAV_GROUND;
|
||||
}
|
||||
|
||||
_filter.setIncludeFlags(includeFlags);
|
||||
|
||||
Reference in New Issue
Block a user