From c177dc910d0adcf7cfda5415d6eecae681754553 Mon Sep 17 00:00:00 2001 From: Emagi Date: Mon, 21 Apr 2025 14:18:55 -0400 Subject: [PATCH] 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 --- source/WorldServer/zoneserver.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/WorldServer/zoneserver.cpp b/source/WorldServer/zoneserver.cpp index a846120..e3d3b5b 100644 --- a/source/WorldServer/zoneserver.cpp +++ b/source/WorldServer/zoneserver.cpp @@ -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); }