Core/Spawns: Allow spawn groups with MANUAL_SPAWN flag to automatically despawn if conditions are not met
Port From (https://github.com/TrinityCore/TrinityCore/commit/97d413c9b4be6af296490580f7acc1d66e606ca9)
This commit is contained in:
@@ -1260,9 +1260,9 @@ namespace Game
|
|||||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} SourceEntry in `condition` table, does not exist in `spawn_group_template`, ignoring.");
|
Log.outError(LogFilter.Sql, $"{cond.ToString()} SourceEntry in `condition` table, does not exist in `spawn_group_template`, ignoring.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (spawnGroup.flags.HasAnyFlag(SpawnGroupFlags.System | SpawnGroupFlags.ManualSpawn))
|
if (spawnGroup.flags.HasAnyFlag(SpawnGroupFlags.System))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} in `spawn_group_template` table cannot have SPAWNGROUP_FLAG_SYSTEM or SPAWNGROUP_FLAG_MANUAL_SPAWN flags, ignoring.");
|
Log.outError(LogFilter.Sql, $"{cond.ToString()} in `spawn_group_template` table cannot have SPAWNGROUP_FLAG_SYSTEM flags, ignoring.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+10
-2
@@ -2374,11 +2374,19 @@ namespace Game.Maps
|
|||||||
foreach (uint spawnGroupId in spawnGroups)
|
foreach (uint spawnGroupId in spawnGroups)
|
||||||
{
|
{
|
||||||
SpawnGroupTemplateData spawnGroupTemplate = GetSpawnGroupData(spawnGroupId);
|
SpawnGroupTemplateData spawnGroupTemplate = GetSpawnGroupData(spawnGroupId);
|
||||||
if (spawnGroupTemplate.flags.HasFlag(SpawnGroupFlags.ManualSpawn))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool isActive = IsSpawnGroupActive(spawnGroupId);
|
bool isActive = IsSpawnGroupActive(spawnGroupId);
|
||||||
bool shouldBeActive = Global.ConditionMgr.IsMapMeetingNotGroupedConditions(ConditionSourceType.SpawnGroup, spawnGroupId, this);
|
bool shouldBeActive = Global.ConditionMgr.IsMapMeetingNotGroupedConditions(ConditionSourceType.SpawnGroup, spawnGroupId, this);
|
||||||
|
|
||||||
|
if (spawnGroupTemplate.flags.HasFlag(SpawnGroupFlags.ManualSpawn))
|
||||||
|
{
|
||||||
|
// Only despawn the group if it isn't meeting conditions
|
||||||
|
if (isActive && !shouldBeActive && spawnGroupTemplate.flags.HasFlag(SpawnGroupFlags.DespawnOnConditionFailure))
|
||||||
|
SpawnGroupDespawn(spawnGroupId, true);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (isActive == shouldBeActive)
|
if (isActive == shouldBeActive)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user