Entities/Creature: Some asserts are now LOG_ERRORs that block spawning. Fix a group spawning bug exposed by the CoS merge. Improve some command output.

Port From (https://github.com/TrinityCore/TrinityCore/commit/2225cb120100da741814dec7515b191cc68f07be)
This commit is contained in:
hondacrx
2021-12-27 15:51:24 -05:00
parent 5321cc2090
commit a693bed211
3 changed files with 26 additions and 8 deletions
+22 -4
View File
@@ -3163,14 +3163,32 @@ namespace Game.Entities
if (m_respawnTime == 0 && !map.IsSpawnGroupActive(data.spawnGroupData.groupId))
{
// @todo pools need fixing! this is just a temporary crashfix, but they violate dynspawn principles
Cypher.Assert(m_respawnCompatibilityMode || Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) != 0, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group {data.spawnGroupData.name}.");
if (!m_respawnCompatibilityMode)
{
// @todo pools need fixing! this is just a temporary thing, but they violate dynspawn principles
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
{
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group '{data.spawnGroupData.name}'");
return false;
}
}
m_respawnTime = GameTime.GetGameTime() + RandomHelper.URand(4, 7);
}
if (m_respawnTime != 0) // respawn on UpdateLoadCreatureFromDB
if (m_respawnTime != 0)
{
Cypher.Assert(m_respawnCompatibilityMode || Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) != 0, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress.");
if (!m_respawnCompatibilityMode)
{
// @todo same as above
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
{
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress");
return false;
}
}
// compatibility mode creatures will be respawned in ::Update()
m_deathState = DeathState.Dead;
if (CanFly())
{