Core/Movement: allow MotionMaster::MovePoint to use velocity arguments and implement speed paramemters for SMART_ACTION_MOVE_OFFSET and SMART_ACTION_MOVE_TO_POS
This commit is contained in:
1 parent
9320382d90
commit
961f82988d
4 files changed
+19
-9
No files matched your search
@@ -1207,13 +1207,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
Position pos = target->GetPosition();
|
||||
|
||||
float speed = (float)e.action.moveOffset.speed / 10;
|
||||
|
||||
// Use forward/backward/left/right cartesian plane movement
|
||||
float x, y, z, o;
|
||||
o = pos.GetOrientation();
|
||||
x = pos.GetPositionX() + (std::cos(o - (M_PI / 2))*e.target.x) + (std::cos(o)*e.target.y);
|
||||
y = pos.GetPositionY() + (std::sin(o - (M_PI / 2))*e.target.x) + (std::sin(o)*e.target.y);
|
||||
z = pos.GetPositionZ() + e.target.z;
|
||||
target->ToCreature()->GetMotionMaster()->MovePoint(SMART_RANDOM_POINT, x, y, z);
|
||||
target->ToCreature()->GetMotionMaster()->MovePoint(SMART_RANDOM_POINT, x, y, z, true, speed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1500,6 +1502,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
}
|
||||
|
||||
float speed = (float)e.action.MoveToPos.speed / 10;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
G3D::Vector3 dest(e.target.x, e.target.y, e.target.z);
|
||||
@@ -1507,7 +1511,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (TransportBase* trans = me->GetDirectTransport())
|
||||
trans->CalculatePassengerPosition(dest.x, dest.y, dest.z);
|
||||
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, e.action.MoveToPos.disablePathfinding == 0);
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, e.action.MoveToPos.disablePathfinding == 0, speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1515,7 +1519,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
target->GetPosition(x, y, z);
|
||||
if (e.action.MoveToPos.ContactDistance > 0)
|
||||
target->GetContactPoint(me, x, y, z, e.action.MoveToPos.ContactDistance);
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, e.action.MoveToPos.disablePathfinding == 0);
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, e.action.MoveToPos.disablePathfinding == 0, speed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user