mirror of
https://github.com/mangosfour/server.git
synced 2025-12-27 01:37:04 +00:00
[c12562] Cleanup Style
This commit is contained in:
parent
d988eb4038
commit
bf5c6b1ddd
19 changed files with 3432 additions and 1071 deletions
|
|
@ -23,39 +23,77 @@
|
|||
* @file Vehicle.cpp
|
||||
* This file contains the code needed for CMaNGOS to support vehicles
|
||||
* Currently implemented
|
||||
* - TODO Board
|
||||
* - TODO Unboard
|
||||
* - TODO Switch
|
||||
* - Board to board a passenger onto a vehicle (includes checks)
|
||||
* - Unboard to unboard a passenger from the vehicle
|
||||
* - SwitchSeat to switch to another seat of the same vehicle
|
||||
* - CanBoard to check if a passenger can board a vehicle
|
||||
* - Internal helper to set the controlling and spells for a vehicle's seat
|
||||
* - Internal helper to control the available seats of a vehicle
|
||||
*/
|
||||
|
||||
#include "Vehicle.h"
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Log.h"
|
||||
#include "Unit.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "SQLStorages.h"
|
||||
#include "Util.h"
|
||||
#include "movement/MoveSplineInit.h"
|
||||
#include "movement/MoveSpline.h"
|
||||
#include "MapManager.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
void ObjectMgr::LoadVehicleAccessory()
|
||||
{
|
||||
sVehicleAccessoryStorage.Load();
|
||||
|
||||
sLog.outString(">> Loaded %u vehicle accessories", sVehicleAccessoryStorage.GetRecordCount());
|
||||
sLog.outString();
|
||||
|
||||
// Check content
|
||||
for (SQLMultiStorage::SQLSIterator<VehicleAccessory> itr = sVehicleAccessoryStorage.getDataBegin<VehicleAccessory>(); itr < sVehicleAccessoryStorage.getDataEnd<VehicleAccessory>(); ++itr)
|
||||
{
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(itr->vehicleEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where vehicle_entry is invalid, skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(itr->passengerEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where accessory_entry is invalid, skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
if (itr->seatId >= MAX_VEHICLE_SEAT)
|
||||
{
|
||||
sLog.outErrorDb("Table `vehicle_accessory` has entry (vehicle entry: %u, seat %u, passenger %u) where seat is invalid (must be between 0 and %u), skip vehicle.", itr->vehicleEntry, itr->seatId, itr->passengerEntry, MAX_VEHICLE_SEAT - 1);
|
||||
sVehicleAccessoryStorage.EraseEntry(itr->vehicleEntry);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of VehicleInfo
|
||||
*
|
||||
* @param owner MUST be provided owner of the vehicle (type Unit)
|
||||
* @param vehicleEntry MUST be provided dbc-entry of the vehicle
|
||||
* @param overwriteNpcEntry Use to overwrite the GetEntry() result for selecting associated passengers
|
||||
*
|
||||
* This function will initialise the VehicleInfo of the vehicle owner
|
||||
* Also the seat-map is created here
|
||||
*/
|
||||
VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry) : TransportBase(owner),
|
||||
VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 overwriteNpcEntry) : TransportBase(owner),
|
||||
m_vehicleEntry(vehicleEntry),
|
||||
m_creatureSeats(0),
|
||||
m_playerSeats(0)
|
||||
m_playerSeats(0),
|
||||
m_overwriteNpcEntry(overwriteNpcEntry),
|
||||
m_isInitialized(false)
|
||||
{
|
||||
MANGOS_ASSERT(vehicleEntry);
|
||||
|
||||
|
|
@ -78,6 +116,33 @@ VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry) : Transp
|
|||
}
|
||||
}
|
||||
|
||||
VehicleInfo::~VehicleInfo()
|
||||
{
|
||||
((Unit*)m_owner)->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
|
||||
|
||||
RemoveAccessoriesFromMap(); // Remove accessories (for example required with player vehicles)
|
||||
}
|
||||
|
||||
void VehicleInfo::Initialize()
|
||||
{
|
||||
if (!m_overwriteNpcEntry)
|
||||
m_overwriteNpcEntry = m_owner->GetEntry();
|
||||
|
||||
// Loading passengers (rough version only!)
|
||||
SQLMultiStorage::SQLMSIteratorBounds<VehicleAccessory> bounds = sVehicleAccessoryStorage.getBounds<VehicleAccessory>(m_overwriteNpcEntry);
|
||||
for (SQLMultiStorage::SQLMultiSIterator<VehicleAccessory> itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (Creature* summoned = m_owner->SummonCreature(itr->passengerEntry, m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ(), 2 * m_owner->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0))
|
||||
{
|
||||
DEBUG_LOG("VehicleInfo(of %s)::Initialize: Load vehicle accessory %s onto seat %u", m_owner->GetGuidStr().c_str(), summoned->GetGuidStr().c_str(), itr->seatId);
|
||||
m_accessoryGuids.insert(summoned->GetObjectGuid());
|
||||
int32 basepoint0 = itr->seatId + 1;
|
||||
summoned->CastCustomSpell((Unit*)m_owner, SPELL_RIDE_VEHICLE_HARDCODED, &basepoint0, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
m_isInitialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will board a passenger onto a vehicle
|
||||
*
|
||||
|
|
@ -88,11 +153,68 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
|||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo::Board: Try to board passenger %s to seat %u", passenger->GetObjectGuid().GetString().c_str(), seat);
|
||||
DEBUG_LOG("VehicleInfo(of %s)::Board: Try to board passenger %s to seat %u", m_owner->GetGuidStr().c_str(), passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// This check is also called in Spell::CheckCast()
|
||||
if (!CanBoard(passenger))
|
||||
return;
|
||||
|
||||
// Use the planned seat only if the seat is valid, possible to choose and empty
|
||||
if (!IsSeatAvailableFor(passenger, seat))
|
||||
if (!GetUsableSeatFor(passenger, seat))
|
||||
return;
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// ToDo: Unboard passenger from a MOTransport when they are properly implemented
|
||||
/*if (TransportInfo* transportInfo = passenger->GetTransportInfo())
|
||||
{
|
||||
WorldObject* transporter = transportInfo->GetTransport();
|
||||
|
||||
// Must be a MO transporter
|
||||
MANGOS_ASSERT(transporter->GetObjectGuid().IsMOTransport());
|
||||
|
||||
((Transport*)transporter)->UnBoardPassenger(passenger);
|
||||
}*/
|
||||
|
||||
DEBUG_LOG("VehicleInfo::Board: Board passenger: %s to seat %u", passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// Calculate passengers local position
|
||||
float lx, ly, lz, lo;
|
||||
CalculateBoardingPositionOf(passenger->GetPositionX(), passenger->GetPositionY(), passenger->GetPositionZ(), passenger->GetOrientation(), lx, ly, lz, lo);
|
||||
|
||||
BoardPassenger(passenger, lx, ly, lz, lo, seat); // Use TransportBase to store the passenger
|
||||
|
||||
// Set data for createobject packets
|
||||
passenger->m_movementInfo.SetTransportData(m_owner->GetObjectGuid(), lx, ly, lz, lo, 0, seat);
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
pPlayer->RemovePet(PET_SAVE_AS_CURRENT);
|
||||
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA);
|
||||
pPlayer->GetSession()->SendPacket(&data);
|
||||
|
||||
// SMSG_BREAK_TARGET (?)
|
||||
}
|
||||
|
||||
if (!passenger->IsRooted())
|
||||
passenger->SetRoot(true);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
||||
init.SetFacing(0.0f); // local orientation ? ToDo: Set proper orientation!
|
||||
init.SetBoardVehicle();
|
||||
init.Launch();
|
||||
|
||||
// Apply passenger modifications
|
||||
ApplySeatMods(passenger, seatEntry->m_flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will switch the seat of a passenger
|
||||
* This function will switch the seat of a passenger on the same vehicle
|
||||
*
|
||||
* @param passenger MUST be provided. This Unit will change its seat on the vehicle
|
||||
* @param seat Seat to which the passenger will be switched
|
||||
|
|
@ -100,6 +222,50 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
|||
void VehicleInfo::SwitchSeat(Unit* passenger, uint8 seat)
|
||||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo::SwitchSeat: passenger: %s try to switch to seat %u", passenger->GetGuidStr().c_str(), seat);
|
||||
|
||||
// Switching seats is not possible
|
||||
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
|
||||
return;
|
||||
|
||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||
MANGOS_ASSERT(itr != m_passengers.end());
|
||||
|
||||
// We are already boarded to this seat
|
||||
if (itr->second->GetTransportSeat() == seat)
|
||||
return;
|
||||
|
||||
// Check if it's a valid seat
|
||||
if (!IsSeatAvailableFor(passenger, seat))
|
||||
return;
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// Switching seats is only allowed if this flag is set
|
||||
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
|
||||
return;
|
||||
|
||||
// Remove passenger modifications of the old seat
|
||||
RemoveSeatMods(passenger, seatEntry->m_flags);
|
||||
|
||||
// Set to new seat
|
||||
itr->second->SetTransportSeat(seat);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
||||
//if (oldorientation != neworientation) (?)
|
||||
//init.SetFacing(0.0f); // local orientation ? ToDo: Set proper orientation!
|
||||
// It seems that Seat switching is sent without SplineFlag BoardVehicle
|
||||
init.Launch();
|
||||
|
||||
// Get seatEntry of new seat
|
||||
seatEntry = GetSeatEntry(seat);
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
// Apply passenger modifications of the new seat
|
||||
ApplySeatMods(passenger, seatEntry->m_flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -113,7 +279,63 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
|||
{
|
||||
MANGOS_ASSERT(passenger);
|
||||
|
||||
DEBUG_LOG("VehicleInfo::Unboard: passenger: %s", passenger->GetObjectGuid().GetString().c_str());
|
||||
DEBUG_LOG("VehicleInfo::Unboard: passenger: %s", passenger->GetGuidStr().c_str());
|
||||
|
||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||
MANGOS_ASSERT(itr != m_passengers.end());
|
||||
|
||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
||||
MANGOS_ASSERT(seatEntry);
|
||||
|
||||
UnBoardPassenger(passenger); // Use TransportBase to remove the passenger from storage list
|
||||
|
||||
if (!changeVehicle) // Send expected unboarding packages
|
||||
{
|
||||
// Update movementInfo
|
||||
passenger->m_movementInfo.ClearTransportData();
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
pPlayer->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
// SMSG_PET_DISMISS_SOUND (?)
|
||||
}
|
||||
|
||||
if (passenger->IsRooted())
|
||||
passenger->SetRoot(false);
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
// ToDo: Set proper unboard coordinates
|
||||
init.MoveTo(m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ());
|
||||
init.SetExitVehicle();
|
||||
init.Launch();
|
||||
|
||||
// Despawn if passenger was accessory
|
||||
if (passenger->GetTypeId() == TYPEID_UNIT && m_accessoryGuids.find(passenger->GetObjectGuid()) != m_accessoryGuids.end())
|
||||
{
|
||||
Creature* cPassenger = static_cast<Creature*>(passenger);
|
||||
// TODO Same TODO as in VehicleInfo::RemoveAccessoriesFromMap
|
||||
cPassenger->ForcedDespawn(5000);
|
||||
m_accessoryGuids.erase(passenger->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove passenger modifications
|
||||
RemoveSeatMods(passenger, seatEntry->m_flags);
|
||||
|
||||
// Some creature vehicles get despawned after passenger unboarding
|
||||
if (m_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
// TODO: Guesswork, but seems to be fairly near correct
|
||||
// Only if the passenger was on control seat? Also depending on some flags
|
||||
if ((seatEntry->m_flags & SEAT_FLAG_CAN_CONTROL) &&
|
||||
!(m_vehicleEntry->m_flags & (VEHICLE_FLAG_UNK4 | VEHICLE_FLAG_UNK20)))
|
||||
{
|
||||
if (((Creature*)m_owner)->IsTemporarySummon())
|
||||
((Creature*)m_owner)->ForcedDespawn(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -130,6 +352,14 @@ bool VehicleInfo::CanBoard(Unit* passenger) const
|
|||
if (passenger == m_owner)
|
||||
return false;
|
||||
|
||||
// Passenger is already on this vehicle (in this case switching seats is required)
|
||||
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
|
||||
return false;
|
||||
|
||||
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
|
||||
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
|
||||
return false;
|
||||
|
||||
// Check if we have at least one empty seat
|
||||
if (!GetEmptySeats())
|
||||
return false;
|
||||
|
|
@ -146,8 +376,17 @@ bool VehicleInfo::CanBoard(Unit* passenger) const
|
|||
return GetEmptySeatsMask() & m_creatureSeats;
|
||||
}
|
||||
|
||||
Unit* VehicleInfo::GetPassenger(uint8 seat) const
|
||||
{
|
||||
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
|
||||
if (itr->second->GetTransportSeat() == seat)
|
||||
return (Unit*)itr->first;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Helper function to undo the turning of the vehicle to calculate a relative position of the passenger when boarding
|
||||
void VehicleInfo::CalculateBoardingPositionOf(float gx, float gy, float gz, float go, float &lx, float &ly, float &lz, float &lo)
|
||||
void VehicleInfo::CalculateBoardingPositionOf(float gx, float gy, float gz, float go, float& lx, float& ly, float& lz, float& lo) const
|
||||
{
|
||||
NormalizeRotatedPosition(gx - m_owner->GetPositionX(), gy - m_owner->GetPositionY(), lx, ly);
|
||||
|
||||
|
|
@ -155,6 +394,21 @@ void VehicleInfo::CalculateBoardingPositionOf(float gx, float gy, float gz, floa
|
|||
lo = NormalizeOrientation(go - m_owner->GetOrientation());
|
||||
}
|
||||
|
||||
void VehicleInfo::RemoveAccessoriesFromMap()
|
||||
{
|
||||
// Remove all accessories
|
||||
for (GuidSet::const_iterator itr = m_accessoryGuids.begin(); itr != m_accessoryGuids.end(); ++itr)
|
||||
{
|
||||
if (Creature* pAccessory = m_owner->GetMap()->GetCreature(*itr))
|
||||
{
|
||||
// TODO - unclear how long to despawn, also maybe some flag etc depending
|
||||
pAccessory->ForcedDespawn(5000);
|
||||
}
|
||||
}
|
||||
m_accessoryGuids.clear();
|
||||
m_isInitialized = false;
|
||||
}
|
||||
|
||||
/* ************************************************************************************************
|
||||
* Helper function for seat control
|
||||
* ***********************************************************************************************/
|
||||
|
|
@ -199,7 +453,7 @@ bool VehicleInfo::IsSeatAvailableFor(Unit* passenger, uint8 seat) const
|
|||
MANGOS_ASSERT(passenger);
|
||||
|
||||
return seat < MAX_VEHICLE_SEAT &&
|
||||
(GetEmptySeatsMask() & (passenger->GetTypeId() == TYPEID_PLAYER ? m_playerSeats : m_creatureSeats) & (1 << seat));
|
||||
(GetEmptySeatsMask() & (passenger->GetTypeId() == TYPEID_PLAYER ? m_playerSeats : m_creatureSeats) & (1 << seat));
|
||||
}
|
||||
|
||||
/// Wrapper to collect all taken seats
|
||||
|
|
@ -221,11 +475,102 @@ bool VehicleInfo:: IsUsableSeatForPlayer(uint32 seatFlags) const
|
|||
/// Add control and such modifiers to a passenger if required
|
||||
void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
||||
{
|
||||
Unit* pVehicle = (Unit*)m_owner; // Vehicles are alawys Unit
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->GetCamera().SetView(pVehicle);
|
||||
|
||||
pPlayer->SetCharm(pVehicle);
|
||||
pVehicle->SetCharmerGuid(pPlayer->GetObjectGuid());
|
||||
|
||||
pVehicle->addUnitState(UNIT_STAT_CONTROLLED);
|
||||
pVehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
pPlayer->SetClientControl(pVehicle, 1);
|
||||
pPlayer->SetMover(pVehicle);
|
||||
|
||||
// Unconfirmed - default speed handling
|
||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (!pPlayer->IsWalking() && pVehicle->IsWalking())
|
||||
{
|
||||
((Creature*)pVehicle)->SetWalk(false, true);
|
||||
}
|
||||
else if (pPlayer->IsWalking() && !pVehicle->IsWalking())
|
||||
{
|
||||
((Creature*)pVehicle)->SetWalk(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
{
|
||||
CharmInfo* charmInfo = pVehicle->InitCharmInfo(pVehicle);
|
||||
charmInfo->InitVehicleCreateSpells();
|
||||
|
||||
pPlayer->PossessSpellInitialize();
|
||||
}
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
passenger->SetCharm(pVehicle);
|
||||
pVehicle->SetCharmerGuid(passenger->GetObjectGuid());
|
||||
}
|
||||
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(false);
|
||||
// Not entirely sure how this must be handled in relation to CONTROL
|
||||
// But in any way this at least would require some changes in the movement system most likely
|
||||
passenger->GetMotionMaster()->Clear(false, true);
|
||||
passenger->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove control and such modifiers to a passenger if they were added
|
||||
void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||
{
|
||||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->SetCharm(NULL);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
|
||||
pPlayer->SetClientControl(pVehicle, 0);
|
||||
pPlayer->SetMover(NULL);
|
||||
|
||||
pVehicle->clearUnitState(UNIT_STAT_CONTROLLED);
|
||||
pVehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
// must be called after movement control unapplying
|
||||
pPlayer->GetCamera().ResetView();
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
pPlayer->RemovePetActionBar();
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
passenger->SetCharm(NULL);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
}
|
||||
// Reinitialize movement
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
||||
if (!passenger->getVictim())
|
||||
passenger->GetMotionMaster()->Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue