mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Got the process cleanup working now, when a task has finished.
ProcessStop is called for each process that is destructed... Actually, I need to implement destructors upon a garbage collection event. Found the method to do that, but need to implement it ... Next time ...
This commit is contained in:
parent
1bd61837f2
commit
07f6760039
@ -67,11 +67,12 @@ function PROCESS:GetMission()
|
|||||||
return self.ProcessTask.Mission
|
return self.ProcessTask.Mission
|
||||||
end
|
end
|
||||||
|
|
||||||
function PROCESS:StartEvents()
|
function PROCESS:ProcessStart()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function PROCESS:StopEvents()
|
function PROCESS:ProcessStop()
|
||||||
|
self:E("ProcessStop Base Class")
|
||||||
|
|
||||||
self:EventRemoveAll()
|
self:EventRemoveAll()
|
||||||
end
|
end
|
||||||
@ -85,7 +86,7 @@ function PROCESS:Assign( ProcessTask, ProcessUnit )
|
|||||||
self:SetControllable( ProcessUnit )
|
self:SetControllable( ProcessUnit )
|
||||||
self:SetTask( ProcessTask )
|
self:SetTask( ProcessTask )
|
||||||
|
|
||||||
self:StartEvents()
|
self:ProcessStart()
|
||||||
|
|
||||||
self.ProcessGroup = ProcessUnit:GetGroup()
|
self.ProcessGroup = ProcessUnit:GetGroup()
|
||||||
--self:Activate()
|
--self:Activate()
|
||||||
|
|||||||
@ -186,7 +186,7 @@ do -- PROCESS_ACCOUNT_DEADS
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function PROCESS_ACCOUNT_DEADS:StartEvents()
|
function PROCESS_ACCOUNT_DEADS:ProcessStart()
|
||||||
self:EventOnDead( self.EventDead )
|
self:EventOnDead( self.EventDead )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -144,6 +144,13 @@ do -- PROCESS_SMOKE_TARGETS_ZONE
|
|||||||
ClassName = "PROCESS_SMOKE_TARGETS_ZONE",
|
ClassName = "PROCESS_SMOKE_TARGETS_ZONE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PROCESS_SMOKE_TARGETS_ZONE:ProcessStop()
|
||||||
|
self:E("ProcessStop Detailed")
|
||||||
|
|
||||||
|
self.Menu:Remove()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
--- Creates a new target smoking state machine. The process will request from the menu if it accepts the task, if not, the unit is removed from the simulator.
|
||||||
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
||||||
|
|||||||
@ -160,10 +160,10 @@ function TASK_BASE:UnAssignFromGroups()
|
|||||||
TaskGroup:SetState( TaskGroup, "Assigned", nil )
|
TaskGroup:SetState( TaskGroup, "Assigned", nil )
|
||||||
local TaskUnits = TaskGroup:GetUnits()
|
local TaskUnits = TaskGroup:GetUnits()
|
||||||
for UnitID, UnitData in pairs( TaskUnits ) do
|
for UnitID, UnitData in pairs( TaskUnits ) do
|
||||||
local TaskUnit = UnitData -- Unit#UNIT
|
local TaskUnit = UnitData -- Wrapper.Unit#UNIT
|
||||||
local PlayerName = TaskUnit:GetPlayerName()
|
local PlayerName = TaskUnit:GetPlayerName()
|
||||||
if PlayerName ~= nil or PlayerName ~= "" then
|
if PlayerName ~= nil or PlayerName ~= "" then
|
||||||
self:UnAssignFromUnit( TaskUnit )
|
self:UnAssignFromUnit( TaskUnit:GetName() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -204,7 +204,9 @@ function TASK_BASE:UnAssignFromUnit( TaskUnitName )
|
|||||||
self:F( TaskUnitName )
|
self:F( TaskUnitName )
|
||||||
|
|
||||||
if self:HasStateMachine( TaskUnitName ) == true then
|
if self:HasStateMachine( TaskUnitName ) == true then
|
||||||
|
self:E("RemoveStateMachines")
|
||||||
self:RemoveStateMachines( TaskUnitName )
|
self:RemoveStateMachines( TaskUnitName )
|
||||||
|
self:E("RemoveProcesses")
|
||||||
self:RemoveProcesses( TaskUnitName )
|
self:RemoveProcesses( TaskUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -461,10 +463,11 @@ end
|
|||||||
-- @param #string TaskUnitName
|
-- @param #string TaskUnitName
|
||||||
-- @return #TASK_BASE self
|
-- @return #TASK_BASE self
|
||||||
function TASK_BASE:RemoveProcesses( TaskUnitName )
|
function TASK_BASE:RemoveProcesses( TaskUnitName )
|
||||||
|
self:E( TaskUnitName )
|
||||||
|
|
||||||
for ProcessID, ProcessData in pairs( self.Processes[TaskUnitName] ) do
|
for ProcessID, ProcessData in pairs( self.Processes[TaskUnitName] ) do
|
||||||
local Process = ProcessData -- Process.Process#PROCESS
|
local Process = ProcessData -- Process.Process#PROCESS
|
||||||
Process:StopEvents()
|
Process:ProcessStop()
|
||||||
Process = nil
|
Process = nil
|
||||||
self.Processes[TaskUnitName][ProcessID] = nil
|
self.Processes[TaskUnitName][ProcessID] = nil
|
||||||
self:E( self.Processes[TaskUnitName][ProcessID] )
|
self:E( self.Processes[TaskUnitName][ProcessID] )
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
--- The CONTROLLABLE class
|
--- The CONTROLLABLE class
|
||||||
-- @type CONTROLLABLE
|
-- @type CONTROLLABLE
|
||||||
-- @extends Positionable#POSITIONABLE
|
-- @extends Wrapper.Positionable#POSITIONABLE
|
||||||
-- @field DCSControllable#Controllable DCSControllable The DCS controllable class.
|
-- @field DCSControllable#Controllable DCSControllable The DCS controllable class.
|
||||||
-- @field #string ControllableName The name of the controllable.
|
-- @field #string ControllableName The name of the controllable.
|
||||||
CONTROLLABLE = {
|
CONTROLLABLE = {
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
--- The IDENTIFIABLE class
|
--- The IDENTIFIABLE class
|
||||||
-- @type IDENTIFIABLE
|
-- @type IDENTIFIABLE
|
||||||
-- @extends Object#OBJECT
|
-- @extends Wrapper.Object#OBJECT
|
||||||
-- @field #string IdentifiableName The name of the identifiable.
|
-- @field #string IdentifiableName The name of the identifiable.
|
||||||
IDENTIFIABLE = {
|
IDENTIFIABLE = {
|
||||||
ClassName = "IDENTIFIABLE",
|
ClassName = "IDENTIFIABLE",
|
||||||
@ -81,7 +81,7 @@ end
|
|||||||
|
|
||||||
--- Returns DCS Identifiable object name.
|
--- Returns DCS Identifiable object name.
|
||||||
-- The function provides access to non-activated objects too.
|
-- The function provides access to non-activated objects too.
|
||||||
-- @param Identifiable#IDENTIFIABLE self
|
-- @param Wrapper.Identifiable#IDENTIFIABLE self
|
||||||
-- @return #string The name of the DCS Identifiable.
|
-- @return #string The name of the DCS Identifiable.
|
||||||
-- @return #nil The DCS Identifiable is not existing or alive.
|
-- @return #nil The DCS Identifiable is not existing or alive.
|
||||||
function IDENTIFIABLE:GetName()
|
function IDENTIFIABLE:GetName()
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
--- The OBJECT class
|
--- The OBJECT class
|
||||||
-- @type OBJECT
|
-- @type OBJECT
|
||||||
-- @extends Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
-- @field #string ObjectName The name of the Object.
|
-- @field #string ObjectName The name of the Object.
|
||||||
OBJECT = {
|
OBJECT = {
|
||||||
ClassName = "OBJECT",
|
ClassName = "OBJECT",
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
--- The POSITIONABLE class
|
--- The POSITIONABLE class
|
||||||
-- @type POSITIONABLE
|
-- @type POSITIONABLE
|
||||||
-- @extends Identifiable#IDENTIFIABLE
|
-- @extends Wrapper.Identifiable#IDENTIFIABLE
|
||||||
-- @field #string PositionableName The name of the measurable.
|
-- @field #string PositionableName The name of the measurable.
|
||||||
POSITIONABLE = {
|
POSITIONABLE = {
|
||||||
ClassName = "POSITIONABLE",
|
ClassName = "POSITIONABLE",
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
--- The UNIT class
|
--- The UNIT class
|
||||||
-- @type UNIT
|
-- @type UNIT
|
||||||
-- @extends Controllable#CONTROLLABLE
|
-- @extends Wrapper.Controllable#CONTROLLABLE
|
||||||
-- @field #UNIT.FlareColor FlareColor
|
-- @field #UNIT.FlareColor FlareColor
|
||||||
-- @field #UNIT.SmokeColor SmokeColor
|
-- @field #UNIT.SmokeColor SmokeColor
|
||||||
UNIT = {
|
UNIT = {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user