fix(Core/Vehicle): Fix invisible vehicle passengers (#23406)
This commit is contained in:
@@ -417,6 +417,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this)
|
|||||||
GetObjectVisibilityContainer().InitForPlayer();
|
GetObjectVisibilityContainer().InitForPlayer();
|
||||||
|
|
||||||
sScriptMgr->OnConstructPlayer(this);
|
sScriptMgr->OnConstructPlayer(this);
|
||||||
|
|
||||||
|
m_expectingChangeTransport = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player()
|
Player::~Player()
|
||||||
|
|||||||
@@ -2633,6 +2633,9 @@ public:
|
|||||||
|
|
||||||
std::string GetDebugInfo() const override;
|
std::string GetDebugInfo() const override;
|
||||||
|
|
||||||
|
bool IsExpectingChangeTransport() const { return m_expectingChangeTransport; }
|
||||||
|
void SetExpectingChangeTransport(bool state) { m_expectingChangeTransport = state; }
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** SPELL QUEUE SYSTEM ***/
|
/*** SPELL QUEUE SYSTEM ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
@@ -3013,6 +3016,8 @@ private:
|
|||||||
PlayerSettingMap m_charSettingsMap;
|
PlayerSettingMap m_charSettingsMap;
|
||||||
|
|
||||||
Seconds m_creationTime;
|
Seconds m_creationTime;
|
||||||
|
|
||||||
|
bool m_expectingChangeTransport;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddItemsSetItem(Player* player, Item* item);
|
void AddItemsSetItem(Player* player, Item* item);
|
||||||
|
|||||||
@@ -19542,6 +19542,9 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
|||||||
if (!vehicleBase)
|
if (!vehicleBase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (IsPlayer())
|
||||||
|
ToPlayer()->SetExpectingChangeTransport(true);
|
||||||
|
|
||||||
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||||
|
|
||||||
Position pos;
|
Position pos;
|
||||||
|
|||||||
@@ -423,7 +423,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
|
|||||||
if (_me->IsInWorld())
|
if (_me->IsInWorld())
|
||||||
{
|
{
|
||||||
unit->SendClearTarget(); // SMSG_BREAK_TARGET
|
unit->SendClearTarget(); // SMSG_BREAK_TARGET
|
||||||
unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
|
unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
|
||||||
|
if (unit->IsPlayer())
|
||||||
|
unit->ToPlayer()->SetExpectingChangeTransport(true);
|
||||||
// also adds MOVEMENTFLAG_ROOT
|
// also adds MOVEMENTFLAG_ROOT
|
||||||
Movement::MoveSplineInit init(unit);
|
Movement::MoveSplineInit init(unit);
|
||||||
init.DisableTransportPathTransformations();
|
init.DisableTransportPathTransformations();
|
||||||
|
|||||||
@@ -376,6 +376,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opcode == CMSG_MOVE_FALL_RESET || opcode == CMSG_MOVE_CHNG_TRANSPORT)
|
||||||
|
return;
|
||||||
|
|
||||||
/* process position-change */
|
/* process position-change */
|
||||||
WorldPacket data(opcode, recvData.size());
|
WorldPacket data(opcode, recvData.size());
|
||||||
WriteMovementInfo(&data, &movementInfo);
|
WriteMovementInfo(&data, &movementInfo);
|
||||||
@@ -516,7 +519,10 @@ bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, Player*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mover->movespline->Finalized())
|
if (!mover->movespline->Finalized())
|
||||||
return false;
|
{
|
||||||
|
if (!mover->movespline->isBoarding() || (opcode != CMSG_FORCE_MOVE_UNROOT_ACK && opcode != CMSG_FORCE_MOVE_ROOT_ACK))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
|
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
|
||||||
if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||||
@@ -958,7 +964,8 @@ void WorldSession::ComputeNewClockDelta()
|
|||||||
|
|
||||||
void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
|
void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging((Opcodes)recvData.GetOpcode()));
|
Opcodes opcode = (Opcodes)recvData.GetOpcode();
|
||||||
|
LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging(opcode));
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
uint32 counter;
|
uint32 counter;
|
||||||
@@ -973,7 +980,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
|
|||||||
if (mover->GetGUID() != guid)
|
if (mover->GetGUID() != guid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (recvData.GetOpcode() == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case
|
if (opcode == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case
|
||||||
{
|
{
|
||||||
if (!mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT))
|
if (!mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT))
|
||||||
return;
|
return;
|
||||||
@@ -987,7 +994,10 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
|
|||||||
if (!ProcessMovementInfo(movementInfo, mover, _player, recvData))
|
if (!ProcessMovementInfo(movementInfo, mover, _player, recvData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data(recvData.GetOpcode() == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT);
|
if (_player->IsExpectingChangeTransport())
|
||||||
|
return;
|
||||||
|
|
||||||
|
WorldPacket data(opcode == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT);
|
||||||
WriteMovementInfo(&data, &movementInfo);
|
WriteMovementInfo(&data, &movementInfo);
|
||||||
mover->SendMessageToSet(&data, _player);
|
mover->SendMessageToSet(&data, _player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,54 +198,70 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
|
|||||||
|
|
||||||
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
|
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
ObjectGuid guid; // used only for proper packet read
|
ObjectGuid guid; // used only for proper packet read
|
||||||
|
MovementInfo movementInfo; // used only for proper packet read
|
||||||
|
uint32 movementCounter; // spline counter
|
||||||
|
|
||||||
|
Unit* mover = _player->m_mover;
|
||||||
|
|
||||||
recvData >> guid.ReadAsPacked();
|
recvData >> guid.ReadAsPacked();
|
||||||
|
|
||||||
MovementInfo movementInfo; // used only for proper packet read
|
|
||||||
movementInfo.guid = guid;
|
|
||||||
ReadMovementInfo(recvData, &movementInfo);
|
ReadMovementInfo(recvData, &movementInfo);
|
||||||
|
recvData >> movementCounter;
|
||||||
|
|
||||||
recvData.read_skip<uint32>(); // spline id
|
if (_player->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT)) // taxi spline case
|
||||||
|
|
||||||
// in taxi flight packet received in 2 case:
|
|
||||||
// 1) end taxi path in far (multi-node) flight
|
|
||||||
// 2) switch from one map to other in case multim-map taxi path
|
|
||||||
// we need process only (1)
|
|
||||||
|
|
||||||
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
|
|
||||||
if (curDest)
|
|
||||||
{
|
{
|
||||||
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
|
// in taxi flight packet received in 2 case:
|
||||||
|
// 1) end taxi path in far (multi-node) flight
|
||||||
|
// 2) switch from one map to other in case multim-map taxi path
|
||||||
|
// we need process only (1)
|
||||||
|
|
||||||
// far teleport case
|
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
|
||||||
if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
|
if (curDest)
|
||||||
{
|
{
|
||||||
if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
|
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
|
||||||
{
|
|
||||||
// short preparations to continue flight
|
|
||||||
flight->SetCurrentNodeAfterTeleport();
|
|
||||||
TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
|
|
||||||
flight->SkipCurrentNode();
|
|
||||||
|
|
||||||
GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
|
// far teleport case
|
||||||
|
if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
|
||||||
|
{
|
||||||
|
// short preparations to continue flight
|
||||||
|
flight->SetCurrentNodeAfterTeleport();
|
||||||
|
TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
|
||||||
|
flight->SkipCurrentNode();
|
||||||
|
|
||||||
|
GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// at this point only 1 node is expected (final destination)
|
||||||
|
if (GetPlayer()->m_taxi.GetPath().size() != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetPlayer()->CleanupAfterTaxiFlight();
|
||||||
|
GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
|
||||||
|
if (GetPlayer()->pvpInfo.IsHostile)
|
||||||
|
{
|
||||||
|
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// at this point only 1 node is expected (final destination)
|
if (mover->GetGUID() != guid)
|
||||||
if (GetPlayer()->m_taxi.GetPath().size() != 1)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
GetPlayer()->CleanupAfterTaxiFlight();
|
if (!_player->IsExpectingChangeTransport() || !mover->movespline || mover->movespline->GetId() != movementCounter)
|
||||||
GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
|
return;
|
||||||
if (GetPlayer()->pvpInfo.IsHostile)
|
|
||||||
{
|
_player->SetExpectingChangeTransport(false);
|
||||||
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
|
WorldPacket data(_player->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) ? MSG_MOVE_ROOT : MSG_MOVE_UNROOT, recvData.size());
|
||||||
}
|
WriteMovementInfo(&data, &movementInfo);
|
||||||
|
mover->SendMessageToSet(&data, _player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
|
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ namespace Movement
|
|||||||
[[nodiscard]] bool isCyclic() const { return splineflags.cyclic; }
|
[[nodiscard]] bool isCyclic() const { return splineflags.cyclic; }
|
||||||
[[nodiscard]] bool isFalling() const { return splineflags.falling; }
|
[[nodiscard]] bool isFalling() const { return splineflags.falling; }
|
||||||
[[nodiscard]] bool isWalking() const { return splineflags.walkmode; }
|
[[nodiscard]] bool isWalking() const { return splineflags.walkmode; }
|
||||||
|
[[nodiscard]] bool isBoarding() const { return splineflags.transportEnter || splineflags.transportExit; }
|
||||||
[[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); }
|
[[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); }
|
||||||
[[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3(); }
|
[[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3(); }
|
||||||
[[nodiscard]] int32 currentPathIdx() const;
|
[[nodiscard]] int32 currentPathIdx() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user