Core/Vehicle: Change vehicle accessories' phase according to the player on the vehicle
Port From (https://github.com/TrinityCore/TrinityCore/commit/6d5086da1747816e1a4e8518e16ab1923de22e1a)
This commit is contained in:
@@ -37,7 +37,8 @@ namespace Game
|
||||
for (var i = 0; i < unit.m_Controlled.Count; ++i)
|
||||
{
|
||||
Unit controlled = unit.m_Controlled[i];
|
||||
if (controlled.GetTypeId() != TypeId.Player)
|
||||
if (controlled.GetTypeId() != TypeId.Player
|
||||
&& controlled.GetVehicle() == null) // Player inside nested vehicle should not phase the root vehicle and its accessories (only direct root vehicle control does)
|
||||
func(controlled);
|
||||
}
|
||||
|
||||
@@ -50,6 +51,17 @@ namespace Game
|
||||
func(summon);
|
||||
}
|
||||
}
|
||||
|
||||
Vehicle vehicle = unit.GetVehicleKit();
|
||||
if (vehicle != null)
|
||||
{
|
||||
foreach (var seat in vehicle.Seats)
|
||||
{
|
||||
Unit passenger = Global.ObjAccessor.GetUnit(unit, seat.Value.Passenger.Guid);
|
||||
if (passenger != null)
|
||||
func(passenger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddPhase(WorldObject obj, uint phaseId, bool updateVisibility)
|
||||
|
||||
Reference in New Issue
Block a user