Core/AreaTrigger: Fix crashes happening if areatrigger is despawned in OnUnitEnter script
Port From (https://github.com/TrinityCore/TrinityCore/commit/9827685634c8487936b8e59cdece596c5abbb145)
This commit is contained in:
@@ -858,6 +858,15 @@ namespace Game.Entities
|
||||
DoActions(unit);
|
||||
|
||||
_ai.OnUnitEnter(unit);
|
||||
|
||||
// OnUnitEnter script can despawn this areatrigger
|
||||
if (!IsInWorld)
|
||||
return;
|
||||
|
||||
// Register areatrigger in Unit after actions/scripts to allow them to determine
|
||||
// if the unit is in one or more areatriggers with the same id
|
||||
// without forcing every script to have additional logic excluding this areatrigger
|
||||
|
||||
unit.EnterAreaTrigger(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user