mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Core/AreaTriggers: Fixed crashes caused by areatrigger OnUnitEnter/OnUnitExit scripts teleporting players to other maps
This commit is contained in:
@@ -895,8 +895,8 @@ void AreaTrigger::HandleUnitEnter(Unit* unit)
|
||||
|
||||
_ai->OnUnitEnter(unit);
|
||||
|
||||
// OnUnitEnter script can despawn this areatrigger
|
||||
if (!IsInWorld())
|
||||
// OnUnitEnter script can despawn this areatrigger or teleport player to a different map
|
||||
if (!IsInWorld() || !IsInMap(unit))
|
||||
return;
|
||||
|
||||
// Register areatrigger in Unit after actions/scripts to allow them to determine
|
||||
@@ -925,10 +925,11 @@ void AreaTrigger::HandleUnitExitInternal(Unit* unit, AreaTriggerExitReason exitM
|
||||
|
||||
UndoActions(unit);
|
||||
|
||||
// OnUnitExit script can teleport player to another map, causing it to attempt to exit the areatrigger again (from Unit::ExitAllAreaTriggers)
|
||||
unit->ExitAreaTrigger(this);
|
||||
|
||||
if (canTriggerOnExit)
|
||||
_ai->OnUnitExit(unit, exitMode);
|
||||
|
||||
unit->ExitAreaTrigger(this);
|
||||
}
|
||||
|
||||
void AreaTrigger::HandleUnitExit(Unit* unit)
|
||||
|
||||
Reference in New Issue
Block a user