*Disable vehicle/creature driver movement when entering vehicle.
--HG-- branch : trunk
This commit is contained in:
@@ -61,6 +61,7 @@ class TRINITY_DLL_DECL NullCreatureAI : public CreatureAI
|
||||
void AttackStart(Unit *) {}
|
||||
void UpdateAI(const uint32) {}
|
||||
void EnterEvadeMode() {}
|
||||
void OnCharmed(bool apply) {}
|
||||
|
||||
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
+5
-2
@@ -11655,7 +11655,10 @@ void Unit::RemoveFromWorld()
|
||||
ExitVehicle();
|
||||
|
||||
if(GetCharmerGUID())
|
||||
{
|
||||
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
|
||||
assert(false);
|
||||
}
|
||||
|
||||
WorldObject::RemoveFromWorld();
|
||||
}
|
||||
@@ -11701,7 +11704,7 @@ void Unit::UpdateCharmAI()
|
||||
if(isCharmed())
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
if(isPossessed())
|
||||
if(isPossessed() || ((Creature*)this)->isVehicle())
|
||||
i_AI = new PossessedAI((Creature*)this);
|
||||
else
|
||||
i_AI = new PetAI((Creature*)this);
|
||||
@@ -14000,7 +14003,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
return;
|
||||
|
||||
for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
|
||||
if((*itr)->GetOwnerGUID() == GetGUID())
|
||||
if((*itr)->GetTypeId() == TYPEID_UNIT)
|
||||
(*itr)->SetPhaseMask(newPhaseMask,true);
|
||||
|
||||
for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include "Chat.h"
|
||||
#include "CreatureAI.h"
|
||||
|
||||
Vehicle::Vehicle() : Creature(), m_vehicleInfo(NULL), m_usableSeatNum(0)
|
||||
{
|
||||
@@ -238,6 +239,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
GetPositionZ() + unit->m_movementInfo.t_z,
|
||||
GetOrientation());
|
||||
|
||||
unit->GetMotionMaster()->MoveIdle(MOTION_SLOT_IDLE);
|
||||
|
||||
WorldPacket data;
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -246,6 +249,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
if(seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right
|
||||
{
|
||||
setFaction(unit->getFaction());
|
||||
AI()->OnCharmed(true);
|
||||
GetMotionMaster()->MoveIdle();
|
||||
((Player*)unit)->SetCharm(this, true);
|
||||
((Player*)unit)->SetViewpoint(this, true);
|
||||
((Player*)unit)->VehicleSpellInitialize();
|
||||
@@ -291,6 +296,7 @@ void Vehicle::RemovePassenger(Unit *unit)
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable())
|
||||
{
|
||||
RestoreFaction();
|
||||
AI()->OnCharmed(false);
|
||||
((Player*)unit)->SetCharm(this, false);
|
||||
((Player*)unit)->SetViewpoint(this, false);
|
||||
((Player*)unit)->SendRemoveControlBar();
|
||||
|
||||
Reference in New Issue
Block a user