diff options
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 22f06801640..79d7c1026d4 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -19,6 +19,7 @@ #include "MotionMaster.h" #include "CreatureAISelector.h" #include "Creature.h" +#include "ScriptSystem.h" #include "ConfusedMovementGenerator.h" #include "FleeingMovementGenerator.h" @@ -28,6 +29,7 @@ #include "TargetedMovementGenerator.h" #include "WaypointMovementGenerator.h" #include "RandomMovementGenerator.h" +#include "SplineChainMovementGenerator.h" #include "MoveSpline.h" #include "MoveSplineInit.h" @@ -479,6 +481,33 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, Movement::PointsArray const& p //MovePoint(EVENT_CHARGE_PREPATH, pos, false); } +void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint32 dbChainId, bool walk) +{ + Creature* owner = _owner->ToCreature(); + if (!owner) + { + TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: non-creature %s tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str()); + return; + } + SplineChain const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId); + if (!chain) + { + TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: creature with entry %u tried to walk along non-existing spline chain with DB id %u.", owner->GetEntry(), dbChainId); + return; + } + MoveAlongSplineChain(pointId, *chain, walk); +} + +void MotionMaster::MoveAlongSplineChain(uint32 pointId, SplineChain const& chain, bool walk) +{ + Mutate(new SplineChainMovementGenerator(pointId, chain, walk), MOTION_SLOT_ACTIVE); +} + +void MotionMaster::ResumeSplineChain(SplineChainResumeInfo const& info) +{ + Mutate(new SplineChainMovementGenerator(info), MOTION_SLOT_ACTIVE); +} + void MotionMaster::MoveFall(uint32 id /*=0*/) { // use larger distance for vmap height search than in most other cases |