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:
@@ -10389,24 +10389,39 @@ void Player::ContinueTaxiFlight()
|
|||||||
|
|
||||||
TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
|
TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
|
||||||
|
|
||||||
float bestDist = SIZE_OF_GRIDS * SIZE_OF_GRIDS; // xinef: large value
|
// Use triangle inequality to find the segment the player is on.
|
||||||
float currDist = 0.0f;
|
// 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 = 1; i < nodeList.size(); ++i)
|
||||||
for (uint32 i = 0; i < nodeList.size() - 1; ++i)
|
|
||||||
{
|
{
|
||||||
TaxiPathNodeEntry const* node = nodeList[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
|
// skip nodes at another map
|
||||||
if (nextNode->mapid != GetMapId() || node->mapid != GetMapId())
|
if (node->mapid != GetMapId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
currDist = (node->x - GetPositionX()) * (node->x - GetPositionX()) + (node->y - GetPositionY()) * (node->y - GetPositionY()) + (node->z - GetPositionZ()) * (node->z - GetPositionZ());
|
distPrev = distNext;
|
||||||
if (currDist < bestDist)
|
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;
|
startNode = i;
|
||||||
bestDist = currDist;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1435,7 +1435,7 @@ void Player::UpdatePvPState()
|
|||||||
|
|
||||||
if (pvpInfo.IsHostile) // in hostile area
|
if (pvpInfo.IsHostile) // in hostile area
|
||||||
{
|
{
|
||||||
if (IsInFlight()) // on taxi
|
if (IsInFlight() || !m_taxi.empty()) // on taxi or taxi pending resume after login
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsPvP() || pvpInfo.EndTimer != 0)
|
if (!IsPvP() || pvpInfo.EndTimer != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user