Game/Mapscripts: Implement SCRIPT_COMMAND_MOVEMENT

This commit is contained in:
Rushor
2017-02-07 00:54:32 +01:00
committed by Aokromes
parent 9e65fead38
commit 85357c75c4
3 changed files with 32 additions and 1 deletions

View File

@@ -872,6 +872,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;
default:
TC_LOG_ERROR("scripts", "Unknown script command %s.", step.script->GetDebugInfo().c_str());
break;