mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11756] Call MovementInform at arrive in effect movement generator, move class to more appropriate place
Signed-off-by: SilverIce <slifeleaf@gmail.com>
This commit is contained in:
parent
eed25030b7
commit
0b26ca38a7
5 changed files with 41 additions and 26 deletions
|
|
@ -465,34 +465,12 @@ void MotionMaster::UpdateFinalDistanceToTarget(float fDistance)
|
||||||
top()->UpdateFinalDistance(fDistance);
|
top()->UpdateFinalDistance(fDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does almost nothing - just doesn't allows previous movegen interrupt current effect. Can be reused for charge effect
|
void MotionMaster::MoveJump(float x, float y, float z, float horizontalSpeed, float max_height, uint32 id)
|
||||||
class EffectMovementGenerator : public MovementGenerator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void Initialize(Unit &) {}
|
|
||||||
void Finalize(Unit &unit)
|
|
||||||
{
|
|
||||||
// Since we have no proper states system need restore previous movement.
|
|
||||||
if (unit.GetTypeId() != TYPEID_PLAYER && unit.isAlive() && !unit.hasUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_FLEEING))
|
|
||||||
{
|
|
||||||
if (Unit * victim = unit.getVictim())
|
|
||||||
unit.GetMotionMaster()->MoveChase(victim);
|
|
||||||
else
|
|
||||||
unit.GetMotionMaster()->Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Interrupt(Unit &) {}
|
|
||||||
void Reset(Unit &) {}
|
|
||||||
bool Update(Unit &u, const uint32 &) { return !u.movespline->Finalized(); }
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() const { return EFFECT_MOTION_TYPE; }
|
|
||||||
};
|
|
||||||
|
|
||||||
void MotionMaster::MoveJump(float x, float y, float z, float horizontalSpeed, float max_height)
|
|
||||||
{
|
{
|
||||||
Movement::MoveSplineInit init(*m_owner);
|
Movement::MoveSplineInit init(*m_owner);
|
||||||
init.MoveTo(x,y,z);
|
init.MoveTo(x,y,z);
|
||||||
init.SetParabolic(max_height,0,false);
|
init.SetParabolic(max_height,0,false);
|
||||||
init.SetVelocity(horizontalSpeed);
|
init.SetVelocity(horizontalSpeed);
|
||||||
init.Launch();
|
init.Launch();
|
||||||
Mutate(new EffectMovementGenerator());
|
Mutate(new EffectMovementGenerator(id));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
||||||
void MoveWaypoint();
|
void MoveWaypoint();
|
||||||
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
||||||
void MoveDistract(uint32 timeLimit);
|
void MoveDistract(uint32 timeLimit);
|
||||||
void MoveJump(float x, float y, float z, float horizontalSpeed, float max_height);
|
void MoveJump(float x, float y, float z, float horizontalSpeed, float max_height, uint32 id = 0);
|
||||||
|
|
||||||
MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,3 +119,25 @@ void AssistanceMovementGenerator::Finalize(Unit &unit)
|
||||||
if (unit.isAlive())
|
if (unit.isAlive())
|
||||||
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EffectMovementGenerator::Update(Unit &unit, const uint32 &)
|
||||||
|
{
|
||||||
|
return !unit.movespline->Finalized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectMovementGenerator::Finalize(Unit &unit)
|
||||||
|
{
|
||||||
|
if (unit.GetTypeId() != TYPEID_UNIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (((Creature&)unit).AI() && unit.movespline->Finalized())
|
||||||
|
((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id);
|
||||||
|
// Need restore previous movement since we have no proper states system
|
||||||
|
if (unit.isAlive() && !unit.hasUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_FLEEING))
|
||||||
|
{
|
||||||
|
if (Unit * victim = unit.getVictim())
|
||||||
|
unit.GetMotionMaster()->MoveChase(victim);
|
||||||
|
else
|
||||||
|
unit.GetMotionMaster()->Initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,4 +58,19 @@ class MANGOS_DLL_SPEC AssistanceMovementGenerator
|
||||||
void Finalize(Unit &);
|
void Finalize(Unit &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Does almost nothing - just doesn't allows previous movegen interrupt current effect. Can be reused for charge effect
|
||||||
|
class EffectMovementGenerator : public MovementGenerator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) {}
|
||||||
|
void Initialize(Unit &) {}
|
||||||
|
void Finalize(Unit &unit);
|
||||||
|
void Interrupt(Unit &) {}
|
||||||
|
void Reset(Unit &) {}
|
||||||
|
bool Update(Unit &u, const uint32 &);
|
||||||
|
MovementGeneratorType GetMovementGeneratorType() const { return EFFECT_MOTION_TYPE; }
|
||||||
|
private:
|
||||||
|
uint32 m_Id;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11755"
|
#define REVISION_NR "11756"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue