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:
Hondacrx
2025-12-08 14:54:52 -05:00
parent be495a1228
commit a478baf421
@@ -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);
}