I found a way to combine the static and dynamic include of Moose.
We need to add the code below on top of the generated Moose.lua.
This will be added to each demo mission and then it will load automatically the individual developer files if the user has added a junction link to his DCS install directory pointing to the MOOSE repo.
This will simplify demo mission testing and maintaining a lot.
Step to integrate:
Replace MOOSE\Moose Setup\Moose Templates\Moose_Dynamic_Loader.luawith the code below.
Add a build step to attach it on top of each generated Moose.lua
-- Try to load Moose as individual script files
-- This method is used by Moose developers
ModuleLoader = 'Scripts/Moose/Modules.lua'
local f=io.open(ModuleLoader,"r")
if f~=nil then
io.close(f)
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
local base = _G
__Moose = {}
__Moose.Include = function( IncludeFile )
if not __Moose.Includes[ IncludeFile ] then
__Moose.Includes[IncludeFile] = IncludeFile
local f = assert( base.loadfile( IncludeFile ) )
if f == nil then
error ("Moose: Could not load Moose file " .. IncludeFile )
else
env.info( "Moose: " .. IncludeFile .. " dynamically loaded." )
return f()
end
end
end
__Moose.Includes = {}
__Moose.Include( 'Scripts/Moose/Modules.lua' )
BASE:TraceOnOff( true )
env.info( '*** MOOSE INCLUDE END *** ' )
-- Skip the static part of this file completly
do return end
end
-- Individual Moose files are not found. Use the static code below.
I found a way to combine the static and dynamic include of Moose. We need to add the code below on top of the generated Moose.lua. This will be added to each demo mission and then it will load automatically the individual developer files if the user has added a junction link to his DCS install directory pointing to the MOOSE repo. This will simplify demo mission testing and maintaining a lot.
Step to integrate:
MOOSE\Moose Setup\Moose Templates\Moose_Dynamic_Loader.lua
with the code below.