mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1939,13 +1939,24 @@ void Map::ScriptsProcess()
|
|||
}
|
||||
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11858"
|
||||
#define REVISION_NR "11859"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue