mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
Core/Unit: 2170541a51 followup
use true as default value since pretty much all the script calls will expect that
This commit is contained in:
@@ -162,9 +162,9 @@ void CreatureAI::TriggerAlert(Unit const* who) const
|
||||
me->SendAIReaction(AI_REACTION_ALERT);
|
||||
|
||||
// Face the unit (stealthed player) and set distracted state for 5 seconds
|
||||
me->SetFacingTo(me->GetAngle(who->GetPositionX(), who->GetPositionY()), true);
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS);
|
||||
me->StopMoving();
|
||||
me->SetFacingTo(me->GetAngle(who));
|
||||
}
|
||||
|
||||
void CreatureAI::EnterEvadeMode(EvadeReason why)
|
||||
|
||||
@@ -658,10 +658,10 @@ void Creature::Update(uint32 diff)
|
||||
if (m_suppressedTarget)
|
||||
{
|
||||
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget))
|
||||
SetFacingToObject(objTarget);
|
||||
SetFacingToObject(objTarget, false);
|
||||
}
|
||||
else
|
||||
SetFacingTo(m_suppressedOrientation);
|
||||
SetFacingTo(m_suppressedOrientation, false);
|
||||
m_shouldReacquireTarget = false;
|
||||
}
|
||||
|
||||
@@ -3037,10 +3037,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
|
||||
bool const canTurnDuringCast = !spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST);
|
||||
// Face the target - we need to do this before the unit state is modified for no-turn spells
|
||||
if (target)
|
||||
SetFacingToObject(target);
|
||||
SetFacingToObject(target, false);
|
||||
else if (!canTurnDuringCast)
|
||||
if (Unit* victim = GetVictim())
|
||||
SetFacingToObject(victim); // ensure orientation is correct at beginning of cast
|
||||
SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast
|
||||
|
||||
if (!canTurnDuringCast)
|
||||
AddUnitState(UNIT_STATE_CANNOT_TURN);
|
||||
@@ -3086,10 +3086,10 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay)
|
||||
if (m_suppressedTarget)
|
||||
{
|
||||
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget))
|
||||
SetFacingToObject(objTarget);
|
||||
SetFacingToObject(objTarget, false);
|
||||
}
|
||||
else
|
||||
SetFacingTo(m_suppressedOrientation);
|
||||
SetFacingTo(m_suppressedOrientation, false);
|
||||
}
|
||||
else
|
||||
// tell the creature that it should reacquire its actual target after the delay expires (this is handled in ::Update)
|
||||
|
||||
@@ -2090,7 +2090,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
|
||||
return; // ignore ranged case
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
|
||||
// melee attack spell cast at main hand attack only - no normal melee dmg dealt
|
||||
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
|
||||
@@ -2138,7 +2138,7 @@ void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BA
|
||||
return; // ignore ranged case
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
|
||||
|
||||
CalcDamageInfo damageInfo;
|
||||
damageInfo.attacker = this;
|
||||
@@ -14189,7 +14189,8 @@ void Unit::SetInFront(WorldObject const* target)
|
||||
|
||||
void Unit::SetFacingTo(float ori, bool force)
|
||||
{
|
||||
if (!force && !IsStopped())
|
||||
// do not face when already moving
|
||||
if (!force && (!IsStopped() || !movespline->Finalized()))
|
||||
return;
|
||||
|
||||
Movement::MoveSplineInit init(this);
|
||||
@@ -14203,7 +14204,7 @@ void Unit::SetFacingTo(float ori, bool force)
|
||||
void Unit::SetFacingToObject(WorldObject const* object, bool force)
|
||||
{
|
||||
// do not face when already moving
|
||||
if (!force && !IsStopped())
|
||||
if (!force && (!IsStopped() || !movespline->Finalized()))
|
||||
return;
|
||||
|
||||
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
|
||||
@@ -1649,8 +1649,8 @@ class TC_GAME_API Unit : public WorldObject
|
||||
virtual bool SetHover(bool enable, bool packetOnly = false);
|
||||
|
||||
void SetInFront(WorldObject const* target);
|
||||
void SetFacingTo(float ori, bool force = false);
|
||||
void SetFacingToObject(WorldObject const* object, bool force = false);
|
||||
void SetFacingTo(float const ori, bool force = true);
|
||||
void SetFacingToObject(WorldObject const* object, bool force = true);
|
||||
|
||||
void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference);
|
||||
void SendClearThreatListOpcode();
|
||||
|
||||
@@ -2490,11 +2490,11 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/)
|
||||
if (unitTarget->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING))
|
||||
return;
|
||||
|
||||
unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget));
|
||||
unitTarget->ClearUnitState(UNIT_STATE_MOVING);
|
||||
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS);
|
||||
|
||||
unitTarget->StopMoving();
|
||||
unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget));
|
||||
}
|
||||
|
||||
void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/)
|
||||
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
DoResetThreat();
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
{
|
||||
me->SetFacingToObject(target, true);
|
||||
me->SetFacingToObject(target);
|
||||
DoCast(target, SPELL_RAIN_OF_BONES);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
{
|
||||
case 4:
|
||||
SetEscortPaused(true);
|
||||
me->SetFacingTo(1.775791f, true);
|
||||
me->SetFacingTo(1.775791f);
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
Talk(SAY_MORRIDUNE_2);
|
||||
break;
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetFacingTo(me->GetOrientation() + float(M_PI), true);
|
||||
me->SetFacingTo(me->GetOrientation() + float(M_PI));
|
||||
if (Creature * trigger = me->SummonCreature(NPC_TRIGGER, MiddleRoomLocation, TEMPSUMMON_CORPSE_DESPAWN))
|
||||
triggerGUID = trigger->GetGUID();
|
||||
me->GetMotionMaster()->MoveTakeoff(11, Phase2Floating);
|
||||
|
||||
@@ -306,7 +306,7 @@ class boss_devourer_of_souls : public CreatureScript
|
||||
|
||||
case EVENT_WAILING_SOULS_TICK:
|
||||
beamAngle += beamAngleDiff;
|
||||
me->SetFacingTo(beamAngle, true);
|
||||
me->SetFacingTo(beamAngle);
|
||||
me->StopMoving();
|
||||
|
||||
DoCast(me, SPELL_WAILING_SOULS);
|
||||
|
||||
@@ -726,7 +726,7 @@ class npc_spinestalker : public CreatureScript
|
||||
me->SetDisableGravity(false);
|
||||
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetHomePosition(SpinestalkerLandPos);
|
||||
me->SetFacingTo(SpinestalkerLandPos.GetOrientation(), true);
|
||||
me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
@@ -863,7 +863,7 @@ class npc_rimefang : public CreatureScript
|
||||
me->SetDisableGravity(false);
|
||||
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||
me->SetHomePosition(RimefangLandPos);
|
||||
me->SetFacingTo(RimefangLandPos.GetOrientation(), true);
|
||||
me->SetFacingTo(RimefangLandPos.GetOrientation());
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
@@ -835,7 +835,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_INTRO_TALK_1, 9000, 0, PHASE_INTRO);
|
||||
break;
|
||||
case POINT_CENTER_1:
|
||||
me->SetFacingTo(0.0f, true);
|
||||
me->SetFacingTo(0.0f);
|
||||
Talk(SAY_LK_REMORSELESS_WINTER);
|
||||
me->GetMap()->SetZoneMusic(AREA_ICECROWN_CITADEL, MUSIC_SPECIAL);
|
||||
DoCast(me, SPELL_REMORSELESS_WINTER_1);
|
||||
@@ -851,7 +851,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_SOUL_REAPER, 94000, 0, PHASE_TWO);
|
||||
break;
|
||||
case POINT_CENTER_2:
|
||||
me->SetFacingTo(0.0f, true);
|
||||
me->SetFacingTo(0.0f);
|
||||
Talk(SAY_LK_REMORSELESS_WINTER);
|
||||
me->GetMap()->SetZoneMusic(AREA_ICECROWN_CITADEL, MUSIC_SPECIAL);
|
||||
DoCast(me, SPELL_REMORSELESS_WINTER_2);
|
||||
|
||||
@@ -437,7 +437,7 @@ class boss_algalon_the_observer : public CreatureScript
|
||||
me->SetDisableGravity(false);
|
||||
else if (pointId == POINT_ALGALON_OUTRO)
|
||||
{
|
||||
me->SetFacingTo(1.605703f, true);
|
||||
me->SetFacingTo(1.605703f);
|
||||
events.ScheduleEvent(EVENT_OUTRO_3, 1200);
|
||||
events.ScheduleEvent(EVENT_OUTRO_4, 2400);
|
||||
events.ScheduleEvent(EVENT_OUTRO_5, 8500);
|
||||
|
||||
@@ -75,7 +75,7 @@ class boss_erekem : public CreatureScript
|
||||
void MovementInform(uint32 type, uint32 pointId) override
|
||||
{
|
||||
if (type == EFFECT_MOTION_TYPE && pointId == POINT_INTRO)
|
||||
me->SetFacingTo(4.921828f, true);
|
||||
me->SetFacingTo(4.921828f);
|
||||
}
|
||||
|
||||
void JustReachedHome() override
|
||||
|
||||
@@ -174,7 +174,7 @@ class npc_commander_eligor_dawnbringer : public CreatureScript
|
||||
{
|
||||
if (id == 1)
|
||||
{
|
||||
me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation(), true);
|
||||
me->SetFacingTo(PosTalkLocations[talkWing].GetOrientation());
|
||||
TurnAudience();
|
||||
|
||||
switch (talkWing)
|
||||
|
||||
@@ -860,7 +860,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_FLY_TO_RANDOM_PILLAR, Seconds(2), GROUP_PHASE_ALL);
|
||||
break;
|
||||
case EVENT_CHANGE_ORIENTATION:
|
||||
me->SetFacingTo(_orientation, true);
|
||||
me->SetFacingTo(_orientation);
|
||||
break;
|
||||
case EVENT_FLY:
|
||||
ChangeOrientation(3.137039f);
|
||||
@@ -877,7 +877,7 @@ public:
|
||||
case EVENT_FACE_MIDDLE:
|
||||
{
|
||||
float angle = me->GetAngle(IllidanMiddlePoint);
|
||||
me->SetFacingTo(angle, true);
|
||||
me->SetFacingTo(angle);
|
||||
break;
|
||||
}
|
||||
case EVENT_EYE_BLAST:
|
||||
@@ -1294,7 +1294,7 @@ public:
|
||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
|
||||
break;
|
||||
case EVENT_CHANGE_ORIENTATION:
|
||||
me->SetFacingTo(_orientation, true);
|
||||
me->SetFacingTo(_orientation);
|
||||
break;
|
||||
case EVENT_HEALING_POTION:
|
||||
if (me->HealthBelowPct(20))
|
||||
|
||||
@@ -494,7 +494,7 @@ public:
|
||||
_events.Repeat(Seconds(3), Seconds(7));
|
||||
break;
|
||||
case EVENT_START_SOUL_RETRIEVE:
|
||||
me->SetFacingTo(FACE_THE_DOOR, true);
|
||||
me->SetFacingTo(FACE_THE_DOOR);
|
||||
DoCast(SPELL_AKAMA_SOUL_RETRIEVE);
|
||||
_events.ScheduleEvent(EVENT_START_BROKEN_FREE, Seconds(15));
|
||||
break;
|
||||
|
||||
@@ -595,7 +595,7 @@ class boss_kaelthas : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_TRANSITION_1, 1000);
|
||||
break;
|
||||
case POINT_TRANSITION_CENTER_ASCENDING:
|
||||
me->SetFacingTo(float(M_PI), true);
|
||||
me->SetFacingTo(float(M_PI));
|
||||
Talk(SAY_PHASE5_NUTS);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->SetDisableGravity(true);
|
||||
|
||||
@@ -956,7 +956,7 @@ public:
|
||||
void StartFight(Player* player)
|
||||
{
|
||||
me->Dismount();
|
||||
me->SetFacingToObject(player, true);
|
||||
me->SetFacingToObject(player);
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
_playerGUID = player->GetGUID();
|
||||
_events.ScheduleEvent(EVENT_TALK, Seconds(2));
|
||||
|
||||
Reference in New Issue
Block a user