diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 9fef6246d..c4365911d 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -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 diff --git a/src/game/Map.cpp b/src/game/Map.cpp index b29454f28..3e2416636 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -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: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fffbca4a7..debe23afd 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11858" + #define REVISION_NR "11859" #endif // __REVISION_NR_H__