[11859] Enable script command MOVE_TO to also change the orientation

This commit is contained in:
Schmoozerd 2011-12-11 00:01:47 +01:00
parent fe79f593ca
commit 7d05ca0b79
3 changed files with 16 additions and 4 deletions

View file

@ -1938,14 +1938,25 @@ void Map::ScriptsProcess()
break;
}
Unit * unit = (Unit*)source;
Unit* unit = (Unit*)source;
// Just turn around
if (step.script->x == 0.0f && step.script->y == 0.0f && step.script->z == 0.0f ||
// Check point-to-point distance, hence revert effect of bounding radius
unit->IsWithinDist3d(step.script->x, step.script->y, step.script->z, 0.01f - unit->GetObjectBoundingRadius()))
{
unit->SetFacingTo(step.script->o);
break;
}
if (step.script->moveTo.travelTime != 0)
{
float speed = unit->GetDistance(step.script->x, step.script->y, step.script->z) / ((float)step.script->moveTo.travelTime * 0.001f);
unit->MonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, speed);
}
else
unit->NearTeleportTo(step.script->x, step.script->y, step.script->z, unit->GetOrientation());
unit->NearTeleportTo(step.script->x, step.script->y, step.script->z, step.script->o != 0.0f ? step.script->o : unit->GetOrientation());
break;
}
case SCRIPT_COMMAND_FLAG_SET: