mirror of
https://github.com/weyne85/DCS-ExportScripts.git
synced 2025-10-29 16:58:18 +00:00
Code cleared up...
Supplement the function ExportScript.Tools.SelectModule() to determine the possible map and to send the information to Ikarus.
This commit is contained in:
parent
7b2193e753
commit
fae5e59f31
@ -38,9 +38,15 @@ function ExportScript.Tools.ProcessInput()
|
||||
if lCommand == "R" then -- R == Reset
|
||||
if ExportScript.Config.IkarusExport then
|
||||
ExportScript.Tools.ResetChangeValues()
|
||||
if ExportScript.Config.Debug then
|
||||
ExportScript.Tools.WriteToLog("Reset fuer Ikarus Daten")
|
||||
end
|
||||
end
|
||||
if ExportScript.Config.DACExport then
|
||||
ExportScript.Tools.ResetChangeValuesDAC()
|
||||
if ExportScript.Config.Debug then
|
||||
ExportScript.Tools.WriteToLog("Reset fuer DAC Daten")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -50,10 +56,16 @@ function ExportScript.Tools.ProcessInput()
|
||||
if lDevice ~= "1000" then
|
||||
if type(lDevice) == "table" then
|
||||
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
|
||||
if ExportScript.Config.Debug then
|
||||
ExportScript.Tools.WriteToLog("Verarbeite fuer Device: "..lCommandArgs[1]..", ButtonID: "..lCommandArgs[2]..", mit Wert: "..lCommandArgs[3])
|
||||
end
|
||||
end
|
||||
elseif lDevice == "1000" then
|
||||
--ExportScript.genericRadio(key, value)
|
||||
ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3])
|
||||
if ExportScript.Config.Debug then
|
||||
ExportScript.Tools.WriteToLog("Verarbeite fuer genericRadio, ButtonID: "..lCommandArgs[2]..", mit Wert: "..lCommandArgs[3])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -224,11 +236,9 @@ end
|
||||
function ExportScript.Tools.FlushData()
|
||||
if #ExportScript.SendStrings > 0 then
|
||||
local lES_SimID = ""
|
||||
if ExportScript.GlassCockpitType == 1 then
|
||||
|
||||
lES_SimID = ExportScript.SimID
|
||||
elseif ExportScript.GlassCockpitType == 2 then
|
||||
lES_SimID = ""
|
||||
end
|
||||
|
||||
local lPacket = lES_SimID .. table.concat(ExportScript.SendStrings, ExportScript.Config.IkarusSeparator) .. "\n"
|
||||
ExportScript.socket.try(ExportScript.UDPsender:sendto(lPacket, ExportScript.Config.IkarusHost, ExportScript.Config.IkarusPort))
|
||||
ExportScript.SendStrings = {}
|
||||
@ -276,6 +286,10 @@ function ExportScript.Tools.SelectModule()
|
||||
return
|
||||
end
|
||||
|
||||
if ExportScript.Config.Debug then
|
||||
ExportScript.Tools.WriteToLog("MyInfo: "..ExportScript.Tools.dump(lMyInfo))
|
||||
end
|
||||
|
||||
ExportScript.ModuleName = lMyInfo.Name
|
||||
local lModuleName = ExportScript.ModuleName..".lua"
|
||||
local lModuleFile = ""
|
||||
@ -297,12 +311,16 @@ function ExportScript.Tools.SelectModule()
|
||||
|
||||
-- load Aircraft File
|
||||
dofile(lModuleFile)
|
||||
if ExportScript.Config.DACExport then
|
||||
ExportScript.Tools.SendDataDAC("File", lMyInfo.Name)
|
||||
for i=1, #ExportScript.Config.DAC, 1 do
|
||||
ExportScript.Tools.FlushDataDAC(i)
|
||||
end
|
||||
end
|
||||
|
||||
if ExportScript.Config.IkarusExport then
|
||||
ExportScript.Tools.SendData("File", lMyInfo.Name)
|
||||
ExportScript.Tools.FlushData()
|
||||
end
|
||||
|
||||
ExportScript.Tools.WriteToLog("File '"..lModuleFile.."' loaded")
|
||||
|
||||
@ -351,6 +369,20 @@ function ExportScript.Tools.SelectModule()
|
||||
ExportScript.Tools.WriteToLog("Unknown Module Type: "..lMyInfo.Name)
|
||||
end
|
||||
|
||||
if ExportScript.Config.IkarusExport then
|
||||
for Map, LatLong in pairs(ExportScript.Maps) do
|
||||
if lMyInfo.LatLongAlt.Lat > LatLong.Lat2 and lMyInfo.LatLongAlt.Lat < LatLong.Lat1 then
|
||||
if lMyInfo.LatLongAlt.Long > LatLong.Long1 and lMyInfo.LatLongAlt.Long < LatLong.Long2 then
|
||||
ExportScript.Tools.WriteToLog("Detected Map: "..Map)
|
||||
ExportScript.Tools.SendData("Map", Map)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ExportScript.Tools.FlushData()
|
||||
end
|
||||
|
||||
else -- Unknown Module
|
||||
ExportScript.ProcessIkarusDCSHighImportance = ExportScript.ProcessIkarusDCSHighImportanceNoConfig
|
||||
ExportScript.ProcessIkarusDCSLowImportance = ExportScript.ProcessIkarusDCSLowImportanceNoConfig
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user