Core/Unit: Added helper functions to modify UNIT_FLAG2_CANNOT_TURN
Port From (https://github.com/TrinityCore/TrinityCore/commit/53f9abec14613c0823b1ee5363b3f873cc23ece9)
This commit is contained in:
@@ -3137,7 +3137,7 @@ namespace Game.Entities
|
|||||||
_spellFocusInfo.Spell = focusSpell;
|
_spellFocusInfo.Spell = focusSpell;
|
||||||
|
|
||||||
bool noTurnDuringCast = spellInfo.HasAttribute(SpellAttr5.AiDoesntFaceTarget);
|
bool noTurnDuringCast = spellInfo.HasAttribute(SpellAttr5.AiDoesntFaceTarget);
|
||||||
bool turnDisabled = HasUnitFlag2(UnitFlags2.CannotTurn);
|
bool turnDisabled = CannotTurn();
|
||||||
// set target, then force send update packet to players if it changed to provide appropriate facing
|
// set target, then force send update packet to players if it changed to provide appropriate facing
|
||||||
ObjectGuid newTarget = (target != null && !noTurnDuringCast && !turnDisabled) ? target.GetGUID() : ObjectGuid.Empty;
|
ObjectGuid newTarget = (target != null && !noTurnDuringCast && !turnDisabled) ? target.GetGUID() : ObjectGuid.Empty;
|
||||||
if (GetTarget() != newTarget)
|
if (GetTarget() != newTarget)
|
||||||
@@ -3181,7 +3181,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (IsPet()) // player pets do not use delay system
|
if (IsPet()) // player pets do not use delay system
|
||||||
{
|
{
|
||||||
if (!HasUnitFlag2(UnitFlags2.CannotTurn))
|
if (!CannotTurn())
|
||||||
ReacquireSpellFocusTarget();
|
ReacquireSpellFocusTarget();
|
||||||
}
|
}
|
||||||
else // don't allow re-target right away to prevent visual bugs
|
else // don't allow re-target right away to prevent visual bugs
|
||||||
@@ -3200,7 +3200,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), _spellFocusInfo.Target);
|
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), _spellFocusInfo.Target);
|
||||||
|
|
||||||
if (!HasUnitFlag2(UnitFlags2.CannotTurn))
|
if (!CannotTurn())
|
||||||
{
|
{
|
||||||
if (!_spellFocusInfo.Target.IsEmpty())
|
if (!_spellFocusInfo.Target.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -684,7 +684,17 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsThreatened()
|
public bool CannotTurn() { return HasUnitFlag2(UnitFlags2.CannotTurn); }
|
||||||
|
|
||||||
|
public void SetCannotTurn(bool apply)
|
||||||
|
{
|
||||||
|
if (apply)
|
||||||
|
SetUnitFlag2(UnitFlags2.CannotTurn);
|
||||||
|
else
|
||||||
|
RemoveUnitFlag2(UnitFlags2.CannotTurn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsThreatened()
|
||||||
{
|
{
|
||||||
return !m_threatManager.IsThreatListEmpty();
|
return !m_threatManager.IsThreatListEmpty();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user