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
|
||||
end
|
||||
|
||||
function PROCESS:StartEvents()
|
||||
function PROCESS:ProcessStart()
|
||||
|
||||
end
|
||||
|
||||
function PROCESS:StopEvents()
|
||||
function PROCESS:ProcessStop()
|
||||
self:E("ProcessStop Base Class")
|
||||
|
||||
self:EventRemoveAll()
|
||||
end
|
||||
@ -85,7 +86,7 @@ function PROCESS:Assign( ProcessTask, ProcessUnit )
|
||||
self:SetControllable( ProcessUnit )
|
||||
self:SetTask( ProcessTask )
|
||||
|
||||
self:StartEvents()
|
||||
self:ProcessStart()
|
||||
|
||||
self.ProcessGroup = ProcessUnit:GetGroup()
|
||||
--self:Activate()
|
||||
|
||||
@ -186,7 +186,7 @@ do -- PROCESS_ACCOUNT_DEADS
|
||||
return self
|
||||
end
|
||||
|
||||
function PROCESS_ACCOUNT_DEADS:StartEvents()
|
||||
function PROCESS_ACCOUNT_DEADS:ProcessStart()
|
||||
self:EventOnDead( self.EventDead )
|
||||
end
|
||||
|
||||
|
||||
@ -144,6 +144,13 @@ do -- 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.
|
||||
-- @param #PROCESS_SMOKE_TARGETS_ZONE self
|
||||
|
||||
@ -160,10 +160,10 @@ function TASK_BASE:UnAssignFromGroups()
|
||||
TaskGroup:SetState( TaskGroup, "Assigned", nil )
|
||||
local TaskUnits = TaskGroup:GetUnits()
|
||||
for UnitID, UnitData in pairs( TaskUnits ) do
|
||||
local TaskUnit = UnitData -- Unit#UNIT
|
||||
local TaskUnit = UnitData -- Wrapper.Unit#UNIT
|
||||
local PlayerName = TaskUnit:GetPlayerName()
|
||||
if PlayerName ~= nil or PlayerName ~= "" then
|
||||
self:UnAssignFromUnit( TaskUnit )
|
||||
self:UnAssignFromUnit( TaskUnit:GetName() )
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -204,7 +204,9 @@ function TASK_BASE:UnAssignFromUnit( TaskUnitName )
|
||||
self:F( TaskUnitName )
|
||||
|
||||
if self:HasStateMachine( TaskUnitName ) == true then
|
||||
self:E("RemoveStateMachines")
|
||||
self:RemoveStateMachines( TaskUnitName )
|
||||
self:E("RemoveProcesses")
|
||||
self:RemoveProcesses( TaskUnitName )
|
||||
end
|
||||
|
||||
@ -461,10 +463,11 @@ end
|
||||
-- @param #string TaskUnitName
|
||||
-- @return #TASK_BASE self
|
||||
function TASK_BASE:RemoveProcesses( TaskUnitName )
|
||||
self:E( TaskUnitName )
|
||||
|
||||
for ProcessID, ProcessData in pairs( self.Processes[TaskUnitName] ) do
|
||||
local Process = ProcessData -- Process.Process#PROCESS
|
||||
Process:StopEvents()
|
||||
Process:ProcessStop()
|
||||
Process = nil
|
||||
self.Processes[TaskUnitName][ProcessID] = nil
|
||||
self:E( self.Processes[TaskUnitName][ProcessID] )
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
|
||||
--- The CONTROLLABLE class
|
||||
-- @type CONTROLLABLE
|
||||
-- @extends Positionable#POSITIONABLE
|
||||
-- @extends Wrapper.Positionable#POSITIONABLE
|
||||
-- @field DCSControllable#Controllable DCSControllable The DCS controllable class.
|
||||
-- @field #string ControllableName The name of the controllable.
|
||||
CONTROLLABLE = {
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
--- The IDENTIFIABLE class
|
||||
-- @type IDENTIFIABLE
|
||||
-- @extends Object#OBJECT
|
||||
-- @extends Wrapper.Object#OBJECT
|
||||
-- @field #string IdentifiableName The name of the identifiable.
|
||||
IDENTIFIABLE = {
|
||||
ClassName = "IDENTIFIABLE",
|
||||
@ -81,7 +81,7 @@ end
|
||||
|
||||
--- Returns DCS Identifiable object name.
|
||||
-- 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 #nil The DCS Identifiable is not existing or alive.
|
||||
function IDENTIFIABLE:GetName()
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
--- The OBJECT class
|
||||
-- @type OBJECT
|
||||
-- @extends Base#BASE
|
||||
-- @extends Core.Base#BASE
|
||||
-- @field #string ObjectName The name of the Object.
|
||||
OBJECT = {
|
||||
ClassName = "OBJECT",
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
--- The POSITIONABLE class
|
||||
-- @type POSITIONABLE
|
||||
-- @extends Identifiable#IDENTIFIABLE
|
||||
-- @extends Wrapper.Identifiable#IDENTIFIABLE
|
||||
-- @field #string PositionableName The name of the measurable.
|
||||
POSITIONABLE = {
|
||||
ClassName = "POSITIONABLE",
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
|
||||
--- The UNIT class
|
||||
-- @type UNIT
|
||||
-- @extends Controllable#CONTROLLABLE
|
||||
-- @extends Wrapper.Controllable#CONTROLLABLE
|
||||
-- @field #UNIT.FlareColor FlareColor
|
||||
-- @field #UNIT.SmokeColor SmokeColor
|
||||
UNIT = {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user