Refactoring

This commit is contained in:
Frank
2020-05-18 10:26:48 +02:00
parent f2af1b1921
commit 322e079486
2 changed files with 17 additions and 12 deletions
+10 -6
View File
@@ -257,12 +257,6 @@ function FLIGHTGROUP:New(groupname, autostart)
-- Holding flag. -- Holding flag.
self.flaghold=USERFLAG:New(string.format("%s_FlagHold", self.groupname)) self.flaghold=USERFLAG:New(string.format("%s_FlagHold", self.groupname))
self.flaghold:Set(0) self.flaghold:Set(0)
-- Init waypoints.
self:InitWaypoints()
-- Initialize group.
self:_InitGroup()
-- Add FSM transitions. -- Add FSM transitions.
-- From State --> Event --> To State -- From State --> Event --> To State
@@ -345,6 +339,12 @@ function FLIGHTGROUP:New(groupname, autostart)
self:HandleEvent(EVENTS.Crash, self.OnEventCrash) self:HandleEvent(EVENTS.Crash, self.OnEventCrash)
self:HandleEvent(EVENTS.RemoveUnit, self.OnEventRemoveUnit) self:HandleEvent(EVENTS.RemoveUnit, self.OnEventRemoveUnit)
-- Init waypoints.
self:InitWaypoints()
-- Initialize group.
self:_InitGroup()
-- Start the status monitoring. -- Start the status monitoring.
self:__CheckZone(-1) self:__CheckZone(-1)
self:__Status(-2) self:__Status(-2)
@@ -2616,6 +2616,10 @@ function FLIGHTGROUP:AddElementByName(unitname)
-- Add element to table. -- Add element to table.
table.insert(self.elements, element) table.insert(self.elements, element)
if unit:IsAlive() then
self:ElementSpawned(element)
end
return element return element
end end
+7 -6
View File
@@ -67,12 +67,6 @@ function NAVYGROUP:New(GroupName)
-- Set some string id for output to DCS.log file. -- Set some string id for output to DCS.log file.
self.lid=string.format("NAVYGROUP %s | ", self.groupname) self.lid=string.format("NAVYGROUP %s | ", self.groupname)
-- Init waypoints.
self:InitWaypoints()
-- Initialize the group.
self:_InitGroup()
-- Defaults -- Defaults
self:SetDefaultROE() self:SetDefaultROE()
self:SetDetection() self:SetDetection()
@@ -100,6 +94,13 @@ function NAVYGROUP:New(GroupName)
-- TODO: Add pseudo functions. -- TODO: Add pseudo functions.
-- Init waypoints.
self:InitWaypoints()
-- Initialize the group.
self:_InitGroup()
-- Debug trace. -- Debug trace.
if false then if false then
self.Debug=true self.Debug=true