Core/Vehicle: Setting home position of creature passenger on AtEngage
Port From (https://github.com/TrinityCore/TrinityCore/commit/4dbacb69852e3324ddd9abb55a44d93b00679e36)
This commit is contained in:
@@ -1066,7 +1066,7 @@ namespace Game.Entities
|
|||||||
return ai.IsEngaged();
|
return ai.IsEngaged();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AtEngage(Unit target)
|
public override void AtEngage(Unit target)
|
||||||
{
|
{
|
||||||
base.AtEngage(target);
|
base.AtEngage(target);
|
||||||
@@ -1085,7 +1085,25 @@ namespace Game.Entities
|
|||||||
|
|
||||||
MovementGeneratorType movetype = GetMotionMaster().GetCurrentMovementGeneratorType();
|
MovementGeneratorType movetype = GetMotionMaster().GetCurrentMovementGeneratorType();
|
||||||
if (movetype == MovementGeneratorType.Waypoint || movetype == MovementGeneratorType.Point || (IsAIEnabled() && GetAI().IsEscorted()))
|
if (movetype == MovementGeneratorType.Waypoint || movetype == MovementGeneratorType.Point || (IsAIEnabled() && GetAI().IsEscorted()))
|
||||||
|
{
|
||||||
SetHomePosition(GetPosition());
|
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
|
||||||
|
Vehicle vehicle = GetVehicleKit();
|
||||||
|
if (vehicle != null)
|
||||||
|
{
|
||||||
|
foreach (var (_, seat) in vehicle.Seats)
|
||||||
|
{
|
||||||
|
Unit passenger = Global.ObjAccessor.GetUnit(this, seat.Passenger.Guid);
|
||||||
|
if (passenger != null)
|
||||||
|
{
|
||||||
|
Creature creature = passenger.ToCreature();
|
||||||
|
if (creature != null)
|
||||||
|
creature.SetHomePosition(GetPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CreatureAI ai = GetAI();
|
CreatureAI ai = GetAI();
|
||||||
if (ai != null)
|
if (ai != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user