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:
@@ -521,6 +521,23 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
return m_vehicle != null ? m_vehicle.GetBase() : null;
|
return m_vehicle != null ? m_vehicle.GetBase() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit GetVehicleRoot()
|
||||||
|
{
|
||||||
|
Unit vehicleRoot = GetVehicleBase();
|
||||||
|
|
||||||
|
if (!vehicleRoot)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
for (; ; )
|
||||||
|
{
|
||||||
|
if (!vehicleRoot.GetVehicleBase())
|
||||||
|
return vehicleRoot;
|
||||||
|
|
||||||
|
vehicleRoot = vehicleRoot.GetVehicleBase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Creature GetVehicleCreatureBase()
|
public Creature GetVehicleCreatureBase()
|
||||||
{
|
{
|
||||||
Unit veh = GetVehicleBase();
|
Unit veh = GetVehicleBase();
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ namespace Game
|
|||||||
for (var i = 0; i < unit.m_Controlled.Count; ++i)
|
for (var i = 0; i < unit.m_Controlled.Count; ++i)
|
||||||
{
|
{
|
||||||
Unit controlled = unit.m_Controlled[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);
|
func(controlled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +51,17 @@ namespace Game
|
|||||||
func(summon);
|
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)
|
public static void AddPhase(WorldObject obj, uint phaseId, bool updateVisibility)
|
||||||
|
|||||||
Reference in New Issue
Block a user