Game/Mapscripts: Implement SCRIPT_COMMAND_MOVEMENT

Cherry pick from 85357c75c4
This commit is contained in:
Aokromes
2017-02-15 07:11:48 +01:00
parent 8821f59340
commit fac5ce67db
3 changed files with 33 additions and 2 deletions

View File

@@ -886,6 +886,28 @@ void Map::ScriptsProcess()
player->SendMovieStart(step.script->PlayMovie.MovieID);
break;
case SCRIPT_COMMAND_MOVEMENT:
// Source must be Creature.
if (Creature* cSource = _GetScriptCreature(source, true, step.script))
{
if (!cSource->IsAlive())
return;
cSource->GetMotionMaster()->MovementExpired();
cSource->GetMotionMaster()->MoveIdle();
switch (step.script->Movement.MovementType)
{
case RANDOM_MOTION_TYPE:
cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance);
break;
case WAYPOINT_MOTION_TYPE:
cSource->GetMotionMaster()->MovePath(step.script->Movement.Path, false);
break;
}
}
break;
case SCRIPT_COMMAND_PLAY_ANIMKIT:
// Source must be Creature.
if (Creature* cSource = _GetScriptCreature(source, true, step.script))