Core/Creatures: Add summoned creatures to summoners transport (#27708)

This commit is contained in:
Seyden
2022-02-07 12:49:45 +01:00
committed by GitHub
parent e64e6f4963
commit 20af35fd13

View File

@@ -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;
}