diff --git a/Moose Development/Moose/Base.lua b/Moose Development/Moose/Base.lua index 1737ebdfd..0c7361e41 100644 --- a/Moose Development/Moose/Base.lua +++ b/Moose Development/Moose/Base.lua @@ -440,7 +440,7 @@ end -- @param Arguments A #table or any field. function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -469,7 +469,7 @@ end -- @param Arguments A #table or any field. function BASE:F( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -485,7 +485,7 @@ end -- @param Arguments A #table or any field. function BASE:F2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -500,7 +500,7 @@ end -- @param Arguments A #table or any field. function BASE:F3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -515,7 +515,7 @@ end -- @param Arguments A #table or any field. function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -544,7 +544,7 @@ end -- @param Arguments A #table or any field. function BASE:T( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -560,7 +560,7 @@ end -- @param Arguments A #table or any field. function BASE:T2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -575,7 +575,7 @@ end -- @param Arguments A #table or any field. function BASE:T3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -590,21 +590,24 @@ end -- @param Arguments A #table or any field. function BASE:E( Arguments ) - local DebugInfoCurrent = debug.getinfo( 2, "nl" ) - local DebugInfoFrom = debug.getinfo( 3, "l" ) - - local Function = "function" - if DebugInfoCurrent.name then - Function = DebugInfoCurrent.name - end - - local LineCurrent = DebugInfoCurrent.currentline - local LineFrom = -1 - if DebugInfoFrom then - LineFrom = DebugInfoFrom.currentline - end - - env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + if debug then + local DebugInfoCurrent = debug.getinfo( 2, "nl" ) + local DebugInfoFrom = debug.getinfo( 3, "l" ) + + local Function = "function" + if DebugInfoCurrent.name then + Function = DebugInfoCurrent.name + end + + local LineCurrent = DebugInfoCurrent.currentline + local LineFrom = -1 + if DebugInfoFrom then + LineFrom = DebugInfoFrom.currentline + end + + env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + end + end diff --git a/Moose Development/Moose/Detection.lua b/Moose Development/Moose/Detection.lua index a57f54440..b4a26d88d 100644 --- a/Moose Development/Moose/Detection.lua +++ b/Moose Development/Moose/Detection.lua @@ -394,15 +394,17 @@ function DETECTION_UNITGROUPS:SmokeDetectedUnits() self:F2() self._SmokeDetectedUnits = true + return self end --- Flare the detected units -- @param #DETECTION_UNITGROUPS self -- @return #DETECTION_UNITGROUPS self -function DETECTION_UNITGROUPS:SmokeDetectedUnits() +function DETECTION_UNITGROUPS:FlareDetectedUnits() self:F2() self._FlareDetectedUnits = true + return self end --- Smoke the detected zones @@ -412,6 +414,7 @@ function DETECTION_UNITGROUPS:SmokeDetectedZones() self:F2() self._SmokeDetectedZones = true + return self end --- Flare the detected zones @@ -421,6 +424,7 @@ function DETECTION_UNITGROUPS:FlareDetectedZones() self:F2() self._FlareDetectedZones = true + return self end @@ -445,7 +449,6 @@ function DETECTION_UNITGROUPS:CreateDetectionSets() for DetectedZoneIndex = 1, #self.DetectedZones do self:T( "Detected Unit Set #" .. DetectedZoneIndex ) local DetectedUnitSet = self.DetectedSets[DetectedZoneIndex] -- Set#SET_BASE - DetectedUnitSet:Flush() local DetectedZone = self.DetectedZones[DetectedZoneIndex] -- Zone#ZONE_UNIT if DetectedUnit:IsInZone( DetectedZone ) then self:T( "Adding to Unit Set #" .. DetectedZoneIndex ) diff --git a/Moose Development/Moose/Event.lua b/Moose Development/Moose/Event.lua index 88f16e783..bcad4497f 100644 --- a/Moose Development/Moose/Event.lua +++ b/Moose Development/Moose/Event.lua @@ -465,7 +465,8 @@ function EVENT:OnPlayerLeaveUnit( EventFunction, EventSelf ) end - +--- @param #EVENT self +-- @param #EVENTDATA Event function EVENT:onEvent( Event ) self:F2( { _EVENTCODES[Event.id], Event } ) @@ -499,7 +500,7 @@ function EVENT:onEvent( Event ) Event.WeaponName = Event.Weapon:getTypeName() --Event.WeaponTgtDCSUnit = Event.Weapon:getTarget() end - self:E( { _EVENTCODES[Event.id], Event } ) + self:E( { _EVENTCODES[Event.id], Event.IniUnitName, Event.TgtUnitName, Event.WeaponName } ) for ClassName, EventData in pairs( self.Events[Event.id] ) do if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:E( { "Calling event function for class ", ClassName, " unit ", Event.IniDCSUnitName } ) diff --git a/Moose Development/Moose/Scheduler.lua b/Moose Development/Moose/Scheduler.lua index d3d75fd95..9d6b66295 100644 --- a/Moose Development/Moose/Scheduler.lua +++ b/Moose Development/Moose/Scheduler.lua @@ -111,8 +111,10 @@ function SCHEDULER:_Scheduler() local ErrorHandler = function( errmsg ) env.info( "Error in SCHEDULER function:" .. errmsg ) - env.info( debug.traceback() ) - + if debug ~= nil then + env.info( debug.traceback() ) + end + return errmsg end diff --git a/Moose Development/Moose/Sead.lua b/Moose Development/Moose/Sead.lua index 489c1ecf9..25e9ceff2 100644 --- a/Moose Development/Moose/Sead.lua +++ b/Moose Development/Moose/Sead.lua @@ -50,7 +50,6 @@ function SEAD:EventShot( Event ) local SEADUnitName = Event.IniDCSUnitName local SEADWeapon = Event.Weapon -- Identify the weapon fired local SEADWeaponName = Event.WeaponName -- return weapon type - --trigger.action.outText( string.format("Alerte, depart missile " ..string.format(SEADWeaponName)), 20) --debug message -- Start of the 2nd loop self:T( "Missile Launched = " .. SEADWeaponName ) if SEADWeaponName == "KH-58" or SEADWeaponName == "KH-25MPU" or SEADWeaponName == "AGM-88" or SEADWeaponName == "KH-31A" or SEADWeaponName == "KH-31P" then -- Check if the missile is a SEAD @@ -76,10 +75,10 @@ function SEAD:EventShot( Event ) local Skills = { "Average", "Good", "High", "Excellent" } _targetskill = Skills[ math.random(1,4) ] end - self:T( _targetskill ) -- debug message for skill check + self:T( _targetskill ) if self.TargetSkill[_targetskill] then if (_evade > self.TargetSkill[_targetskill].Evade) then - self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) --debug message + self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) local _targetMim = Weapon.getTarget(SEADWeapon) local _targetMimname = Unit.getName(_targetMim) local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) diff --git a/Moose Development/Moose/Set.lua b/Moose Development/Moose/Set.lua index c3194e0dc..628d57b75 100644 --- a/Moose Development/Moose/Set.lua +++ b/Moose Development/Moose/Set.lua @@ -399,7 +399,7 @@ end -- @param #SET_BASE self -- @param Event#EVENTDATA Event function SET_BASE:_EventOnDeadOrCrash( Event ) - self:F2( { Event } ) + self:F3( { Event } ) if Event.IniDCSUnit then local ObjectName, Object = self:FindInDatabase( Event ) @@ -455,7 +455,7 @@ function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArgumen local function CoRoutine() local Count = 0 for ObjectID, Object in pairs( Set ) do - self:T2( Object ) + self:T3( Object ) if Function then if Function( unpack( FunctionArguments ), Object ) == true then IteratorFunction( Object, unpack( arg ) ) @@ -544,7 +544,7 @@ function SET_BASE:IsIncludeObject( Object ) return true end ---- Flushes the current SET_BASE contents in the log ... (for debug reasons). +--- Flushes the current SET_BASE contents in the log ... (for debugging reasons). -- @param #SET_BASE self -- @return #string A string with the names of the objects. function SET_BASE:Flush() @@ -1165,7 +1165,6 @@ end function SET_UNIT:FindInDatabase( Event ) self:F3( { Event } ) - self:E( { Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] } ) return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] end 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 8c3b6bdf7..f0bd89564 100644 --- a/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua +++ b/Moose Mission Setup/Moose Create Dynamic/Moose_Dynamic_Loader.lua @@ -3,25 +3,13 @@ local base = _G Include = {} -Include.Path = function() - local str = debug.getinfo(2, "S").source - return str:match("(.*/)"):sub(1,-2):gsub("\\","/") -end - Include.File = function( IncludeFile ) if not Include.Files[ IncludeFile ] then Include.Files[IncludeFile] = IncludeFile env.info( "Include:" .. IncludeFile .. " from " .. Include.ProgramPath ) local f = assert( base.loadfile( Include.ProgramPath .. IncludeFile .. ".lua" ) ) if f == nil then - env.info( "Include:" .. IncludeFile .. " from " .. Include.MissionPath ) - local f = assert( base.loadfile( Include.MissionPath .. IncludeFile .. ".lua" ) ) - if f == nil then - error ("Could not load MOOSE file " .. IncludeFile .. ".lua" ) - else - env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.MissionPath ) - return f() - end + error ("Could not load MOOSE file " .. IncludeFile .. ".lua" ) else env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.ProgramPath ) return f() @@ -30,10 +18,8 @@ Include.File = function( IncludeFile ) end Include.ProgramPath = "Scripts/Moose/" -Include.MissionPath = Include.Path() env.info( "Include.ProgramPath = " .. Include.ProgramPath) -env.info( "Include.MissionPath = " .. Include.MissionPath) Include.Files = {} diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index 0a431f203..ad0a76b0d 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20160625_0851' ) +env.info( 'Moose Generation Timestamp: 20160625_1329' ) local base = _G Include = {} @@ -2969,7 +2969,7 @@ end -- @param Arguments A #table or any field. function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -2998,7 +2998,7 @@ end -- @param Arguments A #table or any field. function BASE:F( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3014,7 +3014,7 @@ end -- @param Arguments A #table or any field. function BASE:F2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3029,7 +3029,7 @@ end -- @param Arguments A #table or any field. function BASE:F3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3044,7 +3044,7 @@ end -- @param Arguments A #table or any field. function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -3073,7 +3073,7 @@ end -- @param Arguments A #table or any field. function BASE:T( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3089,7 +3089,7 @@ end -- @param Arguments A #table or any field. function BASE:T2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3104,7 +3104,7 @@ end -- @param Arguments A #table or any field. function BASE:T3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3119,21 +3119,24 @@ end -- @param Arguments A #table or any field. function BASE:E( Arguments ) - local DebugInfoCurrent = debug.getinfo( 2, "nl" ) - local DebugInfoFrom = debug.getinfo( 3, "l" ) - - local Function = "function" - if DebugInfoCurrent.name then - Function = DebugInfoCurrent.name - end - - local LineCurrent = DebugInfoCurrent.currentline - local LineFrom = -1 - if DebugInfoFrom then - LineFrom = DebugInfoFrom.currentline - end - - env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + if debug then + local DebugInfoCurrent = debug.getinfo( 2, "nl" ) + local DebugInfoFrom = debug.getinfo( 3, "l" ) + + local Function = "function" + if DebugInfoCurrent.name then + Function = DebugInfoCurrent.name + end + + local LineCurrent = DebugInfoCurrent.currentline + local LineFrom = -1 + if DebugInfoFrom then + LineFrom = DebugInfoFrom.currentline + end + + env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + end + end @@ -6072,8 +6075,10 @@ function SCHEDULER:_Scheduler() local ErrorHandler = function( errmsg ) env.info( "Error in SCHEDULER function:" .. errmsg ) - env.info( debug.traceback() ) - + if debug ~= nil then + env.info( debug.traceback() ) + end + return errmsg end @@ -6592,7 +6597,8 @@ function EVENT:OnPlayerLeaveUnit( EventFunction, EventSelf ) end - +--- @param #EVENT self +-- @param #EVENTDATA Event function EVENT:onEvent( Event ) self:F2( { _EVENTCODES[Event.id], Event } ) @@ -6626,7 +6632,7 @@ function EVENT:onEvent( Event ) Event.WeaponName = Event.Weapon:getTypeName() --Event.WeaponTgtDCSUnit = Event.Weapon:getTarget() end - self:E( { _EVENTCODES[Event.id], Event } ) + self:E( { _EVENTCODES[Event.id], Event.IniUnitName, Event.TgtUnitName, Event.WeaponName } ) for ClassName, EventData in pairs( self.Events[Event.id] ) do if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:E( { "Calling event function for class ", ClassName, " unit ", Event.IniDCSUnitName } ) @@ -11078,7 +11084,7 @@ end -- @param #SET_BASE self -- @param Event#EVENTDATA Event function SET_BASE:_EventOnDeadOrCrash( Event ) - self:F2( { Event } ) + self:F3( { Event } ) if Event.IniDCSUnit then local ObjectName, Object = self:FindInDatabase( Event ) @@ -11134,7 +11140,7 @@ function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArgumen local function CoRoutine() local Count = 0 for ObjectID, Object in pairs( Set ) do - self:T2( Object ) + self:T3( Object ) if Function then if Function( unpack( FunctionArguments ), Object ) == true then IteratorFunction( Object, unpack( arg ) ) @@ -11223,7 +11229,7 @@ function SET_BASE:IsIncludeObject( Object ) return true end ---- Flushes the current SET_BASE contents in the log ... (for debug reasons). +--- Flushes the current SET_BASE contents in the log ... (for debugging reasons). -- @param #SET_BASE self -- @return #string A string with the names of the objects. function SET_BASE:Flush() @@ -11844,7 +11850,6 @@ end function SET_UNIT:FindInDatabase( Event ) self:F3( { Event } ) - self:E( { Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] } ) return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] end @@ -19578,7 +19583,6 @@ function SEAD:EventShot( Event ) local SEADUnitName = Event.IniDCSUnitName local SEADWeapon = Event.Weapon -- Identify the weapon fired local SEADWeaponName = Event.WeaponName -- return weapon type - --trigger.action.outText( string.format("Alerte, depart missile " ..string.format(SEADWeaponName)), 20) --debug message -- Start of the 2nd loop self:T( "Missile Launched = " .. SEADWeaponName ) if SEADWeaponName == "KH-58" or SEADWeaponName == "KH-25MPU" or SEADWeaponName == "AGM-88" or SEADWeaponName == "KH-31A" or SEADWeaponName == "KH-31P" then -- Check if the missile is a SEAD @@ -19604,10 +19608,10 @@ function SEAD:EventShot( Event ) local Skills = { "Average", "Good", "High", "Excellent" } _targetskill = Skills[ math.random(1,4) ] end - self:T( _targetskill ) -- debug message for skill check + self:T( _targetskill ) if self.TargetSkill[_targetskill] then if (_evade > self.TargetSkill[_targetskill].Evade) then - self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) --debug message + self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) local _targetMim = Weapon.getTarget(SEADWeapon) local _targetMimname = Unit.getName(_targetMim) local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) @@ -23109,7 +23113,7 @@ end -- -- 1.1) DETECTION_BASE constructor -- ------------------------------- --- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION.New}() method. +-- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION_BASE.New}() method. -- -- 1.2) DETECTION_BASE initialization -- ---------------------------------- @@ -23495,15 +23499,17 @@ function DETECTION_UNITGROUPS:SmokeDetectedUnits() self:F2() self._SmokeDetectedUnits = true + return self end --- Flare the detected units -- @param #DETECTION_UNITGROUPS self -- @return #DETECTION_UNITGROUPS self -function DETECTION_UNITGROUPS:SmokeDetectedUnits() +function DETECTION_UNITGROUPS:FlareDetectedUnits() self:F2() self._FlareDetectedUnits = true + return self end --- Smoke the detected zones @@ -23513,6 +23519,7 @@ function DETECTION_UNITGROUPS:SmokeDetectedZones() self:F2() self._SmokeDetectedZones = true + return self end --- Flare the detected zones @@ -23522,6 +23529,7 @@ function DETECTION_UNITGROUPS:FlareDetectedZones() self:F2() self._FlareDetectedZones = true + return self end @@ -23546,7 +23554,6 @@ function DETECTION_UNITGROUPS:CreateDetectionSets() for DetectedZoneIndex = 1, #self.DetectedZones do self:T( "Detected Unit Set #" .. DetectedZoneIndex ) local DetectedUnitSet = self.DetectedSets[DetectedZoneIndex] -- Set#SET_BASE - DetectedUnitSet:Flush() local DetectedZone = self.DetectedZones[DetectedZoneIndex] -- Zone#ZONE_UNIT if DetectedUnit:IsInZone( DetectedZone ) then self:T( "Adding to Unit Set #" .. DetectedZoneIndex ) diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 0a431f203..ad0a76b0d 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20160625_0851' ) +env.info( 'Moose Generation Timestamp: 20160625_1329' ) local base = _G Include = {} @@ -2969,7 +2969,7 @@ end -- @param Arguments A #table or any field. function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -2998,7 +2998,7 @@ end -- @param Arguments A #table or any field. function BASE:F( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3014,7 +3014,7 @@ end -- @param Arguments A #table or any field. function BASE:F2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3029,7 +3029,7 @@ end -- @param Arguments A #table or any field. function BASE:F3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3044,7 +3044,7 @@ end -- @param Arguments A #table or any field. function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam ) - if ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then + if debug and ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) then local DebugInfoCurrent = DebugInfoCurrentParam and DebugInfoCurrentParam or debug.getinfo( 2, "nl" ) local DebugInfoFrom = DebugInfoFromParam and DebugInfoFromParam or debug.getinfo( 3, "l" ) @@ -3073,7 +3073,7 @@ end -- @param Arguments A #table or any field. function BASE:T( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3089,7 +3089,7 @@ end -- @param Arguments A #table or any field. function BASE:T2( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3104,7 +3104,7 @@ end -- @param Arguments A #table or any field. function BASE:T3( Arguments ) - if _TraceOnOff then + if debug and _TraceOnOff then local DebugInfoCurrent = debug.getinfo( 2, "nl" ) local DebugInfoFrom = debug.getinfo( 3, "l" ) @@ -3119,21 +3119,24 @@ end -- @param Arguments A #table or any field. function BASE:E( Arguments ) - local DebugInfoCurrent = debug.getinfo( 2, "nl" ) - local DebugInfoFrom = debug.getinfo( 3, "l" ) - - local Function = "function" - if DebugInfoCurrent.name then - Function = DebugInfoCurrent.name - end - - local LineCurrent = DebugInfoCurrent.currentline - local LineFrom = -1 - if DebugInfoFrom then - LineFrom = DebugInfoFrom.currentline - end - - env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + if debug then + local DebugInfoCurrent = debug.getinfo( 2, "nl" ) + local DebugInfoFrom = debug.getinfo( 3, "l" ) + + local Function = "function" + if DebugInfoCurrent.name then + Function = DebugInfoCurrent.name + end + + local LineCurrent = DebugInfoCurrent.currentline + local LineFrom = -1 + if DebugInfoFrom then + LineFrom = DebugInfoFrom.currentline + end + + env.info( string.format( "%6d(%6d)/%1s:%20s%05d.%s(%s)" , LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) ) + end + end @@ -6072,8 +6075,10 @@ function SCHEDULER:_Scheduler() local ErrorHandler = function( errmsg ) env.info( "Error in SCHEDULER function:" .. errmsg ) - env.info( debug.traceback() ) - + if debug ~= nil then + env.info( debug.traceback() ) + end + return errmsg end @@ -6592,7 +6597,8 @@ function EVENT:OnPlayerLeaveUnit( EventFunction, EventSelf ) end - +--- @param #EVENT self +-- @param #EVENTDATA Event function EVENT:onEvent( Event ) self:F2( { _EVENTCODES[Event.id], Event } ) @@ -6626,7 +6632,7 @@ function EVENT:onEvent( Event ) Event.WeaponName = Event.Weapon:getTypeName() --Event.WeaponTgtDCSUnit = Event.Weapon:getTarget() end - self:E( { _EVENTCODES[Event.id], Event } ) + self:E( { _EVENTCODES[Event.id], Event.IniUnitName, Event.TgtUnitName, Event.WeaponName } ) for ClassName, EventData in pairs( self.Events[Event.id] ) do if Event.IniDCSUnitName and EventData.IniUnit and EventData.IniUnit[Event.IniDCSUnitName] then self:E( { "Calling event function for class ", ClassName, " unit ", Event.IniDCSUnitName } ) @@ -11078,7 +11084,7 @@ end -- @param #SET_BASE self -- @param Event#EVENTDATA Event function SET_BASE:_EventOnDeadOrCrash( Event ) - self:F2( { Event } ) + self:F3( { Event } ) if Event.IniDCSUnit then local ObjectName, Object = self:FindInDatabase( Event ) @@ -11134,7 +11140,7 @@ function SET_BASE:ForEach( IteratorFunction, arg, Set, Function, FunctionArgumen local function CoRoutine() local Count = 0 for ObjectID, Object in pairs( Set ) do - self:T2( Object ) + self:T3( Object ) if Function then if Function( unpack( FunctionArguments ), Object ) == true then IteratorFunction( Object, unpack( arg ) ) @@ -11223,7 +11229,7 @@ function SET_BASE:IsIncludeObject( Object ) return true end ---- Flushes the current SET_BASE contents in the log ... (for debug reasons). +--- Flushes the current SET_BASE contents in the log ... (for debugging reasons). -- @param #SET_BASE self -- @return #string A string with the names of the objects. function SET_BASE:Flush() @@ -11844,7 +11850,6 @@ end function SET_UNIT:FindInDatabase( Event ) self:F3( { Event } ) - self:E( { Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] } ) return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] end @@ -19578,7 +19583,6 @@ function SEAD:EventShot( Event ) local SEADUnitName = Event.IniDCSUnitName local SEADWeapon = Event.Weapon -- Identify the weapon fired local SEADWeaponName = Event.WeaponName -- return weapon type - --trigger.action.outText( string.format("Alerte, depart missile " ..string.format(SEADWeaponName)), 20) --debug message -- Start of the 2nd loop self:T( "Missile Launched = " .. SEADWeaponName ) if SEADWeaponName == "KH-58" or SEADWeaponName == "KH-25MPU" or SEADWeaponName == "AGM-88" or SEADWeaponName == "KH-31A" or SEADWeaponName == "KH-31P" then -- Check if the missile is a SEAD @@ -19604,10 +19608,10 @@ function SEAD:EventShot( Event ) local Skills = { "Average", "Good", "High", "Excellent" } _targetskill = Skills[ math.random(1,4) ] end - self:T( _targetskill ) -- debug message for skill check + self:T( _targetskill ) if self.TargetSkill[_targetskill] then if (_evade > self.TargetSkill[_targetskill].Evade) then - self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) --debug message + self:T( string.format("Evading, target skill " ..string.format(_targetskill)) ) local _targetMim = Weapon.getTarget(SEADWeapon) local _targetMimname = Unit.getName(_targetMim) local _targetMimgroup = Unit.getGroup(Weapon.getTarget(SEADWeapon)) @@ -23109,7 +23113,7 @@ end -- -- 1.1) DETECTION_BASE constructor -- ------------------------------- --- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION.New}() method. +-- Construct a new DETECTION_BASE instance using the @{Detection#DETECTION_BASE.New}() method. -- -- 1.2) DETECTION_BASE initialization -- ---------------------------------- @@ -23495,15 +23499,17 @@ function DETECTION_UNITGROUPS:SmokeDetectedUnits() self:F2() self._SmokeDetectedUnits = true + return self end --- Flare the detected units -- @param #DETECTION_UNITGROUPS self -- @return #DETECTION_UNITGROUPS self -function DETECTION_UNITGROUPS:SmokeDetectedUnits() +function DETECTION_UNITGROUPS:FlareDetectedUnits() self:F2() self._FlareDetectedUnits = true + return self end --- Smoke the detected zones @@ -23513,6 +23519,7 @@ function DETECTION_UNITGROUPS:SmokeDetectedZones() self:F2() self._SmokeDetectedZones = true + return self end --- Flare the detected zones @@ -23522,6 +23529,7 @@ function DETECTION_UNITGROUPS:FlareDetectedZones() self:F2() self._FlareDetectedZones = true + return self end @@ -23546,7 +23554,6 @@ function DETECTION_UNITGROUPS:CreateDetectionSets() for DetectedZoneIndex = 1, #self.DetectedZones do self:T( "Detected Unit Set #" .. DetectedZoneIndex ) local DetectedUnitSet = self.DetectedSets[DetectedZoneIndex] -- Set#SET_BASE - DetectedUnitSet:Flush() local DetectedZone = self.DetectedZones[DetectedZoneIndex] -- Zone#ZONE_UNIT if DetectedUnit:IsInZone( DetectedZone ) then self:T( "Adding to Unit Set #" .. DetectedZoneIndex ) diff --git a/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz b/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz index 94e4c4089..675694bae 100644 Binary files a/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz and b/Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz differ diff --git a/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz b/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz index f22c23be2..81ce23081 100644 Binary files a/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz and b/Moose Test Missions/Moose_Test_AIRBASEPOLICE/Moose_Test_AIRBASEPOLICE.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz index 1d19f356a..bc8ef06d3 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_with_Moose.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz index 4d06d7f0f..dbef0d18a 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_AIRBLANCER_without_Moose.miz differ diff --git a/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz b/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz index 3b9c57ad8..73151b2ae 100644 Binary files a/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz and b/Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz differ diff --git a/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz b/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz index 68b9d0b7b..86f023d61 100644 Binary files a/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz and b/Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz differ diff --git a/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz b/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz index 58349ca2f..7caceff8a 100644 Binary files a/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz and b/Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz differ diff --git a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz index 366bf2c74..304947086 100644 Binary files a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz and b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION.miz differ diff --git a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz index 5c8138b82..754d3f787 100644 Binary files a/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz and b/Moose Test Missions/Moose_Test_DETECTION/Moose_Test_DETECTION_Laser.miz differ diff --git a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz index c36c14757..83e8e20bd 100644 Binary files a/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz and b/Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz differ diff --git a/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz b/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz index f8e039058..242defb89 100644 Binary files a/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz and b/Moose Test Missions/Moose_Test_FAC/Moose_Test_FAC.miz differ diff --git a/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz b/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz index c9e9d4835..48b3108c1 100644 Binary files a/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz and b/Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz differ diff --git a/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz b/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz index 2ccdc62a5..333d145d1 100644 Binary files a/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz and b/Moose Test Missions/Moose_Test_PATROLZONE/MOOSE_Test_PATROLZONE.miz differ diff --git a/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz b/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz index fa00cc356..1e51788f4 100644 Binary files a/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz and b/Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz differ diff --git a/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz b/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz index 9a3617477..65de21a82 100644 Binary files a/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz and b/Moose Test Missions/Moose_Test_SET_AIRBASE/Moose_Test_SET_AIRBASE.miz differ diff --git a/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz b/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz index 2d750e3f7..2499c79f3 100644 Binary files a/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz and b/Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz differ diff --git a/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz index 9791487ad..4fe2e30a9 100644 Binary files a/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz and b/Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz differ diff --git a/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz b/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz index 0bc001417..195491d57 100644 Binary files a/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz and b/Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz differ diff --git a/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz b/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz index 5ef153478..39cfc446f 100644 Binary files a/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz and b/Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz differ diff --git a/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz b/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz index 43cbe10c0..ddd31ebf0 100644 Binary files a/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz and b/Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz differ diff --git a/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz b/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz index 81729afd8..fa6954e3d 100644 Binary files a/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz and b/Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz b/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz index 08536ea49..58c924b3b 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz and b/Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz b/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz index 3fe74fccf..c62627bef 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz and b/Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz b/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz index 8d593e3c6..d8b00633c 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz and b/Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz differ diff --git a/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz b/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz index f98754531..0474b247e 100644 Binary files a/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz and b/Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz differ