aboutsummaryrefslogtreecommitdiff
path: root/src/game/Vehicle.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-03 00:24:07 -0500
committermegamage <none@none>2009-06-03 00:24:07 -0500
commit297ce013a841731e83fd8169ba1de65f4419eef0 (patch)
tree808a32d9c0eebcd43c6f793ef30b05bce2c18161 /src/game/Vehicle.cpp
parent7e3bb5c2d43faac7ee8d32892840b070f8beaf92 (diff)
*Disable vehicle/creature driver movement when entering vehicle.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Vehicle.cpp')
-rw-r--r--src/game/Vehicle.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index aaf97b3e413..f915c828c1d 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -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();