Core/AreaTrigger: Implement AreaTriggerActionSetFlag::DontDespawnWithCreator
Port From (https://github.com/TrinityCore/TrinityCore/commit/c40b6e0b3f1882a9fce8dfd103be4291ca986851)
This commit is contained in:
@@ -607,13 +607,19 @@ namespace Framework.Constants
|
||||
|
||||
public enum UnitDynFlags
|
||||
{
|
||||
None = 0x00,
|
||||
HideModel = 0x02, // Object model is not shown with this flag
|
||||
Lootable = 0x04,
|
||||
TrackUnit = 0x08,
|
||||
Tapped = 0x10, // Lua_UnitIsTapped
|
||||
SpecialInfo = 0x20,
|
||||
CanSkin = 0x40, // previously UNIT_DYNFLAG_DEAD
|
||||
ReferAFriend = 0x80
|
||||
None = 0x00,
|
||||
HideModel = 0x02, // Object model is not shown with this flag
|
||||
Lootable = 0x04,
|
||||
TrackUnit = 0x08,
|
||||
Tapped = 0x10, // Lua_UnitIsTapped
|
||||
SpecialInfo = 0x20,
|
||||
CanSkin = 0x40, // previously UNIT_DYNFLAG_DEAD
|
||||
ReferAFriend = 0x80
|
||||
}
|
||||
|
||||
public enum AreaTriggerRemoveReason
|
||||
{
|
||||
Default,
|
||||
UnitDespawn
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,10 +866,15 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAllAreaTriggers()
|
||||
public void RemoveAllAreaTriggers(AreaTriggerRemoveReason reason = AreaTriggerRemoveReason.Default)
|
||||
{
|
||||
while (!m_areaTrigger.Empty())
|
||||
m_areaTrigger.Last()?.Remove();
|
||||
foreach (AreaTrigger at in m_areaTrigger)
|
||||
{
|
||||
if (reason == AreaTriggerRemoveReason.UnitDespawn && at.GetTemplate().ActionSetFlags.HasFlag(AreaTriggerActionSetFlag.DontDespawnWithCreator))
|
||||
continue;
|
||||
|
||||
at.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public NPCFlags GetNpcFlags() { return (NPCFlags)m_unitData.NpcFlags.GetValue(); }
|
||||
|
||||
Reference in New Issue
Block a user