fix(Script/BlackTemple): teleport position with fatal attraction (#19971)
* fix(Script/BlackTemple): teleport position with fatal attraction * fix codestyle * try a new way by keeping a random teleport * remove the old fixed position * improve the dest selection * raycast around the new position for check a valid dest * fix codestyle * revert the old changes * refactor to remove the while loop * few refactor * Revert "few refactor" This reverts commit fb7613d5cc5a19df01bbcf41ef5c982119ee9685. * . * add a los check * new improvement with stairs cases & console errors * fix disableWarning option * Update boss_mother_shahraz.cpp * Update boss_mother_shahraz.cpp * Update boss_mother_shahraz.cpp * Update boss_mother_shahraz.cpp * Update boss_mother_shahraz.cpp
This commit is contained in:
parent
c2a0d8cb99
commit
8bf3595cef
3 changed files with 60 additions and 10 deletions
|
|
@ -2725,17 +2725,17 @@ bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float
|
|||
return true;
|
||||
}
|
||||
|
||||
Position WorldObject::GetNearPosition(float dist, float angle)
|
||||
Position WorldObject::GetNearPosition(float dist, float angle, bool disableWarning)
|
||||
{
|
||||
Position pos = GetPosition();
|
||||
MovePosition(pos, dist, angle);
|
||||
MovePosition(pos, dist, angle, disableWarning);
|
||||
return pos;
|
||||
}
|
||||
|
||||
Position WorldObject::GetRandomNearPosition(float radius)
|
||||
Position WorldObject::GetRandomNearPosition(float radius, bool disableWarning)
|
||||
{
|
||||
Position pos = GetPosition();
|
||||
MovePosition(pos, radius * (float) rand_norm(), (float) rand_norm() * static_cast<float>(2 * M_PI));
|
||||
MovePosition(pos, radius * (float) rand_norm(), (float) rand_norm() * static_cast<float>(2 * M_PI), disableWarning);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
@ -2773,7 +2773,7 @@ void WorldObject::GetChargeContactPoint(WorldObject const* obj, float& x, float&
|
|||
return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE * GetObjectScale();
|
||||
}
|
||||
|
||||
void WorldObject::MovePosition(Position& pos, float dist, float angle)
|
||||
void WorldObject::MovePosition(Position& pos, float dist, float angle, bool disableWarning)
|
||||
{
|
||||
angle += GetOrientation();
|
||||
float destx, desty, destz, ground, floor;
|
||||
|
|
@ -2783,7 +2783,9 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
|
|||
// Prevent invalid coordinates here, position is unchanged
|
||||
if (!Acore::IsValidMapCoord(destx, desty))
|
||||
{
|
||||
LOG_FATAL("entities.object", "WorldObject::MovePosition invalid coordinates X: {} and Y: {} were passed!", destx, desty);
|
||||
if (!disableWarning)
|
||||
LOG_FATAL("entities.object", "WorldObject::MovePosition invalid coordinates X: {} and Y: {} were passed!", destx, desty);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue