mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11859] Enable script command MOVE_TO to also change the orientation
This commit is contained in:
parent
fe79f593ca
commit
7d05ca0b79
3 changed files with 16 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue