From 90a1d0f09183185fb83a1dca406fad15e9f732e5 Mon Sep 17 00:00:00 2001 From: gcask <53709079+gcask@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:04:37 -0500 Subject: [PATCH] Add option to use the altitude as it is already set for the group. Provide a way to use the spawn altitude as set in the editor, without randomization. Mainly useful for training scenarios. --- mist.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mist.lua b/mist.lua index d3a093c..c9ce2d3 100644 --- a/mist.lua +++ b/mist.lua @@ -4457,13 +4457,14 @@ do -- group functions scope newGroupData.units[unitNum].x = unitData.x + diff.x newGroupData.units[unitNum].y = unitData.y + diff.y end - if point then + + -- Set the altitude if it isn't set already and we don't use the one from the cloned template. + if point and (not newGroupData.units[unitNum].alt or not vars.useTemplateAltitude) then if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') then if point.z and point.y > 0 and point.y > land.getHeight({newGroupData.units[unitNum].x, newGroupData.units[unitNum].y}) + 10 then newGroupData.units[unitNum].alt = point.y --log:info('far enough from ground') else - if newGroupData.category == 'plane' then --log:info('setNewAlt') newGroupData.units[unitNum].alt = land.getHeight({newGroupData.units[unitNum].x, newGroupData.units[unitNum].y}) + math.random(300, 9000)