mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spawns: Allow spawn groups with MANUAL_SPAWN flag to automatically despawn if conditions are not met (#28778)
This commit is contained in:
@@ -2459,11 +2459,19 @@ void Map::UpdateSpawnGroupConditions()
|
||||
for (uint32 spawnGroupId : *spawnGroups)
|
||||
{
|
||||
SpawnGroupTemplateData const* spawnGroupTemplate = ASSERT_NOTNULL(GetSpawnGroupData(spawnGroupId));
|
||||
if (spawnGroupTemplate->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN)
|
||||
continue;
|
||||
|
||||
bool isActive = IsSpawnGroupActive(spawnGroupId);
|
||||
bool shouldBeActive = sConditionMgr->IsMapMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_SPAWN_GROUP, spawnGroupId, this);
|
||||
|
||||
if (spawnGroupTemplate->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN)
|
||||
{
|
||||
// Only despawn the group if it isn't meeting conditions
|
||||
if (isActive && !shouldBeActive && spawnGroupTemplate->flags & SPAWNGROUP_FLAG_DESPAWN_ON_CONDITION_FAILURE)
|
||||
SpawnGroupDespawn(spawnGroupId, true);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isActive == shouldBeActive)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user