mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[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:
parent
12fa17dba5
commit
6b6b2379a3
8 changed files with 43 additions and 31 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue