[12030] Support Random Movement around a point

* Remove unused MoveRandom function
* Add MotionMaster::MoveRandomAroundPoint function
* Toggle DB-command COMMAND_MOVEMENT to be able to move around current position or respawn position (depending on data_flags)
This commit is contained in:
Reamer 2012-07-12 19:06:46 +02:00 committed by Schmoozerd
parent 12fa17dba5
commit 6b6b2379a3
8 changed files with 43 additions and 31 deletions

View file

@ -1477,7 +1477,15 @@ void ScriptAction::HandleScriptStep()
((Creature*)pSource)->GetMotionMaster()->MoveIdle();
break;
case RANDOM_MOTION_TYPE:
((Creature*)pSource)->GetMotionMaster()->MoveRandom();
if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
((Creature*)pSource)->GetMotionMaster()->MoveRandomAroundPoint(pSource->GetPositionX(), pSource->GetPositionY(), pSource->GetPositionZ(), float(m_script->movement.wanderDistance));
else
{
float respX, respY, respZ, respO, wander_distance;
((Creature*)pSource)->GetRespawnCoord(respX, respY, respZ, &respO, &wander_distance);
wander_distance = m_script->movement.wanderDistance ? m_script->movement.wanderDistance : wander_distance;
((Creature*)pSource)->GetMotionMaster()->MoveRandomAroundPoint(respX, respY, respZ, wander_distance);
}
break;
case WAYPOINT_MOTION_TYPE:
((Creature*)pSource)->GetMotionMaster()->MoveWaypoint();