mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS Respawn
This commit is contained in:
parent
835041e5f6
commit
78b3e3c60b
@ -410,7 +410,7 @@ do -- FSM
|
|||||||
Transition.To = To
|
Transition.To = To
|
||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
self:T2( Transition )
|
self:T3( Transition )
|
||||||
|
|
||||||
self._Transitions[Transition] = Transition
|
self._Transitions[Transition] = Transition
|
||||||
self:_eventmap( self.Events, Transition )
|
self:_eventmap( self.Events, Transition )
|
||||||
@ -432,7 +432,7 @@ do -- FSM
|
|||||||
-- @param #table ReturnEvents A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
|
-- @param #table ReturnEvents A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.
|
||||||
-- @return Core.Fsm#FSM_PROCESS The SubFSM.
|
-- @return Core.Fsm#FSM_PROCESS The SubFSM.
|
||||||
function FSM:AddProcess( From, Event, Process, ReturnEvents )
|
function FSM:AddProcess( From, Event, Process, ReturnEvents )
|
||||||
self:T( { From, Event } )
|
self:T3( { From, Event } )
|
||||||
|
|
||||||
local Sub = {}
|
local Sub = {}
|
||||||
Sub.From = From
|
Sub.From = From
|
||||||
@ -533,7 +533,7 @@ do -- FSM
|
|||||||
Process._Scores[State].ScoreText = ScoreText
|
Process._Scores[State].ScoreText = ScoreText
|
||||||
Process._Scores[State].Score = Score
|
Process._Scores[State].Score = Score
|
||||||
|
|
||||||
self:T( Process._Scores )
|
self:T3( Process._Scores )
|
||||||
|
|
||||||
return Process
|
return Process
|
||||||
end
|
end
|
||||||
@ -576,7 +576,7 @@ do -- FSM
|
|||||||
self[__Event] = self[__Event] or self:_delayed_transition(Event)
|
self[__Event] = self[__Event] or self:_delayed_transition(Event)
|
||||||
|
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
self:T2( "Added methods: " .. Event .. ", " .. __Event )
|
self:T3( "Added methods: " .. Event .. ", " .. __Event )
|
||||||
|
|
||||||
Events[Event] = self.Events[Event] or { map = {} }
|
Events[Event] = self.Events[Event] or { map = {} }
|
||||||
self:_add_to_map( Events[Event].map, EventStructure )
|
self:_add_to_map( Events[Event].map, EventStructure )
|
||||||
@ -825,7 +825,7 @@ do -- FSM
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Debug.
|
-- Debug.
|
||||||
self:T2( { CallID = CallID } )
|
self:T3( { CallID = CallID } )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -846,7 +846,7 @@ do -- FSM
|
|||||||
function FSM:_gosub( ParentFrom, ParentEvent )
|
function FSM:_gosub( ParentFrom, ParentEvent )
|
||||||
local fsmtable = {}
|
local fsmtable = {}
|
||||||
if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then
|
if self.subs[ParentFrom] and self.subs[ParentFrom][ParentEvent] then
|
||||||
self:T( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } )
|
self:T3( { ParentFrom, ParentEvent, self.subs[ParentFrom], self.subs[ParentFrom][ParentEvent] } )
|
||||||
return self.subs[ParentFrom][ParentEvent]
|
return self.subs[ParentFrom][ParentEvent]
|
||||||
else
|
else
|
||||||
return {}
|
return {}
|
||||||
@ -1150,7 +1150,7 @@ do -- FSM_PROCESS
|
|||||||
-- @param #FSM_PROCESS self
|
-- @param #FSM_PROCESS self
|
||||||
-- @return #FSM_PROCESS
|
-- @return #FSM_PROCESS
|
||||||
function FSM_PROCESS:Copy( Controllable, Task )
|
function FSM_PROCESS:Copy( Controllable, Task )
|
||||||
self:T( { self:GetClassNameAndID() } )
|
self:T3( { self:GetClassNameAndID() } )
|
||||||
|
|
||||||
|
|
||||||
local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS
|
local NewFsm = self:New( Controllable, Task ) -- Core.Fsm#FSM_PROCESS
|
||||||
@ -1176,13 +1176,13 @@ do -- FSM_PROCESS
|
|||||||
|
|
||||||
-- Copy End States
|
-- Copy End States
|
||||||
for EndStateID, EndState in pairs( self:GetEndStates() ) do
|
for EndStateID, EndState in pairs( self:GetEndStates() ) do
|
||||||
self:T( EndState )
|
self:T3( EndState )
|
||||||
NewFsm:AddEndState( EndState )
|
NewFsm:AddEndState( EndState )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Copy the score tables
|
-- Copy the score tables
|
||||||
for ScoreID, Score in pairs( self:GetScores() ) do
|
for ScoreID, Score in pairs( self:GetScores() ) do
|
||||||
self:T( Score )
|
self:T3( Score )
|
||||||
NewFsm:AddScore( ScoreID, Score.ScoreText, Score.Score )
|
NewFsm:AddScore( ScoreID, Score.ScoreText, Score.Score )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -26,19 +26,28 @@
|
|||||||
--
|
--
|
||||||
-- ### Authors:
|
-- ### Authors:
|
||||||
--
|
--
|
||||||
-- * FlightControl : Design & Programming
|
-- * FlightControl (Design & Programming)
|
||||||
--
|
--
|
||||||
-- ### Contributions:
|
-- ### Contributions:
|
||||||
|
--
|
||||||
|
-- * funkyfranky
|
||||||
|
-- * Applevangelist
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Core.Point
|
-- @module Core.Point
|
||||||
-- @image Core_Coordinate.JPG
|
-- @image Core_Coordinate.JPG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do -- COORDINATE
|
do -- COORDINATE
|
||||||
|
|
||||||
--- @type COORDINATE
|
--- @type COORDINATE
|
||||||
|
-- @field #string ClassName Name of the class
|
||||||
|
-- @field #number x Component of the 3D vector.
|
||||||
|
-- @field #number y Component of the 3D vector.
|
||||||
|
-- @field #number z Component of the 3D vector.
|
||||||
|
-- @field #number Heading Heading in degrees. Needs to be set first.
|
||||||
|
-- @field #number Velocity Velocity in meters per second. Needs to be set first.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
|
||||||
@ -201,13 +210,24 @@ do -- COORDINATE
|
|||||||
ClassName = "COORDINATE",
|
ClassName = "COORDINATE",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field COORDINATE.WaypointAltType
|
--- Waypoint altitude types.
|
||||||
|
-- @type COORDINATE.WaypointAltType
|
||||||
|
-- @field #string BARO Barometric altitude.
|
||||||
|
-- @field #string RADIO Radio altitude.
|
||||||
COORDINATE.WaypointAltType = {
|
COORDINATE.WaypointAltType = {
|
||||||
BARO = "BARO",
|
BARO = "BARO",
|
||||||
RADIO = "RADIO",
|
RADIO = "RADIO",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field COORDINATE.WaypointAction
|
--- Waypoint actions.
|
||||||
|
-- @type COORDINATE.WaypointAction
|
||||||
|
-- @field #string TurningPoint Turning point.
|
||||||
|
-- @field #string FlyoverPoint Fly over point.
|
||||||
|
-- @field #string FromParkingArea From parking area.
|
||||||
|
-- @field #string FromParkingAreaHot From parking area hot.
|
||||||
|
-- @field #string FromRunway From runway.
|
||||||
|
-- @field #string Landing Landing.
|
||||||
|
-- @field #string LandingReFuAr Landing and refuel and rearm.
|
||||||
COORDINATE.WaypointAction = {
|
COORDINATE.WaypointAction = {
|
||||||
TurningPoint = "Turning Point",
|
TurningPoint = "Turning Point",
|
||||||
FlyoverPoint = "Fly Over Point",
|
FlyoverPoint = "Fly Over Point",
|
||||||
@ -218,7 +238,14 @@ do -- COORDINATE
|
|||||||
LandingReFuAr = "LandingReFuAr",
|
LandingReFuAr = "LandingReFuAr",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- @field COORDINATE.WaypointType
|
--- Waypoint types.
|
||||||
|
-- @type COORDINATE.WaypointType
|
||||||
|
-- @field #string TakeOffParking Take of parking.
|
||||||
|
-- @field #string TakeOffParkingHot Take of parking hot.
|
||||||
|
-- @field #string TakeOff Take off parking hot.
|
||||||
|
-- @field #string TurningPoint Turning point.
|
||||||
|
-- @field #string Land Landing point.
|
||||||
|
-- @field #string LandingReFuAr Landing and refuel and rearm.
|
||||||
COORDINATE.WaypointType = {
|
COORDINATE.WaypointType = {
|
||||||
TakeOffParking = "TakeOffParking",
|
TakeOffParking = "TakeOffParking",
|
||||||
TakeOffParkingHot = "TakeOffParkingHot",
|
TakeOffParkingHot = "TakeOffParkingHot",
|
||||||
@ -232,13 +259,13 @@ do -- COORDINATE
|
|||||||
--- COORDINATE constructor.
|
--- COORDINATE constructor.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
-- @param DCS#Distance x The x coordinate of the Vec3 point, pointing to the North.
|
||||||
-- @param DCS#Distance y The y coordinate of the Vec3 point, pointing to the Right.
|
-- @param DCS#Distance y The y coordinate of the Vec3 point, pointing to up.
|
||||||
-- @param DCS#Distance z The z coordinate of the Vec3 point, pointing to the Right.
|
-- @param DCS#Distance z The z coordinate of the Vec3 point, pointing to the right.
|
||||||
-- @return #COORDINATE
|
-- @return #COORDINATE self
|
||||||
function COORDINATE:New( x, y, z )
|
function COORDINATE:New( x, y, z )
|
||||||
|
|
||||||
--env.info("FF COORDINATE New")
|
local self=BASE:Inherit(self, BASE:New()) -- #COORDINATE
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #COORDINATE
|
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.z = z
|
self.z = z
|
||||||
@ -249,7 +276,7 @@ do -- COORDINATE
|
|||||||
--- COORDINATE constructor.
|
--- COORDINATE constructor.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE Coordinate.
|
-- @param #COORDINATE Coordinate.
|
||||||
-- @return #COORDINATE
|
-- @return #COORDINATE self
|
||||||
function COORDINATE:NewFromCoordinate( Coordinate )
|
function COORDINATE:NewFromCoordinate( Coordinate )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #COORDINATE
|
local self = BASE:Inherit( self, BASE:New() ) -- #COORDINATE
|
||||||
@ -263,8 +290,8 @@ do -- COORDINATE
|
|||||||
--- Create a new COORDINATE object from Vec2 coordinates.
|
--- Create a new COORDINATE object from Vec2 coordinates.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec2 Vec2 The Vec2 point.
|
-- @param DCS#Vec2 Vec2 The Vec2 point.
|
||||||
-- @param DCS#Distance LandHeightAdd (optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
|
-- @param DCS#Distance LandHeightAdd (Optional) The default height if required to be evaluated will be the land height of the x, y coordinate. You can specify an extra height to be added to the land height.
|
||||||
-- @return #COORDINATE
|
-- @return #COORDINATE self
|
||||||
function COORDINATE:NewFromVec2( Vec2, LandHeightAdd )
|
function COORDINATE:NewFromVec2( Vec2, LandHeightAdd )
|
||||||
|
|
||||||
local LandHeight = land.getHeight( Vec2 )
|
local LandHeight = land.getHeight( Vec2 )
|
||||||
@ -274,8 +301,6 @@ do -- COORDINATE
|
|||||||
|
|
||||||
local self = self:New( Vec2.x, LandHeight, Vec2.y ) -- #COORDINATE
|
local self = self:New( Vec2.x, LandHeight, Vec2.y ) -- #COORDINATE
|
||||||
|
|
||||||
self:F2( self )
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -283,7 +308,7 @@ do -- COORDINATE
|
|||||||
--- Create a new COORDINATE object from Vec3 coordinates.
|
--- Create a new COORDINATE object from Vec3 coordinates.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param DCS#Vec3 Vec3 The Vec3 point.
|
-- @param DCS#Vec3 Vec3 The Vec3 point.
|
||||||
-- @return #COORDINATE
|
-- @return #COORDINATE self
|
||||||
function COORDINATE:NewFromVec3( Vec3 )
|
function COORDINATE:NewFromVec3( Vec3 )
|
||||||
|
|
||||||
local self = self:New( Vec3.x, Vec3.y, Vec3.z ) -- #COORDINATE
|
local self = self:New( Vec3.x, Vec3.y, Vec3.z ) -- #COORDINATE
|
||||||
@ -292,6 +317,22 @@ do -- COORDINATE
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Create a new COORDINATE object from a waypoint. This uses the components
|
||||||
|
--
|
||||||
|
-- * `waypoint.x`
|
||||||
|
-- * `waypoint.alt`
|
||||||
|
-- * `waypoint.y`
|
||||||
|
--
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param DCS#Waypoint Waypoint The waypoint.
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromWaypoint(Waypoint)
|
||||||
|
|
||||||
|
local self=self:New(Waypoint.x, Waypoint.alt, Waypoint.y) -- #COORDINATE
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Return the coordinates itself. Sounds stupid but can be useful for compatibility.
|
--- Return the coordinates itself. Sounds stupid but can be useful for compatibility.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
@ -1720,7 +1761,7 @@ do -- COORDINATE
|
|||||||
return self:GetSurfaceType()==land.SurfaceType.LAND
|
return self:GetSurfaceType()==land.SurfaceType.LAND
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Checks if the surface type is road.
|
--- Checks if the surface type is land.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @return #boolean If true, the surface type at the coordinate is land.
|
-- @return #boolean If true, the surface type at the coordinate is land.
|
||||||
function COORDINATE:IsSurfaceTypeLand()
|
function COORDINATE:IsSurfaceTypeLand()
|
||||||
@ -2082,7 +2123,7 @@ do -- COORDINATE
|
|||||||
--- Circle to all.
|
--- Circle to all.
|
||||||
-- Creates a circle on the map with a given radius, color, fill color, and outline.
|
-- Creates a circle on the map with a given radius, color, fill color, and outline.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #numberr Radius Radius in meters. Default 1000 m.
|
-- @param #number Radius Radius in meters. Default 1000 m.
|
||||||
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
||||||
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
|
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
|
||||||
-- @param #number Alpha Transparency [0,1]. Default 1.
|
-- @param #number Alpha Transparency [0,1]. Default 1.
|
||||||
|
|||||||
@ -141,7 +141,7 @@ function ARMYGROUP:New(group)
|
|||||||
|
|
||||||
|
|
||||||
-- Init waypoints.
|
-- Init waypoints.
|
||||||
self:InitWaypoints()
|
self:_InitWaypoints()
|
||||||
|
|
||||||
-- Initialize the group.
|
-- Initialize the group.
|
||||||
self:_InitGroup()
|
self:_InitGroup()
|
||||||
@ -1115,8 +1115,9 @@ end
|
|||||||
|
|
||||||
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
||||||
-- @param #ARMYGROUP self
|
-- @param #ARMYGROUP self
|
||||||
|
-- @param #table Template Template used to init the group. Default is `self.template`.
|
||||||
-- @return #ARMYGROUP self
|
-- @return #ARMYGROUP self
|
||||||
function ARMYGROUP:_InitGroup()
|
function ARMYGROUP:_InitGroup(Template)
|
||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
@ -1125,7 +1126,7 @@ function ARMYGROUP:_InitGroup()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get template of group.
|
-- Get template of group.
|
||||||
self.template=self.group:GetTemplate()
|
local template=Template or self:_GetTemplate()
|
||||||
|
|
||||||
-- Define category.
|
-- Define category.
|
||||||
self.isAircraft=false
|
self.isAircraft=false
|
||||||
@ -1136,7 +1137,7 @@ function ARMYGROUP:_InitGroup()
|
|||||||
self.isAI=true
|
self.isAI=true
|
||||||
|
|
||||||
-- Is (template) group late activated.
|
-- Is (template) group late activated.
|
||||||
self.isLateActivated=self.template.lateActivation
|
self.isLateActivated=template.lateActivation
|
||||||
|
|
||||||
-- Ground groups cannot be uncontrolled.
|
-- Ground groups cannot be uncontrolled.
|
||||||
self.isUncontrolled=false
|
self.isUncontrolled=false
|
||||||
|
|||||||
@ -306,7 +306,7 @@ function FLIGHTGROUP:New(group)
|
|||||||
self:HandleEvent(EVENTS.Kill, self.OnEventKill)
|
self:HandleEvent(EVENTS.Kill, self.OnEventKill)
|
||||||
|
|
||||||
-- Init waypoints.
|
-- Init waypoints.
|
||||||
self:InitWaypoints()
|
self:_InitWaypoints()
|
||||||
|
|
||||||
-- Initialize group.
|
-- Initialize group.
|
||||||
self:_InitGroup()
|
self:_InitGroup()
|
||||||
@ -1478,7 +1478,7 @@ function FLIGHTGROUP:onafterElementTakeoff(From, Event, To, Element, airbase)
|
|||||||
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.TAKEOFF, airbase)
|
self:_UpdateStatus(Element, OPSGROUP.ElementStatus.TAKEOFF, airbase)
|
||||||
|
|
||||||
-- Trigger element airborne event.
|
-- Trigger element airborne event.
|
||||||
self:__ElementAirborne(0.1, Element)
|
self:__ElementAirborne(0.01, Element)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1750,7 +1750,7 @@ function FLIGHTGROUP:onafterAirborne(From, Event, To)
|
|||||||
self.currbase=nil
|
self.currbase=nil
|
||||||
|
|
||||||
-- Cruising.
|
-- Cruising.
|
||||||
self:__Cruise(-0.05)
|
self:__Cruise(-0.01)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1882,7 +1882,7 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
SpawnPoint.airdromeId = nil
|
SpawnPoint.airdromeId = nil
|
||||||
|
|
||||||
-- Airbase.
|
-- Airbase.
|
||||||
local airbase=self.isLandingAtAirbase
|
local airbase=self.isLandingAtAirbase --Wrapper.Airbase#AIRBASE
|
||||||
|
|
||||||
-- Get airbase ID and category.
|
-- Get airbase ID and category.
|
||||||
local AirbaseID = airbase:GetID()
|
local AirbaseID = airbase:GetID()
|
||||||
@ -1909,7 +1909,7 @@ function FLIGHTGROUP:onafterArrived(From, Event, To)
|
|||||||
local unit=units[i]
|
local unit=units[i]
|
||||||
local element=self:GetElementByName(unit.name)
|
local element=self:GetElementByName(unit.name)
|
||||||
if element and element.status~=OPSGROUP.ElementStatus.DEAD then
|
if element and element.status~=OPSGROUP.ElementStatus.DEAD then
|
||||||
unit.parking=element.parking.TerminalID
|
unit.parking=element.parking and element.parking.TerminalID or nil
|
||||||
unit.parking_id=nil
|
unit.parking_id=nil
|
||||||
local vec3=element.unit:GetVec3()
|
local vec3=element.unit:GetVec3()
|
||||||
local heading=element.unit:GetHeading()
|
local heading=element.unit:GetHeading()
|
||||||
@ -2415,6 +2415,10 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
|
|||||||
|
|
||||||
-- Passed final waypoint!
|
-- Passed final waypoint!
|
||||||
self.passedfinalwp=true
|
self.passedfinalwp=true
|
||||||
|
|
||||||
|
-- Not waiting any more.
|
||||||
|
self.Twaiting=nil
|
||||||
|
self.dTwait=nil
|
||||||
|
|
||||||
-- Defaults:
|
-- Defaults:
|
||||||
SpeedTo=SpeedTo or UTILS.KmphToKnots(self.speedCruise)
|
SpeedTo=SpeedTo or UTILS.KmphToKnots(self.speedCruise)
|
||||||
@ -2469,7 +2473,7 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
|
|||||||
-- Set holding flag to 0=false.
|
-- Set holding flag to 0=false.
|
||||||
self.flaghold:Set(0)
|
self.flaghold:Set(0)
|
||||||
|
|
||||||
local holdtime=1*60
|
local holdtime=2*60
|
||||||
if fc or self.airboss then
|
if fc or self.airboss then
|
||||||
holdtime=nil
|
holdtime=nil
|
||||||
end
|
end
|
||||||
@ -3002,8 +3006,9 @@ end
|
|||||||
|
|
||||||
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param #table Template Template used to init the group. Default is `self.template`.
|
||||||
-- @return #FLIGHTGROUP self
|
-- @return #FLIGHTGROUP self
|
||||||
function FLIGHTGROUP:_InitGroup()
|
function FLIGHTGROUP:_InitGroup(Template)
|
||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
@ -3015,7 +3020,7 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
local group=self.group --Wrapper.Group#GROUP
|
local group=self.group --Wrapper.Group#GROUP
|
||||||
|
|
||||||
-- Get template of group.
|
-- Get template of group.
|
||||||
self.template=group:GetTemplate()
|
local template=Template or self:_GetTemplate()
|
||||||
|
|
||||||
-- Define category.
|
-- Define category.
|
||||||
self.isAircraft=true
|
self.isAircraft=true
|
||||||
@ -3026,10 +3031,10 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
self.isHelo=group:IsHelicopter()
|
self.isHelo=group:IsHelicopter()
|
||||||
|
|
||||||
-- Is (template) group uncontrolled.
|
-- Is (template) group uncontrolled.
|
||||||
self.isUncontrolled=self.template.uncontrolled
|
self.isUncontrolled=template.uncontrolled
|
||||||
|
|
||||||
-- Is (template) group late activated.
|
-- Is (template) group late activated.
|
||||||
self.isLateActivated=self.template.lateActivation
|
self.isLateActivated=template.lateActivation
|
||||||
|
|
||||||
-- Max speed in km/h.
|
-- Max speed in km/h.
|
||||||
self.speedMax=group:GetSpeedMax()
|
self.speedMax=group:GetSpeedMax()
|
||||||
@ -3044,12 +3049,12 @@ function FLIGHTGROUP:_InitGroup()
|
|||||||
self.ammo=self:GetAmmoTot()
|
self.ammo=self:GetAmmoTot()
|
||||||
|
|
||||||
-- Radio parameters from template. Default is set on spawn if not modified by user.
|
-- Radio parameters from template. Default is set on spawn if not modified by user.
|
||||||
self.radio.Freq=tonumber(self.template.frequency)
|
self.radio.Freq=tonumber(template.frequency)
|
||||||
self.radio.Modu=tonumber(self.template.modulation)
|
self.radio.Modu=tonumber(template.modulation)
|
||||||
self.radio.On=self.template.communication
|
self.radio.On=template.communication
|
||||||
|
|
||||||
-- Set callsign. Default is set on spawn if not modified by user.
|
-- Set callsign. Default is set on spawn if not modified by user.
|
||||||
local callsign=self.template.units[1].callsign
|
local callsign=template.units[1].callsign
|
||||||
if type(callsign)=="number" then -- Sometimes callsign is just "101".
|
if type(callsign)=="number" then -- Sometimes callsign is just "101".
|
||||||
local cs=tostring(callsign)
|
local cs=tostring(callsign)
|
||||||
callsign={}
|
callsign={}
|
||||||
@ -3453,7 +3458,7 @@ function FLIGHTGROUP:IsLandingAirbase(wp)
|
|||||||
|
|
||||||
if wp then
|
if wp then
|
||||||
|
|
||||||
if wp.action and wp.action==COORDINATE.WaypointAction.LANDING then
|
if wp.action and wp.action==COORDINATE.WaypointAction.Landing then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -165,7 +165,7 @@ function NAVYGROUP:New(group)
|
|||||||
|
|
||||||
|
|
||||||
-- Init waypoints.
|
-- Init waypoints.
|
||||||
self:InitWaypoints()
|
self:_InitWaypoints()
|
||||||
|
|
||||||
-- Initialize the group.
|
-- Initialize the group.
|
||||||
self:_InitGroup()
|
self:_InitGroup()
|
||||||
@ -1130,8 +1130,9 @@ end
|
|||||||
|
|
||||||
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
--- Initialize group parameters. Also initializes waypoints if self.waypoints is nil.
|
||||||
-- @param #NAVYGROUP self
|
-- @param #NAVYGROUP self
|
||||||
|
-- @param #table Template Template used to init the group. Default is `self.template`.
|
||||||
-- @return #NAVYGROUP self
|
-- @return #NAVYGROUP self
|
||||||
function NAVYGROUP:_InitGroup()
|
function NAVYGROUP:_InitGroup(Template)
|
||||||
|
|
||||||
-- First check if group was already initialized.
|
-- First check if group was already initialized.
|
||||||
if self.groupinitialized then
|
if self.groupinitialized then
|
||||||
@ -1140,7 +1141,7 @@ function NAVYGROUP:_InitGroup()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get template of group.
|
-- Get template of group.
|
||||||
self.template=self.group:GetTemplate()
|
local template=Template or self:_GetTemplate()
|
||||||
|
|
||||||
-- Define category.
|
-- Define category.
|
||||||
self.isAircraft=false
|
self.isAircraft=false
|
||||||
@ -1154,7 +1155,7 @@ function NAVYGROUP:_InitGroup()
|
|||||||
self.isAI=true
|
self.isAI=true
|
||||||
|
|
||||||
-- Is (template) group late activated.
|
-- Is (template) group late activated.
|
||||||
self.isLateActivated=self.template.lateActivation
|
self.isLateActivated=template.lateActivation
|
||||||
|
|
||||||
-- Naval groups cannot be uncontrolled.
|
-- Naval groups cannot be uncontrolled.
|
||||||
self.isUncontrolled=false
|
self.isUncontrolled=false
|
||||||
@ -1170,8 +1171,8 @@ function NAVYGROUP:_InitGroup()
|
|||||||
|
|
||||||
-- Radio parameters from template. Default is set on spawn if not modified by the user.
|
-- Radio parameters from template. Default is set on spawn if not modified by the user.
|
||||||
self.radio.On=true -- Radio is always on for ships.
|
self.radio.On=true -- Radio is always on for ships.
|
||||||
self.radio.Freq=tonumber(self.template.units[1].frequency)/1000000
|
self.radio.Freq=tonumber(template.units[1].frequency)/1000000
|
||||||
self.radio.Modu=tonumber(self.template.units[1].modulation)
|
self.radio.Modu=tonumber(template.units[1].modulation)
|
||||||
|
|
||||||
-- Set default formation. No really applicable for ships.
|
-- Set default formation. No really applicable for ships.
|
||||||
self.optionDefault.Formation="Off Road"
|
self.optionDefault.Formation="Off Road"
|
||||||
|
|||||||
@ -375,6 +375,12 @@ OPSGROUP.TaskType={
|
|||||||
-- @field #number MissilesBM Amount of ballistic missiles.
|
-- @field #number MissilesBM Amount of ballistic missiles.
|
||||||
-- @field #number MissilesSA Amount of surfe-to-air missiles.
|
-- @field #number MissilesSA Amount of surfe-to-air missiles.
|
||||||
|
|
||||||
|
--- Spawn point data.
|
||||||
|
-- @type OPSGROUP.Spawnpoint
|
||||||
|
-- @field Core.Point#COORDINATE Coordinate Coordinate where to spawn
|
||||||
|
-- @field Wrapper.Airbase#AIRBASE Airport Airport where to spawn.
|
||||||
|
-- @field #table TerminalIDs Terminal IDs, where to spawn the group. It is a table of `#number`s because a group can consist of multiple units.
|
||||||
|
|
||||||
--- Waypoint data.
|
--- Waypoint data.
|
||||||
-- @type OPSGROUP.Waypoint
|
-- @type OPSGROUP.Waypoint
|
||||||
-- @field #number uid Waypoint's unit id, which is a running number.
|
-- @field #number uid Waypoint's unit id, which is a running number.
|
||||||
@ -503,6 +509,9 @@ function OPSGROUP:New(group)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Set the template.
|
||||||
|
self:_SetTemplate()
|
||||||
|
|
||||||
-- Init set of detected units.
|
-- Init set of detected units.
|
||||||
self.detectedunits=SET_UNIT:New()
|
self.detectedunits=SET_UNIT:New()
|
||||||
@ -3881,7 +3890,7 @@ end
|
|||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
--- On before "Wait" event.
|
--- On before "Wait" event.
|
||||||
-- @param #FLIGHTGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
@ -4787,7 +4796,7 @@ end
|
|||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
-- @param #number Delay Delay in seconds before respawn happens. Default 0.
|
-- @param #number Delay Delay in seconds before respawn happens. Default 0.
|
||||||
-- @param DCS#Template Template (optional) The template of the Group retrieved with GROUP:GetTemplate(). If the template is not provided, the template will be retrieved of the group itself.
|
-- @param DCS#Template Template (optional) The template of the Group retrieved with GROUP:GetTemplate(). If the template is not provided, the template will be retrieved of the group itself.
|
||||||
-- @param #boolean Reset Reset positions if TRUE.
|
-- @param #boolean Reset Reset waypoints and reinit group if `true`.
|
||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
function OPSGROUP:_Respawn(Delay, Template, Reset)
|
function OPSGROUP:_Respawn(Delay, Template, Reset)
|
||||||
|
|
||||||
@ -4799,7 +4808,7 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
self:T2(self.lid.."FF _Respawn")
|
self:T2(self.lid.."FF _Respawn")
|
||||||
|
|
||||||
-- Given template or get old.
|
-- Given template or get old.
|
||||||
Template=Template or UTILS.DeepCopy(self.template)
|
Template=Template or self:_GetTemplate(true)
|
||||||
|
|
||||||
if self:IsAlive() then
|
if self:IsAlive() then
|
||||||
|
|
||||||
@ -4807,6 +4816,8 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
-- Group is ALIVE
|
-- Group is ALIVE
|
||||||
---
|
---
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
-- Get units.
|
-- Get units.
|
||||||
local units=self.group:GetUnits()
|
local units=self.group:GetUnits()
|
||||||
|
|
||||||
@ -4828,6 +4839,29 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
local units=Template.units
|
||||||
|
|
||||||
|
for i=#units,1,-1 do
|
||||||
|
local unit=units[i]
|
||||||
|
local element=self:GetElementByName(unit.name)
|
||||||
|
if element and element.status~=OPSGROUP.ElementStatus.DEAD then
|
||||||
|
unit.parking=element.parking and element.parking.TerminalID or unit.parking
|
||||||
|
unit.parking_id=nil
|
||||||
|
local vec3=element.unit:GetVec3()
|
||||||
|
local heading=element.unit:GetHeading()
|
||||||
|
unit.x=vec3.x
|
||||||
|
unit.y=vec3.z
|
||||||
|
unit.alt=vec3.y
|
||||||
|
unit.heading=math.rad(heading)
|
||||||
|
unit.psi=-unit.heading
|
||||||
|
else
|
||||||
|
table.remove(units, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Despawn old group. Dont trigger any remove unit event since this is a respawn.
|
-- Despawn old group. Dont trigger any remove unit event since this is a respawn.
|
||||||
self:Despawn(0, true)
|
self:Despawn(0, true)
|
||||||
@ -4843,28 +4877,6 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
local element=_element --#OPSGROUP.Element
|
local element=_element --#OPSGROUP.Element
|
||||||
self:ElementInUtero(element)
|
self:ElementInUtero(element)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
|
|
||||||
-- Loop over template units.
|
|
||||||
for UnitID, Unit in pairs(Template.units) do
|
|
||||||
|
|
||||||
local element=self:GetElementByName(Unit.name)
|
|
||||||
|
|
||||||
if element then
|
|
||||||
local vec3=element.vec3
|
|
||||||
local heading=element.heading
|
|
||||||
Unit.x=vec3.x
|
|
||||||
Unit.y=vec3.z
|
|
||||||
Unit.alt=vec3.y
|
|
||||||
Unit.heading=math.rad(heading)
|
|
||||||
Unit.psi=-Unit.heading
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
]]
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -4881,10 +4893,18 @@ function OPSGROUP:_Respawn(Delay, Template, Reset)
|
|||||||
-- Not dead or destroyed any more.
|
-- Not dead or destroyed any more.
|
||||||
self.isDead=false
|
self.isDead=false
|
||||||
self.isDestroyed=false
|
self.isDestroyed=false
|
||||||
self.Ndestroyed=0
|
|
||||||
|
|
||||||
self:InitWaypoints()
|
|
||||||
self:_InitGroup()
|
self.groupinitialized=false
|
||||||
|
self.Ndestroyed=0
|
||||||
|
self.wpcounter=1
|
||||||
|
self.currentwp=1
|
||||||
|
|
||||||
|
-- Init waypoints.
|
||||||
|
self:_InitWaypoints()
|
||||||
|
|
||||||
|
-- Init Group.
|
||||||
|
self:_InitGroup()
|
||||||
|
|
||||||
-- Reset events.
|
-- Reset events.
|
||||||
--self:ResetEvents()
|
--self:ResetEvents()
|
||||||
@ -5827,6 +5847,10 @@ function OPSGROUP:onafterPickup(From, Event, To)
|
|||||||
|
|
||||||
-- Add waypoint.
|
-- Add waypoint.
|
||||||
if self.isFlightgroup then
|
if self.isFlightgroup then
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Flight Group
|
||||||
|
---
|
||||||
|
|
||||||
if airbasePickup then
|
if airbasePickup then
|
||||||
|
|
||||||
@ -5872,7 +5896,9 @@ function OPSGROUP:onafterPickup(From, Event, To)
|
|||||||
|
|
||||||
elseif self.isNavygroup then
|
elseif self.isNavygroup then
|
||||||
|
|
||||||
|
---
|
||||||
-- Navy Group
|
-- Navy Group
|
||||||
|
---
|
||||||
|
|
||||||
local cwp=self:GetWaypointCurrent()
|
local cwp=self:GetWaypointCurrent()
|
||||||
local uid=cwp and cwp.uid or nil
|
local uid=cwp and cwp.uid or nil
|
||||||
@ -5898,7 +5924,9 @@ function OPSGROUP:onafterPickup(From, Event, To)
|
|||||||
|
|
||||||
elseif self.isArmygroup then
|
elseif self.isArmygroup then
|
||||||
|
|
||||||
|
---
|
||||||
-- Army Group
|
-- Army Group
|
||||||
|
---
|
||||||
|
|
||||||
local cwp=self:GetWaypointCurrent()
|
local cwp=self:GetWaypointCurrent()
|
||||||
local uid=cwp and cwp.uid or nil
|
local uid=cwp and cwp.uid or nil
|
||||||
@ -5972,12 +6000,12 @@ function OPSGROUP:onafterLoading(From, Event, To)
|
|||||||
|
|
||||||
else
|
else
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid.."Cannot board carrier!")
|
self:T(self.lid..string.format("Cannot board carrier! Group %s is NOT (yet) in zone %s", cargo.opsgroup:GetName(), self.cargoTransport.embarkzone:GetName()))
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid.."Cargo NOT in embark zone "..self.cargoTransport.embarkzone:GetName())
|
self:T(self.lid..string.format("Cargo %s NOT in embark zone %s", cargo.opsgroup:GetName(), self.cargoTransport.embarkzone:GetName()))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -7251,6 +7279,7 @@ function OPSGROUP:_CreateWaypoint(waypoint)
|
|||||||
waypoint.patrol=false
|
waypoint.patrol=false
|
||||||
waypoint.detour=false
|
waypoint.detour=false
|
||||||
waypoint.astar=false
|
waypoint.astar=false
|
||||||
|
waypoint.temp=false
|
||||||
|
|
||||||
-- Increase UID counter.
|
-- Increase UID counter.
|
||||||
self.wpcounter=self.wpcounter+1
|
self.wpcounter=self.wpcounter+1
|
||||||
@ -7271,33 +7300,40 @@ function OPSGROUP:_AddWaypoint(waypoint, wpnumber)
|
|||||||
table.insert(self.waypoints, wpnumber, waypoint)
|
table.insert(self.waypoints, wpnumber, waypoint)
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Adding waypoint at index=%d id=%d", wpnumber, waypoint.uid))
|
self:T(self.lid..string.format("Adding waypoint at index=%d with UID=%d", wpnumber, waypoint.uid))
|
||||||
|
|
||||||
-- Now we obviously did not pass the final waypoint.
|
-- Now we obviously did not pass the final waypoint.
|
||||||
self.passedfinalwp=false
|
if self.currentwp and wpnumber>self.currentwp then
|
||||||
|
self.passedfinalwp=false
|
||||||
-- Switch to cruise mode.
|
|
||||||
if self:IsHolding() then
|
|
||||||
-- Disable this for now. Cruise has to be commanded manually now. If group is ordered to hold, it will hold until told to move again.
|
|
||||||
--self:Cruise()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Initialize Mission Editor waypoints.
|
--- Initialize Mission Editor waypoints.
|
||||||
-- @param #OPSGROUP self
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #number WpIndexMin
|
||||||
|
-- @param #number WpIndexMax
|
||||||
-- @return #OPSGROUP self
|
-- @return #OPSGROUP self
|
||||||
function OPSGROUP:InitWaypoints()
|
function OPSGROUP:_InitWaypoints(WpIndexMin, WpIndexMax)
|
||||||
|
|
||||||
-- Template waypoints.
|
-- Template waypoints.
|
||||||
self.waypoints0=self.group:GetTemplateRoutePoints()
|
self.waypoints0=self.group:GetTemplateRoutePoints()
|
||||||
|
|
||||||
-- Waypoints
|
-- Waypoints empty!
|
||||||
self.waypoints={}
|
self.waypoints={}
|
||||||
|
|
||||||
|
WpIndexMin=WpIndexMin or 1
|
||||||
|
WpIndexMax=WpIndexMax or #self.waypoints0
|
||||||
|
WpIndexMax=math.min(WpIndexMax, #self.waypoints0) --Ensure max is not out of bounce.
|
||||||
|
|
||||||
for index,wp in pairs(self.waypoints0) do
|
--for index,wp in pairs(self.waypoints0) do
|
||||||
|
|
||||||
|
for i=WpIndexMin,WpIndexMax do
|
||||||
|
|
||||||
|
local wp=self.waypoints0[i] --DCS#Waypoint
|
||||||
|
|
||||||
-- Coordinate of the waypoint.
|
-- Coordinate of the waypoint.
|
||||||
local coordinate=COORDINATE:New(wp.x, wp.alt, wp.y)
|
local coordinate=COORDINATE:NewFromWaypoint(wp)
|
||||||
|
|
||||||
-- Strange!
|
-- Strange!
|
||||||
wp.speed=wp.speed or 0
|
wp.speed=wp.speed or 0
|
||||||
@ -7305,17 +7341,49 @@ function OPSGROUP:InitWaypoints()
|
|||||||
-- Speed at the waypoint.
|
-- Speed at the waypoint.
|
||||||
local speedknots=UTILS.MpsToKnots(wp.speed)
|
local speedknots=UTILS.MpsToKnots(wp.speed)
|
||||||
|
|
||||||
if index==1 then
|
if i==1 then
|
||||||
self.speedWp=wp.speed
|
self.speedWp=wp.speed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local waypoint=self:_CreateWaypoint(wp)
|
||||||
|
|
||||||
|
self:_AddWaypoint(waypoint)
|
||||||
|
|
||||||
-- Add waypoint.
|
-- Add waypoint.
|
||||||
self:AddWaypoint(coordinate, speedknots, index-1, nil, false)
|
--[[
|
||||||
|
if self:IsFlightgroup() then
|
||||||
|
FLIGHTGROUP.AddWaypoint(self, coordinate, speedknots, index-1, Altitude, false)
|
||||||
|
elseif self:IsArmygroup() then
|
||||||
|
ARMYGROUP.AddWaypoint(self, coordinate, speedknots, index-1, Formation, false)
|
||||||
|
elseif self:IsNavygroup() then
|
||||||
|
NAVYGROUP.AddWaypoint(self, coordinate, speedknots, index-1, Depth, false)
|
||||||
|
else
|
||||||
|
-- Should not happen!
|
||||||
|
self:AddWaypoint(coordinate, speedknots, index-1, nil, false)
|
||||||
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T(self.lid..string.format("Initializing %d waypoints", #self.waypoints))
|
self:T(self.lid..string.format("Initializing %d waypoints", #self.waypoints))
|
||||||
|
|
||||||
|
-- Flight group specific.
|
||||||
|
if self:IsFlightgroup() then
|
||||||
|
|
||||||
|
-- Get home and destination airbases from waypoints.
|
||||||
|
self.homebase=self.homebase or self:GetHomebaseFromWaypoints()
|
||||||
|
self.destbase=self.destbase or self:GetDestinationFromWaypoints()
|
||||||
|
self.currbase=self:GetHomebaseFromWaypoints()
|
||||||
|
|
||||||
|
-- Remove the landing waypoint. We use RTB for that. It makes adding new waypoints easier as we do not have to check if the last waypoint is the landing waypoint.
|
||||||
|
if self.destbase and #self.waypoints>1 then
|
||||||
|
table.remove(self.waypoints, #self.waypoints)
|
||||||
|
else
|
||||||
|
self.destbase=self.homebase
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Update route.
|
-- Update route.
|
||||||
if #self.waypoints>0 then
|
if #self.waypoints>0 then
|
||||||
@ -7324,7 +7392,9 @@ function OPSGROUP:InitWaypoints()
|
|||||||
if #self.waypoints==1 then
|
if #self.waypoints==1 then
|
||||||
self.passedfinalwp=true
|
self.passedfinalwp=true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
self:E(self.lid.."WARNING: No waypoints initialized. Number of waypoints is 0!")
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -9219,6 +9289,42 @@ function OPSGROUP:_AddElementByName(unitname)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the template of the group.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #table Template Template to set. Default is from the GROUP.
|
||||||
|
-- @return #OPSGROUP self
|
||||||
|
function OPSGROUP:_SetTemplate(Template)
|
||||||
|
|
||||||
|
self.template=Template or self.group:GetTemplate()
|
||||||
|
|
||||||
|
self:I(self.lid.."Setting group template")
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the template of the group.
|
||||||
|
-- @param #OPSGROUP self
|
||||||
|
-- @param #boolean Copy Get a deep copy of the template.
|
||||||
|
-- @return #table Template table.
|
||||||
|
function OPSGROUP:_GetTemplate(Copy)
|
||||||
|
|
||||||
|
if self.template then
|
||||||
|
|
||||||
|
if Copy then
|
||||||
|
local template=UTILS.DeepCopy(self.template)
|
||||||
|
return template
|
||||||
|
else
|
||||||
|
return self.template
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
self:E(self.lid..string.format("ERROR: No template was set yet!"))
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user