Core/Creature: Fix a crash in .npc delete, Also fix an issue breaking vehicles in certain edge case situations.

Port From (https://github.com/TrinityCore/TrinityCore/commit/b538cdc129e6132ddd6afc2c5ac5ccaae2959730)
This commit is contained in:
hondacrx
2020-08-24 11:40:14 -04:00
parent 203bbfd3b7
commit c9e535bb3a
+3 -3
View File
@@ -383,7 +383,7 @@ namespace Game.Entities
{
triggerJustAppeared = false;
GetAI().JustAppeared();
if (VehicleKit != null)
if (m_respawnCompatibilityMode && VehicleKit != null)
VehicleKit.Reset();
}
@@ -1480,8 +1480,8 @@ namespace Game.Entities
DB.World.CommitTransaction(trans);
// then delete any active instances of the creature
var range = GetMap().GetCreatureBySpawnIdStore().LookupByKey(m_spawnId);
foreach (var creature in range)
var spawnMap = GetMap().GetCreatureBySpawnIdStore().LookupByKey(m_spawnId);
foreach (var creature in spawnMap)
creature.AddObjectToRemoveList();
}