mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/AreaTriggers: Don't suppress TimeToTarget changes in values update on movement start
This commit is contained in:
@@ -1086,10 +1086,10 @@ void AreaTrigger::InitSplineOffsets(std::vector<Position> const& offsets, uint32
|
||||
rotatedPoints.emplace_back(x, y, z);
|
||||
}
|
||||
|
||||
InitSplines(std::move(rotatedPoints), timeToTarget);
|
||||
InitSplines(rotatedPoints, timeToTarget);
|
||||
}
|
||||
|
||||
void AreaTrigger::InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget)
|
||||
void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget)
|
||||
{
|
||||
if (splinePoints.size() < 2)
|
||||
return;
|
||||
@@ -1097,15 +1097,10 @@ void AreaTrigger::InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 tim
|
||||
_movementTime = 0;
|
||||
|
||||
_spline = std::make_unique<::Movement::Spline<int32>>();
|
||||
_spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear);
|
||||
_spline->init_spline(splinePoints.data(), splinePoints.size(), ::Movement::SplineBase::ModeLinear);
|
||||
_spline->initLengths();
|
||||
|
||||
// should be sent in object create packets only
|
||||
DoWithSuppressingObjectUpdates([&]()
|
||||
{
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&AreaTrigger::m_areaTriggerData).ModifyValue(&UF::AreaTriggerData::TimeToTarget), timeToTarget);
|
||||
const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::TimeToTarget);
|
||||
});
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&AreaTrigger::m_areaTriggerData).ModifyValue(&UF::AreaTriggerData::TimeToTarget), timeToTarget);
|
||||
|
||||
if (IsInWorld())
|
||||
{
|
||||
|
||||
@@ -153,7 +153,7 @@ class TC_GAME_API AreaTrigger final : public WorldObject, public GridObject<Area
|
||||
Position const& GetRollPitchYaw() const { return _rollPitchYaw; }
|
||||
Position const& GetTargetRollPitchYaw() const { return _targetRollPitchYaw; }
|
||||
void InitSplineOffsets(std::vector<Position> const& offsets, uint32 timeToTarget);
|
||||
void InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget);
|
||||
void InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget);
|
||||
bool HasSplines() const;
|
||||
::Movement::Spline<int32> const& GetSpline() const { return *_spline; }
|
||||
uint32 GetElapsedTimeForMovement() const { return GetTimeSinceCreated(); } /// @todo: research the right value, in sniffs both timers are nearly identical
|
||||
|
||||
@@ -2957,7 +2957,7 @@ struct at_anduin_wrynn_wicked_star : AreaTriggerAI
|
||||
splinePoints.push_back(PositionToVector3(at->GetPosition()));
|
||||
|
||||
float timeToTarget = at->GetDistance(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ()) * 2 / GetWickedStarSpeed(at->GetMap()->GetDifficultyID()) * 1000;
|
||||
at->InitSplines(std::move(splinePoints), timeToTarget);
|
||||
at->InitSplines(splinePoints, timeToTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3021,7 +3021,7 @@ struct at_anduin_wrynn_empowered_wicked_star : public at_anduin_wrynn_wicked_sta
|
||||
splinePoints.push_back(PositionToVector3(destPos));
|
||||
|
||||
float timeToTarget = at->GetDistance(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ()) / EMPOWERED_WICKED_STAR_SPEED * 1000;
|
||||
at->InitSplines(std::move(splinePoints), timeToTarget);
|
||||
at->InitSplines(splinePoints, timeToTarget);
|
||||
}
|
||||
|
||||
void OnInitialize() override
|
||||
|
||||
Reference in New Issue
Block a user