aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-02-23 22:07:40 +0100
committerjackpoz <giacomopoz@gmail.com>2020-02-23 22:07:40 +0100
commit7a57029d8fd46c0966eb32b17019291785e61f37 (patch)
treed0e4c2b66d0e86e9ccd1e3e85ad94cd985d51cba
parent21175ba2ff06a2eb869a3054133111c0546de68f (diff)
Core/Movement: Add support to cyclic splines to GenericMovementGenerator
GenericMovementGenerator sets the _duration to the return value of spline.Launch(). For cyclic splines, this is the duration of 1 single cycle, while the spline itself never ends. To support this edge case in GenericMovementGenerator we just never update the _duration timer for cyclic splines.
-rw-r--r--src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp5
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp12
2 files changed, 4 insertions, 13 deletions
diff --git a/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp
index 3aeb3ab2d38..00f48fd0cfe 100644
--- a/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp
@@ -55,7 +55,10 @@ bool GenericMovementGenerator::Update(Unit* owner, uint32 diff)
if (!owner || HasFlag(MOVEMENTGENERATOR_FLAG_FINALIZED))
return false;
- _duration.Update(diff);
+ // Cyclic splines never expire, so update the duration only if it's not cyclic
+ if (!owner->movespline->isCyclic())
+ _duration.Update(diff);
+
if (_duration.Passed() || owner->movespline->Finalized())
{
AddFlag(MOVEMENTGENERATOR_FLAG_INFORM_ENABLED);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index 261ab643524..e9743454674 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -1169,18 +1169,6 @@ class npc_ominous_cloud : public CreatureScript
me->GetMotionMaster()->MoveCirclePath(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY(), me->GetPositionZ() + 5.0f, me->GetDistance2d(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY()), clockwise, 16);
}
- void MovementInform(uint32 type, uint32 /*id*/) override
- {
- if (type != EFFECT_MOTION_TYPE)
- return;
-
- /* MoveCirclePath() add a GenericMovementGenerator that doesn't handle cyclic splines, handling only 1 round of the circle.
- * This means we have to reschedule another MoveCirclePath() every time the previous one ends.
- * Remove this code once GenericMovementGenerator properly handles cyclic splines.
- */
- me->GetMotionMaster()->MoveCirclePath(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY(), me->GetPositionZ() + 5.0f, me->GetDistance2d(YoggSaronSpawnPos.GetPositionX(), YoggSaronSpawnPos.GetPositionY()), clockwise, 16);
- }
-
bool clockwise = false;
};