fix(Core/Creature): Reduce z offset for automated spawn correction (#18153)

- this is necessary to correctly spawn creatures within small defines
- 0.42f is as good as 1.0f to detect and correct reasonable z errors
in DB spawn data
This commit is contained in:
sudlud
2024-01-11 15:15:41 +01:00
committed by GitHub
parent 7ec2585cc8
commit 96d8d1d89a

View File

@@ -1669,8 +1669,8 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
// xinef: fix from db
if ((addToMap || gridLoad) && !data->overwrittenZ)
{
float tz = map->GetHeight(data->posX, data->posY, data->posZ + 1.0f, true);
if (tz >= data->posZ && tz - data->posZ <= 1.0f)
float tz = map->GetHeight(data->posX, data->posY, data->posZ + 0.42f, true);
if (tz >= data->posZ && tz - data->posZ <= 0.42f)
const_cast<CreatureData*>(data)->posZ = tz + 0.1f;
const_cast<CreatureData*>(data)->overwrittenZ = true;