mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
parent
dafbd3f368
commit
76e75505e5
@ -306,7 +306,7 @@ function ARMYGROUP:onafterStatus(From, Event, To)
|
||||
self:I(self.lid..text)
|
||||
end
|
||||
|
||||
self:__Status(-10)
|
||||
self:__Status(-30)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -757,11 +757,6 @@ function ARMYGROUP:_InitGroup()
|
||||
|
||||
-- Radio parameters from template.
|
||||
self.radioOn=false -- Radio is always OFF for ground.
|
||||
|
||||
-- We set some values.
|
||||
self.radioDefault.Freq=133
|
||||
self.radioDefault.Modu=radio.modulation.AM
|
||||
|
||||
self.radio.Freq=133
|
||||
self.radio.Modu=radio.modulation.AM
|
||||
|
||||
|
||||
@ -432,24 +432,24 @@ AUFTRAG.version="0.3.1"
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Clone mission. How? Deepcopy?
|
||||
-- DONE: Option to assign mission to specific squadrons (requires an AIRWING).
|
||||
-- TODO: Option to assign a specific payload for the mission (requires an AIRWING).
|
||||
-- DONE: Add mission start conditions.
|
||||
-- TODO: Add recovery tanker mission for boat ops.
|
||||
-- DONE: Add rescue helo mission for boat ops.
|
||||
-- TODO: Mission success options damaged, destroyed.
|
||||
-- TODO: Recon mission. What input? Set of coordinates?
|
||||
-- NOPE: Clone mission. How? Deepcopy? ==> Create a new auftrag.
|
||||
-- TODO: F10 marker to create new missions.
|
||||
-- TODO: Add recovery tanker mission for boat ops.
|
||||
-- DONE: Option to assign mission to specific squadrons (requires an AIRWING).
|
||||
-- DONE: Add mission start conditions.
|
||||
-- DONE: Add rescue helo mission for boat ops.
|
||||
-- DONE: Mission ROE and ROT.
|
||||
-- DONE: Mission frequency and TACAN.
|
||||
-- TODO: Mission formation, etc.
|
||||
-- DONE: Mission formation, etc.
|
||||
-- DONE: FSM events.
|
||||
-- DONE: F10 marker functions that are updated on Status event.
|
||||
-- TODO: F10 marker to create new missions.
|
||||
-- DONE: Evaluate mission result ==> SUCCESS/FAILURE
|
||||
-- DONE: NewAUTO() NewA2G NewA2A
|
||||
-- DONE: Transport mission.
|
||||
-- TODO: Recon mission. What input? Set of coordinates?
|
||||
-- TODO: Set mission coalition, e.g. for F10 markers. Could be derived from target if target has a coalition.
|
||||
-- DONE: Set mission coalition, e.g. for F10 markers. Could be derived from target if target has a coalition.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- Constructor
|
||||
@ -545,7 +545,7 @@ function AUFTRAG:NewANTISHIP(Target, Altitude)
|
||||
-- DCS task parameters:
|
||||
mission.engageWeaponType=ENUMS.WeaponFlag.Auto
|
||||
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
|
||||
mission.engageAltitude=Altitude or UTILS.FeetToMeters(2000)
|
||||
mission.engageAltitude=UTILS.FeetToMeters(Altitude or 2000)
|
||||
|
||||
-- Mission options:
|
||||
mission.missionTask=ENUMS.MissionTask.ANTISHIPSTRIKE
|
||||
|
||||
@ -1420,13 +1420,17 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
||||
end
|
||||
|
||||
-- Turn on the radio.
|
||||
if self.radioDefault and self.radioDefault.Freq then
|
||||
if self.radioDefault then
|
||||
self:SwitchRadio(self.radioDefault.Freq, self.radioDefault.Modu)
|
||||
else
|
||||
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu)
|
||||
end
|
||||
|
||||
-- Set callsign.
|
||||
if self.callsignDefault and self.callsignDefault.NameSquad then
|
||||
--self:SwitchCallsign(self.callsignDefault.Name, self.callsignNumberDefault)
|
||||
if self.callsignDefault then
|
||||
self:SwitchCallsign(self.callsignDefault.NumberSquad, self.callsignDefault.NumberGroup)
|
||||
else
|
||||
self:SetDefaultCallsign(self.callsign.NumberSquad, self.callsign.NumberGroup)
|
||||
end
|
||||
|
||||
-- TODO: make this input.
|
||||
@ -2530,12 +2534,14 @@ function FLIGHTGROUP:_InitGroup()
|
||||
|
||||
-- Radio parameters from template.
|
||||
self.radioOn=self.template.communication
|
||||
|
||||
self.radio.Freq=self.template.frequency
|
||||
self.radio.Modu=self.template.modulation
|
||||
|
||||
self.radioDefault.Freq=self.radio.Freq
|
||||
self.radioDefault.Modu=self.radio.Modu
|
||||
--TODO callsign from template or getCallsign
|
||||
self.callsign.NumberSquad=self.template.units[1].callsign[1]
|
||||
self.callsign.NumberGroup=self.template.units[1].callsign[2]
|
||||
self.callsign.NumberElement=self.template.units[1].callsign[3] -- First element only
|
||||
self.callsign.NameSquad=UTILS.GetCallsignName(self.callsign.NumberSquad)
|
||||
|
||||
-- Set default formation.
|
||||
if self.ishelo then
|
||||
|
||||
@ -21,6 +21,8 @@
|
||||
-- @field #table Qintowind Queue of "into wind" turns.
|
||||
-- @field #number depth Ordered depth in meters.
|
||||
-- @field #boolean collisionwarning If true, collition warning.
|
||||
-- @field #boolean pathfindingOn If true, enable pathfining.
|
||||
-- @field #boolean ispathfinding If true, group is currently path finding.
|
||||
-- @extends Ops.OpsGroup#OPSGROUP
|
||||
|
||||
--- *Something must be left to chance; nothing is sure in a sea fight above all.* -- Horatio Nelson
|
||||
@ -70,6 +72,7 @@ NAVYGROUP.version="0.1.0"
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- TODO: Collision warning.
|
||||
-- DONE: Detour, add temporary waypoint and resume route.
|
||||
-- DONE: Stop and resume route.
|
||||
-- DONE: Add waypoints.
|
||||
@ -112,6 +115,7 @@ function NAVYGROUP:New(GroupName)
|
||||
self:AddTransition("OnDetour", "DetourReached", "Cruising") -- Group reached the detour coordinate.
|
||||
|
||||
self:AddTransition("*", "CollitionWarning", "*") -- Collision warning.
|
||||
self:AddTransition("*", "ClearAhead", "*") -- Clear ahead.
|
||||
|
||||
self:AddTransition("*", "Dive", "Diving") -- Command a submarine to dive.
|
||||
self:AddTransition("Diving", "Surface", "Cruising") -- Command a submarine to go to the surface.
|
||||
@ -175,6 +179,14 @@ function NAVYGROUP:SetPatrolAdInfinitum(switch)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Enable/disable pathfinding.
|
||||
-- @param #NAVYGROUP self
|
||||
-- @param #boolean switch If true, enable pathfinding.
|
||||
-- @return #NAVYGROUP self
|
||||
function NAVYGROUP:SetPathfinding(Switch)
|
||||
self.pathfindingOn=Switch
|
||||
end
|
||||
|
||||
--- Add a *scheduled* task.
|
||||
-- @param #NAVYGROUP self
|
||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
||||
@ -386,11 +398,19 @@ function NAVYGROUP:onafterStatus(From, Event, To)
|
||||
local freepath=10000
|
||||
local collision=false
|
||||
|
||||
-- Only check if not currently turning.
|
||||
if not self:IsTurning() then
|
||||
|
||||
-- Check free path ahead.
|
||||
freepath=self:_CheckFreePath(freepath, 100)
|
||||
|
||||
if freepath<5000 then
|
||||
self:CollisionWarning()
|
||||
end
|
||||
|
||||
if not self.ispathfinding then
|
||||
|
||||
freepath=self:_CheckFreePath(freepath, 100)
|
||||
|
||||
|
||||
if freepath<5000 then
|
||||
self.ispathfinding=self:_FindPathToNextWaypoint()
|
||||
@ -498,8 +518,8 @@ function NAVYGROUP:onafterStatus(From, Event, To)
|
||||
end
|
||||
|
||||
|
||||
-- Next status update in 10 seconds.
|
||||
self:__Status(-10)
|
||||
-- Next status update in 30 seconds.
|
||||
self:__Status(-30)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -549,8 +569,21 @@ function NAVYGROUP:onafterSpawned(From, Event, To)
|
||||
-- Set default Alarm State.
|
||||
self:SwitchAlarmstate(self.option.Alarm)
|
||||
|
||||
-- Turn TACAN beacon on.
|
||||
if self.tacanDefault then
|
||||
self:SwitchTACAN(self.tacanDefault.Channel, self.tacanDefault.Morse, self.tacanDefault.BeaconName, self.tacanDefault.Band)
|
||||
end
|
||||
|
||||
-- Turn ICLS on.
|
||||
if self.iclsDefault then
|
||||
self:SwitchICLS(self.iclsDefault.Channel, self.iclsDefault.Morse, self.iclsDefault.BeaconName)
|
||||
end
|
||||
|
||||
-- Turn on the radio.
|
||||
if self.radioDefault then
|
||||
self:SwitchRadio(self.radioDefault.Freq, self.radioDefault.Modu)
|
||||
else
|
||||
self:SetDefaultRadio(self.radio.Freq, self.radio.Modu)
|
||||
end
|
||||
|
||||
end
|
||||
@ -1076,9 +1109,6 @@ function NAVYGROUP:_InitGroup()
|
||||
self.radio.Freq=tonumber(self.template.units[1].frequency)/1000000
|
||||
self.radio.Modu=tonumber(self.template.units[1].modulation)
|
||||
|
||||
self.radioDefault.Freq=self.radio.Freq
|
||||
self.radioDefault.Modu=self.radio.Modu
|
||||
|
||||
-- Set default formation. No really applicable for ships.
|
||||
self.optionDefault.Formation="Off Road"
|
||||
self.option.Formation=self.optionDefault.Formation
|
||||
@ -1408,15 +1438,6 @@ function NAVYGROUP:_CheckTurnsIntoWind()
|
||||
|
||||
end
|
||||
|
||||
--- Get default cruise speed.
|
||||
-- @param #NAVYGROUP self
|
||||
-- @return #number Cruise speed (>0) in knots.
|
||||
function NAVYGROUP:GetSpeedCruise()
|
||||
return UTILS.KmphToKnots(self.speedCruise or self.speedmax*0.7)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Check queued turns into wind.
|
||||
-- @param #NAVYGROUP self
|
||||
-- @return #NAVYGROUP.IntoWind Next into wind data.
|
||||
|
||||
@ -2982,7 +2982,7 @@ function OPSGROUP:GetAlarmstate()
|
||||
return self.option.Alarm
|
||||
end
|
||||
|
||||
--- Set default TACAN parameters. AA TACANs are always on "Y" band.
|
||||
--- Set default TACAN parameters.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #number Channel TACAN channel.
|
||||
-- @param #string Morse Morse code. Default "XXX".
|
||||
@ -3009,7 +3009,7 @@ end
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:SwitchTACAN(Channel, Morse, UnitName, Band)
|
||||
|
||||
if self:IsAlive() and Channel then
|
||||
if self:IsAlive() then
|
||||
|
||||
local unit=self.group:GetUnit(1) --Wrapper.Unit#UNIT
|
||||
|
||||
@ -3026,11 +3026,15 @@ function OPSGROUP:SwitchTACAN(Channel, Morse, UnitName, Band)
|
||||
unit=self.group:GetUnit(1)
|
||||
end
|
||||
|
||||
if not Channel then
|
||||
Channel=self.tacanDefault and self.tacanDefault.Channel or nil
|
||||
end
|
||||
|
||||
if not Morse then
|
||||
Morse=self.tacanDefault and self.tacanDefault.Morse or "XXX"
|
||||
end
|
||||
|
||||
if unit and unit:IsAlive() then
|
||||
if unit and unit:IsAlive() and Channel then
|
||||
|
||||
local UnitID=unit:GetID()
|
||||
|
||||
@ -3089,6 +3093,103 @@ function OPSGROUP:TurnOffTACAN()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Set default ICLS parameters.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #number Channel ICLS channel.
|
||||
-- @param #string Morse Morse code. Default "XXX".
|
||||
-- @param #string UnitName Name of the unit acting as beacon.
|
||||
-- @param #string Band ICLS mode. Default is "X" for ground and "Y" for airborne units.
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:SetDefaultICLS(Channel, Morse, UnitName)
|
||||
|
||||
self.iclsDefault={}
|
||||
self.iclsDefault.Channel=Channel
|
||||
self.iclsDefault.Morse=Morse or "XXX"
|
||||
self.iclsDefault.BeaconName=UnitName
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Activate/switch ICLS beacon settings.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #number Channel ICLS Channel.
|
||||
-- @param #string Morse ICLS morse code. Default is the value set in @{#OPSGROUP.SetDefaultICLS} or if not set "XXX".
|
||||
-- @param #string UnitName Name of the unit in the group which should activate the ICLS beacon. Can also be given as #number to specify the unit number. Default is the first unit of the group.
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:SwitchICLS(Channel, Morse, UnitName)
|
||||
|
||||
if self:IsAlive() then
|
||||
|
||||
local unit=self.group:GetUnit(1) --Wrapper.Unit#UNIT
|
||||
|
||||
if UnitName then
|
||||
if type(UnitName)=="number" then
|
||||
unit=self.group:GetUnit(UnitName)
|
||||
else
|
||||
unit=UNIT:FindByName(UnitName)
|
||||
end
|
||||
end
|
||||
|
||||
if not unit then
|
||||
self:E(self.lid.."ERROR: Could not get ICLS unit. Trying first unit in the group.")
|
||||
unit=self.group:GetUnit(1)
|
||||
end
|
||||
|
||||
if not Channel then
|
||||
Channel=self.iclsDefault and self.iclsDefault.Channel or nil
|
||||
end
|
||||
|
||||
if not Morse then
|
||||
Morse=self.iclsDefault and self.iclsDefault.Morse or "XXX"
|
||||
end
|
||||
|
||||
if unit and unit:IsAlive() and Channel then
|
||||
|
||||
local UnitID=unit:GetID()
|
||||
|
||||
-- Activate beacon.
|
||||
unit:CommandActivateICLS(Channel, UnitID, Morse)
|
||||
|
||||
-- Update info.
|
||||
self.icls={}
|
||||
self.icls.Channel=Channel
|
||||
self.icls.Morse=Morse
|
||||
self.icls.Band=Band
|
||||
self.icls.BeaconName=unit:GetName()
|
||||
self.icls.BeaconUnit=unit
|
||||
|
||||
-- ICLS is now on.
|
||||
self.iclsOn=true
|
||||
|
||||
self:I(self.lid..string.format("Switching ICLS to Channel %d Morse %s on unit %s", self.icls.Channel, tostring(self.icls.Morse), self.icls.BeaconName))
|
||||
|
||||
else
|
||||
|
||||
self:E(self.lid.."ERROR: Cound not set ICLS! Unit is not alive.")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Deactivate ICLS beacon.
|
||||
-- @param #OPSGROUP self
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:TurnOffICLS()
|
||||
|
||||
if self.icls.BeaconUnit and self.icls.BeaconUnit:IsAlive() then
|
||||
self.icls.BeaconUnit:CommandDeactivateICLS()
|
||||
end
|
||||
|
||||
self:I(self.lid..string.format("Switching ICLS OFF"))
|
||||
self.iclsOn=false
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Set default Radio frequency and modulation.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #number Frequency Radio frequency in MHz. Default 251 MHz.
|
||||
@ -3096,6 +3197,7 @@ end
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:SetDefaultRadio(Frequency, Modulation)
|
||||
|
||||
self.radioDefault={}
|
||||
self.radioDefault.Freq=Frequency or 251
|
||||
self.radioDefault.Modu=Modulation or radio.modulation.AM
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user