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.
self.flaghold=USERFLAG:New(string.format("%s_FlagHold", self.groupname))
self.flaghold:Set(0)
-- Init waypoints.
self:InitWaypoints()
-- Initialize group.
self:_InitGroup()
-- Add FSM transitions.
-- From State --> Event --> To State
@@ -345,6 +339,12 @@ function FLIGHTGROUP:New(groupname, autostart)
self:HandleEvent(EVENTS.Crash, self.OnEventCrash)
self:HandleEvent(EVENTS.RemoveUnit, self.OnEventRemoveUnit)
-- Init waypoints.
self:InitWaypoints()
-- Initialize group.
self:_InitGroup()
-- Start the status monitoring.
self:__CheckZone(-1)
self:__Status(-2)
@@ -2616,6 +2616,10 @@ function FLIGHTGROUP:AddElementByName(unitname)
-- Add element to table.
table.insert(self.elements, element)
if unit:IsAlive() then
self:ElementSpawned(element)
end
return element
end