[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

@ -112,8 +112,9 @@ spell_scripts
* datalong2 = field value
3 SCRIPT_COMMAND_MOVE_TO source = Creature
If position is very near to current position, or x=y=z=0, then only orientation is changed
* datalong2 = travel time
* x/y/z
* x/y/z/o
4 SCRIPT_COMMAND_FLAG_SET source = any
* datalong = field_id

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:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11858"
#define REVISION_NR "11859"
#endif // __REVISION_NR_H__