Core/Creatures: Update HomePosition upon ExitVehicle only if the creature was inside a vehicle (#29491)

This commit is contained in:
Gildor
2023-12-13 13:08:36 +01:00
committed by GitHub
parent 8a619460e2
commit acf5ce58a7

View File

@@ -3387,9 +3387,11 @@ std::string Creature::GetDebugInfo() const
void Creature::ExitVehicle(Position const* /*exitPosition*/)
{
bool const isInVehicle = GetVehicle();
Unit::ExitVehicle();
// if the creature exits a vehicle, set it's home position to the
// if alive creature exits a vehicle, set it's home position to the
// exited position so it won't run away (home) and evade if it's hostile
SetHomePosition(GetPosition());
if (isInVehicle && IsAlive())
SetHomePosition(GetPosition());
}