mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 17:08:23 +01:00
Core/Spawn: Move spawn group state management from sObjectMgr to the Map object, which makes it actually function as intended with instances. Woops.
This commit is contained in:
@@ -133,13 +133,18 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
|
||||
ASSERT(cdata, "Tried to load creature with spawnId %u, but no such creature exists.", guid);
|
||||
SpawnGroupTemplateData const* const group = cdata->spawnGroupData;
|
||||
// If creature in manual spawn group, don't spawn here, unless group is already active.
|
||||
if ((group->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN) && !group->isActive)
|
||||
continue;
|
||||
if (!(group->flags & SPAWNGROUP_FLAG_SYSTEM))
|
||||
if (!map->IsSpawnGroupActive(group->groupId))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If script is blocking spawn, don't spawn but queue for a re-check in a little bit
|
||||
if (!(group->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE) && !sScriptMgr->CanSpawn(guid, cdata->id, cdata, map))
|
||||
{
|
||||
map->SaveRespawnTime(SPAWN_TYPE_CREATURE, guid, cdata->id, time(NULL) + urand(4,7), map->GetZoneId(cdata->spawnPoint), Trinity::ComputeGridCoord(cdata->spawnPoint.GetPositionX(), cdata->spawnPoint.GetPositionY()).GetId(), false);
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -148,8 +153,12 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
|
||||
// If gameobject in manual spawn group, don't spawn here, unless group is already active.
|
||||
GameObjectData const* godata = sObjectMgr->GetGameObjectData(guid);
|
||||
ASSERT(godata, "Tried to load gameobject with spawnId %u, but no such object exists.", guid);
|
||||
if ((godata->spawnGroupData->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN) && !godata->spawnGroupData->isActive)
|
||||
continue;
|
||||
if (!(godata->spawnGroupData->flags & SPAWNGROUP_FLAG_SYSTEM))
|
||||
if (!map->IsSpawnGroupActive(godata->spawnGroupData->groupId))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj->LoadFromDB(guid, map, false, false))
|
||||
|
||||
Reference in New Issue
Block a user