mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Vehicle: Setting home position of creature passenger on AtEngage (#26482)
Co-authored-by: Edder <d.rosenauer@gmail.com>
(cherry picked from commit fb88a1409f)
This commit is contained in:
@@ -3464,8 +3464,20 @@ void Creature::AtEngage(Unit* target)
|
||||
|
||||
MovementGeneratorType const movetype = GetMotionMaster()->GetCurrentMovementGeneratorType();
|
||||
if (movetype == WAYPOINT_MOTION_TYPE || movetype == POINT_MOTION_TYPE || (IsAIEnabled() && AI()->IsEscorted()))
|
||||
{
|
||||
SetHomePosition(GetPosition());
|
||||
|
||||
// if its a vehicle, set the home positon of every creature passenger at engage
|
||||
// so that they are in combat range if hostile
|
||||
if (Vehicle* vehicle = GetVehicleKit())
|
||||
{
|
||||
for (auto seat = vehicle->Seats.begin(); seat != vehicle->Seats.end(); ++seat)
|
||||
if (Unit* passenger = ObjectAccessor::GetUnit(*this, seat->second.Passenger.Guid))
|
||||
if (Creature* creature = passenger->ToCreature())
|
||||
creature->SetHomePosition(GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatureAI* ai = AI())
|
||||
ai->JustEngagedWith(target);
|
||||
if (CreatureGroup* formation = GetFormation())
|
||||
|
||||
Reference in New Issue
Block a user