diff options
| author | treeston <treeston.mmoc@gmail.com> | 2016-09-14 23:53:37 +0200 | 
|---|---|---|
| committer | treeston <treeston.mmoc@gmail.com> | 2016-09-20 00:37:36 +0200 | 
| commit | 6d00d3f28380dd0811a18913450b1dc4f07fef48 (patch) | |
| tree | 4367f426d2c48a718cade01216e2da407fa9633f /src/server/game/Movement/MotionMaster.cpp | |
| parent | 0b658f789cab005c080941e2be33e855debcbfde (diff) | |
Core/Movement: Add new SplineChainMovementGenerator that allows accurate replication of sniffed waypoints in static sequences, along with DB facilities that allow loading of waypoints from DB.
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 aab8db633ae..d2fce399ac0 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" @@ -468,6 +470,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 | 
