diff options
author | Meji <alvaro.megias@outlook.com> | 2023-01-29 19:50:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-29 19:50:34 +0100 |
commit | 97d413c9b4be6af296490580f7acc1d66e606ca9 (patch) | |
tree | 05a2a8de6279e824ee47137f5243e603df0fe652 /src/server/game/Maps/Map.cpp | |
parent | 03918978c166c9fb191117a0cae9ba1285bf0e37 (diff) |
Core/Spawns: Allow spawn groups with MANUAL_SPAWN flag to automatically despawn if conditions are not met (#28778)
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r-- | src/server/game/Maps/Map.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 2836fc423d8..d215693c4cc 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -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; |