mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Creatures: Add summoned creatures to summoners transport (#27708)
This commit is contained in:
@@ -1811,6 +1811,18 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Transport* transport = summoner ? summoner->GetTransport() : nullptr;
|
||||
if (transport)
|
||||
{
|
||||
float x, y, z, o;
|
||||
pos.GetPosition(x, y, z, o);
|
||||
transport->CalculatePassengerOffset(x, y, z, &o);
|
||||
summon->m_movementInfo.transport.pos.Relocate(x, y, z, o);
|
||||
|
||||
// This object must be added to transport before adding to map for the client to properly display it
|
||||
transport->AddPassenger(summon);
|
||||
}
|
||||
|
||||
if (summoner && !(properties && properties->GetFlags().HasFlag(SummonPropertiesFlags::IgnoreSummonerPhase)))
|
||||
PhasingHandler::InheritPhaseShift(summon, summoner);
|
||||
|
||||
@@ -1838,6 +1850,10 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
|
||||
if (!AddToMap(summon->ToCreature()))
|
||||
{
|
||||
// Returning false will cause the object to be deleted - remove from transport
|
||||
if (transport)
|
||||
transport->RemovePassenger(summon);
|
||||
|
||||
delete summon;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user