Core/Movement: Add MovePoint with facing
Port From (https://github.com/TrinityCore/TrinityCore/commit/c6d6ece1c7a450145598d5ac3c83b399cc731ee9)
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
public class PointMovementGenerator<T> : MovementGeneratorMedium<T> where T : Unit
|
public class PointMovementGenerator<T> : MovementGeneratorMedium<T> where T : Unit
|
||||||
{
|
{
|
||||||
public PointMovementGenerator(uint id, float x, float y, float z, bool generatePath, float speed = 0.0f, Unit faceTarget = null, SpellEffectExtraData spellEffectExtraData = null)
|
public PointMovementGenerator(uint id, float x, float y, float z, bool generatePath, float speed = 0.0f, Unit faceTarget = null, SpellEffectExtraData spellEffectExtraData = null, float? finalOrient = null)
|
||||||
{
|
{
|
||||||
_movementId = id;
|
_movementId = id;
|
||||||
_destination = new Position(x, y, z);
|
_destination = new Position(x, y, z);
|
||||||
@@ -31,6 +31,7 @@ namespace Game.Movement
|
|||||||
_spellEffectExtra = spellEffectExtraData;
|
_spellEffectExtra = spellEffectExtraData;
|
||||||
_generatePath = generatePath;
|
_generatePath = generatePath;
|
||||||
_recalculateSpeed = false;
|
_recalculateSpeed = false;
|
||||||
|
_finalOrient = finalOrient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoInitialize(T owner)
|
public override void DoInitialize(T owner)
|
||||||
@@ -63,6 +64,9 @@ namespace Game.Movement
|
|||||||
if (_spellEffectExtra != null)
|
if (_spellEffectExtra != null)
|
||||||
init.SetSpellEffectExtraData(_spellEffectExtra);
|
init.SetSpellEffectExtraData(_spellEffectExtra);
|
||||||
|
|
||||||
|
if (_finalOrient.HasValue)
|
||||||
|
init.SetFacing(_finalOrient.Value);
|
||||||
|
|
||||||
init.Launch();
|
init.Launch();
|
||||||
|
|
||||||
// Call for creature group update
|
// Call for creature group update
|
||||||
@@ -149,6 +153,8 @@ namespace Game.Movement
|
|||||||
bool _generatePath;
|
bool _generatePath;
|
||||||
bool _recalculateSpeed;
|
bool _recalculateSpeed;
|
||||||
bool _interrupt;
|
bool _interrupt;
|
||||||
|
//! if set then unit will turn to specified _orient in provided _pos
|
||||||
|
float? _finalOrient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AssistanceMovementGenerator : PointMovementGenerator<Creature>
|
public class AssistanceMovementGenerator : PointMovementGenerator<Creature>
|
||||||
|
|||||||
@@ -259,17 +259,17 @@ namespace Game.Movement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePoint(uint id, Position pos, bool generatePath = true)
|
public void MovePoint(uint id, Position pos, bool generatePath = true, float? finalOrient = null)
|
||||||
{
|
{
|
||||||
MovePoint(id, pos.posX, pos.posY, pos.posZ, generatePath);
|
MovePoint(id, pos.posX, pos.posY, pos.posZ, generatePath, finalOrient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePoint(uint id, float x, float y, float z, bool generatePath = true)
|
public void MovePoint(uint id, float x, float y, float z, bool generatePath = true, float? finalOrient = null)
|
||||||
{
|
{
|
||||||
if (_owner.IsTypeId(TypeId.Player))
|
if (_owner.IsTypeId(TypeId.Player))
|
||||||
StartMovement(new PointMovementGenerator<Player>(id, x, y, z, generatePath), MovementSlot.Active);
|
StartMovement(new PointMovementGenerator<Player>(id, x, y, z, generatePath, 0.0f, null, null, finalOrient), MovementSlot.Active);
|
||||||
else
|
else
|
||||||
StartMovement(new PointMovementGenerator<Creature>(id, x, y, z, generatePath), MovementSlot.Active);
|
StartMovement(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, 0.0f, null, null, finalOrient), MovementSlot.Active);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveCloserAndStop(uint id, Unit target, float distance)
|
public void MoveCloserAndStop(uint id, Unit target, float distance)
|
||||||
|
|||||||
Reference in New Issue
Block a user