diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-04-06 18:09:55 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-09-24 23:37:43 +0200 |
| commit | 14939204955d1a24fe465cdfcbf307daf3ce4f09 (patch) | |
| tree | 18e2bc2c0fa726bdcea65384c99742805e6d0cdf /src/server/scripts/Commands | |
| parent | 27fa6f3e341bb5a52b8c9b37b5a018d40b8e88a5 (diff) | |
Core/Movement: Replace old TargetedMovementGenerator into ChaseMovementGenerator and FollowMovementGenerator, full rewrite for both.
- Chase to angle is now functional. Pets use this to chase behind the target. Closes #19925.
- Chase to arbitrary range interval works. Not used anywhere, but you can technically make hunter-like mobs.
- Pets now follow the hunter cleanly and without stutter stepping. Also fix some other things. Closes #8924.
(cherry picked from commit 2a84562dc85516f432bb1e5de9add23c28b26ce4)
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 15 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_mmaps.cpp | 1 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 4 |
3 files changed, 6 insertions, 14 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 54426cf8471..2e5fadef27f 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -20,10 +20,12 @@ #include "ArenaTeamMgr.h" #include "CellImpl.h" #include "CharacterCache.h" +#include "ChaseMovementGenerator.h" #include "Chat.h" #include "DatabaseEnv.h" #include "DB2Stores.h" #include "DisableMgr.h" +#include "FollowMovementGenerator.h" #include "GridNotifiers.h" #include "Group.h" #include "GroupMgr.h" @@ -48,7 +50,6 @@ #include "SpellAuras.h" #include "SpellHistory.h" #include "SpellMgr.h" -#include "TargetedMovementGenerator.h" #include "Transport.h" #include "Weather.h" #include "WeatherMgr.h" @@ -2236,11 +2237,7 @@ public: break; case CHASE_MOTION_TYPE: { - Unit* target = nullptr; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); - else - target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget(); + Unit* target = static_cast<ChaseMovementGenerator const*>(movementGenerator)->GetTarget(); if (!target) handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); @@ -2252,11 +2249,7 @@ public: } case FOLLOW_MOTION_TYPE: { - Unit* target = nullptr; - if (unit->GetTypeId() == TYPEID_PLAYER) - target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); - else - target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget(); + Unit* target = static_cast<FollowMovementGenerator const*>(movementGenerator)->GetTarget(); if (!target) handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 125bd880ce0..20213f392d2 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -35,7 +35,6 @@ #include "Player.h" #include "PointMovementGenerator.h" #include "RBAC.h" -#include "TargetedMovementGenerator.h" #include "WorldSession.h" class mmaps_commandscript : public CommandScript diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 071c02394af..07d2e01b6d2 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "CreatureAI.h" #include "CreatureGroups.h" #include "DatabaseEnv.h" +#include "FollowMovementGenerator.h" #include "GameTime.h" #include "Language.h" #include "Log.h" @@ -37,7 +38,6 @@ EndScriptData */ #include "PhasingHandler.h" #include "Player.h" #include "RBAC.h" -#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand #include "Transport.h" #include "World.h" #include "WorldSession.h" @@ -1391,7 +1391,7 @@ public: return false; } - FollowMovementGenerator<Creature> const* mgen = static_cast<FollowMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top())); + FollowMovementGenerator const* mgen = static_cast<FollowMovementGenerator const*>((creature->GetMotionMaster()->top())); if (mgen->GetTarget() != player) { |
