Core/AreaTrigger: Implement AreaTriggerActionSetFlag::DontDespawnWithCreator

Port From (https://github.com/TrinityCore/TrinityCore/commit/c40b6e0b3f1882a9fce8dfd103be4291ca986851)
This commit is contained in:
Hondacrx
2025-08-14 20:21:10 -04:00
parent 10998036b2
commit 1b838e6d5a
2 changed files with 22 additions and 11 deletions
+14 -8
View File
@@ -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
}
}
+8 -3
View File
@@ -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(); }