mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into Airbase-Guard
# Conflicts: # Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua # Moose Mission Setup/Moose.lua # Moose Mission Setup/Moose_Create.bat # Moose Test Missions/Moose_Test_AIBALANCER/Moose_Test_AIBALANCER.miz # Moose Test Missions/Moose_Test_CLEANUP/Moose_Test_CLEANUP.miz # Moose Test Missions/Moose_Test_DESTROY/MOOSE_Test_DESTROY.miz # Moose Test Missions/Moose_Test_ESCORT/MOOSE_Test_ESCORT.miz # Moose Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz # Moose Test Missions/Moose_Test_SEAD/MOOSE_Test_SEAD.miz # Moose Test Missions/Moose_Test_SET_CLIENT/Moose_Test_SET_CLIENT.miz # Moose Test Missions/Moose_Test_SET_GROUP/Moose_Test_SET_GROUP.miz # Moose Test Missions/Moose_Test_SPAWN/MOOSE_Test_SPAWN.miz # Moose Test Missions/Moose_Test_SPAWN_Repeat/MOOSE_Test_SPAWN_Repeat.miz # Moose Test Missions/Moose_Test_TASK_Pickup_and_Deploy/MOOSE_Test_TASK_Pickup_and_Deploy.miz # Moose Test Missions/Moose_Test_WRAPPER/Moose_Test_WRAPPER.miz # Moose Test Missions/Moose_Test_ZONE/Moose_Test_ZONE.miz # Moose Test Missions/Moose_Test_ZONE_POLYGON/Moose_Test_ZONE_POLYGON.miz # Moose Test Missions/Moose_Test_ZONE_RADIUS/Moose_Test_ZONE_RADIUS.miz # Moose Test Missions/Moose_Test_ZONE_UNIT/Moose_Test_ZONE_UNIT.miz
This commit is contained in:
commit
45140d6563
@ -1,32 +1,37 @@
|
||||
--- BASE classes.
|
||||
--- This module contains the BASE class.
|
||||
--
|
||||
-- @{#BASE} class
|
||||
-- ==============
|
||||
-- The @{#BASE} class is the super class for most of the classes defined within MOOSE.
|
||||
-- 1) @{#BASE} class
|
||||
-- =================
|
||||
-- The @{#BASE} class is the super class for all the classes defined within MOOSE.
|
||||
--
|
||||
-- It handles:
|
||||
--
|
||||
-- * The construction and inheritance of child classes.
|
||||
-- * The tracing of objects during mission execution within the DCS.log file (under saved games folder).
|
||||
-- * The tracing of objects during mission execution within the **DCS.log** file, under the **"Saved Games\DCS\Logs"** folder.
|
||||
--
|
||||
-- Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.
|
||||
--
|
||||
-- BASE Trace functionality
|
||||
-- ========================
|
||||
-- 1.1) BASE constructor
|
||||
-- ---------------------
|
||||
-- Any class derived from BASE, must use the @{Base#BASE.New) constructor within the @{Base#BASE.Inherit) method.
|
||||
-- See an example at the @{Base#BASE.New} method how this is done.
|
||||
--
|
||||
-- 1.2) BASE Trace functionality
|
||||
-- -----------------------------
|
||||
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
|
||||
-- Note that these trace methods are inherited by each MOOSE class interiting BASE.
|
||||
-- As such, each object created from derived class from BASE can use the tracing functions to trace its execution.
|
||||
--
|
||||
-- Trace a function call
|
||||
-- ---------------------
|
||||
-- 1.2.1) Tracing functions
|
||||
-- ------------------------
|
||||
-- There are basically 3 types of tracing methods available within BASE:
|
||||
--
|
||||
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters.
|
||||
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters.
|
||||
-- * @{#BASE.E}: Trace an execption within a function giving optional variables or parameters. An exception will always be traced.
|
||||
-- * @{#BASE.F}: Trace the beginning of a function and its given parameters. An F is indicated at column 44 in the DCS.log file.
|
||||
-- * @{#BASE.T}: Trace further logic within a function giving optional variables or parameters. A T is indicated at column 44 in the DCS.log file.
|
||||
-- * @{#BASE.E}: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.
|
||||
--
|
||||
-- Tracing levels
|
||||
-- --------------
|
||||
-- 1.2.2) Tracing levels
|
||||
-- ---------------------
|
||||
-- There are 3 tracing levels within MOOSE.
|
||||
-- These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.
|
||||
--
|
||||
@ -37,8 +42,8 @@
|
||||
-- * @{#BASE.T2}: Trace further logic within a function giving optional variables or parameters with tracing level 2.
|
||||
-- * @{#BASE.T3}: Trace further logic within a function giving optional variables or parameters with tracing level 3.
|
||||
--
|
||||
-- BASE Inheritance support
|
||||
-- ========================
|
||||
-- 1.3) BASE Inheritance support
|
||||
-- ===========================
|
||||
-- The following methods are available to support inheritance:
|
||||
--
|
||||
-- * @{#BASE.Inherit}: Inherits from a class.
|
||||
@ -55,16 +60,19 @@
|
||||
|
||||
|
||||
|
||||
local _TraceOn = true
|
||||
local _TraceOnOff = true
|
||||
local _TraceLevel = 1
|
||||
local _TraceAll = false
|
||||
local _TraceClass = {}
|
||||
local _TraceClassMethod = {}
|
||||
|
||||
local _ClassID = 0
|
||||
|
||||
--- The BASE Class
|
||||
-- @type BASE
|
||||
-- @field ClassName The name of the class.
|
||||
-- @field ClassID The ID number of the class.
|
||||
-- @field ClassNameAndID The name of the class concatenated with the ID number of the class.
|
||||
BASE = {
|
||||
ClassName = "BASE",
|
||||
ClassID = 0,
|
||||
@ -86,27 +94,29 @@ FORMATION = {
|
||||
-- @param #BASE self
|
||||
-- @return #BASE The new instance of the BASE class.
|
||||
-- @usage
|
||||
-- function TASK:New()
|
||||
-- -- This declares the constructor of the class TASK, inheriting from BASE.
|
||||
-- --- TASK constructor
|
||||
-- -- @param #TASK self
|
||||
-- -- @param Parameter The parameter of the New constructor.
|
||||
-- -- @return #TASK self
|
||||
-- function TASK:New( Parameter )
|
||||
--
|
||||
-- local self = BASE:Inherit( self, BASE:New() )
|
||||
--
|
||||
-- -- assign Task default values during construction
|
||||
-- self.TaskBriefing = "Task: No Task."
|
||||
-- self.Time = timer.getTime()
|
||||
-- self.ExecuteStage = _TransportExecuteStage.NONE
|
||||
--
|
||||
-- self.Variable = Parameter
|
||||
--
|
||||
-- return self
|
||||
-- end
|
||||
-- @todo need to investigate if the deepCopy is really needed... Don't think so.
|
||||
function BASE:New()
|
||||
local Child = routines.utils.deepCopy( self )
|
||||
local Parent = {}
|
||||
setmetatable( Child, Parent )
|
||||
Child.__index = Child
|
||||
self.ClassID = self.ClassID + 1
|
||||
Child.ClassID = self.ClassID
|
||||
--Child.AddEvent( Child, S_EVENT_BIRTH, Child.EventBirth )
|
||||
return Child
|
||||
local self = routines.utils.deepCopy( self ) -- Create a new self instance
|
||||
local MetaTable = {}
|
||||
setmetatable( self, MetaTable )
|
||||
self.__index = self
|
||||
_ClassID = _ClassID + 1
|
||||
self.ClassID = _ClassID
|
||||
self.ClassNameAndID = string.format( '%s#%09d', self.ClassName, self.ClassID )
|
||||
return self
|
||||
end
|
||||
|
||||
--- This is the worker method to inherit from a parent class.
|
||||
@ -142,7 +152,7 @@ end
|
||||
-- @param #BASE self
|
||||
-- @return #string The ClassName + ClassID of the class instance.
|
||||
function BASE:GetClassNameAndID()
|
||||
return string.format( '%s#%09d', self:GetClassName(), self:GetClassID() )
|
||||
return self.ClassNameAndID
|
||||
end
|
||||
|
||||
--- Get the ClassName of the class instance.
|
||||
@ -328,11 +338,12 @@ end
|
||||
function BASE:SetState( Object, StateName, State )
|
||||
|
||||
local ClassNameAndID = Object:GetClassNameAndID()
|
||||
|
||||
if not self.States[ClassNameAndID] then
|
||||
self.States[ClassNameAndID] = {}
|
||||
end
|
||||
self.States[ClassNameAndID][StateName] = State
|
||||
self:E( { ClassNameAndID, StateName, State } )
|
||||
self:F2( { ClassNameAndID, StateName, State } )
|
||||
|
||||
return self.States[ClassNameAndID][StateName]
|
||||
end
|
||||
@ -340,10 +351,10 @@ end
|
||||
function BASE:GetState( Object, StateName )
|
||||
|
||||
local ClassNameAndID = Object:GetClassNameAndID()
|
||||
self:E( { ClassNameAndID } )
|
||||
|
||||
if self.States[ClassNameAndID] then
|
||||
local State = self.States[ClassNameAndID][StateName]
|
||||
self:E( { ClassNameAndID, StateName, State } )
|
||||
self:F2( { ClassNameAndID, StateName, State } )
|
||||
return State
|
||||
end
|
||||
|
||||
@ -363,6 +374,23 @@ end
|
||||
-- Log a trace (only shown when trace is on)
|
||||
-- TODO: Make trace function using variable parameters.
|
||||
|
||||
--- Set trace on or off
|
||||
-- Note that when trace is off, no debug statement is performed, increasing performance!
|
||||
-- When Moose is loaded statically, (as one file), tracing is switched off by default.
|
||||
-- So tracing must be switched on manually in your mission if you are using Moose statically.
|
||||
-- When moose is loading dynamically (for moose class development), tracing is switched on by default.
|
||||
-- @param BASE self
|
||||
-- @param #boolean TraceOnOff Switch the tracing on or off.
|
||||
-- @usage
|
||||
-- -- Switch the tracing On
|
||||
-- BASE:TraceOn( true )
|
||||
--
|
||||
-- -- Switch the tracing Off
|
||||
-- BASE:TraceOn( false )
|
||||
function BASE:TraceOnOff( TraceOnOff )
|
||||
_TraceOnOff = TraceOnOff
|
||||
end
|
||||
|
||||
--- Set trace level
|
||||
-- @param #BASE self
|
||||
-- @param #number Level
|
||||
@ -407,12 +435,12 @@ function BASE:TraceClassMethod( Class, Method )
|
||||
self:E( "Tracing method " .. Method .. " of class " .. Class )
|
||||
end
|
||||
|
||||
--- Trace a function call. Must be at the beginning of the function logic.
|
||||
--- Trace a function call. This function is private.
|
||||
-- @param #BASE self
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
|
||||
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
|
||||
if ( _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" )
|
||||
@ -436,18 +464,35 @@ function BASE:F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
end
|
||||
end
|
||||
|
||||
--- Trace a function call. Must be at the beginning of the function logic.
|
||||
-- @param #BASE self
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:F( Arguments )
|
||||
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 1 then
|
||||
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Trace a function call level 2. Must be at the beginning of the function logic.
|
||||
-- @param #BASE self
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:F2( Arguments )
|
||||
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 2 then
|
||||
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 2 then
|
||||
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Trace a function call level 3. Must be at the beginning of the function logic.
|
||||
@ -455,13 +500,14 @@ end
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:F3( Arguments )
|
||||
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 3 then
|
||||
self:F( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 3 then
|
||||
self:_F( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Trace a function logic.
|
||||
@ -469,7 +515,7 @@ end
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
|
||||
|
||||
if _TraceOn and ( ( _TraceAll == true ) or ( _TraceClass[self.ClassName] or _TraceClassMethod[self.ClassName] ) ) then
|
||||
if ( _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" )
|
||||
@ -498,13 +544,14 @@ end
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:T( Arguments )
|
||||
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 1 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 1 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -513,13 +560,14 @@ end
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:T2( Arguments )
|
||||
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 2 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 2 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Trace a function logic level 3. Can be anywhere within the function logic.
|
||||
@ -527,13 +575,14 @@ end
|
||||
-- @param Arguments A #table or any field.
|
||||
function BASE:T3( Arguments )
|
||||
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 3 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
if _TraceOnOff then
|
||||
local DebugInfoCurrent = debug.getinfo( 2, "nl" )
|
||||
local DebugInfoFrom = debug.getinfo( 3, "l" )
|
||||
|
||||
if _TraceLevel >= 3 then
|
||||
self:_T( Arguments, DebugInfoCurrent, DebugInfoFrom )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Log an exception which will be traced always. Can be anywhere within the function logic.
|
||||
|
||||
@ -37,12 +37,6 @@
|
||||
-- @module Client
|
||||
-- @author FlightControl
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- The CLIENT class
|
||||
-- @type CLIENT
|
||||
-- @extends Unit#UNIT
|
||||
@ -131,7 +125,7 @@ function CLIENT:Register( ClientName )
|
||||
self.ClientAlive2 = false
|
||||
|
||||
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
|
||||
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, {}, 1, 5 )
|
||||
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, { "Client Alive " .. ClientName }, 1, 5 )
|
||||
|
||||
self:E( self )
|
||||
return self
|
||||
@ -241,10 +235,11 @@ function CLIENT:Alive( CallBackFunction, ... )
|
||||
end
|
||||
|
||||
--- @param #CLIENT self
|
||||
function CLIENT:_AliveCheckScheduler()
|
||||
self:F( { self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
|
||||
function CLIENT:_AliveCheckScheduler( SchedulerName )
|
||||
self:E( SchedulerName )
|
||||
self:F( { SchedulerName, self.ClientName, self.ClientAlive2, self.ClientBriefingShown, self.ClientCallBack } )
|
||||
|
||||
if self:IsAlive() then -- Polymorphic call of UNIT
|
||||
if self:IsAlive() then
|
||||
if self.ClientAlive2 == false then
|
||||
self:ShowBriefing()
|
||||
if self.ClientCallBack then
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
--- Models time events calling event handing functions.
|
||||
--
|
||||
--
|
||||
-- @{SCHEDULER} class
|
||||
-- ===================
|
||||
-- The @{SCHEDULER} class models time events calling given event handling functions.
|
||||
--
|
||||
--
|
||||
-- SCHEDULER constructor
|
||||
-- =====================
|
||||
-- The SCHEDULER class is quite easy to use:
|
||||
--
|
||||
--
|
||||
-- * @{#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
|
||||
--
|
||||
--
|
||||
-- SCHEDULER timer methods
|
||||
-- =======================
|
||||
-- The SCHEDULER can be stopped and restarted with the following methods:
|
||||
--
|
||||
--
|
||||
-- * @{#SCHEDULER.Start}: (Re-)Start the scheduler.
|
||||
-- * @{#SCHEDULER.Start}: Stop the scheduler.
|
||||
--
|
||||
--
|
||||
-- @module Scheduler
|
||||
-- @author FlightControl
|
||||
|
||||
--- The SCHEDULER class
|
||||
-- @type SCHEDULER
|
||||
-- @field #number ScheduleID the ID of the scheduler.
|
||||
-- @extends Base#BASE
|
||||
SCHEDULER = {
|
||||
ClassName = "SCHEDULER",
|
||||
}
|
||||
|
||||
|
||||
--- Constructor.
|
||||
--- SCHEDULER constructor.
|
||||
-- @param #SCHEDULER self
|
||||
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
|
||||
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
|
||||
@ -63,10 +63,10 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
|
||||
if StopSeconds then
|
||||
self.StopSeconds = StopSeconds
|
||||
end
|
||||
|
||||
|
||||
|
||||
self.StartTime = timer.getTime()
|
||||
|
||||
|
||||
self:Start()
|
||||
|
||||
return self
|
||||
@ -77,12 +77,12 @@ end
|
||||
-- @return #SCHEDULER self
|
||||
function SCHEDULER:Start()
|
||||
self:F2( self.TimeEventObject )
|
||||
|
||||
if self.RepeatSecondsInterval ~= 0 then
|
||||
self.Repeat = true
|
||||
end
|
||||
timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
||||
|
||||
|
||||
if self.RepeatSecondsInterval ~= 0 then
|
||||
self.Repeat = true
|
||||
end
|
||||
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -91,17 +91,20 @@ end
|
||||
-- @return #SCHEDULER self
|
||||
function SCHEDULER:Stop()
|
||||
self:F2( self.TimeEventObject )
|
||||
|
||||
|
||||
self.Repeat = false
|
||||
|
||||
timer.removeFunction( self.ScheduleID )
|
||||
self.ScheduleID = nil
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-- Private Functions
|
||||
|
||||
--- @param #SCHEDULER self
|
||||
function SCHEDULER:_Scheduler()
|
||||
self:F2( self.TimeEventFunctionArguments )
|
||||
|
||||
|
||||
local ErrorHandler = function( errmsg )
|
||||
|
||||
env.info( "Error in SCHEDULER function:" .. errmsg )
|
||||
@ -110,27 +113,37 @@ function SCHEDULER:_Scheduler()
|
||||
return errmsg
|
||||
end
|
||||
|
||||
local Status, Result
|
||||
local Status, Result
|
||||
if self.TimeEventObject then
|
||||
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||
else
|
||||
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||
end
|
||||
|
||||
self:T( { Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
|
||||
|
||||
|
||||
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
|
||||
|
||||
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
||||
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
|
||||
local ScheduleTime = timer.getTime() + self.RepeatSecondsInterval + math.random( - ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ), ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ) ) + 0.01
|
||||
self:T( { timer.getTime(), ScheduleTime } )
|
||||
timer.scheduleFunction(
|
||||
self._Scheduler,
|
||||
self,
|
||||
ScheduleTime
|
||||
)
|
||||
local ScheduleTime =
|
||||
timer.getTime() +
|
||||
self.RepeatSecondsInterval +
|
||||
math.random(
|
||||
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
|
||||
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
|
||||
) +
|
||||
0.01
|
||||
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
||||
return ScheduleTime -- returns the next time the function needs to be called.
|
||||
else
|
||||
timer.removeFunction( self.ScheduleID )
|
||||
self.ScheduleID = nil
|
||||
end
|
||||
else
|
||||
timer.removeFunction( self.ScheduleID )
|
||||
self.ScheduleID = nil
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@ -140,3 +153,11 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -155,13 +155,13 @@ function UNIT:FindByName( UnitName )
|
||||
end
|
||||
|
||||
function UNIT:GetDCSUnit()
|
||||
|
||||
local DCSUnit = Unit.getByName( self.UnitName )
|
||||
|
||||
|
||||
if DCSUnit then
|
||||
return DCSUnit
|
||||
end
|
||||
|
||||
self:E( "Unit " .. self.UnitName .. " not found!" )
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
|
||||
BASE:TraceOnOff( true )
|
||||
@ -1,13 +1,7 @@
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
|
||||
Include.Path = function()
|
||||
local str = debug.getinfo(2, "S").source
|
||||
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
|
||||
end
|
||||
|
||||
Include.Files = {}
|
||||
Include.File = function( IncludeFile )
|
||||
end
|
||||
|
||||
Include.Files = {}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
|
||||
BASE:TraceOnOff( false )
|
||||
@ -19,10 +19,11 @@ GOTO End
|
||||
ECHO Dynamic Moose.lua
|
||||
|
||||
REM Create a timestamp with is logged in the DCS.log file.
|
||||
ECHO env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) > Moose.lua
|
||||
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
|
||||
ECHO env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) > Moose.lua
|
||||
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
|
||||
|
||||
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Dynamic_Loader.lua" Moose.lua
|
||||
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Dynamic_Loader.lua" Moose.lua
|
||||
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Trace_On.lua" Moose.lua
|
||||
|
||||
GOTO End
|
||||
|
||||
@ -31,53 +32,54 @@ GOTO End
|
||||
ECHO Static Moose.lua
|
||||
|
||||
REM Create a timestamp with is logged in the DCS.log file.
|
||||
ECHO env.info( '*** MOOSE STATIC INCLUDE START *** ' ) > Moose.lua
|
||||
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
|
||||
ECHO env.info( '*** MOOSE STATIC INCLUDE START *** ' ) > Moose.lua
|
||||
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
|
||||
|
||||
COPY /b Moose.lua + "Moose Create Static\Moose_Static_Loader.lua" Moose.lua
|
||||
COPY /b Moose.lua + "Moose Create Static\Moose_Static_Loader.lua" Moose.lua
|
||||
|
||||
|
||||
COPY /b Moose.lua + %1\Routines.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Base.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Event.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Menu.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Group.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Unit.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Zone.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Client.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Static.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Database.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Set.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Point.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Moose.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Scoring.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Cargo.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Message.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Stage.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Task.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\GoHomeTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyBaseTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyGroupsTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyRadarsTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyUnitTypesTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\PickupTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DeployTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\NoTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\RouteTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Mission.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\CleanUp.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Spawn.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Movement.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Sead.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Escort.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\MissileTrainer.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\AIBalancer.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\AirbasePolice.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Routines.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Base.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Event.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Menu.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Group.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Unit.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Zone.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Client.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Static.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Database.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Set.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Point.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Moose.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Scoring.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Cargo.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Message.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Stage.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Task.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\GoHomeTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyBaseTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyGroupsTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyRadarsTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DestroyUnitTypesTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\PickupTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\DeployTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\NoTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\RouteTask.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Mission.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\CleanUp.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Spawn.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Movement.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Sead.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\Escort.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\MissileTrainer.lua Moose.lua
|
||||
COPY /b Moose.lua + %1\AIBalancer.lua Moose.lua
|
||||
|
||||
COPY /b Moose.lua + "Moose Create Static\Moose_Trace_Off.lua" Moose.lua
|
||||
|
||||
GOTO End
|
||||
|
||||
:End
|
||||
|
||||
ECHO env.info( '*** MOOSE INCLUDE END *** ' ) >> Moose.lua
|
||||
ECHO env.info( '*** MOOSE INCLUDE END *** ' ) >> Moose.lua
|
||||
COPY Moose.lua %3
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz
Normal file
BIN
Moose Test Missions/Moose_Test_BASE/Moose_Test_BASE.miz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user