mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-18 21:25:58 +00:00
Refactoring
This commit is contained in:
@@ -258,12 +258,6 @@ function FLIGHTGROUP:New(groupname, autostart)
|
|||||||
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
|
||||||
self:AddTransition("*", "RTB", "Inbound") -- Group is returning to destination base.
|
self:AddTransition("*", "RTB", "Inbound") -- Group is returning to destination base.
|
||||||
@@ -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)
|
||||||
@@ -2617,6 +2617,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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user