From c9e535bb3ac0803ee1513c95789524886d35f3ee Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 24 Aug 2020 11:40:14 -0400 Subject: [PATCH] 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) --- Source/Game/Entities/Creature/Creature.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index e34dfbf5a..0db83331d 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -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(); }