fix(Core/Movement): prevent PvP flag and backwards movement on taxi login (#25153)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
030006dd57
commit
6c43bdb5df
2 changed files with 26 additions and 11 deletions
|
|
@ -10389,24 +10389,39 @@ void Player::ContinueTaxiFlight()
|
|||
|
||||
TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
|
||||
|
||||
float bestDist = SIZE_OF_GRIDS * SIZE_OF_GRIDS; // xinef: large value
|
||||
float currDist = 0.0f;
|
||||
// Use triangle inequality to find the segment the player is on.
|
||||
// When distPrev + distNext < distNodes, the player projects between
|
||||
// the two nodes of the segment. Resume from the end node (i).
|
||||
float distPrev;
|
||||
float distNext =
|
||||
(nodeList[0]->x - GetPositionX()) * (nodeList[0]->x - GetPositionX()) +
|
||||
(nodeList[0]->y - GetPositionY()) * (nodeList[0]->y - GetPositionY()) +
|
||||
(nodeList[0]->z - GetPositionZ()) * (nodeList[0]->z - GetPositionZ());
|
||||
|
||||
// xinef: changed to -1, we dont want to catch last node
|
||||
for (uint32 i = 0; i < nodeList.size() - 1; ++i)
|
||||
for (uint32 i = 1; i < nodeList.size(); ++i)
|
||||
{
|
||||
TaxiPathNodeEntry const* node = nodeList[i];
|
||||
TaxiPathNodeEntry const* nextNode = nodeList[i + 1];
|
||||
TaxiPathNodeEntry const* prevNode = nodeList[i - 1];
|
||||
|
||||
// xinef: skip nodes at another map, get last valid node on current map
|
||||
if (nextNode->mapid != GetMapId() || node->mapid != GetMapId())
|
||||
// skip nodes at another map
|
||||
if (node->mapid != GetMapId())
|
||||
continue;
|
||||
|
||||
currDist = (node->x - GetPositionX()) * (node->x - GetPositionX()) + (node->y - GetPositionY()) * (node->y - GetPositionY()) + (node->z - GetPositionZ()) * (node->z - GetPositionZ());
|
||||
if (currDist < bestDist)
|
||||
distPrev = distNext;
|
||||
distNext =
|
||||
(node->x - GetPositionX()) * (node->x - GetPositionX()) +
|
||||
(node->y - GetPositionY()) * (node->y - GetPositionY()) +
|
||||
(node->z - GetPositionZ()) * (node->z - GetPositionZ());
|
||||
|
||||
float distNodes =
|
||||
(node->x - prevNode->x) * (node->x - prevNode->x) +
|
||||
(node->y - prevNode->y) * (node->y - prevNode->y) +
|
||||
(node->z - prevNode->z) * (node->z - prevNode->z);
|
||||
|
||||
if (distPrev + distNext < distNodes)
|
||||
{
|
||||
startNode = i;
|
||||
bestDist = currDist;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1435,7 +1435,7 @@ void Player::UpdatePvPState()
|
|||
|
||||
if (pvpInfo.IsHostile) // in hostile area
|
||||
{
|
||||
if (IsInFlight()) // on taxi
|
||||
if (IsInFlight() || !m_taxi.empty()) // on taxi or taxi pending resume after login
|
||||
return;
|
||||
|
||||
if (!IsPvP() || pvpInfo.EndTimer != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue