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
|
public enum UnitDynFlags
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
HideModel = 0x02, // Object model is not shown with this flag
|
HideModel = 0x02, // Object model is not shown with this flag
|
||||||
Lootable = 0x04,
|
Lootable = 0x04,
|
||||||
TrackUnit = 0x08,
|
TrackUnit = 0x08,
|
||||||
Tapped = 0x10, // Lua_UnitIsTapped
|
Tapped = 0x10, // Lua_UnitIsTapped
|
||||||
SpecialInfo = 0x20,
|
SpecialInfo = 0x20,
|
||||||
CanSkin = 0x40, // previously UNIT_DYNFLAG_DEAD
|
CanSkin = 0x40, // previously UNIT_DYNFLAG_DEAD
|
||||||
ReferAFriend = 0x80
|
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())
|
foreach (AreaTrigger at in m_areaTrigger)
|
||||||
m_areaTrigger.Last()?.Remove();
|
{
|
||||||
|
if (reason == AreaTriggerRemoveReason.UnitDespawn && at.GetTemplate().ActionSetFlags.HasFlag(AreaTriggerActionSetFlag.DontDespawnWithCreator))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
at.Remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NPCFlags GetNpcFlags() { return (NPCFlags)m_unitData.NpcFlags.GetValue(); }
|
public NPCFlags GetNpcFlags() { return (NPCFlags)m_unitData.NpcFlags.GetValue(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user