mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2025-08-15 10:47:23 +00:00
r38
Fixed bug with optional variables in coordinate message functions
This commit is contained in:
parent
36d7a0c3bc
commit
b2080628fe
90
mist.lua
90
mist.lua
@ -8,7 +8,7 @@ mist = {}
|
|||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 3
|
mist.majorVersion = 3
|
||||||
mist.minorVersion = 5
|
mist.minorVersion = 5
|
||||||
mist.build = 37
|
mist.build = 38
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -678,6 +678,7 @@ do
|
|||||||
newGroup.country = newCountry
|
newGroup.country = newCountry
|
||||||
|
|
||||||
|
|
||||||
|
--mist.debug.writeData(mist.utils.serialize,{'msg', newGroup}, 'newGroup.lua')
|
||||||
|
|
||||||
-- sanitize table
|
-- sanitize table
|
||||||
newGroup.groupName = nil
|
newGroup.groupName = nil
|
||||||
@ -4503,12 +4504,15 @@ mist.msgMGRS = function(vars)
|
|||||||
|
|
||||||
local s = mist.getMGRSString{units = units, acc = acc}
|
local s = mist.getMGRSString{units = units, acc = acc}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
if text then
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if string.find(text, '%%s') then -- look for %s
|
||||||
else -- else, just append to the end.
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
newText = text .. s
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
@ -4534,10 +4538,14 @@ mist.msgLL = function(vars)
|
|||||||
|
|
||||||
local s = mist.getLLString{units = units, acc = acc, DMS = DMS}
|
local s = mist.getLLString{units = units, acc = acc, DMS = DMS}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
if text then
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if string.find(text, '%%s') then -- look for %s
|
||||||
else -- else, just append to the end.
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
newText = text .. s
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
@ -4569,10 +4577,14 @@ mist.msgBR = function(vars)
|
|||||||
|
|
||||||
local s = mist.getBRString{units = units, ref = ref, alt = alt, metric = metric}
|
local s = mist.getBRString{units = units, ref = ref, alt = alt, metric = metric}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
if text then
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if string.find(text, '%%s') then -- look for %s
|
||||||
else -- else, just append to the end.
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
newText = text .. s
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
@ -4648,10 +4660,14 @@ mist.msgLeadingMGRS = function(vars)
|
|||||||
|
|
||||||
local s = mist.getLeadingMGRSString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, acc = acc}
|
local s = mist.getLeadingMGRSString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, acc = acc}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
if text then
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if string.find(text, '%%s') then -- look for %s
|
||||||
else -- else, just append to the end.
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
newText = text .. s
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
@ -4686,10 +4702,15 @@ mist.msgLeadingLL = function(vars)
|
|||||||
|
|
||||||
local s = mist.getLeadingLLString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, acc = acc, DMS = DMS}
|
local s = mist.getLeadingLLString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, acc = acc, DMS = DMS}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if text then
|
||||||
else -- else, just append to the end.
|
if string.find(text, '%%s') then -- look for %s
|
||||||
newText = text .. s
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
@ -4726,10 +4747,15 @@ mist.msgLeadingBR = function(vars)
|
|||||||
|
|
||||||
local s = mist.getLeadingBRString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, metric = metric, alt = alt, ref = ref}
|
local s = mist.getLeadingBRString{units = units, heading = heading, radius = radius, headingDegrees = headingDegrees, metric = metric, alt = alt, ref = ref}
|
||||||
local newText
|
local newText
|
||||||
if string.find(text, '%%s') then -- look for %s
|
|
||||||
newText = string.format(text, s) -- insert the coordinates into the message
|
if text then
|
||||||
else -- else, just append to the end.
|
if string.find(text, '%%s') then -- look for %s
|
||||||
newText = text .. s
|
newText = string.format(text, s) -- insert the coordinates into the message
|
||||||
|
else -- else, just append to the end.
|
||||||
|
newText = text .. s
|
||||||
|
end
|
||||||
|
else
|
||||||
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
@ -5030,13 +5056,15 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
|
|||||||
newGroupData.units[unitNum]["x"] = unitData.x + diff.x
|
newGroupData.units[unitNum]["x"] = unitData.x + diff.x
|
||||||
newGroupData.units[unitNum]["y"] = unitData.y + diff.y
|
newGroupData.units[unitNum]["y"] = unitData.y + diff.y
|
||||||
end
|
end
|
||||||
|
if point then
|
||||||
--[[if newGroupData.category == 'plane' or newGroupData.category = 'helicopter' then
|
if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') and point.z then
|
||||||
if point.z and point.y + 10 > terrain.getHeight({point.x, point.z}) then
|
if point.y > 0 and point.y > terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||||
newGroupData.units[unitNum]["alt"] = point.y
|
newGroupData.units[unitNum]["alt"] = point.y
|
||||||
|
else
|
||||||
|
newGroupData.units[unitNum]["alt"] = terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--tostring, tostring(),
|
--tostring, tostring(),
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
-- changelog
|
-- changelog
|
||||||
|
v38
|
||||||
|
- fixed bug with optional variables for coordinate messages not actually being optional
|
||||||
|
|
||||||
v37
|
v37
|
||||||
- If the point given
|
- Teleport To Point related functions now check the altitude of a given point if specified for teleporting aircraft
|
||||||
- fixed bug with mist.flagFunc.group_alive_less_than and mist.flagFunc.group_alive_more_than
|
- fixed bug with mist.flagFunc.group_alive_less_than and mist.flagFunc.group_alive_more_than
|
||||||
|
|
||||||
v36
|
v36
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user