Core/Creature: drop method SetPosition

eeeevil, use UpdatePosition. It was there just for old scripts compatibility.
This commit is contained in:
ccrs
2017-05-02 14:18:42 +02:00
parent dd2151cc7a
commit 17579f8d91
20 changed files with 23 additions and 40 deletions

View File

@@ -2733,20 +2733,6 @@ float Creature::GetPetChaseDistance() const
return range;
}
void Creature::SetPosition(float x, float y, float z, float o)
{
// prevent crash when a bad coord is sent by the client
if (!Trinity::IsValidMapCoord(x, y, z, o))
{
TC_LOG_DEBUG("entities.unit", "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z);
return;
}
GetMap()->CreatureRelocation(this, x, y, z, o);
if (IsVehicle())
GetVehicleKit()->RelocatePassengers();
}
bool Creature::SetWalk(bool enable)
{
if (!Unit::SetWalk(enable))

View File

@@ -668,9 +668,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
}
bool CanNotReachTarget() const { return m_cannotReachTarget; }
void SetPosition(float x, float y, float z, float o);
void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); }
void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }

View File

@@ -823,7 +823,7 @@ public:
const_cast<CreatureData*>(data)->posZ = z;
const_cast<CreatureData*>(data)->orientation = o;
}
creature->SetPosition(x, y, z, o);
creature->UpdatePosition(x, y, z, o);
creature->GetMotionMaster()->Initialize();
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{

View File

@@ -215,7 +215,7 @@ public:
{
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
me->SetPosition(x, y, LOCATION_Z, 0.0f);
me->UpdatePosition(x, y, LOCATION_Z, 0.0f);
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)

View File

@@ -76,7 +76,7 @@ public:
x -= 3.5f;
y -= 5.0f;
me->GetMotionMaster()->Clear(false);
me->SetPosition(x, y, z, 0.0f);
me->UpdatePosition(x, y, z, 0.0f);
}
void UpdateAI(uint32 diff) override

View File

@@ -801,7 +801,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z); //this visual aura some under ground
me->SetPosition(x, y, z + 0.35f, 0.0f);
me->UpdatePosition(x, y, z + 0.35f, 0.0f);
debuffGUID.Clear();
Despawn();
Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500);

View File

@@ -668,7 +668,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_SATH_DEATH);
me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
TeleportAllPlayersBack();
if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID))
{

View File

@@ -358,7 +358,7 @@ class boss_hexlord_malacrass : public CreatureScript
else
{
creature->AI()->EnterEvadeMode();
creature->SetPosition(Pos_X[i], POS_Y, POS_Z, ORIENT);
creature->UpdatePosition(Pos_X[i], POS_Y, POS_Z, ORIENT);
creature->StopMoving();
}
}

View File

@@ -150,7 +150,7 @@ public:
if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
{
target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, me->GetOrientation(), 0);
target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -298,7 +298,7 @@ public:
{
me->SetDisableGravity(true);
me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetDistance(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW) / (5000 * 0.001f));
me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
EventMove = false;
} else EventMoveTimer -= diff;
}

View File

@@ -1172,7 +1172,7 @@ public:
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
me->UpdatePosition(x, y, z, 0);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -1290,7 +1290,7 @@ public:
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
me->UpdatePosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);
}

View File

@@ -1039,7 +1039,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);
@@ -1156,7 +1156,7 @@ public:
if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
{
pPortal->SetReactState(REACT_PASSIVE);

View File

@@ -227,8 +227,8 @@ struct boss_twinemperorsAI : public ScriptedAI
thisPos.Relocate(me);
Position otherPos;
otherPos.Relocate(pOtherBoss);
pOtherBoss->SetPosition(thisPos);
me->SetPosition(otherPos);
pOtherBoss->UpdatePosition(thisPos);
me->UpdatePosition(otherPos);
SetAfterTeleport();
ENSURE_AI(boss_twinemperorsAI, pOtherBoss->AI())->SetAfterTeleport();

View File

@@ -262,7 +262,7 @@ class ValithriaDespawner : public BasicEvent
creature->SetRespawnDelay(10);
if (CreatureData const* data = creature->GetCreatureData())
creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation);
creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);

View File

@@ -352,7 +352,7 @@ class FrostwingGauntletRespawner
creature->SetRespawnDelay(2);
if (CreatureData const* data = creature->GetCreatureData())
creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
creature->UpdatePosition(data->posX, data->posY, data->posZ, data->orientation);
creature->DespawnOrUnsummon();
creature->SetCorpseDelay(corpseDelay);

View File

@@ -258,7 +258,7 @@ public:
for (uint8 n = 0; n < 3; ++n)
time[n] = 0;
me->GetMotionMaster()->Clear();
me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
me->UpdatePosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
DoCast(me, SPELL_TELESTRA_BACK);
me->SetVisible(true);
if (Phase == 1)

View File

@@ -780,7 +780,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
me->UpdatePosition(x, y, z, 0);
}
void UpdateAI(uint32 /*diff*/) override

View File

@@ -275,7 +275,7 @@ class npc_frozen_orb_stalker : public CreatureScript
{
Position pos;
me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f);
me->SetPosition(pos);
me->UpdatePosition(pos);
DoCast(me, SPELL_FROZEN_ORB_SUMMON);
}
}

View File

@@ -188,7 +188,7 @@ class boss_grandmaster_vorpil : public CreatureScript
if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
me->SetPosition(VorpilPosition);
me->UpdatePosition(VorpilPosition);
DoCast(me, SPELL_DRAW_SHADOWS, true);
DoCast(me, SPELL_RAIN_OF_FIRE);
events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000);

View File

@@ -286,7 +286,7 @@ class boss_alar : public CreatureScript
if (me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f))
dist = 5.0f;
WaitTimer = 1000 + uint32(floor(dist / 80 * 1000.0f));
me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
me->UpdatePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
me->StopMoving();
WaitEvent = WE_LAND;
return;

View File

@@ -288,7 +288,7 @@ class boss_high_astromancer_solarian : public CreatureScript
Phase1_Timer = 50000;
//After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
me->GetMotionMaster()->Clear();
me->SetPosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);
for (uint8 i=0; i <= 2; ++i)
{
if (!i)
@@ -354,7 +354,7 @@ class boss_high_astromancer_solarian : public CreatureScript
//15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals.
int i = rand32() % 3;
me->GetMotionMaster()->Clear();
me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
me->UpdatePosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
for (int j=0; j <= 2; j++)
if (j != i)