From b6009e5d3376da5bc59954fc641b2f597e6db86f Mon Sep 17 00:00:00 2001 From: McMicha Date: Tue, 27 Mar 2018 23:50:55 +0200 Subject: [PATCH] fix for F-86 multiplayer export add the variable ExportScript.NoLuaExportBeforeNextFrame to avoid errors during multiplayer export of F-86 --- Scripts/DCS-ExportScript/ExportScript.lua | 14 ++++++++++++-- .../ExportsModules/F-86F Sabre.lua | 3 ++- Scripts/DCS-ExportScript/lib/Tools.lua | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Scripts/DCS-ExportScript/ExportScript.lua b/Scripts/DCS-ExportScript/ExportScript.lua index ea5b7f9..71580a9 100644 --- a/Scripts/DCS-ExportScript/ExportScript.lua +++ b/Scripts/DCS-ExportScript/ExportScript.lua @@ -22,6 +22,8 @@ ExportScript.LastDataDAC = {} ExportScript.lastExportTimeHI = 0 ExportScript.lastExportTimeLI = 0 +ExportScript.NoLuaExportBeforeNextFrame = false + local PrevExport = {} PrevExport.LuaExportStart = LuaExportStart PrevExport.LuaExportStop = LuaExportStop @@ -29,6 +31,7 @@ PrevExport.LuaExportBeforeNextFrame = LuaExportBeforeNextFrame PrevExport.LuaExportAfterNextFrame = LuaExportAfterNextFrame dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\Config.lua]]) +ExportScript.utf8 = dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\utf8.lua]]) dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Tools.lua]]) dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\genericRadio.lua]]) dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Maps.lua]]) @@ -69,7 +72,7 @@ function LuaExportStart() end --local lrename1, lrename2 = os.rename(ExportScript.Config.LogPath, ExportScript.Config.LogPath..".old") - ExportScript.logFile = io.open(ExportScript.Config.LogPath, "w+") + ExportScript.logFile = io.open(ExportScript.Config.LogPath, "wa") -- "W+" if ExportScript.logFile then ExportScript.logFile:write('\239\187\191') -- create a UTF-8 BOM end @@ -79,6 +82,7 @@ function LuaExportStart() ExportScript.AF = {} -- Table for Auxiliary functions + ExportScript.NoLuaExportBeforeNextFrame = false ExportScript.Tools.SelectModule() -- point globals to Module functions and data. -- Chain previously-included export as necessary @@ -95,7 +99,9 @@ function LuaExportBeforeNextFrame() coStatus = coroutine.resume(ExportScript.coProcessArguments_BeforeNextFrame) end - ExportScript.Tools.ProcessOutput() + if ExportScript.NoLuaExportBeforeNextFrame == false then + ExportScript.Tools.ProcessOutput() + end -- Chain previously-included export as necessary if PrevExport.LuaExportBeforeNextFrame then @@ -104,6 +110,10 @@ function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() + if ExportScript.NoLuaExportBeforeNextFrame then + ExportScript.Tools.ProcessOutput() + end + -- Chain previously-included export as necessary if PrevExport.LuaExportAfterNextFrame then PrevExport.LuaExportAfterNextFrame() diff --git a/Scripts/DCS-ExportScript/ExportsModules/F-86F Sabre.lua b/Scripts/DCS-ExportScript/ExportsModules/F-86F Sabre.lua index 23b9a15..c2853d6 100644 --- a/Scripts/DCS-ExportScript/ExportsModules/F-86F Sabre.lua +++ b/Scripts/DCS-ExportScript/ExportsModules/F-86F Sabre.lua @@ -1,7 +1,8 @@ -- F-86 Export --- Version 1.0.0 BETA +-- Version 1.0.1 ExportScript.FoundDCSModule = true +ExportScript.NoLuaExportBeforeNextFrame = true ExportScript.ConfigEveryFrameArguments = { diff --git a/Scripts/DCS-ExportScript/lib/Tools.lua b/Scripts/DCS-ExportScript/lib/Tools.lua index 4a3b3f7..6e00cfe 100644 --- a/Scripts/DCS-ExportScript/lib/Tools.lua +++ b/Scripts/DCS-ExportScript/lib/Tools.lua @@ -79,7 +79,9 @@ function ExportScript.Tools.ProcessOutput() local lMyInfo = LoGetSelfData() if lMyInfo ~= nil then if ExportScript.ModuleName ~= lMyInfo.Name then - ExportScript.Tools.SelectModule() -- point globals to Module functions and data. + ExportScript.NoLuaExportBeforeNextFrame = false + ExportScript.Tools.SelectModule() -- point globals to Module functions and data. + return end lMyInfo = nil end