mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #262 from FlightControl-Master/master-scoring
Master scoring
This commit is contained in:
commit
9bc84264ef
@ -64,7 +64,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
|
|
||||||
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
||||||
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
||||||
self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } )
|
self.ObjectSchedulers = self.ObjectSchedulers or {} -- setmetatable( {}, { __mode = "v" } )
|
||||||
|
|
||||||
if Scheduler.MasterObject then
|
if Scheduler.MasterObject then
|
||||||
self.ObjectSchedulers[self.CallID] = Scheduler
|
self.ObjectSchedulers[self.CallID] = Scheduler
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170302_1741' )
|
env.info( 'Moose Generation Timestamp: 20170302_2326' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -3875,7 +3875,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
|
|
||||||
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
||||||
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
||||||
self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } )
|
self.ObjectSchedulers = self.ObjectSchedulers or {} -- setmetatable( {}, { __mode = "v" } )
|
||||||
|
|
||||||
if Scheduler.MasterObject then
|
if Scheduler.MasterObject then
|
||||||
self.ObjectSchedulers[self.CallID] = Scheduler
|
self.ObjectSchedulers[self.CallID] = Scheduler
|
||||||
@ -31345,6 +31345,7 @@ end
|
|||||||
-- * @{#TASK.HasStateMachine}():Enquire if the task has a @{Fsm}
|
-- * @{#TASK.HasStateMachine}():Enquire if the task has a @{Fsm}
|
||||||
-- * @{#TASK.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK}.
|
-- * @{#TASK.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK}.
|
||||||
-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit.
|
-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit.
|
||||||
|
-- * @{#TASK.SetTimeOut}(): Set timer in seconds before task gets cancelled if not assigned.
|
||||||
--
|
--
|
||||||
-- 1.2) Set and enquire task status (beyond the task state machine processing).
|
-- 1.2) Set and enquire task status (beyond the task state machine processing).
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
@ -31401,6 +31402,7 @@ TASK = {
|
|||||||
FsmTemplate = nil,
|
FsmTemplate = nil,
|
||||||
Mission = nil,
|
Mission = nil,
|
||||||
CommandCenter = nil,
|
CommandCenter = nil,
|
||||||
|
TimeOut = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- FSM PlayerAborted event handler prototype for TASK.
|
--- FSM PlayerAborted event handler prototype for TASK.
|
||||||
@ -31494,6 +31496,7 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
|
|||||||
self:AddTransition( "*", "PlayerAborted", "*" )
|
self:AddTransition( "*", "PlayerAborted", "*" )
|
||||||
self:AddTransition( "*", "PlayerDead", "*" )
|
self:AddTransition( "*", "PlayerDead", "*" )
|
||||||
self:AddTransition( { "Failed", "Aborted", "Cancelled" }, "Replan", "Planned" )
|
self:AddTransition( { "Failed", "Aborted", "Cancelled" }, "Replan", "Planned" )
|
||||||
|
self:AddTransition( "*", "TimeOut", "Cancelled" )
|
||||||
|
|
||||||
self:E( "New TASK " .. TaskName )
|
self:E( "New TASK " .. TaskName )
|
||||||
|
|
||||||
@ -31735,6 +31738,17 @@ function TASK:UnAssignFromUnit( TaskUnit )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sets the TimeOut for the @{Task}. If @{Task} stayed planned for longer than TimeOut, it gets into Cancelled status.
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #integer Timer in seconds
|
||||||
|
-- @return #TASK self
|
||||||
|
function TASK:SetTimeOut ( Timer )
|
||||||
|
self:F( Timer )
|
||||||
|
self.TimeOut = Timer
|
||||||
|
self:__TimeOut( self.TimeOut )
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Send a message of the @{Task} to the assigned @{Group}s.
|
--- Send a message of the @{Task} to the assigned @{Group}s.
|
||||||
-- @param #TASK self
|
-- @param #TASK self
|
||||||
function TASK:MessageToGroups( Message )
|
function TASK:MessageToGroups( Message )
|
||||||
@ -32266,6 +32280,30 @@ function TASK:onstatechange( From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- FSM function for a TASK
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function TASK:onenterPlanned( From, Event, To)
|
||||||
|
if not self.TimeOut == 0 then
|
||||||
|
self.__TimeOut( self.TimeOut )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- FSM function for a TASK
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function TASK:onbeforeTimeOut( From, Event, To )
|
||||||
|
if From == "Planned" then
|
||||||
|
self:RemoveMenu()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
do -- Reporting
|
do -- Reporting
|
||||||
|
|
||||||
--- Create a summary report of the Task.
|
--- Create a summary report of the Task.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170302_1741' )
|
env.info( 'Moose Generation Timestamp: 20170302_2326' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -3875,7 +3875,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
|
|||||||
|
|
||||||
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
-- Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
||||||
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
-- If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.
|
||||||
self.ObjectSchedulers = self.ObjectSchedulers or setmetatable( {}, { __mode = "v" } )
|
self.ObjectSchedulers = self.ObjectSchedulers or {} -- setmetatable( {}, { __mode = "v" } )
|
||||||
|
|
||||||
if Scheduler.MasterObject then
|
if Scheduler.MasterObject then
|
||||||
self.ObjectSchedulers[self.CallID] = Scheduler
|
self.ObjectSchedulers[self.CallID] = Scheduler
|
||||||
@ -31345,6 +31345,7 @@ end
|
|||||||
-- * @{#TASK.HasStateMachine}():Enquire if the task has a @{Fsm}
|
-- * @{#TASK.HasStateMachine}():Enquire if the task has a @{Fsm}
|
||||||
-- * @{#TASK.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK}.
|
-- * @{#TASK.AssignToUnit}(): Assign a task to a unit. (Needs to be implemented in the derived classes from @{#TASK}.
|
||||||
-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit.
|
-- * @{#TASK.UnAssignFromUnit}(): Unassign the task from a unit.
|
||||||
|
-- * @{#TASK.SetTimeOut}(): Set timer in seconds before task gets cancelled if not assigned.
|
||||||
--
|
--
|
||||||
-- 1.2) Set and enquire task status (beyond the task state machine processing).
|
-- 1.2) Set and enquire task status (beyond the task state machine processing).
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
@ -31401,6 +31402,7 @@ TASK = {
|
|||||||
FsmTemplate = nil,
|
FsmTemplate = nil,
|
||||||
Mission = nil,
|
Mission = nil,
|
||||||
CommandCenter = nil,
|
CommandCenter = nil,
|
||||||
|
TimeOut = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- FSM PlayerAborted event handler prototype for TASK.
|
--- FSM PlayerAborted event handler prototype for TASK.
|
||||||
@ -31494,6 +31496,7 @@ function TASK:New( Mission, SetGroupAssign, TaskName, TaskType )
|
|||||||
self:AddTransition( "*", "PlayerAborted", "*" )
|
self:AddTransition( "*", "PlayerAborted", "*" )
|
||||||
self:AddTransition( "*", "PlayerDead", "*" )
|
self:AddTransition( "*", "PlayerDead", "*" )
|
||||||
self:AddTransition( { "Failed", "Aborted", "Cancelled" }, "Replan", "Planned" )
|
self:AddTransition( { "Failed", "Aborted", "Cancelled" }, "Replan", "Planned" )
|
||||||
|
self:AddTransition( "*", "TimeOut", "Cancelled" )
|
||||||
|
|
||||||
self:E( "New TASK " .. TaskName )
|
self:E( "New TASK " .. TaskName )
|
||||||
|
|
||||||
@ -31735,6 +31738,17 @@ function TASK:UnAssignFromUnit( TaskUnit )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sets the TimeOut for the @{Task}. If @{Task} stayed planned for longer than TimeOut, it gets into Cancelled status.
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #integer Timer in seconds
|
||||||
|
-- @return #TASK self
|
||||||
|
function TASK:SetTimeOut ( Timer )
|
||||||
|
self:F( Timer )
|
||||||
|
self.TimeOut = Timer
|
||||||
|
self:__TimeOut( self.TimeOut )
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Send a message of the @{Task} to the assigned @{Group}s.
|
--- Send a message of the @{Task} to the assigned @{Group}s.
|
||||||
-- @param #TASK self
|
-- @param #TASK self
|
||||||
function TASK:MessageToGroups( Message )
|
function TASK:MessageToGroups( Message )
|
||||||
@ -32266,6 +32280,30 @@ function TASK:onstatechange( From, Event, To )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- FSM function for a TASK
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function TASK:onenterPlanned( From, Event, To)
|
||||||
|
if not self.TimeOut == 0 then
|
||||||
|
self.__TimeOut( self.TimeOut )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- FSM function for a TASK
|
||||||
|
-- @param #TASK self
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string To
|
||||||
|
function TASK:onbeforeTimeOut( From, Event, To )
|
||||||
|
if From == "Planned" then
|
||||||
|
self:RemoveMenu()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
do -- Reporting
|
do -- Reporting
|
||||||
|
|
||||||
--- Create a summary report of the Task.
|
--- Create a summary report of the Task.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user