diff options
author | Rushor <Rushor@users.noreply.github.com> | 2017-01-21 22:10:07 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-12-09 14:18:42 +0100 |
commit | 77cb6c1a3f94a9209581a77fdebd222f15088866 (patch) | |
tree | a9643b119596b560677b031057a2f3a537e200da /src | |
parent | 0764ac47e09adaaaf4cf8185c108e98606bb6e7d (diff) |
Game/AI: Implement ContactDistance for ACTION_MOVE_TO_POS (#18720)
(cherry-picked from 60d1c0e20d3f8f32de81bff047531b927e586a97)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 8 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 79af3ea66b9..6c888550494 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1707,7 +1707,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest, 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: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 7b9e1ff5f3d..ac765bfa47a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -513,7 +513,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 @@ -997,6 +997,7 @@ struct SmartAction uint32 pointId; uint32 transport; uint32 disablePathfinding; + uint32 ContactDistance; } MoveToPos; struct |