Scripts/Commands: Fix some quirkiness and potential crashes with live DB modification commands (npc move and npc delete), which are horrible and should be deleted anyway.

Port From (https://github.com/TrinityCore/TrinityCore/commit/f15b4f5043799b3a580c8577ad4466135ca9ae38)
This commit is contained in:
hondacrx
2020-08-24 10:35:14 -04:00
parent ca4f55b20a
commit cd92a34082
@@ -1477,6 +1477,11 @@ namespace Game.Entities
trans.Append(stmt);
DB.World.CommitTransaction(trans);
// then delete any active instances of the creature
var range = GetMap().GetCreatureBySpawnIdStore().LookupByKey(m_spawnId);
foreach (var creature in range)
creature.AddObjectToRemoveList();
}
public override bool IsInvisibleDueToDespawn()