Skip to content

Commit

Permalink
Game/AI: Implement ContactDistance for ACTION_MOVE_TO_POS (#18720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushor authored and Keader committed Jan 21, 2017
1 parent 65b6202 commit 60d1c0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/server/game/AI/SmartScripts/SmartScript.cpp
Expand Up @@ -1522,7 +1522,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, e.action.MoveToPos.disablePathfinding == 0);
}
else
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), e.action.MoveToPos.disablePathfinding == 0);
{
float x, y, z;
target->GetPosition(x, y, z);
if (e.action.MoveToPos.ContactDistance > 0)
target->GetContactPoint(me, x, y, z, e.action.MoveToPos.ContactDistance);
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, x, y, z, e.action.MoveToPos.disablePathfinding == 0);
}
break;
}
case SMART_ACTION_RESPAWN_TARGET:
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/AI/SmartScripts/SmartScriptMgr.h
Expand Up @@ -508,7 +508,7 @@ enum SMART_ACTION
SMART_ACTION_SET_ORIENTATION = 66, //
SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
SMART_ACTION_PLAYMOVIE = 68, // entry
SMART_ACTION_MOVE_TO_POS = 69, // PointId, transport, disablePathfinding
SMART_ACTION_MOVE_TO_POS = 69, // PointId, transport, disablePathfinding, ContactDistance
SMART_ACTION_RESPAWN_TARGET = 70, //
SMART_ACTION_EQUIP = 71, // entry, slotmask slot1, slot2, slot3 , only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), slots1-3 are only used if no entry is set
SMART_ACTION_CLOSE_GOSSIP = 72, // none
Expand Down Expand Up @@ -980,6 +980,7 @@ struct SmartAction
uint32 pointId;
uint32 transport;
uint32 disablePathfinding;
uint32 ContactDistance;
} MoveToPos;

struct
Expand Down

0 comments on commit 60d1c0e

Please sign in to comment.