diff --git a/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua b/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua index f78858836..9ab74881e 100644 --- a/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua +++ b/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua @@ -1,21 +1,21 @@ local base = _G -__Moose = {} +MOOSE = {} -__Moose.Include = function( LuaPath, IncludeFile ) - if not __Moose.Includes[ IncludeFile ] then - __Moose.Includes[IncludeFile] = IncludeFile +MOOSE.Include = function( LuaPath, IncludeFile ) + if not MOOSE.Includes[ IncludeFile ] then + MOOSE.Includes[IncludeFile] = IncludeFile local f = assert( base.loadfile( LuaPath .. IncludeFile ) ) if f == nil then - error ("Moose: Could not load Moose file " .. IncludeFile ) + error ("MOOSE: Could not load Moose file " .. IncludeFile ) else - env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. LuaPath ) + env.info( "MOOSE: " .. IncludeFile .. " dynamically loaded from " .. LuaPath ) return f() end end end -__Moose.ProgramPath = "Scripts/Moose/" +MOOSE.ProgramPath = "Scripts/Moose/" -__Moose.Includes = {} +MOOSE.Includes = {} diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 2b0aa7d9b..539b24049 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,98 +1,98 @@ env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20171107_1722' ) +env.info( 'Moose Generation Timestamp: 20171110_1045' ) local base = _G -__Moose = {} +MOOSE = {} -__Moose.Include = function( LuaPath, IncludeFile ) - if not __Moose.Includes[ IncludeFile ] then - __Moose.Includes[IncludeFile] = IncludeFile +MOOSE.Include = function( LuaPath, IncludeFile ) + if not MOOSE.Includes[ IncludeFile ] then + MOOSE.Includes[IncludeFile] = IncludeFile local f = assert( base.loadfile( LuaPath .. IncludeFile ) ) if f == nil then - error ("Moose: Could not load Moose file " .. IncludeFile ) + error ("MOOSE: Could not load Moose file " .. IncludeFile ) else - env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. LuaPath ) + env.info( "MOOSE: " .. IncludeFile .. " dynamically loaded from " .. LuaPath ) return f() end end end -__Moose.ProgramPath = "Scripts/Moose/" +MOOSE.ProgramPath = "Scripts/Moose/" -__Moose.Includes = {} -__Moose.Include( __Moose.ProgramPath, 'Utilities/Routines.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Utilities/Utils.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Base.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/UserFlag.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/UserSound.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Report.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Scheduler.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/ScheduleDispatcher.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Event.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Settings.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Menu.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Zone.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Database.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Set.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Point.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Velocity.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Message.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Fsm.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Radio.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Spawn.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/SpawnStatic.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Goal.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Cargo.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Core/Spot.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Object.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Identifiable.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Positionable.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Controllable.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Group.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Unit.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Client.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Static.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Airbase.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Wrapper/Scenery.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Scoring.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/CleanUp.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Movement.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Sead.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Escort.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/MissileTrainer.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/ATC_Ground.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Detection.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/Designate.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/RAT.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/ZoneGoal.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/ZoneGoalCoalition.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Functional/ZoneCaptureCoalition.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Balancer.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_A2A.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_A2A_Patrol.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_A2A_Cap.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_A2A_Gci.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_A2A_Dispatcher.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Patrol.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Cap.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Cas.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Bai.lua' ) -__Moose.Include( __Moose.ProgramPath, 'AI/AI_Formation.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Actions/Act_Assign.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Actions/Act_Route.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Actions/Act_Account.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Actions/Act_Assist.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/CommandCenter.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Mission.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/DetectionManager.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_A2G_Dispatcher.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_A2G.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_A2A_Dispatcher.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_A2A.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_Cargo.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Tasking/TaskZoneCapture.lua' ) -__Moose.Include( __Moose.ProgramPath, 'Moose.lua' ) +MOOSE.Includes = {} +MOOSE.Include( MOOSE.ProgramPath, 'Utilities/Routines.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Utilities/Utils.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Base.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/UserFlag.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/UserSound.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Report.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Scheduler.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/ScheduleDispatcher.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Event.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Settings.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Menu.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Zone.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Database.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Set.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Point.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Velocity.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Message.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Fsm.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Radio.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Spawn.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/SpawnStatic.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Goal.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Cargo.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Core/Spot.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Object.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Identifiable.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Positionable.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Controllable.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Group.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Unit.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Client.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Static.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Airbase.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Wrapper/Scenery.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Scoring.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/CleanUp.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Movement.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Sead.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Escort.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/MissileTrainer.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/ATC_Ground.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Detection.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/Designate.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/RAT.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/ZoneGoal.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/ZoneGoalCoalition.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Functional/ZoneCaptureCoalition.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Balancer.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_A2A.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_A2A_Patrol.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_A2A_Cap.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_A2A_Gci.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_A2A_Dispatcher.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Patrol.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Cap.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Cas.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Bai.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'AI/AI_Formation.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Actions/Act_Assign.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Actions/Act_Route.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Actions/Act_Account.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Actions/Act_Assist.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/CommandCenter.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Mission.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/DetectionManager.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task_A2G_Dispatcher.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task_A2G.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task_A2A_Dispatcher.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task_A2A.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/Task_Cargo.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Tasking/TaskZoneCapture.lua' ) +MOOSE.Include( MOOSE.ProgramPath, 'Moose.lua' ) BASE:TraceOnOff( true ) env.info( '*** MOOSE INCLUDE END *** ' ) diff --git a/Moose Mission Setup/Moose_.lua b/Moose Mission Setup/Moose_.lua index f1ef98916..404ecfc7b 100644 --- a/Moose Mission Setup/Moose_.lua +++ b/Moose Mission Setup/Moose_.lua @@ -1,93 +1,93 @@ env.info('*** MOOSE DYNAMIC INCLUDE START *** ') -env.info('Moose Generation Timestamp: 20171107_1722') +env.info('Moose Generation Timestamp: 20171110_1045') local base=_G -__Moose={} -__Moose.Include=function(LuaPath,IncludeFile) -if not __Moose.Includes[IncludeFile]then -__Moose.Includes[IncludeFile]=IncludeFile +MOOSE={} +MOOSE.Include=function(LuaPath,IncludeFile) +if not MOOSE.Includes[IncludeFile]then +MOOSE.Includes[IncludeFile]=IncludeFile local f=assert(base.loadfile(LuaPath..IncludeFile)) if f==nil then -error("Moose: Could not load Moose file "..IncludeFile) +error("MOOSE: Could not load Moose file "..IncludeFile) else -env.info("Moose: "..IncludeFile.." dynamically loaded from "..LuaPath) +env.info("MOOSE: "..IncludeFile.." dynamically loaded from "..LuaPath) return f() end end end -__Moose.ProgramPath="Scripts/Moose/" -__Moose.Includes={} -__Moose.Include(__Moose.ProgramPath,'Utilities/Routines.lua') -__Moose.Include(__Moose.ProgramPath,'Utilities/Utils.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Base.lua') -__Moose.Include(__Moose.ProgramPath,'Core/UserFlag.lua') -__Moose.Include(__Moose.ProgramPath,'Core/UserSound.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Report.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Scheduler.lua') -__Moose.Include(__Moose.ProgramPath,'Core/ScheduleDispatcher.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Event.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Settings.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Menu.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Zone.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Database.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Set.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Point.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Velocity.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Message.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Fsm.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Radio.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Spawn.lua') -__Moose.Include(__Moose.ProgramPath,'Core/SpawnStatic.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Goal.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Cargo.lua') -__Moose.Include(__Moose.ProgramPath,'Core/Spot.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Object.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Identifiable.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Positionable.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Controllable.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Group.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Unit.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Client.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Static.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Airbase.lua') -__Moose.Include(__Moose.ProgramPath,'Wrapper/Scenery.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Scoring.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/CleanUp.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Movement.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Sead.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Escort.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/MissileTrainer.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/ATC_Ground.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Detection.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/Designate.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/RAT.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/ZoneGoal.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/ZoneGoalCoalition.lua') -__Moose.Include(__Moose.ProgramPath,'Functional/ZoneCaptureCoalition.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Balancer.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_A2A.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_A2A_Patrol.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_A2A_Cap.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_A2A_Gci.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_A2A_Dispatcher.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Patrol.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Cap.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Cas.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Bai.lua') -__Moose.Include(__Moose.ProgramPath,'AI/AI_Formation.lua') -__Moose.Include(__Moose.ProgramPath,'Actions/Act_Assign.lua') -__Moose.Include(__Moose.ProgramPath,'Actions/Act_Route.lua') -__Moose.Include(__Moose.ProgramPath,'Actions/Act_Account.lua') -__Moose.Include(__Moose.ProgramPath,'Actions/Act_Assist.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/CommandCenter.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Mission.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/DetectionManager.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task_A2G_Dispatcher.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task_A2G.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task_A2A_Dispatcher.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task_A2A.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/Task_Cargo.lua') -__Moose.Include(__Moose.ProgramPath,'Tasking/TaskZoneCapture.lua') -__Moose.Include(__Moose.ProgramPath,'Moose.lua') +MOOSE.ProgramPath="Scripts/Moose/" +MOOSE.Includes={} +MOOSE.Include(MOOSE.ProgramPath,'Utilities/Routines.lua') +MOOSE.Include(MOOSE.ProgramPath,'Utilities/Utils.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Base.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/UserFlag.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/UserSound.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Report.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Scheduler.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/ScheduleDispatcher.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Event.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Settings.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Menu.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Zone.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Database.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Set.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Point.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Velocity.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Message.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Fsm.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Radio.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Spawn.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/SpawnStatic.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Goal.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Cargo.lua') +MOOSE.Include(MOOSE.ProgramPath,'Core/Spot.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Object.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Identifiable.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Positionable.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Controllable.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Group.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Unit.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Client.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Static.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Airbase.lua') +MOOSE.Include(MOOSE.ProgramPath,'Wrapper/Scenery.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Scoring.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/CleanUp.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Movement.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Sead.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Escort.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/MissileTrainer.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/ATC_Ground.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Detection.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/Designate.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/RAT.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/ZoneGoal.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/ZoneGoalCoalition.lua') +MOOSE.Include(MOOSE.ProgramPath,'Functional/ZoneCaptureCoalition.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Balancer.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_A2A.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_A2A_Patrol.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_A2A_Cap.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_A2A_Gci.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_A2A_Dispatcher.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Patrol.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Cap.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Cas.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Bai.lua') +MOOSE.Include(MOOSE.ProgramPath,'AI/AI_Formation.lua') +MOOSE.Include(MOOSE.ProgramPath,'Actions/Act_Assign.lua') +MOOSE.Include(MOOSE.ProgramPath,'Actions/Act_Route.lua') +MOOSE.Include(MOOSE.ProgramPath,'Actions/Act_Account.lua') +MOOSE.Include(MOOSE.ProgramPath,'Actions/Act_Assist.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/CommandCenter.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Mission.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/DetectionManager.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task_A2G_Dispatcher.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task_A2G.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task_A2A_Dispatcher.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task_A2A.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/Task_Cargo.lua') +MOOSE.Include(MOOSE.ProgramPath,'Tasking/TaskZoneCapture.lua') +MOOSE.Include(MOOSE.ProgramPath,'Moose.lua') BASE:TraceOnOff(true) env.info('*** MOOSE INCLUDE END *** ') diff --git a/Moose Mission Setup/Moose_Create.lua b/Moose Mission Setup/Moose_Create.lua index 23bf446a0..0d39f746c 100644 --- a/Moose Mission Setup/Moose_Create.lua +++ b/Moose Mission Setup/Moose_Create.lua @@ -50,7 +50,7 @@ while( MooseSource ) do local MooseFilePath = MooseDevelopmentPath .. "/" .. MooseSource if MooseDynamicStatic == "D" then print( "Load dynamic: " .. MooseSource ) - MooseFile:write( "__Moose.Include( __Moose.ProgramPath, '" .. MooseSource .. "' )\n" ) + MooseFile:write( "MOOSE.Include( MOOSE.ProgramPath, '" .. MooseSource .. "' )\n" ) end if MooseDynamicStatic == "S" then print( "Load static: " .. MooseSource ) diff --git a/docs/Debugging/DEBUG_Add_Favorites.JPG b/docs/Debugging/DEBUG_Add_Favorites.JPG new file mode 100644 index 000000000..5aacedd6b Binary files /dev/null and b/docs/Debugging/DEBUG_Add_Favorites.JPG differ diff --git a/docs/Debugging/DEBUG_Breakpoint.JPG b/docs/Debugging/DEBUG_Breakpoint.JPG new file mode 100644 index 000000000..5e02de2f3 Binary files /dev/null and b/docs/Debugging/DEBUG_Breakpoint.JPG differ diff --git a/docs/Debugging/DEBUG_Breakpoint_List.JPG b/docs/Debugging/DEBUG_Breakpoint_List.JPG new file mode 100644 index 000000000..aa7b53b82 Binary files /dev/null and b/docs/Debugging/DEBUG_Breakpoint_List.JPG differ diff --git a/docs/Debugging/DEBUG_Bug.JPG b/docs/Debugging/DEBUG_Bug.JPG new file mode 100644 index 000000000..ddc7864cd Binary files /dev/null and b/docs/Debugging/DEBUG_Bug.JPG differ diff --git a/docs/Debugging/DEBUG_Debugger.JPG b/docs/Debugging/DEBUG_Debugger.JPG new file mode 100644 index 000000000..76fb44070 Binary files /dev/null and b/docs/Debugging/DEBUG_Debugger.JPG differ diff --git a/docs/Debugging/DEBUG_Dynamic.JPG b/docs/Debugging/DEBUG_Dynamic.JPG new file mode 100644 index 000000000..f7c2ffe20 Binary files /dev/null and b/docs/Debugging/DEBUG_Dynamic.JPG differ diff --git a/docs/Debugging/DEBUG_Engine.JPG b/docs/Debugging/DEBUG_Engine.JPG new file mode 100644 index 000000000..ea4dc5da0 Binary files /dev/null and b/docs/Debugging/DEBUG_Engine.JPG differ diff --git a/docs/Debugging/DEBUG_Favorites.JPG b/docs/Debugging/DEBUG_Favorites.JPG new file mode 100644 index 000000000..f76a07361 Binary files /dev/null and b/docs/Debugging/DEBUG_Favorites.JPG differ diff --git a/docs/Debugging/DEBUG_Flag.JPG b/docs/Debugging/DEBUG_Flag.JPG new file mode 100644 index 000000000..b2c70424a Binary files /dev/null and b/docs/Debugging/DEBUG_Flag.JPG differ diff --git a/docs/Debugging/DEBUG_Intro.JPG b/docs/Debugging/DEBUG_Intro.JPG new file mode 100644 index 000000000..397db83d5 Binary files /dev/null and b/docs/Debugging/DEBUG_Intro.JPG differ diff --git a/docs/Debugging/DEBUG_LDT_Setup.JPG b/docs/Debugging/DEBUG_LDT_Setup.JPG new file mode 100644 index 000000000..f67106a2c Binary files /dev/null and b/docs/Debugging/DEBUG_LDT_Setup.JPG differ diff --git a/docs/Debugging/DEBUG_Listener.JPG b/docs/Debugging/DEBUG_Listener.JPG new file mode 100644 index 000000000..d575b696b Binary files /dev/null and b/docs/Debugging/DEBUG_Listener.JPG differ diff --git a/docs/Debugging/DEBUG_Loader.JPG b/docs/Debugging/DEBUG_Loader.JPG new file mode 100644 index 000000000..cfe35fe78 Binary files /dev/null and b/docs/Debugging/DEBUG_Loader.JPG differ diff --git a/docs/Debugging/DEBUG_MissionScripting.JPG b/docs/Debugging/DEBUG_MissionScripting.JPG new file mode 100644 index 000000000..69ef88ee6 Binary files /dev/null and b/docs/Debugging/DEBUG_MissionScripting.JPG differ diff --git a/docs/Debugging/DEBUG_Run_Listener.JPG b/docs/Debugging/DEBUG_Run_Listener.JPG new file mode 100644 index 000000000..9ad173408 Binary files /dev/null and b/docs/Debugging/DEBUG_Run_Listener.JPG differ diff --git a/docs/Debugging/DEBUG_Session.JPG b/docs/Debugging/DEBUG_Session.JPG new file mode 100644 index 000000000..03b78ab79 Binary files /dev/null and b/docs/Debugging/DEBUG_Session.JPG differ diff --git a/docs/Debugging/DEBUG_Source.JPG b/docs/Debugging/DEBUG_Source.JPG new file mode 100644 index 000000000..2db11e005 Binary files /dev/null and b/docs/Debugging/DEBUG_Source.JPG differ diff --git a/docs/Debugging/DEBUG_Static.JPG b/docs/Debugging/DEBUG_Static.JPG new file mode 100644 index 000000000..bcc70cef4 Binary files /dev/null and b/docs/Debugging/DEBUG_Static.JPG differ diff --git a/docs/Debugging/DEBUG_Tracking.JPG b/docs/Debugging/DEBUG_Tracking.JPG new file mode 100644 index 000000000..5f694c8e4 Binary files /dev/null and b/docs/Debugging/DEBUG_Tracking.JPG differ diff --git a/docs/Interactive_Debug_Guide.md b/docs/Interactive_Debug_Guide.md new file mode 100644 index 000000000..d2fccdb58 --- /dev/null +++ b/docs/Interactive_Debug_Guide.md @@ -0,0 +1,315 @@ +# Interactive DEBUG using Lua Development Tools from the Eclipse open source suite. + +The Lua Development Tools in the Eclipse suite has a possibility to "attach a lua debugger" to your LDT environment. +Read this section to setup a debugger in our DCS World environment. + +The people who have used debuggers before, will recognize a lot in this explanation! + +How it works: + + * Setup a **debug listener** within LDT. When running, it will listen over IP on the local host (127.0.0.1) on a port. + * Attach a **debug client** to your DCS World configuration. This **debug client** will attach itself to the **debug listener** over IP. + * Modify your mission, so that your source files are loaded **dynamically**. This is very important because DCS World **renames** unfortunately the name of the source files when it runs a mission! + * Set breakpoints where needed. The debugger will stop at the breakpoints set. + * Run the **debug listener** on LDT. + * Run the DCS World mission, which uses the **debug client** to connect to the **debug listener** over IP. + * The logic will stop at the set breakpoints. Using LDT, you can walk through the logic (statements), while inspecting variable contents and evaluate expressions. + * You can set breakpoints during the process where you want, you can add / delete variables in the views where you want. + +**This capability will give you a new experience in DCS World mission design!** + +**Note:** The assets that are used in this description, were modified to accomodate the debugging, so the LDT off-the-shelf assets aren't working. +So use the assets as listed here, or your debugger won't work! + + +## 1. Explanation of the LDT debugging environment. + +![](Debugging/DEBUG_Intro.JPG) + +The following pictures outline some of the interesting places in LDT to debug your lua code... A quick manual. + +![](Debugging/DEBUG_Bug.JPG) + +This picture shows a debug view of the LDT environment. You can activate the debug view through the debug icon that is located in the upper right corner of the LDT. + +![](Debugging/DEBUG_Tracking.JPG) + +Various windows exist to track the content of: + + * Variables: local and global variables will appear automatically in the Variables window where used. + * Breakpoints: Breakpoints that are set at lines of various sources, are listed here. + * Expressions: Various expressions can be entered to evaluate a more complex statement. + * Interactive Console: Here you can type in commands that will be executed. Here you can SPAWN for example new groups. + +![](Debugging/DEBUG_Source.JPG) + +This window lists the sources active in Eclipse. +During a debug sessions, the sources where the process is at the moment of debugging, should be loaded automatically. +If not, something is wrong. +All the other sources that are currently open in the LDT are also listed. + +![](Debugging/DEBUG_Engine.JPG) + +This window shows the status of the "attach debug engine". +If this process is running, it will listen to the IP 127.0.0.1 or localhost if setup on your PC. + + + +## 2. Setup your **debug listener** in LDT. + +To use the debug enviornment in LDT, you'll need to setup within LDT a " Lua Attach to Application" **debug listener**. + +![](Debugging/DEBUG_Engine.JPG) + +You can access this screen through the LDT editor menu **Run->Debug Configurations...**. + +This is the meaning of each field: + + * Project: The name of the project that you are debugging within your workspace. You need to have a project registered here! + * IDE key: this string is used connect the **debug client** to the **debug listener**. + * Timeout: the amount of seconds you want DCS World to wait for the **debug listener** to be connecting. + * Source mapping: Select the option "Local Resolution". All the sources are loaded locally from your PC automatically when debugging. + +Thats it on the LDT side. + + + +## 3. Setup your **debug client** and attach it to DCS World mission runtime. + +This process is essential. + +Within the MOOSE repository, there are two files that you need to consider. +These files are located + + + +### 3.1. debugger.lua. + +This is the **debug client**. The source is part of the LDT debug suite, but has been modified to work together with the DCS World scripting engine. +You need to copy this file to the root directory of your DCS World installation in Program Files. + +![](Debugging/DEBUG_debugger.JPG) + +The location of debugger.lua is here on my DCS World installation. + +### 3.2. Modify the MissionScripting.lua file. + +The connect.lua file is a file that contains an explanation of how to modify the MissionScripting.lua. + +But for clarity reasons, I've also attached my version of the MissionScripting.lua. + +![](Debugging/DEBUG_MissionScripting.JPG) + + +Take the MissionScripting.lua from the folder, and copy / paste (overwrite) the version in your DCS World installation directory under the Scripts folder. +If you want, you can first rename the existing MissionScripting.lua file to MissionScripting_old.lua +Don't mistake yourself, a lot of mods/tools modify this file during installation. (like slmod etc). + +Once you've overwritten the MissionScripting.lua file, check if the contents are changed. +It should contain the following: + +``` +--Initialization script for the Mission lua Environment (SSE) + +dofile('Scripts/ScriptingSystem.lua') + +-- Add LuaSocket to the LUAPATH, so that it can be found. +package.path = package.path..";.\\LuaSocket\\?.lua;" + +-- Connect to the debugger, first require it. +local initconnection = require("debugger") + +-- Now make the connection.. +-- "127.0.0.1" is the localhost. +-- 10000 is the port. If you wanna use another port in LDT, change this number too! +-- "dcsserver" is the name of the server. If you wanna use another name, change the name here too! +-- nil (is for transport protocol, but not using this) +-- "win" don't touch. But is important to indicate that we are in a windows environment to the debugger script. +initconnection( "127.0.0.1", 10000, "dcsserver", nil, "win", "" ) + + +--Sanitize Mission Scripting environment +--This makes unavailable some unsecure functions. +--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions. +--You can remove the code below and make availble these functions at your own risk. + +local function sanitizeModule(name) + _G[name] = nil + package.loaded[name] = nil +end + + +do + sanitizeModule('os') + --sanitizeModule('io') + sanitizeModule('lfs') + require = nil + loadlib = nil +end +``` + +Please read through the comment lines for a detailed description what it does. +The io module has been de-sanitized because the debugger.lua needs to use the io module while debugging. + + + +## 4. Setup your .miz file. + +When you run a mission in single player in DCS World, a couple of things are happening. + + 1. The .miz (mission) file that was selected to run, is unzipped in a temp folder on your drive. + 2. Each lua file that is included in a DO SCRIPT FILE, is **RENAMED** to a file structure like ~mis__nnnnn___.lua. + This is very bad. Because this prevents you from settings breakpoints at the source file and ensure that the debugger + recognizes the source during run and the location of the breakpoint! + +So we need to do something special. The trick is **dynamic loading**. +And believe me, it is the only way to be able to debug your sources. +So this is a little task that you need to learn how to do, but once you understand it, it will become very easy to do. + +Instead of executing a DO SCRIPT FILE, you need to add a couple of things in your .miz file. + + +### 4.1 Conditionalize the DO SCRIPT FILE execution. + +Keep the DO SCRIPT FILE line in your mission. Why? Because if you would remove it, and you woudn't debug your code, your mission file would be deleted. +Instead, we are going to put a flag before this part of the execution. A debug flag. For example, in my mission I put a debug flag 999. When 999 is ON, I would NOT execute the mission file... + +Follow this process how to do that... As my recommendation... + +![](Debugging/DEBUG_Flag.JPG) + +Setup a debug flag... If you wanna debug, set flag 999 to ON. + +![](Debugging/DEBUG_Static.JPG) + +Conditionalize the DO SCRIPT FILE execution by evaluating if the 999 is OFF. + + +### 4.2 Add a dynamic loader to debug your mission script. + +Now we are adding a little line. +We are now going to ADD a **dynamic loader** of your mission source. + +![](Debugging/DEBUG_Dynamic.JPG) + +This loads the file dynamically. Instead of a DO SCRIPT FILE, we execute here a DO SCRIPT. +The DO SCRIPT contains a little piece of code that loads your source file from a location on your disk. + +![](Debugging/DEBUG_Loader.JPG) + +This is how my piece of code looks like. I am using a stub of the MOOSE framework to load the file. + +`MOOSE.Include( full_path_name, file_name )` + + * The `full_path_name` needs to be between quotes, **follows unix folder notation** and **needs to end with a /** + * The `file name` is the full file name, **including the .lua extension**! + + +If you don't wanna use __Moose.Include, no worries, there is another method. + +`_G.loadfile( full_path_name .. file_name )` + +The MOOSE.Include loader uses _G.loadfile to load the sources. But it does a bit more checking and logs in dcs.log which files were dynamically loaded, and from which location! + + + +### 5. Run the **debug listener** on LDT. + +Now we are all setup! You've got your **debug listener** setup in LDT, you got your **debug client** setup and connected to your DCS World environment, and you got your mission file ready for debug! + +Now we are going to run a debug. To have a successful debug run, you need to start the listener in LDT. + +### 5.1. Setup your debug favorite. + +First we setup the Debug as your "favorite", so that it is easy for your to repeat the run easily. + +![](Debugging/DEBUG_Favorites.JPG) + +Click on the "Bug" icon that you'll find in the task bar. The "Bug" icon is the place where you will start your **debug listener**. +However, first, click on Organize Favorites. You need to do this one time only. + +![](Debugging/DEBUG_Add Favorites.JPG) + +Just click on the Debug Name that you entered (for me DCS 1.5) in the Debug Configuration window and it will be added ot your favorites. +I did already that, so it was already added as an example in the previous picture. + +### 5.2. Run the **debug listener**. + +Now you can easily activate the **debug listener**. + +![](Debugging/DEBUG_Run_Listener.JPG) + +Just click the "Bug" again, and select the **debug listener** that you configured. + +![](Debugging/DEBUG_Listener.JPG) + +When done, you'll see that the **debug listener** is running! + +It will be listening quietly to IP 127.0.0.1 on port 100000. + + + +### 6. Set breakpoints. + +Open your source file **from the exact location** from where you have specified it to be loaded as part of the **dynamic loading**. +Once it is loaded, you can attach breakpoints within the editor. + +![](Debugging/DEBUG_Breakpoint.JPG) + +How? Right click on the source line number or the grey area before the line, and a pop-up window will appear. Select "Toggle Breakpoint". + +![](Debugging/DEBUG_Breakpoint_List.JPG) + +As a result, the breakpoint will be listed in the "Breakpoints" list at the debug view, and it will show also the line number where the breakpoint is set. +When your mission runs, the logic will stop at this line!!! + + + +### 7. Run your DCS World mission. + +Now it is time to start your DCS World mission. Just run it as you would like have it. + + 1. The **debug client** (debugger.lua) is loaded as part of the MissionScripting.lua file. + 2. The **debug client** connects to the **debug listener** on ldt using 127.0.0.1 using port 10000. + 3. Your **mission source** will be **loaded dynamically**. + 4. Your mission will start running. + 5. Debugger is active and will monitor if a breakpoint has been set at the source currently active during runtime of your mission. + 6. Once it matches a valid breakpoint at a valid source and a specified line, it will stop the logic! + + +![](Debugging/DEBUG_Session.JPG) + + + +### 8. Next steps. + +There is a lot to say about debugging and the techniques that you can use how to track the code. +For this, videos will be made in the MOOSE For Dummies video series. + +Please consult the youtube channel for more info on debugging. + + + +### 9. Sequel. + +When I started to use DCS World (discovered it by accident), I was sold. +After a while I started to discover the SSE capabilities of DCS World and started to code lua. +But a very important piece was missing while developing the MOOSE framework. + +**A debugger**. + +I've been searching for about 4 years to get this working. There was a huge learning curve. +I had to "hack" myself into the LDT environment and modify the LDT assets to make this work. +There were moments of "clarity" that made me understand how it all fits together. +And now it is there. Wanted to share this for all users of DCS World. + +It does require a bit of effort to use this in the DCS World environment, but the little effort +is a small trade against the huge advantages here! + +I also encourage you to use the MOOSE Framework, as it brings you a lot of great capabilities +you will never have in any editor. Being able to debug your code, will solve a lot of your questions now! + +I hope you will all have fun with the new debug capability and that it may result in greater missions. + +kind regards, +FC \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 3cc335f97..3aba41adc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -239,6 +239,11 @@ Those people who have experience in lua development or are excited to contribute Please consult the **[Contribution Guide](Contribution_Guide.html)** for more information. +## 3.4. Debug your code interactively using LDT + +Have a look at the **[Interactive Debug Guide](Interactive_Debug_Guide.html)** to setup your system so you can debug your mission code. + + # 4. MOOSE Support Channels