mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
33b7a0cef2
@ -3962,6 +3962,30 @@ do
|
||||
function AI_A2A_DISPATCHER:SchedulerCAP( SquadronName )
|
||||
self:CAP( SquadronName )
|
||||
end
|
||||
|
||||
--- Add resources to a Squadron
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
-- @param #string Squadron The squadron name.
|
||||
-- @param #number Amount Number of resources to add.
|
||||
function AI_A2A_DISPATCHER:AddToSquadron(Squadron,Amount)
|
||||
local Squadron = self:GetSquadron(Squadron)
|
||||
if Squadron.ResourceCount then
|
||||
Squadron.ResourceCount = Squadron.ResourceCount + Amount
|
||||
end
|
||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||
end
|
||||
|
||||
--- Remove resources from a Squadron
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
-- @param #string Squadron The squadron name.
|
||||
-- @param #number Amount Number of resources to remove.
|
||||
function AI_A2A_DISPATCHER:RemoveFromSquadron(Squadron,Amount)
|
||||
local Squadron = self:GetSquadron(Squadron)
|
||||
if Squadron.ResourceCount then
|
||||
Squadron.ResourceCount = Squadron.ResourceCount - Amount
|
||||
end
|
||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -4732,3 +4732,26 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
--- Add resources to a Squadron
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #string Squadron The squadron name.
|
||||
-- @param #number Amount Number of resources to add.
|
||||
function AI_A2G_DISPATCHER:AddToSquadron(Squadron,Amount)
|
||||
local Squadron = self:GetSquadron(Squadron)
|
||||
if Squadron.ResourceCount then
|
||||
Squadron.ResourceCount = Squadron.ResourceCount + Amount
|
||||
end
|
||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||
end
|
||||
|
||||
--- Remove resources from a Squadron
|
||||
-- @param #AI_A2G_DISPATCHER self
|
||||
-- @param #string Squadron The squadron name.
|
||||
-- @param #number Amount Number of resources to remove.
|
||||
function AI_A2G_DISPATCHER:RemoveFromSquadron(Squadron,Amount)
|
||||
local Squadron = self:GetSquadron(Squadron)
|
||||
if Squadron.ResourceCount then
|
||||
Squadron.ResourceCount = Squadron.ResourceCount - Amount
|
||||
end
|
||||
self:T({Squadron = Squadron.Name,SquadronResourceCount = Squadron.ResourceCount})
|
||||
end
|
||||
@ -912,7 +912,7 @@ do -- COORDINATE
|
||||
-- The text will reflect the temperature like this:
|
||||
--
|
||||
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
|
||||
-- - For Americain aircraft we link to the imperial system - Degrees Farenheit (°F)
|
||||
-- - For American aircraft we link to the imperial system - Degrees Farenheit (°F)
|
||||
--
|
||||
-- A text containing a pressure will look like this:
|
||||
--
|
||||
@ -958,7 +958,7 @@ do -- COORDINATE
|
||||
-- The text will contain always the pressure in hPa and:
|
||||
--
|
||||
-- - For Russian and European aircraft using the metric system - hPa and mmHg
|
||||
-- - For Americain and European aircraft we link to the imperial system - hPa and inHg
|
||||
-- - For American and European aircraft we link to the imperial system - hPa and inHg
|
||||
--
|
||||
-- A text containing a pressure will look like this:
|
||||
--
|
||||
@ -1051,7 +1051,7 @@ do -- COORDINATE
|
||||
-- The text will reflect the wind like this:
|
||||
--
|
||||
-- - For Russian and European aircraft using the metric system - Wind direction in degrees (°) and wind speed in meters per second (mps).
|
||||
-- - For Americain aircraft we link to the imperial system - Wind direction in degrees (°) and wind speed in knots per second (kps).
|
||||
-- - For American aircraft we link to the imperial system - Wind direction in degrees (°) and wind speed in knots per second (kps).
|
||||
--
|
||||
-- A text containing a pressure will look like this:
|
||||
--
|
||||
@ -1883,82 +1883,101 @@ do -- COORDINATE
|
||||
-- @param #COORDINATE self
|
||||
-- @param Utilities.Utils#BIGSMOKEPRESET preset Smoke preset (1=small smoke and fire, 2=medium smoke and fire, 3=large smoke and fire, 4=huge smoke and fire, 5=small smoke, 6=medium smoke, 7=large smoke, 8=huge smoke).
|
||||
-- @param #number density (Optional) Smoke density. Number in [0,...,1]. Default 0.5.
|
||||
function COORDINATE:BigSmokeAndFire( preset, density )
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeAndFire( preset, density, name )
|
||||
self:F2( { preset=preset, density=density } )
|
||||
density=density or 0.5
|
||||
trigger.action.effectSmokeBig( self:GetVec3(), preset, density )
|
||||
self.firename = name or "Fire-"..math.random(1,10000)
|
||||
trigger.action.effectSmokeBig( self:GetVec3(), preset, density, self.firename )
|
||||
end
|
||||
|
||||
--- Stop big smoke and fire at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #string name (Optional) Name of the fire to stop it, if not using the same COORDINATE object.
|
||||
function COORDINATE:StopBigSmokeAndFire( name )
|
||||
self:F2( { name = name } )
|
||||
name = name or self.firename
|
||||
trigger.action.effectSmokeStop( name )
|
||||
end
|
||||
|
||||
--- Small smoke and fire at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeAndFireSmall( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeAndFireSmall( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, density, name)
|
||||
end
|
||||
|
||||
--- Medium smoke and fire at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeAndFireMedium( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeAndFireMedium( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, density, name)
|
||||
end
|
||||
|
||||
--- Large smoke and fire at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeAndFireLarge( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeAndFireLarge( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, density, name)
|
||||
end
|
||||
|
||||
--- Huge smoke and fire at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeAndFireHuge( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeAndFireHuge( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, density, name)
|
||||
end
|
||||
|
||||
--- Small smoke at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeSmall( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeSmall( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, density, name)
|
||||
end
|
||||
|
||||
--- Medium smoke at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeMedium( density )
|
||||
-- @param number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeMedium( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, density, name)
|
||||
end
|
||||
|
||||
--- Large smoke at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeLarge( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeLarge( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, density,name)
|
||||
end
|
||||
|
||||
--- Huge smoke at the coordinate.
|
||||
-- @param #COORDINATE self
|
||||
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
function COORDINATE:BigSmokeHuge( density )
|
||||
-- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
|
||||
-- @param #string name (Optional) Name of the fire to stop it later again if not using the same COORDINATE object. Defaults to "Fire-" plus a random 5-digit-number.
|
||||
function COORDINATE:BigSmokeHuge( density, name )
|
||||
self:F2( { density=density } )
|
||||
density=density or 0.5
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, density)
|
||||
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, density,name)
|
||||
end
|
||||
|
||||
--- Flares the point in a color.
|
||||
@ -2105,7 +2124,7 @@ do -- COORDINATE
|
||||
--- Line to all.
|
||||
-- Creates a line on the F10 map from one point to another.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE Endpoint COORDIANTE to where the line is drawn.
|
||||
-- @param #COORDINATE Endpoint COORDINATE to where the line is drawn.
|
||||
-- @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 #number Alpha Transparency [0,1]. Default 1.
|
||||
@ -2162,7 +2181,7 @@ do -- COORDINATE
|
||||
--- Rectangle to all. Creates a rectangle on the map from the COORDINATE in one corner to the end COORDINATE in the opposite corner.
|
||||
-- Creates a line on the F10 map from one point to another.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE Endpoint COORDIANTE in the opposite corner.
|
||||
-- @param #COORDINATE Endpoint COORDINATE in the opposite corner.
|
||||
-- @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 #number Alpha Transparency [0,1]. Default 1.
|
||||
@ -2190,9 +2209,9 @@ do -- COORDINATE
|
||||
|
||||
--- Creates a shape defined by 4 points on the F10 map. The first point is the current COORDINATE. The remaining three points need to be specified.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE Coord2 Second COORDIANTE of the quad shape.
|
||||
-- @param #COORDINATE Coord3 Third COORDIANTE of the quad shape.
|
||||
-- @param #COORDINATE Coord4 Fourth COORDIANTE of the quad shape.
|
||||
-- @param #COORDINATE Coord2 Second COORDINATE of the quad shape.
|
||||
-- @param #COORDINATE Coord3 Third COORDINATE of the quad shape.
|
||||
-- @param #COORDINATE Coord4 Fourth COORDINATE of the quad shape.
|
||||
-- @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 #number Alpha Transparency [0,1]. Default 1.
|
||||
@ -3007,7 +3026,7 @@ do -- POINT_VEC3
|
||||
-- @type POINT_VEC3
|
||||
-- @field #number x The x coordinate in 3D space.
|
||||
-- @field #number y The y coordinate in 3D space.
|
||||
-- @field #number z The z coordiante in 3D space.
|
||||
-- @field #number z The z COORDINATE in 3D space.
|
||||
-- @field Utilities.Utils#SMOKECOLOR SmokeColor
|
||||
-- @field Utilities.Utils#FLARECOLOR FlareColor
|
||||
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType
|
||||
|
||||
@ -326,7 +326,7 @@ do -- SET_BASE
|
||||
|
||||
for _,Object in pairs(union.Set) do
|
||||
if self:IsIncludeObject(Object) and SetB:IsIncludeObject(Object) then
|
||||
intersection:AddObject(intersection)
|
||||
intersection:AddObject(Object)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
-- * Starting from a FARP or Airbase
|
||||
-- * Dedicated MASH zone
|
||||
-- * Some FSM functions to include in your mission scripts
|
||||
-- * Limit number of available helos
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@ -45,7 +46,8 @@
|
||||
-- @field #table rescued Track number of rescued pilot.
|
||||
-- @field #boolean autoonoff Only send a helo when no human heli pilots are available.
|
||||
-- @field Core.Set#SET_CLIENT playerset Track if alive heli pilots are available.
|
||||
--
|
||||
-- @field #boolean limithelos limit available number of helos going on mission (defaults to true)
|
||||
-- @field #number helonumber number of helos available (default: 3)
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
|
||||
@ -81,7 +83,9 @@
|
||||
-- my_aicsar.maxdistance -- maximum operational distance in meters. Defaults to 50NM or 92.6km
|
||||
-- my_aicsar.rescuezoneradius -- landing zone around downed pilot. Defaults to 200m
|
||||
-- my_aicsar.autoonoff -- stop operations when human helicopter pilots are around. Defaults to true.
|
||||
-- my_aicsar.verbose -- text messages coalition side about ongoing operations. Defaults to true.
|
||||
-- my_aicsar.verbose -- text messages to own coalition about ongoing operations. Defaults to true.
|
||||
-- my_aicsarlimithelos -- limit available number of helos going on mission (defaults to true)
|
||||
-- my_aicsar.helonumber -- number of helos available (default: 3)
|
||||
--
|
||||
-- ## Radio options
|
||||
--
|
||||
@ -148,7 +152,7 @@
|
||||
-- @field #AICSAR
|
||||
AICSAR = {
|
||||
ClassName = "AICSAR",
|
||||
version = "0.0.3",
|
||||
version = "0.0.4",
|
||||
lid = "",
|
||||
coalition = coalition.side.BLUE,
|
||||
template = "",
|
||||
@ -176,6 +180,8 @@ AICSAR = {
|
||||
DCSFrequency = 243,
|
||||
DCSModulation = radio.modulation.AM,
|
||||
DCSRadioGroup = nil,
|
||||
limithelos = true,
|
||||
helonumber = 3,
|
||||
}
|
||||
|
||||
-- TODO Messages
|
||||
@ -290,6 +296,10 @@ function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
|
||||
|
||||
self.MGRS_Accuracy = 2
|
||||
|
||||
-- limit number of available helos at the same time
|
||||
self.limithelos = true
|
||||
self.helonumber = 3
|
||||
|
||||
-- Set some string id for output to DCS.log file.
|
||||
self.lid=string.format("%s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
|
||||
|
||||
@ -311,7 +321,9 @@ function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
|
||||
|
||||
self:__Start(math.random(2,5))
|
||||
|
||||
self:I(self.lid .. " AI CSAR Starting")
|
||||
local text = string.format("%sAICSAR Version %s Starting",self.lid,self.version)
|
||||
|
||||
self:I(text)
|
||||
|
||||
------------------------
|
||||
--- Pseudo Functions ---
|
||||
@ -606,6 +618,18 @@ function AICSAR:_CheckHelos()
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] Count helos queue
|
||||
-- @param #AICSAR self
|
||||
-- @return #number Number of helos on mission
|
||||
function AICSAR:_CountHelos()
|
||||
self:T(self.lid .. "_CountHelos")
|
||||
local count = 0
|
||||
for _index,_helo in pairs(self.helos) do
|
||||
count = count + 1
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
--- [Internal] Check pilot queue for next mission
|
||||
-- @param #AICSAR self
|
||||
-- @return #AICSAR self
|
||||
@ -614,11 +638,29 @@ function AICSAR:_CheckQueue()
|
||||
for _index, _pilot in pairs(self.pilotqueue) do
|
||||
local classname = _pilot.ClassName and _pilot.ClassName or "NONE"
|
||||
local name = _pilot.GroupName and _pilot.GroupName or "NONE"
|
||||
local helocount = self:_CountHelos()
|
||||
--self:T("Looking at " .. classname .. " " .. name)
|
||||
-- find one w/o mission
|
||||
if _pilot and _pilot.ClassName and _pilot.ClassName == "GROUP" then
|
||||
local flightgroup = self.helos[_index] -- Ops.FlightGroup#FLIGHTGROUP
|
||||
-- rescued?
|
||||
if self:_CheckInMashZone(_pilot) then
|
||||
self:T("Pilot" .. _pilot.GroupName .. " rescued!")
|
||||
_pilot:Destroy(false)
|
||||
self.pilotqueue[_index] = nil
|
||||
self.rescued[_index] = true
|
||||
self:__PilotRescued(2)
|
||||
if flightgroup then
|
||||
flightgroup.AICSARReserved = false
|
||||
end
|
||||
end -- end rescued
|
||||
-- has no mission assigned?
|
||||
if not _pilot.AICSAR then
|
||||
-- helo available?
|
||||
if self.limithelos and helocount >= self.helonumber then
|
||||
-- none free
|
||||
break
|
||||
end -- end limit
|
||||
_pilot.AICSAR = {}
|
||||
_pilot.AICSAR.Status = "Initiated"
|
||||
_pilot.AICSAR.Boarded = false
|
||||
@ -626,23 +668,14 @@ function AICSAR:_CheckQueue()
|
||||
break
|
||||
else
|
||||
-- update status from OPSGROUP
|
||||
local flightgroup = self.helos[_index] -- Ops.FlightGroup#FLIGHTGROUP
|
||||
if flightgroup then
|
||||
local state = flightgroup:GetState()
|
||||
_pilot.AICSAR.Status = state
|
||||
end
|
||||
--self:T("Flight for " .. _pilot.GroupName .. " in state " .. state)
|
||||
if self:_CheckInMashZone(_pilot) then
|
||||
self:T("Pilot" .. _pilot.GroupName .. " rescued!")
|
||||
_pilot:Destroy(false)
|
||||
self.pilotqueue[_index] = nil
|
||||
self.rescued[_index] = true
|
||||
self:__PilotRescued(2)
|
||||
flightgroup.AICSARReserved = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end -- end has mission
|
||||
end -- end if pilot
|
||||
end -- end loop
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ AUTOLASE = {
|
||||
|
||||
--- AUTOLASE class version.
|
||||
-- @field #string version
|
||||
AUTOLASE.version = "0.0.10"
|
||||
AUTOLASE.version = "0.0.11"
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Begin Functional.Autolase.lua
|
||||
@ -736,20 +736,22 @@ function AUTOLASE:onafterMonitor(From, Event, To)
|
||||
local contact = _contact -- Ops.Intelligence#INTEL.Contact
|
||||
local grp = contact.group
|
||||
local coord = contact.position
|
||||
local reccename = contact.recce
|
||||
local reccename = contact.recce or "none"
|
||||
local reccegrp = UNIT:FindByName(reccename)
|
||||
local reccecoord = reccegrp:GetCoordinate()
|
||||
local distance = math.floor(reccecoord:Get3DDistance(coord))
|
||||
local text = string.format("%s of %s | Distance %d km | Threatlevel %d",contact.attribute, contact.groupname, math.floor(distance/1000), contact.threatlevel)
|
||||
report:Add(text)
|
||||
self:T(text)
|
||||
if self.debug then self:I(text) end
|
||||
lines = lines + 1
|
||||
-- sort out groups beyond sight
|
||||
local lasedistance = self:GetLosFromUnit(reccegrp)
|
||||
if grp:IsGround() and lasedistance >= distance then
|
||||
table.insert(groupsbythreat,{contact.group,contact.threatlevel})
|
||||
self.RecceNames[contact.groupname] = contact.recce
|
||||
if reccegrp then
|
||||
local reccecoord = reccegrp:GetCoordinate()
|
||||
local distance = math.floor(reccecoord:Get3DDistance(coord))
|
||||
local text = string.format("%s of %s | Distance %d km | Threatlevel %d",contact.attribute, contact.groupname, math.floor(distance/1000), contact.threatlevel)
|
||||
report:Add(text)
|
||||
self:T(text)
|
||||
if self.debug then self:I(text) end
|
||||
lines = lines + 1
|
||||
-- sort out groups beyond sight
|
||||
local lasedistance = self:GetLosFromUnit(reccegrp)
|
||||
if grp:IsGround() and lasedistance >= distance then
|
||||
table.insert(groupsbythreat,{contact.group,contact.threatlevel})
|
||||
self.RecceNames[contact.groupname] = contact.recce
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -714,7 +714,7 @@ do -- DETECTION_BASE
|
||||
if self.RejectZones then
|
||||
for RejectZoneID, RejectZone in pairs( self.RejectZones ) do
|
||||
local RejectZone = RejectZone -- Core.Zone#ZONE_BASE
|
||||
if RejectZone:IsPointVec2InZone( DetectedObjectVec2 ) == true then
|
||||
if RejectZone:IsVec2InZone( DetectedObjectVec2 ) == true then
|
||||
DetectionAccepted = false
|
||||
end
|
||||
end
|
||||
@ -759,7 +759,7 @@ do -- DETECTION_BASE
|
||||
local ZoneProbability = ZoneData[2] -- #number
|
||||
ZoneProbability = ZoneProbability * 30 / 300
|
||||
|
||||
if ZoneObject:IsPointVec2InZone( DetectedObjectVec2 ) == true then
|
||||
if ZoneObject:IsVec2InZone( DetectedObjectVec2 ) == true then
|
||||
local Probability = math.random() -- Selects a number between 0 and 1
|
||||
--self:T( { Probability, ZoneProbability } )
|
||||
if Probability > ZoneProbability then
|
||||
@ -2485,13 +2485,13 @@ do -- DETECTION_AREAS
|
||||
-- ## 4.1) Retrieve the Detected Unit Sets and Detected Zones
|
||||
--
|
||||
-- The methods to manage the DetectedItems[].Set(s) are implemented in @{Functional.Detection#DECTECTION_BASE} and
|
||||
-- the methods to manage the DetectedItems[].Zone(s) is implemented in @{Functional.Detection#DETECTION_AREAS}.
|
||||
-- the methods to manage the DetectedItems[].Zone(s) are implemented in @{Functional.Detection#DETECTION_AREAS}.
|
||||
--
|
||||
-- Retrieve the DetectedItems[].Set with the method @{Functional.Detection#DETECTION_BASE.GetDetectedSet}(). A @{Core.Set#SET_UNIT} object will be returned.
|
||||
--
|
||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZones}().
|
||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZoneCount}().
|
||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_BASE.GetDetectionZone}() with a given index.
|
||||
-- Retrieve the formed @{Zone@ZONE_UNIT}s as a result of the grouping the detected units within the DetectionZoneRange, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZones}().
|
||||
-- To understand the amount of zones created, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneCount}().
|
||||
-- If you want to obtain a specific zone from the DetectedZones, use the method @{Functional.Detection#DETECTION_AREAS.GetDetectionZoneByID}() with a given index.
|
||||
--
|
||||
-- ## 4.4) Flare or Smoke detected units
|
||||
--
|
||||
@ -2535,7 +2535,49 @@ do -- DETECTION_AREAS
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Retrieve set of detected zones.
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @return Core.Set#SET_ZONE The @{Set} of ZONE_UNIT objects detected.
|
||||
function DETECTION_AREAS:GetDetectionZones()
|
||||
local zoneset = SET_ZONE:New()
|
||||
for _ID,_Item in pairs (self.DetectedItems) do
|
||||
local item = _Item -- #DETECTION_BASE.DetectedItem
|
||||
if item.Zone then
|
||||
zoneset:AddZone(item.Zone)
|
||||
end
|
||||
end
|
||||
return zoneset
|
||||
end
|
||||
|
||||
--- Retrieve a specific zone by its ID (number)
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @param #number ID
|
||||
-- @return Core.Zone#ZONE_UNIT The zone or nil if it does not exist
|
||||
function DETECTION_AREAS:GetDetectionZoneByID(ID)
|
||||
local zone = nil
|
||||
for _ID,_Item in pairs (self.DetectedItems) do
|
||||
local item = _Item -- #DETECTION_BASE.DetectedItem
|
||||
if item.ID == ID then
|
||||
zone = item.Zone
|
||||
break
|
||||
end
|
||||
end
|
||||
return zone
|
||||
end
|
||||
|
||||
--- Retrieve number of detected zones.
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @return #number The number of zones.
|
||||
function DETECTION_AREAS:GetDetectionZoneCount()
|
||||
local zoneset = 0
|
||||
for _ID,_Item in pairs (self.DetectedItems) do
|
||||
if _Item.Zone then
|
||||
zoneset = zoneset + 1
|
||||
end
|
||||
end
|
||||
return zoneset
|
||||
end
|
||||
|
||||
--- Report summary of a detected item using a given numeric index.
|
||||
-- @param #DETECTION_AREAS self
|
||||
-- @param #DETECTION_BASE.DetectedItem DetectedItem The DetectedItem.
|
||||
|
||||
@ -99,6 +99,9 @@
|
||||
-- @field #string rangecontrolrelayname Name of relay unit.
|
||||
-- @field #string instructorrelayname Name of relay unit.
|
||||
-- @field #string soundpath Path inside miz file where the sound files are located. Default is "Range Soundfiles/".
|
||||
-- @field #boolean targetsheet If true, players can save their target sheets. Rangeboss will not work if targetsheets do not save.
|
||||
-- @field #string targetpath Path where to save the target sheets.
|
||||
-- @field #string targetprefix File prefix for target sheet files.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- *Don't only practice your art, but force your way into its secrets; art deserves that, for it and knowledge can raise man to the Divine.* - Ludwig van Beethoven
|
||||
@ -267,6 +270,7 @@
|
||||
--
|
||||
-- The [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is (implicitly) used in this example.
|
||||
--
|
||||
--
|
||||
-- # Debugging
|
||||
--
|
||||
-- In case you have problems, it is always a good idea to have a look at your DCS log file. You find it in your "Saved Games" folder, so for example in
|
||||
@ -333,7 +337,10 @@ RANGE={
|
||||
instructor = nil,
|
||||
rangecontrolfreq = nil,
|
||||
rangecontrol = nil,
|
||||
soundpath = "Range Soundfiles/"
|
||||
soundpath = "Range Soundfiles/",
|
||||
targetsheet = nil,
|
||||
targetpath = nil,
|
||||
targetprefix = nil,
|
||||
}
|
||||
|
||||
--- Default range parameters.
|
||||
@ -881,6 +888,22 @@ function RANGE:SetAutosaveOff()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Enable saving of player's target sheets and specify an optional directory path.
|
||||
-- @param #RANGE self
|
||||
-- @param #string path (Optional) Path where to save the target sheets.
|
||||
-- @param #string prefix (Optional) Prefix for target sheet files. File name will be saved as *prefix_aircrafttype-0001.csv*, *prefix_aircrafttype-0002.csv*, etc.
|
||||
-- @return #RANGE self
|
||||
function RANGE:SetTargetSheet(path, prefix)
|
||||
if io then
|
||||
self.targetsheet=true
|
||||
self.targetpath=path
|
||||
self.targetprefix=prefix
|
||||
else
|
||||
self:E(self.lid.."ERROR: io is not desanitized. Cannot save target sheet.")
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set messages to examiner. The examiner will receive messages from all clients.
|
||||
-- @param #RANGE self
|
||||
-- @param #string examinergroupname Name of the group of the examiner.
|
||||
@ -1877,7 +1900,7 @@ function RANGE:OnEventShot(EventData)
|
||||
result.roundsFired=0 --Rangeboss Edit
|
||||
result.roundsHit=0 --Rangeboss Edit
|
||||
result.roundsQuality="N/A" --Rangeboss Edit
|
||||
result.rangename = self.rangename
|
||||
result.rangename = self.rangename
|
||||
|
||||
-- Add to table.
|
||||
table.insert(_results, result)
|
||||
@ -1932,15 +1955,24 @@ function RANGE:_SaveTargetSheet(_playername, result) --RangeBoss Specific Functi
|
||||
end
|
||||
end
|
||||
|
||||
local path=lfs.writedir()..[[Logs\]]
|
||||
|
||||
-- Set path or default.
|
||||
local path=self.targetpath
|
||||
if lfs then
|
||||
path=path or lfs.writedir()..[[Logs\]]
|
||||
end
|
||||
|
||||
-- Create unused file name.
|
||||
local filename=nil
|
||||
for i=1,9999 do
|
||||
|
||||
-- Create file name
|
||||
if self.targetprefix then
|
||||
filename=string.format("%s_%s-%04d.csv", self.targetprefix, playerData.actype, i)
|
||||
else
|
||||
local name=UTILS.ReplaceIllegalCharacters(_playername, "_")
|
||||
filename=string.format("RANGERESULTS-%s_Targetsheet-%s-%04d.csv",self.rangename,name, i)
|
||||
--end
|
||||
filename=string.format("RANGERESULTS-%s_Targetsheet-%s-%04d.csv",self.rangename,name, i)
|
||||
end
|
||||
|
||||
-- Set path.
|
||||
if path~=nil then
|
||||
@ -2975,9 +3007,12 @@ function RANGE:_CheckInZone(_unitName)
|
||||
Straferesult.roundsHit= _result.hits
|
||||
Straferesult.roundsQuality=_result.text
|
||||
Straferesult.strafeAccuracy=accur
|
||||
Straferesult.rangename=self.rangename
|
||||
|
||||
Straferesult.rangename=self.rangename
|
||||
|
||||
-- Save trap sheet.
|
||||
if playerData.targeton and self.targetsheet then
|
||||
self:_SaveTargetSheet(_playername, result)
|
||||
end
|
||||
--RangeBoss edit for strafe data saved to file
|
||||
|
||||
-- Voice over.
|
||||
@ -3084,7 +3119,8 @@ function RANGE:_AddF10Commands(_unitName)
|
||||
-- MISSION LEVEL --
|
||||
-------------------
|
||||
|
||||
_rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root)
|
||||
--_rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10Root)
|
||||
_rangePath = MENU_GROUP:New(group,"On the Range")
|
||||
|
||||
else
|
||||
|
||||
@ -3094,55 +3130,57 @@ function RANGE:_AddF10Commands(_unitName)
|
||||
|
||||
-- Main F10 menu: F10/On the Range/<Range Name>/
|
||||
if RANGE.MenuF10[_gid] == nil then
|
||||
RANGE.MenuF10[_gid]=missionCommands.addSubMenuForGroup(_gid, "On the Range")
|
||||
--RANGE.MenuF10[_gid]=missionCommands.addSubMenuForGroup(_gid, "On the Range")
|
||||
RANGE.MenuF10[_gid]=MENU_GROUP:New(group,"On the Range")
|
||||
end
|
||||
_rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10[_gid])
|
||||
|
||||
--_rangePath = missionCommands.addSubMenuForGroup(_gid, self.rangename, RANGE.MenuF10[_gid])
|
||||
_rangePath = MENU_GROUP:New(group,self.rangename,RANGE.MenuF10[_gid])
|
||||
end
|
||||
|
||||
|
||||
local _statsPath = missionCommands.addSubMenuForGroup(_gid, "Statistics", _rangePath)
|
||||
local _markPath = missionCommands.addSubMenuForGroup(_gid, "Mark Targets", _rangePath)
|
||||
local _settingsPath = missionCommands.addSubMenuForGroup(_gid, "My Settings", _rangePath)
|
||||
local _infoPath = missionCommands.addSubMenuForGroup(_gid, "Range Info", _rangePath)
|
||||
|
||||
local _statsPath = MENU_GROUP:New(group,"Statistics",_rangePath)
|
||||
local _markPath = MENU_GROUP:New(group,"Mark Targets",_rangePath)
|
||||
local _settingsPath = MENU_GROUP:New(group,"My Settings",_rangePath)
|
||||
local _infoPath = MENU_GROUP:New(group,"Range Info",_rangePath)
|
||||
|
||||
-- F10/On the Range/<Range Name>/My Settings/
|
||||
local _mysmokePath = missionCommands.addSubMenuForGroup(_gid, "Smoke Color", _settingsPath)
|
||||
local _myflarePath = missionCommands.addSubMenuForGroup(_gid, "Flare Color", _settingsPath)
|
||||
local _mysmokePath = MENU_GROUP:New(group,"Smoke Color",_settingsPath)
|
||||
local _myflarePath = MENU_GROUP:New(group,"Flare Color",_settingsPath)
|
||||
|
||||
-- F10/On the Range/<Range Name>/Mark Targets/
|
||||
missionCommands.addCommandForGroup(_gid, "Mark On Map", _markPath, self._MarkTargetsOnMap, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Illuminate Range", _markPath, self._IlluminateBombTargets, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Smoke Strafe Pits", _markPath, self._SmokeStrafeTargetBoxes, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Smoke Strafe Tgts", _markPath, self._SmokeStrafeTargets, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Smoke Bomb Tgts", _markPath, self._SmokeBombTargets, self, _unitName)
|
||||
--F10/On the Range/<Range Name>/Mark Targets/
|
||||
local _MoMap = MENU_GROUP_COMMAND:New(group,"Mark On Map",_markPath,self._MarkTargetsOnMap, self, _unitName)
|
||||
local _IllRng = MENU_GROUP_COMMAND:New(group, "Illuminate Range", _markPath, self._IlluminateBombTargets, self, _unitName)
|
||||
local _SSpit = MENU_GROUP_COMMAND:New(group, "Smoke Strafe Pits", _markPath, self._SmokeStrafeTargetBoxes, self, _unitName)
|
||||
local _SStgts = MENU_GROUP_COMMAND:New(group, "Smoke Strafe Tgts", _markPath, self._SmokeStrafeTargets, self, _unitName)
|
||||
local _SBtgts = MENU_GROUP_COMMAND:New(group, "Smoke Bomb Tgts", _markPath, self._SmokeBombTargets, self, _unitName)
|
||||
-- F10/On the Range/<Range Name>/Stats/
|
||||
missionCommands.addCommandForGroup(_gid, "All Strafe Results", _statsPath, self._DisplayStrafePitResults, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "All Bombing Results", _statsPath, self._DisplayBombingResults, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "My Strafe Results", _statsPath, self._DisplayMyStrafePitResults, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "My Bomb Results", _statsPath, self._DisplayMyBombingResults, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Reset All Stats", _statsPath, self._ResetRangeStats, self, _unitName)
|
||||
local _AllSR = MENU_GROUP_COMMAND:New(group, "All Strafe Results", _statsPath, self._DisplayStrafePitResults, self, _unitName)
|
||||
local _AllBR = MENU_GROUP_COMMAND:New(group, "All Bombing Results", _statsPath, self._DisplayBombingResults, self, _unitName)
|
||||
local _MySR = MENU_GROUP_COMMAND:New(group, "My Strafe Results", _statsPath, self._DisplayMyStrafePitResults, self, _unitName)
|
||||
local _MyBR = MENU_GROUP_COMMAND:New(group, "My Bomb Results", _statsPath, self._DisplayMyBombingResults, self, _unitName)
|
||||
local _ResetST = MENU_GROUP_COMMAND:New(group, "Reset All Stats", _statsPath, self._ResetRangeStats, self, _unitName)
|
||||
-- F10/On the Range/<Range Name>/My Settings/Smoke Color/
|
||||
missionCommands.addCommandForGroup(_gid, "Blue Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Blue)
|
||||
missionCommands.addCommandForGroup(_gid, "Green Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Green)
|
||||
missionCommands.addCommandForGroup(_gid, "Orange Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Orange)
|
||||
missionCommands.addCommandForGroup(_gid, "Red Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Red)
|
||||
missionCommands.addCommandForGroup(_gid, "White Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.White)
|
||||
local _BlueSM = MENU_GROUP_COMMAND:New(group, "Blue Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Blue)
|
||||
local _GrSM = MENU_GROUP_COMMAND:New(group, "Green Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Green)
|
||||
local _OrSM = MENU_GROUP_COMMAND:New(group, "Orange Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Orange)
|
||||
local _ReSM = MENU_GROUP_COMMAND:New(group, "Red Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Red)
|
||||
local _WhSm = MENU_GROUP_COMMAND:New(group, "White Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.White)
|
||||
-- F10/On the Range/<Range Name>/My Settings/Flare Color/
|
||||
missionCommands.addCommandForGroup(_gid, "Green Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Green)
|
||||
missionCommands.addCommandForGroup(_gid, "Red Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Red)
|
||||
missionCommands.addCommandForGroup(_gid, "White Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.White)
|
||||
missionCommands.addCommandForGroup(_gid, "Yellow Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Yellow)
|
||||
local _GrFl = MENU_GROUP_COMMAND:New(group, "Green Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Green)
|
||||
local _ReFl = MENU_GROUP_COMMAND:New(group, "Red Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Red)
|
||||
local _WhFl = MENU_GROUP_COMMAND:New(group, "White Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.White)
|
||||
local _YeFl = MENU_GROUP_COMMAND:New(group, "Yellow Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Yellow)
|
||||
-- F10/On the Range/<Range Name>/My Settings/
|
||||
missionCommands.addCommandForGroup(_gid, "Smoke Delay On/Off", _settingsPath, self._SmokeBombDelayOnOff, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Smoke Impact On/Off", _settingsPath, self._SmokeBombImpactOnOff, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Flare Hits On/Off", _settingsPath, self._FlareDirectHitsOnOff, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "All Messages On/Off", _settingsPath, self._MessagesToPlayerOnOff, self, _unitName)
|
||||
local _SmDe = MENU_GROUP_COMMAND:New(group, "Smoke Delay On/Off", _settingsPath, self._SmokeBombDelayOnOff, self, _unitName)
|
||||
local _SmIm = MENU_GROUP_COMMAND:New(group, "Smoke Impact On/Off", _settingsPath, self._SmokeBombImpactOnOff, self, _unitName)
|
||||
local _FlHi = MENU_GROUP_COMMAND:New(group, "Flare Hits On/Off", _settingsPath, self._FlareDirectHitsOnOff, self, _unitName)
|
||||
local _AlMeA = MENU_GROUP_COMMAND:New(group, "All Messages On/Off", _settingsPath, self._MessagesToPlayerOnOff, self, _unitName)
|
||||
local _TrpSh = MENU_GROUP_COMMAND:New(group, "Targetsheet On/Off", _settingsPath, self._TargetsheetOnOff, self, _unitName)
|
||||
|
||||
-- F10/On the Range/<Range Name>/Range Information
|
||||
missionCommands.addCommandForGroup(_gid, "General Info", _infoPath, self._DisplayRangeInfo, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Weather Report", _infoPath, self._DisplayRangeWeather, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Bombing Targets", _infoPath, self._DisplayBombTargets, self, _unitName)
|
||||
missionCommands.addCommandForGroup(_gid, "Strafe Pits", _infoPath, self._DisplayStrafePits, self, _unitName)
|
||||
local _WeIn = MENU_GROUP_COMMAND:New(group, "General Info", _infoPath, self._DisplayRangeInfo, self, _unitName)
|
||||
local _WeRe = MENU_GROUP_COMMAND:New(group, "Weather Report", _infoPath, self._DisplayRangeWeather, self, _unitName)
|
||||
local _BoTgtgs = MENU_GROUP_COMMAND:New(group, "Bombing Targets", _infoPath, self._DisplayBombTargets, self, _unitName)
|
||||
local _StrPits = MENU_GROUP_COMMAND:New(group, "Strafe Pits", _infoPath, self._DisplayStrafePits, self, _unitName):Refresh()
|
||||
end
|
||||
else
|
||||
self:E(self.id.."Could not find group or group ID in AddF10Menu() function. Unit name: ".._unitName)
|
||||
@ -3468,6 +3506,49 @@ function RANGE:_MessagesToPlayerOnOff(unitname)
|
||||
|
||||
end
|
||||
|
||||
--- Targetsheet saves if player on or off.
|
||||
-- @param #RANGE self
|
||||
-- @param #string _unitname Name of the player unit.
|
||||
function RANGE:_TargetsheetOnOff(_unitname)
|
||||
self:F2(_unitname)
|
||||
|
||||
-- Get player unit and player name.
|
||||
local unit, playername = self:_GetPlayerUnitAndName(_unitname)
|
||||
|
||||
-- Check if we have a player.
|
||||
if unit and playername then
|
||||
|
||||
-- Player data.
|
||||
local playerData=self.PlayerSettings[playername] --#RANGE.PlayerData
|
||||
|
||||
if playerData then
|
||||
|
||||
-- Check if option is enabled at all.
|
||||
local text=""
|
||||
if self.targetsheet then
|
||||
|
||||
-- Invert current setting.
|
||||
playerData.targeton=not playerData.targeton
|
||||
|
||||
-- Inform player.
|
||||
if playerData.targeton==true then
|
||||
text=string.format("roger, your targetsheets are now SAVED.")
|
||||
else
|
||||
text=string.format("affirm, your targetsheets are NOT SAVED.")
|
||||
end
|
||||
|
||||
else
|
||||
text="negative, target sheet data recorder is broken on this range."
|
||||
end
|
||||
|
||||
-- Message to player.
|
||||
--self:MessageToPlayer(playerData, text, nil, playerData.name, 5)
|
||||
self:_DisplayMessageToGroup(unit,text,5,false,false)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- Toggle status of flaring direct hits of range targets.
|
||||
-- @param #RANGE self
|
||||
-- @param #string unitname Name of the player unit.
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
-- @module Ops.CSAR
|
||||
-- @image OPS_CSAR.jpg
|
||||
|
||||
-- Date: Dec 2021
|
||||
-- Date: Feb 2022
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||
@ -244,10 +244,11 @@ CSAR.AircraftType["Mi-8MT"] = 12
|
||||
CSAR.AircraftType["Mi-24P"] = 8
|
||||
CSAR.AircraftType["Mi-24V"] = 8
|
||||
CSAR.AircraftType["Bell-47"] = 2
|
||||
CSAR.AircraftType["UH-60L"] = 10
|
||||
|
||||
--- CSAR class version.
|
||||
-- @field #string version
|
||||
CSAR.version="1.0.1r1"
|
||||
CSAR.version="1.0.3"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@ -696,7 +697,7 @@ end
|
||||
|
||||
--- (Internal) Function to add a CSAR object into the scene at a zone coordinate. For mission designers wanting to add e.g. PoWs to the scene.
|
||||
-- @param #CSAR self
|
||||
-- @param #string _zone Name of the zone.
|
||||
-- @param #string _zone Name of the zone. Can also be passed as a (normal, round) ZONE object.
|
||||
-- @param #number _coalition Coalition.
|
||||
-- @param #string _description (optional) Description.
|
||||
-- @param #boolean _randomPoint (optional) Random yes or no.
|
||||
@ -707,7 +708,16 @@ end
|
||||
function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage, unitname, typename, forcedesc)
|
||||
self:T(self.lid .. " _SpawnCsarAtZone")
|
||||
local freq = self:_GenerateADFFrequency()
|
||||
local _triggerZone = ZONE:New(_zone) -- trigger to use as reference position
|
||||
|
||||
local _triggerZone = nil
|
||||
if type(_zone) == "string" then
|
||||
_triggerZone = ZONE:New(_zone) -- trigger to use as reference position
|
||||
elseif type(_zone) == "table" and _zone.ClassName then
|
||||
if string.find(_zone.ClassName, "ZONE",1) then
|
||||
_triggerZone = _zone -- is already a zone
|
||||
end
|
||||
end
|
||||
|
||||
if _triggerZone == nil then
|
||||
self:E(self.lid.."ERROR: Can\'t find zone called " .. _zone, 10)
|
||||
return
|
||||
@ -741,7 +751,7 @@ end
|
||||
|
||||
--- Function to add a CSAR object into the scene at a zone coordinate. For mission designers wanting to add e.g. PoWs to the scene.
|
||||
-- @param #CSAR self
|
||||
-- @param #string Zone Name of the zone.
|
||||
-- @param #string Zone Name of the zone. Can also be passed as a (normal, round) ZONE object.
|
||||
-- @param #number Coalition Coalition.
|
||||
-- @param #string Description (optional) Description.
|
||||
-- @param #boolean RandomPoint (optional) Random yes or no.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -400,7 +400,7 @@ function OPSZONE:SetMarkZone(Switch, ReadOnly)
|
||||
self.marker:Remove()
|
||||
end
|
||||
self.marker=nil
|
||||
self.marker=false
|
||||
--self.marker=false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
--- This module contains derived utilities taken from the MIST framework, which are excellent tools to be reused in an OO environment.
|
||||
--- This module contains derived utilities taken from the MIST framework, as well as a lot of added helpers from the MOOSE community.
|
||||
--
|
||||
-- ### Authors:
|
||||
--
|
||||
@ -7,6 +7,7 @@
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- * FlightControl : Rework to OO framework.
|
||||
-- * And many more
|
||||
--
|
||||
-- @module Utils
|
||||
-- @image MOOSE.JPG
|
||||
@ -130,6 +131,62 @@ CALLSIGN={
|
||||
Dublin=9,
|
||||
Perth=10,
|
||||
},
|
||||
F16={
|
||||
Viper=9,
|
||||
Venom=10,
|
||||
Lobo=11,
|
||||
Cowboy=12,
|
||||
Python=13,
|
||||
Rattler=14,
|
||||
Panther=15,
|
||||
Wolf=16,
|
||||
Weasel=17,
|
||||
Wild=18,
|
||||
Ninja=19,
|
||||
Jedi=20,
|
||||
},
|
||||
F18={
|
||||
Hornet=9,
|
||||
Squid=10,
|
||||
Ragin=11,
|
||||
Roman=12,
|
||||
Sting=13,
|
||||
Jury=14,
|
||||
Jokey=15,
|
||||
Ram=16,
|
||||
Hawk=17,
|
||||
Devil=18,
|
||||
Check=19,
|
||||
Snake=20,
|
||||
},
|
||||
F15E={
|
||||
Dude=9,
|
||||
Thud=10,
|
||||
Gunny=11,
|
||||
Trek=12,
|
||||
Sniper=13,
|
||||
Sled=14,
|
||||
Best=15,
|
||||
Jazz=16,
|
||||
Rage=17,
|
||||
Tahoe=18,
|
||||
},
|
||||
B1B={
|
||||
Bone=9,
|
||||
Dark=10,
|
||||
Vader=11
|
||||
},
|
||||
B52={
|
||||
Buff=9,
|
||||
Dump=10,
|
||||
Kenworth=11,
|
||||
},
|
||||
TransportAircraft={
|
||||
Heavy=9,
|
||||
Trash=10,
|
||||
Cargo=11,
|
||||
Ascot=12,
|
||||
},
|
||||
} --#CALLSIGN
|
||||
|
||||
--- Utilities static class.
|
||||
@ -1683,10 +1740,21 @@ function UTILS.IsLoadingDoorOpen( unit_name )
|
||||
BASE:T(unit_name .. " door is open")
|
||||
ret_val = true
|
||||
end
|
||||
|
||||
if string.find(type_name, "UH-60L") and (unit:getDrawArgumentValue(401) == 1) or (unit:getDrawArgumentValue(402) == 1) then
|
||||
BASE:T(unit_name .. " cargo door is open")
|
||||
ret_val = true
|
||||
end
|
||||
|
||||
if string.find(type_name, "UH-60L" ) and unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(400) == 1 then
|
||||
BASE:T(unit_name .. " front door(s) are open")
|
||||
ret_val = true
|
||||
end
|
||||
|
||||
if ret_val == false then
|
||||
BASE:T(unit_name .. " all doors are closed")
|
||||
end
|
||||
|
||||
return ret_val
|
||||
|
||||
end -- nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user