fix(Core/Vehicle): Fix invisible vehicle passengers (#23406)

This commit is contained in:
killerwife
2025-10-26 02:25:43 +01:00
committed by GitHub
parent dfd21be75b
commit 1b2db00701
7 changed files with 77 additions and 38 deletions

View File

@@ -417,6 +417,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this)
GetObjectVisibilityContainer().InitForPlayer();
sScriptMgr->OnConstructPlayer(this);
m_expectingChangeTransport = false;
}
Player::~Player()

View File

@@ -2633,6 +2633,9 @@ public:
std::string GetDebugInfo() const override;
bool IsExpectingChangeTransport() const { return m_expectingChangeTransport; }
void SetExpectingChangeTransport(bool state) { m_expectingChangeTransport = state; }
/*********************************************************/
/*** SPELL QUEUE SYSTEM ***/
/*********************************************************/
@@ -3013,6 +3016,8 @@ private:
PlayerSettingMap m_charSettingsMap;
Seconds m_creationTime;
bool m_expectingChangeTransport;
};
void AddItemsSetItem(Player* player, Item* item);

View File

@@ -19542,6 +19542,9 @@ void Unit::_ExitVehicle(Position const* exitPosition)
if (!vehicleBase)
return;
if (IsPlayer())
ToPlayer()->SetExpectingChangeTransport(true);
SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
Position pos;

View File

@@ -423,7 +423,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
if (_me->IsInWorld())
{
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
Movement::MoveSplineInit init(unit);
init.DisableTransportPathTransformations();