mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/AreaTrigger: Implement AreaTriggerActionSetFlag::DontDespawnWithCreator (#30832)
This commit is contained in:
@@ -191,7 +191,7 @@ enum class AreaTriggerActionSetFlag : uint32
|
||||
CreatorsPartyOnly = 0x0100,
|
||||
DontRunOnLeaveWhenExpiring = 0x0200, /*NYI*/
|
||||
CanAffectUninteractible = 0x0400,
|
||||
DontDespawnWithCreator = 0x0800, /*NYI*/
|
||||
DontDespawnWithCreator = 0x0800,
|
||||
CanAffectBeastmaster = 0x1000, // Can affect GMs
|
||||
RequiresLineOfSight = 0x2000 /*NYI*/
|
||||
};
|
||||
|
||||
@@ -5453,10 +5453,15 @@ void Unit::RemoveAreaTrigger(AuraEffect const* aurEff)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAllAreaTriggers()
|
||||
void Unit::RemoveAllAreaTriggers(AreaTriggerRemoveReason reason /*= AreaTriggerRemoveReason::Default*/)
|
||||
{
|
||||
while (!m_areaTrigger.empty())
|
||||
m_areaTrigger.back()->Remove();
|
||||
for (AreaTrigger* at : AreaTriggerList(std::move(m_areaTrigger)))
|
||||
{
|
||||
if (reason == AreaTriggerRemoveReason::UnitDespawn && at->GetTemplate()->ActionSetFlags.HasFlag(AreaTriggerActionSetFlag::DontDespawnWithCreator))
|
||||
continue;
|
||||
|
||||
at->Remove();
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const* log)
|
||||
@@ -10034,7 +10039,7 @@ void Unit::RemoveFromWorld()
|
||||
|
||||
RemoveAllGameObjects();
|
||||
RemoveAllDynObjects();
|
||||
RemoveAllAreaTriggers();
|
||||
RemoveAllAreaTriggers(AreaTriggerRemoveReason::UnitDespawn);
|
||||
|
||||
ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
|
||||
UnsummonAllTotems();
|
||||
|
||||
@@ -1626,9 +1626,16 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void _UnregisterAreaTrigger(AreaTrigger* areaTrigger);
|
||||
AreaTrigger* GetAreaTrigger(uint32 spellId) const;
|
||||
std::vector<AreaTrigger*> GetAreaTriggers(uint32 spellId) const;
|
||||
|
||||
enum class AreaTriggerRemoveReason : uint8
|
||||
{
|
||||
Default,
|
||||
UnitDespawn
|
||||
};
|
||||
|
||||
void RemoveAreaTrigger(uint32 spellId);
|
||||
void RemoveAreaTrigger(AuraEffect const* aurEff);
|
||||
void RemoveAllAreaTriggers();
|
||||
void RemoveAllAreaTriggers(AreaTriggerRemoveReason reason = AreaTriggerRemoveReason::Default);
|
||||
|
||||
void ModifyAuraState(AuraStateType flag, bool apply);
|
||||
uint32 BuildAuraStateUpdateForTarget(Unit const* target) const;
|
||||
|
||||
Reference in New Issue
Block a user