1
0

If a grid is not assigned to a spawn then we will try to force one on the map if they are not a flying creature

This commit is contained in:
Emagi 2025-04-21 14:18:55 -04:00
parent ce6ad0e2a3
commit c177dc910d

View File

@ -2986,7 +2986,17 @@ void ZoneServer::DeterminePosition(SpawnLocation* spawnlocation, Spawn* spawn){
spawn->SetSpawnOrigHeading(spawn->GetHeading());
spawn->SetSpawnOrigPitch(spawnlocation->pitch);
spawn->SetSpawnOrigRoll(spawnlocation->roll);
int32 grid = spawnlocation->grid_id;
spawn->SetLocation(spawnlocation->grid_id);
if(grid == 0 && !spawn->IsFlyingCreature()) {
Map* zonemap = world.GetMap(std::string(GetZoneFile()),0);
if(zonemap) {
auto loc = glm::vec3(spawn->GetX(), spawn->GetZ(), spawn->GetY());
float new_y = zonemap->FindBestZ(loc, nullptr, nullptr, &grid);
spawn->SetLocation(grid);
}
}
spawn->SetSpawnLocationPlacementID(spawnlocation->placement_id);
}