mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1111 from FlightControl-Master/FF/Develop
RECOVERYTANKER v1.0.5
This commit is contained in:
commit
080c496cc3
@ -1319,6 +1319,3 @@ do -- AI
|
||||
AI = {} --#AI
|
||||
|
||||
end -- AI
|
||||
|
||||
|
||||
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
-- @field Core.Point#COORDINATE position Position of carrier. Used to monitor if carrier significantly changed its position and then update the tanker pattern.
|
||||
-- @field #string alias Alias of the spawn group.
|
||||
-- @field #number uid Unique ID of this tanker.
|
||||
-- @field #boolean awacs If true, the groups gets the enroute task AWACS instead of tanker.
|
||||
-- @field #number callsignname Number for the callsign name.
|
||||
-- @field #number callsignnumber Number of the callsign name.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- Recovery Tanker.
|
||||
@ -185,6 +188,37 @@
|
||||
-- The maximum update frequency is set to 10 minutes. You can adjust this by @{#RECOVERYTANKER.SetPatternUpdateInterval}.
|
||||
-- Also the pattern will not be updated whilst the carrier is turning or the tanker is currently refueling another unit.
|
||||
--
|
||||
-- ## Callsign
|
||||
--
|
||||
-- The callsign of the tanker can be set via the @{#RECOVERYTANKER.SetCallsign}(*callsignname*, *callsignnumber*) function. Both parameters are *numbers*.
|
||||
-- The first parameter *callsignname* defines the name (1=Texaco, 2=Arco, 3=Shell). The second (optional) parameter specifies the first number and has to be between 1-9.
|
||||
-- Also see [DCS_enum_callsigns](https://wiki.hoggitworld.com/view/DCS_enum_callsigns) and [DCS_command_setCallsign](https://wiki.hoggitworld.com/view/DCS_command_setCallsign).
|
||||
--
|
||||
-- TexacoStennis:SetCAllsign(CALLSIGN.Tanker.Arco)
|
||||
--
|
||||
-- For convenience, MOOSE has a CALLSIGN enumerator introduced.
|
||||
--
|
||||
-- ## AWACS
|
||||
--
|
||||
-- You can use the class also to have an AWACS orbiting overhead the carrier. This requires to add the @{#RECOVERYTANKER.SetAWACS}() function to the script, which sets the enroute tasks AWACS
|
||||
-- as soon as the aircraft enters its pattern.
|
||||
--
|
||||
-- A simple script could look like this:
|
||||
--
|
||||
-- -- E-2D at USS Stennis spawning in air.
|
||||
-- local awacsStennis=RECOVERYTANKER:New("USS Stennis", "E2D Group")
|
||||
--
|
||||
-- -- Custom settings:
|
||||
-- awacsStennis:SetAWACS()
|
||||
-- awacsStennis:SetCallsign(CALLSIGN.AWACS.Wizard, 1)
|
||||
-- awacsStennis:SetTakeoffAir()
|
||||
-- awacsStennis:SetAltitude(20000)
|
||||
-- awacsStennis:SetRadio(262)
|
||||
-- awacsStennis:SetTACAN(2, "WIZ")
|
||||
--
|
||||
-- -- Start AWACS.
|
||||
-- awacsStennis:Start()
|
||||
--
|
||||
-- # Finite State Machine
|
||||
--
|
||||
-- The implementation uses a Finite State Machine (FSM). This allows the mission designer to hook in to certain events.
|
||||
@ -255,6 +289,9 @@ RECOVERYTANKER = {
|
||||
position = nil,
|
||||
alias = nil,
|
||||
uid = 0,
|
||||
awacs = nil,
|
||||
callsignname = nil,
|
||||
callsignnumber = nil,
|
||||
}
|
||||
|
||||
--- Unique ID (global).
|
||||
@ -263,7 +300,7 @@ RECOVERYTANKER.UID=0
|
||||
|
||||
--- Class version.
|
||||
-- @field #string version
|
||||
RECOVERYTANKER.version="1.0.4"
|
||||
RECOVERYTANKER.version="1.0.5"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -336,6 +373,7 @@ function RECOVERYTANKER:New(carrierunit, tankergroupname)
|
||||
self:SetPatternUpdateDistance()
|
||||
self:SetPatternUpdateHeading()
|
||||
self:SetPatternUpdateInterval()
|
||||
self:SetAWACS(false)
|
||||
|
||||
-- Debug trace.
|
||||
if false then
|
||||
@ -555,6 +593,30 @@ function RECOVERYTANKER:SetHomeBase(airbase)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set that the group takes the roll of an AWACS instead of a refueling tanker.
|
||||
-- @param #RECOVERYTANKER self
|
||||
-- @param #boolean switch If true or nil, set roll AWACS.
|
||||
-- @return #RECOVERYTANKER self
|
||||
function RECOVERYTANKER:SetAWACS(switch)
|
||||
if switch==nil or switch==true then
|
||||
self.awacs=true
|
||||
else
|
||||
self.awacs=false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set callsign of the tanker group.
|
||||
-- @param #RECOVERYTANKER self
|
||||
-- @param #number callsignname Number
|
||||
-- @param #number callsignnumber Number
|
||||
-- @return #RECOVERYTANKER self
|
||||
function RECOVERYTANKER:SetCallsign(callsignname, callsignnumber)
|
||||
self.callsignname=callsignname
|
||||
self.callsignnumber=callsignnumber
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set takeoff type.
|
||||
-- @param #RECOVERYTANKER self
|
||||
-- @param #number takeofftype Takeoff type.
|
||||
@ -813,6 +875,11 @@ function RECOVERYTANKER:onafterStart(From, Event, To)
|
||||
self:_ActivateTACAN(2)
|
||||
end
|
||||
|
||||
-- Set callsign.
|
||||
if self.callsignname then
|
||||
self.tanker:CommandSetCallsign(self.callsignname, self.callsignnumber, 2)
|
||||
end
|
||||
|
||||
-- Get initial orientation and position of carrier.
|
||||
self.orientation=self.carrier:GetOrientationX()
|
||||
self.orientlast=self.carrier:GetOrientationX()
|
||||
@ -877,6 +944,11 @@ function RECOVERYTANKER:onafterStatus(From, Event, To)
|
||||
self:_ActivateTACAN(3)
|
||||
end
|
||||
|
||||
-- Set callsign.
|
||||
if self.callsignname then
|
||||
self.tanker:CommandSetCallsign(self.callsignname, self.callsignnumber, 3)
|
||||
end
|
||||
|
||||
-- Update Pattern in 2 seconds. Need to give a bit time so that the respawned group is in the game.
|
||||
self:__PatternUpdate(2)
|
||||
end
|
||||
@ -976,10 +1048,13 @@ function RECOVERYTANKER:onafterPatternUpdate(From, Event, To)
|
||||
self.tanker:WayPointInitialize(wp)
|
||||
|
||||
-- Task combo.
|
||||
local tasktanker = self.tanker:EnRouteTaskTanker()
|
||||
local taskroll = self.tanker:EnRouteTaskTanker()
|
||||
if self.awacs then
|
||||
taskroll=self.tanker:EnRouteTaskAWACS()
|
||||
end
|
||||
local taskroute = self.tanker:TaskRoute(wp)
|
||||
-- Note that tasktanker has to come first. Otherwise it does not work!
|
||||
local taskcombo = self.tanker:TaskCombo({tasktanker, taskroute})
|
||||
-- Note that the order is important here! tasktanker has to come first. Otherwise it does not work.
|
||||
local taskcombo = self.tanker:TaskCombo({taskroll, taskroute})
|
||||
|
||||
-- Set task.
|
||||
self.tanker:SetTask(taskcombo, 1)
|
||||
@ -1071,7 +1146,12 @@ function RECOVERYTANKER:OnEventEngineShutdown(EventData)
|
||||
|
||||
-- Create tanker beacon and activate TACAN.
|
||||
if self.TACANon then
|
||||
self:_ActivateTACAN(2)
|
||||
self:_ActivateTACAN(3)
|
||||
end
|
||||
|
||||
-- Set callsign.
|
||||
if self.callsignname then
|
||||
self.tanker:CommandSetCallsign(self.callsignname, self.callsignnumber, 3)
|
||||
end
|
||||
|
||||
-- Initial route.
|
||||
|
||||
@ -56,6 +56,68 @@ DCSMAP = {
|
||||
PersianGulf="PersianGulf"
|
||||
}
|
||||
|
||||
|
||||
--- See [DCS_enum_callsigns](https://wiki.hoggitworld.com/view/DCS_enum_callsigns)
|
||||
-- @type CALLSIGN
|
||||
-- @field #table Aircraft Aircraft callsigns.
|
||||
-- @field #table AWACS AWACS callsigns.
|
||||
-- @field #table Tanker Tanker callsigns.
|
||||
-- @field #table JTAC JTAC callsigns.
|
||||
CALLSIGN={
|
||||
-- Aircraft
|
||||
Aircraft={
|
||||
Enfield=1,
|
||||
Springfield=2,
|
||||
Uzi=3,
|
||||
Cold=4,
|
||||
Dodge=5,
|
||||
Ford=6,
|
||||
Chevy=7,
|
||||
Pontiac=8,
|
||||
-- A-10A or A-10C
|
||||
Hawg=9,
|
||||
Boar=10,
|
||||
Pig=11,
|
||||
Tusk=12,
|
||||
},
|
||||
-- AWACS
|
||||
AWACS={
|
||||
Overloard=1,
|
||||
Magic=2,
|
||||
Wizard=3,
|
||||
Focus=4,
|
||||
Darkstar=5,
|
||||
},
|
||||
-- Tanker
|
||||
Tanker={
|
||||
Texaco=1,
|
||||
Arco=2,
|
||||
Shell=3,
|
||||
},
|
||||
-- JTAC
|
||||
JTAC={
|
||||
Axeman=1,
|
||||
Darknight=2,
|
||||
Warrier=3,
|
||||
Pointer=4,
|
||||
Eyeball=5,
|
||||
Moonbeam=6,
|
||||
Whiplash=7,
|
||||
Finger=8,
|
||||
Pinpoint=9,
|
||||
Ferret=10,
|
||||
Shaba=11,
|
||||
Playboy=12,
|
||||
Hammer=13,
|
||||
Jaguar=14,
|
||||
Deathstar=15,
|
||||
Anvil=16,
|
||||
Firefly=17,
|
||||
Mantis=18,
|
||||
Badger=19,
|
||||
},
|
||||
} --#CALLSIGN
|
||||
|
||||
--- Utilities static class.
|
||||
-- @type UTILS
|
||||
UTILS = {
|
||||
|
||||
@ -761,6 +761,27 @@ function CONTROLLABLE:CommandDeactivateICLS(Delay)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set callsign of the CONTROLLABLE. See [DCS_command_setCallsign](https://wiki.hoggitworld.com/view/DCS_command_setCallsign)
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param DCS#CALLSIGN CallName Number corresponding the the callsign identifier you wish this group to be called.
|
||||
-- @param #number CallNumber The number value the group will be referred to as. Only valid numbers are 1-9. For example Uzi **5**-1. Default 1.
|
||||
-- @param #number Delay (Optional) Delay in seconds before the callsign is set. Default is immediately.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:CommandSetCallsign(CallName, CallNumber, Delay)
|
||||
self:F()
|
||||
|
||||
-- Command to set the callsign.
|
||||
local CommandSetCallsign={id='SetCallsign', params={callname=CallName, callnumber=CallNumber or 1}}
|
||||
|
||||
if Delay and Delay>0 then
|
||||
SCHEDULER:New(nil, self.CommandSetCallsign, {self, CallName, CallNumber}, Delay)
|
||||
else
|
||||
self:SetCommand(CommandSetCallsign)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
-- TASKS FOR AIR CONTROLLABLES
|
||||
--- (AIR) Attack a Controllable.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user