Skip to content

Commit

Permalink
Added nil check for y coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Feb 15, 2025
1 parent cdfa999 commit e47094d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/specializations/CpCourseGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ function CpCourseGenerator:onWriteStream(streamId, connection)
streamWriteInt32(streamId, #spec.fieldPolygon)
for _, point in pairs(spec.fieldPolygon) do
streamWriteFloat32(streamId, point.x)
streamWriteFloat32(streamId, point.y)
if point.y ~= nil then
streamWriteFloat32(streamId, point.y)
else
streamWriteFloat32(streamId, getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, point.x, 1, point.z))
end
streamWriteFloat32(streamId, point.z)
end
else
Expand Down

0 comments on commit e47094d

Please sign in to comment.