Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank 2022-02-08 08:53:03 +01:00
commit 33b7a0cef2
12 changed files with 1400 additions and 214 deletions

View File

@ -3963,6 +3963,30 @@ do
self:CAP( SquadronName ) self:CAP( SquadronName )
end 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 end
do do

View File

@ -4732,3 +4732,26 @@ do
end end
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

View File

@ -912,7 +912,7 @@ do -- COORDINATE
-- The text will reflect the temperature like this: -- The text will reflect the temperature like this:
-- --
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C) -- - 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: -- 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: -- The text will contain always the pressure in hPa and:
-- --
-- - For Russian and European aircraft using the metric system - hPa and mmHg -- - 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: -- A text containing a pressure will look like this:
-- --
@ -1051,7 +1051,7 @@ do -- COORDINATE
-- The text will reflect the wind like this: -- 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 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: -- A text containing a pressure will look like this:
-- --
@ -1883,82 +1883,101 @@ do -- COORDINATE
-- @param #COORDINATE self -- @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 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. -- @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 } ) self:F2( { preset=preset, density=density } )
density=density or 0.5 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 end
--- Small smoke and fire at the coordinate. --- Small smoke and fire at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeAndFireSmall( 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:BigSmokeAndFireSmall( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, density) self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmokeAndFire, density, name)
end end
--- Medium smoke and fire at the coordinate. --- Medium smoke and fire at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeAndFireMedium( 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:BigSmokeAndFireMedium( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, density) self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmokeAndFire, density, name)
end end
--- Large smoke and fire at the coordinate. --- Large smoke and fire at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeAndFireLarge( 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:BigSmokeAndFireLarge( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, density) self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmokeAndFire, density, name)
end end
--- Huge smoke and fire at the coordinate. --- Huge smoke and fire at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeAndFireHuge( 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:BigSmokeAndFireHuge( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, density) self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmokeAndFire, density, name)
end end
--- Small smoke at the coordinate. --- Small smoke at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeSmall( 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:BigSmokeSmall( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, density) self:BigSmokeAndFire(BIGSMOKEPRESET.SmallSmoke, density, name)
end end
--- Medium smoke at the coordinate. --- Medium smoke at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeMedium( 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:BigSmokeMedium( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, density) self:BigSmokeAndFire(BIGSMOKEPRESET.MediumSmoke, density, name)
end end
--- Large smoke at the coordinate. --- Large smoke at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeLarge( 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:BigSmokeLarge( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, density) self:BigSmokeAndFire(BIGSMOKEPRESET.LargeSmoke, density,name)
end end
--- Huge smoke at the coordinate. --- Huge smoke at the coordinate.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @number density (Optional) Smoke density. Number between 0 and 1. Default 0.5. -- @param #number density (Optional) Smoke density. Number between 0 and 1. Default 0.5.
function COORDINATE:BigSmokeHuge( 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:BigSmokeHuge( density, name )
self:F2( { density=density } ) self:F2( { density=density } )
density=density or 0.5 density=density or 0.5
self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, density) self:BigSmokeAndFire(BIGSMOKEPRESET.HugeSmoke, density,name)
end end
--- Flares the point in a color. --- Flares the point in a color.
@ -2105,7 +2124,7 @@ do -- COORDINATE
--- Line to all. --- Line to all.
-- Creates a line on the F10 map from one point to another. -- Creates a line on the F10 map from one point to another.
-- @param #COORDINATE self -- @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 #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.
@ -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. --- 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. -- Creates a line on the F10 map from one point to another.
-- @param #COORDINATE self -- @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 #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.
@ -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. --- 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 self
-- @param #COORDINATE Coord2 Second COORDIANTE of the quad shape. -- @param #COORDINATE Coord2 Second COORDINATE of the quad shape.
-- @param #COORDINATE Coord3 Third COORDIANTE of the quad shape. -- @param #COORDINATE Coord3 Third COORDINATE of the quad shape.
-- @param #COORDINATE Coord4 Fourth COORDIANTE 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 #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.
@ -3007,7 +3026,7 @@ do -- POINT_VEC3
-- @type POINT_VEC3 -- @type POINT_VEC3
-- @field #number x The x coordinate in 3D space. -- @field #number x The x coordinate in 3D space.
-- @field #number y The y 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#SMOKECOLOR SmokeColor
-- @field Utilities.Utils#FLARECOLOR FlareColor -- @field Utilities.Utils#FLARECOLOR FlareColor
-- @field #POINT_VEC3.RoutePointAltType RoutePointAltType -- @field #POINT_VEC3.RoutePointAltType RoutePointAltType

View File

@ -326,7 +326,7 @@ do -- SET_BASE
for _,Object in pairs(union.Set) do for _,Object in pairs(union.Set) do
if self:IsIncludeObject(Object) and SetB:IsIncludeObject(Object) then if self:IsIncludeObject(Object) and SetB:IsIncludeObject(Object) then
intersection:AddObject(intersection) intersection:AddObject(Object)
end end
end end

View File

@ -8,6 +8,7 @@
-- * Starting from a FARP or Airbase -- * Starting from a FARP or Airbase
-- * Dedicated MASH zone -- * Dedicated MASH zone
-- * Some FSM functions to include in your mission scripts -- * 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 #table rescued Track number of rescued pilot.
-- @field #boolean autoonoff Only send a helo when no human heli pilots are available. -- @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 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 -- @extends Core.Fsm#FSM
@ -81,7 +83,9 @@
-- my_aicsar.maxdistance -- maximum operational distance in meters. Defaults to 50NM or 92.6km -- 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.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.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 -- ## Radio options
-- --
@ -148,7 +152,7 @@
-- @field #AICSAR -- @field #AICSAR
AICSAR = { AICSAR = {
ClassName = "AICSAR", ClassName = "AICSAR",
version = "0.0.3", version = "0.0.4",
lid = "", lid = "",
coalition = coalition.side.BLUE, coalition = coalition.side.BLUE,
template = "", template = "",
@ -176,6 +180,8 @@ AICSAR = {
DCSFrequency = 243, DCSFrequency = 243,
DCSModulation = radio.modulation.AM, DCSModulation = radio.modulation.AM,
DCSRadioGroup = nil, DCSRadioGroup = nil,
limithelos = true,
helonumber = 3,
} }
-- TODO Messages -- TODO Messages
@ -290,6 +296,10 @@ function AICSAR:New(Alias,Coalition,Pilottemplate,Helotemplate,FARP,MASHZone)
self.MGRS_Accuracy = 2 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. -- 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") 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:__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 --- --- Pseudo Functions ---
@ -606,6 +618,18 @@ function AICSAR:_CheckHelos()
return self return self
end 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 --- [Internal] Check pilot queue for next mission
-- @param #AICSAR self -- @param #AICSAR self
-- @return #AICSAR self -- @return #AICSAR self
@ -614,11 +638,29 @@ function AICSAR:_CheckQueue()
for _index, _pilot in pairs(self.pilotqueue) do for _index, _pilot in pairs(self.pilotqueue) do
local classname = _pilot.ClassName and _pilot.ClassName or "NONE" local classname = _pilot.ClassName and _pilot.ClassName or "NONE"
local name = _pilot.GroupName and _pilot.GroupName or "NONE" local name = _pilot.GroupName and _pilot.GroupName or "NONE"
local helocount = self:_CountHelos()
--self:T("Looking at " .. classname .. " " .. name) --self:T("Looking at " .. classname .. " " .. name)
-- find one w/o mission -- find one w/o mission
if _pilot and _pilot.ClassName and _pilot.ClassName == "GROUP" then 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? -- has no mission assigned?
if not _pilot.AICSAR then 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 = {}
_pilot.AICSAR.Status = "Initiated" _pilot.AICSAR.Status = "Initiated"
_pilot.AICSAR.Boarded = false _pilot.AICSAR.Boarded = false
@ -626,23 +668,14 @@ function AICSAR:_CheckQueue()
break break
else else
-- update status from OPSGROUP -- update status from OPSGROUP
local flightgroup = self.helos[_index] -- Ops.FlightGroup#FLIGHTGROUP
if flightgroup then if flightgroup then
local state = flightgroup:GetState() local state = flightgroup:GetState()
_pilot.AICSAR.Status = state _pilot.AICSAR.Status = state
end end
--self:T("Flight for " .. _pilot.GroupName .. " in state " .. state) --self:T("Flight for " .. _pilot.GroupName .. " in state " .. state)
if self:_CheckInMashZone(_pilot) then end -- end has mission
self:T("Pilot" .. _pilot.GroupName .. " rescued!") end -- end if pilot
_pilot:Destroy(false) end -- end loop
self.pilotqueue[_index] = nil
self.rescued[_index] = true
self:__PilotRescued(2)
flightgroup.AICSARReserved = false
end
end
end
end
return self return self
end end

View File

@ -109,7 +109,7 @@ AUTOLASE = {
--- AUTOLASE class version. --- AUTOLASE class version.
-- @field #string version -- @field #string version
AUTOLASE.version = "0.0.10" AUTOLASE.version = "0.0.11"
------------------------------------------------------------------- -------------------------------------------------------------------
-- Begin Functional.Autolase.lua -- Begin Functional.Autolase.lua
@ -736,8 +736,9 @@ function AUTOLASE:onafterMonitor(From, Event, To)
local contact = _contact -- Ops.Intelligence#INTEL.Contact local contact = _contact -- Ops.Intelligence#INTEL.Contact
local grp = contact.group local grp = contact.group
local coord = contact.position local coord = contact.position
local reccename = contact.recce local reccename = contact.recce or "none"
local reccegrp = UNIT:FindByName(reccename) local reccegrp = UNIT:FindByName(reccename)
if reccegrp then
local reccecoord = reccegrp:GetCoordinate() local reccecoord = reccegrp:GetCoordinate()
local distance = math.floor(reccecoord:Get3DDistance(coord)) 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) local text = string.format("%s of %s | Distance %d km | Threatlevel %d",contact.attribute, contact.groupname, math.floor(distance/1000), contact.threatlevel)
@ -752,6 +753,7 @@ function AUTOLASE:onafterMonitor(From, Event, To)
self.RecceNames[contact.groupname] = contact.recce self.RecceNames[contact.groupname] = contact.recce
end end
end end
end
self.GroupsByThreat = groupsbythreat self.GroupsByThreat = groupsbythreat

View File

@ -714,7 +714,7 @@ do -- DETECTION_BASE
if self.RejectZones then if self.RejectZones then
for RejectZoneID, RejectZone in pairs( self.RejectZones ) do for RejectZoneID, RejectZone in pairs( self.RejectZones ) do
local RejectZone = RejectZone -- Core.Zone#ZONE_BASE local RejectZone = RejectZone -- Core.Zone#ZONE_BASE
if RejectZone:IsPointVec2InZone( DetectedObjectVec2 ) == true then if RejectZone:IsVec2InZone( DetectedObjectVec2 ) == true then
DetectionAccepted = false DetectionAccepted = false
end end
end end
@ -759,7 +759,7 @@ do -- DETECTION_BASE
local ZoneProbability = ZoneData[2] -- #number local ZoneProbability = ZoneData[2] -- #number
ZoneProbability = ZoneProbability * 30 / 300 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 local Probability = math.random() -- Selects a number between 0 and 1
--self:T( { Probability, ZoneProbability } ) --self:T( { Probability, ZoneProbability } )
if Probability > ZoneProbability then if Probability > ZoneProbability then
@ -2485,13 +2485,13 @@ do -- DETECTION_AREAS
-- ## 4.1) Retrieve the Detected Unit Sets and Detected Zones -- ## 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[].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 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}(). -- 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_BASE.GetDetectionZoneCount}(). -- 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_BASE.GetDetectionZone}() with a given index. -- 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 -- ## 4.4) Flare or Smoke detected units
-- --
@ -2535,6 +2535,48 @@ do -- DETECTION_AREAS
return self return self
end 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. --- Report summary of a detected item using a given numeric index.
-- @param #DETECTION_AREAS self -- @param #DETECTION_AREAS self

View File

@ -99,6 +99,9 @@
-- @field #string rangecontrolrelayname Name of relay unit. -- @field #string rangecontrolrelayname Name of relay unit.
-- @field #string instructorrelayname 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 #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 -- @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 --- *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. -- The [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is (implicitly) used in this example.
-- --
--
-- # Debugging -- # 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 -- 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, instructor = nil,
rangecontrolfreq = nil, rangecontrolfreq = nil,
rangecontrol = nil, rangecontrol = nil,
soundpath = "Range Soundfiles/" soundpath = "Range Soundfiles/",
targetsheet = nil,
targetpath = nil,
targetprefix = nil,
} }
--- Default range parameters. --- Default range parameters.
@ -881,6 +888,22 @@ function RANGE:SetAutosaveOff()
return self return self
end 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. --- Set messages to examiner. The examiner will receive messages from all clients.
-- @param #RANGE self -- @param #RANGE self
-- @param #string examinergroupname Name of the group of the examiner. -- @param #string examinergroupname Name of the group of the examiner.
@ -1932,15 +1955,24 @@ function RANGE:_SaveTargetSheet(_playername, result) --RangeBoss Specific Functi
end end
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. -- Create unused file name.
local filename=nil local filename=nil
for i=1,9999 do 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, "_") local name=UTILS.ReplaceIllegalCharacters(_playername, "_")
filename=string.format("RANGERESULTS-%s_Targetsheet-%s-%04d.csv",self.rangename,name, i) filename=string.format("RANGERESULTS-%s_Targetsheet-%s-%04d.csv",self.rangename,name, i)
--end end
-- Set path. -- Set path.
if path~=nil then if path~=nil then
@ -2977,7 +3009,10 @@ function RANGE:_CheckInZone(_unitName)
Straferesult.strafeAccuracy=accur 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) self:_SaveTargetSheet(_playername, result)
end
--RangeBoss edit for strafe data saved to file --RangeBoss edit for strafe data saved to file
-- Voice over. -- Voice over.
@ -3084,7 +3119,8 @@ function RANGE:_AddF10Commands(_unitName)
-- MISSION LEVEL -- -- 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 else
@ -3094,55 +3130,57 @@ function RANGE:_AddF10Commands(_unitName)
-- Main F10 menu: F10/On the Range/<Range Name>/ -- Main F10 menu: F10/On the Range/<Range Name>/
if RANGE.MenuF10[_gid] == nil then 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 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 end
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)
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)
-- F10/On the Range/<Range Name>/My Settings/ -- F10/On the Range/<Range Name>/My Settings/
local _mysmokePath = missionCommands.addSubMenuForGroup(_gid, "Smoke Color", _settingsPath) local _mysmokePath = MENU_GROUP:New(group,"Smoke Color",_settingsPath)
local _myflarePath = missionCommands.addSubMenuForGroup(_gid, "Flare Color", _settingsPath) local _myflarePath = MENU_GROUP:New(group,"Flare Color",_settingsPath)
--F10/On the Range/<Range Name>/Mark Targets/ --F10/On the Range/<Range Name>/Mark Targets/
missionCommands.addCommandForGroup(_gid, "Mark On Map", _markPath, self._MarkTargetsOnMap, self, _unitName) local _MoMap = MENU_GROUP_COMMAND:New(group,"Mark On Map",_markPath,self._MarkTargetsOnMap, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Illuminate Range", _markPath, self._IlluminateBombTargets, self, _unitName) local _IllRng = MENU_GROUP_COMMAND:New(group, "Illuminate Range", _markPath, self._IlluminateBombTargets, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Smoke Strafe Pits", _markPath, self._SmokeStrafeTargetBoxes, self, _unitName) local _SSpit = MENU_GROUP_COMMAND:New(group, "Smoke Strafe Pits", _markPath, self._SmokeStrafeTargetBoxes, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Smoke Strafe Tgts", _markPath, self._SmokeStrafeTargets, self, _unitName) local _SStgts = MENU_GROUP_COMMAND:New(group, "Smoke Strafe Tgts", _markPath, self._SmokeStrafeTargets, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Smoke Bomb Tgts", _markPath, self._SmokeBombTargets, self, _unitName) local _SBtgts = MENU_GROUP_COMMAND:New(group, "Smoke Bomb Tgts", _markPath, self._SmokeBombTargets, self, _unitName)
-- F10/On the Range/<Range Name>/Stats/ -- F10/On the Range/<Range Name>/Stats/
missionCommands.addCommandForGroup(_gid, "All Strafe Results", _statsPath, self._DisplayStrafePitResults, self, _unitName) local _AllSR = MENU_GROUP_COMMAND:New(group, "All Strafe Results", _statsPath, self._DisplayStrafePitResults, self, _unitName)
missionCommands.addCommandForGroup(_gid, "All Bombing Results", _statsPath, self._DisplayBombingResults, self, _unitName) local _AllBR = MENU_GROUP_COMMAND:New(group, "All Bombing Results", _statsPath, self._DisplayBombingResults, self, _unitName)
missionCommands.addCommandForGroup(_gid, "My Strafe Results", _statsPath, self._DisplayMyStrafePitResults, self, _unitName) local _MySR = MENU_GROUP_COMMAND:New(group, "My Strafe Results", _statsPath, self._DisplayMyStrafePitResults, self, _unitName)
missionCommands.addCommandForGroup(_gid, "My Bomb Results", _statsPath, self._DisplayMyBombingResults, self, _unitName) local _MyBR = MENU_GROUP_COMMAND:New(group, "My Bomb Results", _statsPath, self._DisplayMyBombingResults, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Reset All Stats", _statsPath, self._ResetRangeStats, 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/ -- F10/On the Range/<Range Name>/My Settings/Smoke Color/
missionCommands.addCommandForGroup(_gid, "Blue Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Blue) local _BlueSM = MENU_GROUP_COMMAND:New(group, "Blue Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Blue)
missionCommands.addCommandForGroup(_gid, "Green Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Green) local _GrSM = MENU_GROUP_COMMAND:New(group, "Green Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Green)
missionCommands.addCommandForGroup(_gid, "Orange Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Orange) local _OrSM = MENU_GROUP_COMMAND:New(group, "Orange Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Orange)
missionCommands.addCommandForGroup(_gid, "Red Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Red) local _ReSM = MENU_GROUP_COMMAND:New(group, "Red Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.Red)
missionCommands.addCommandForGroup(_gid, "White Smoke", _mysmokePath, self._playersmokecolor, self, _unitName, SMOKECOLOR.White) 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/ -- F10/On the Range/<Range Name>/My Settings/Flare Color/
missionCommands.addCommandForGroup(_gid, "Green Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Green) local _GrFl = MENU_GROUP_COMMAND:New(group, "Green Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Green)
missionCommands.addCommandForGroup(_gid, "Red Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Red) local _ReFl = MENU_GROUP_COMMAND:New(group, "Red Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Red)
missionCommands.addCommandForGroup(_gid, "White Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.White) local _WhFl = MENU_GROUP_COMMAND:New(group, "White Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.White)
missionCommands.addCommandForGroup(_gid, "Yellow Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Yellow) local _YeFl = MENU_GROUP_COMMAND:New(group, "Yellow Flares", _myflarePath, self._playerflarecolor, self, _unitName, FLARECOLOR.Yellow)
-- F10/On the Range/<Range Name>/My Settings/ -- F10/On the Range/<Range Name>/My Settings/
missionCommands.addCommandForGroup(_gid, "Smoke Delay On/Off", _settingsPath, self._SmokeBombDelayOnOff, self, _unitName) local _SmDe = MENU_GROUP_COMMAND:New(group, "Smoke Delay On/Off", _settingsPath, self._SmokeBombDelayOnOff, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Smoke Impact On/Off", _settingsPath, self._SmokeBombImpactOnOff, self, _unitName) local _SmIm = MENU_GROUP_COMMAND:New(group, "Smoke Impact On/Off", _settingsPath, self._SmokeBombImpactOnOff, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Flare Hits On/Off", _settingsPath, self._FlareDirectHitsOnOff, self, _unitName) local _FlHi = MENU_GROUP_COMMAND:New(group, "Flare Hits On/Off", _settingsPath, self._FlareDirectHitsOnOff, self, _unitName)
missionCommands.addCommandForGroup(_gid, "All Messages On/Off", _settingsPath, self._MessagesToPlayerOnOff, 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 -- F10/On the Range/<Range Name>/Range Information
missionCommands.addCommandForGroup(_gid, "General Info", _infoPath, self._DisplayRangeInfo, self, _unitName) local _WeIn = MENU_GROUP_COMMAND:New(group, "General Info", _infoPath, self._DisplayRangeInfo, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Weather Report", _infoPath, self._DisplayRangeWeather, self, _unitName) local _WeRe = MENU_GROUP_COMMAND:New(group, "Weather Report", _infoPath, self._DisplayRangeWeather, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Bombing Targets", _infoPath, self._DisplayBombTargets, self, _unitName) local _BoTgtgs = MENU_GROUP_COMMAND:New(group, "Bombing Targets", _infoPath, self._DisplayBombTargets, self, _unitName)
missionCommands.addCommandForGroup(_gid, "Strafe Pits", _infoPath, self._DisplayStrafePits, self, _unitName) local _StrPits = MENU_GROUP_COMMAND:New(group, "Strafe Pits", _infoPath, self._DisplayStrafePits, self, _unitName):Refresh()
end end
else else
self:E(self.id.."Could not find group or group ID in AddF10Menu() function. Unit name: ".._unitName) 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 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. --- Toggle status of flaring direct hits of range targets.
-- @param #RANGE self -- @param #RANGE self
-- @param #string unitname Name of the player unit. -- @param #string unitname Name of the player unit.

View File

@ -22,7 +22,7 @@
-- @module Ops.CSAR -- @module Ops.CSAR
-- @image OPS_CSAR.jpg -- @image OPS_CSAR.jpg
-- Date: Dec 2021 -- Date: Feb 2022
------------------------------------------------------------------------- -------------------------------------------------------------------------
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM --- **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-24P"] = 8
CSAR.AircraftType["Mi-24V"] = 8 CSAR.AircraftType["Mi-24V"] = 8
CSAR.AircraftType["Bell-47"] = 2 CSAR.AircraftType["Bell-47"] = 2
CSAR.AircraftType["UH-60L"] = 10
--- CSAR class version. --- CSAR class version.
-- @field #string version -- @field #string version
CSAR.version="1.0.1r1" CSAR.version="1.0.3"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list -- 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. --- (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 #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 #number _coalition Coalition.
-- @param #string _description (optional) Description. -- @param #string _description (optional) Description.
-- @param #boolean _randomPoint (optional) Random yes or no. -- @param #boolean _randomPoint (optional) Random yes or no.
@ -707,7 +708,16 @@ end
function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage, unitname, typename, forcedesc) function CSAR:_SpawnCsarAtZone( _zone, _coalition, _description, _randomPoint, _nomessage, unitname, typename, forcedesc)
self:T(self.lid .. " _SpawnCsarAtZone") self:T(self.lid .. " _SpawnCsarAtZone")
local freq = self:_GenerateADFFrequency() 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 if _triggerZone == nil then
self:E(self.lid.."ERROR: Can\'t find zone called " .. _zone, 10) self:E(self.lid.."ERROR: Can\'t find zone called " .. _zone, 10)
return 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. --- 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 #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 #number Coalition Coalition.
-- @param #string Description (optional) Description. -- @param #string Description (optional) Description.
-- @param #boolean RandomPoint (optional) Random yes or no. -- @param #boolean RandomPoint (optional) Random yes or no.

File diff suppressed because it is too large Load Diff

View File

@ -400,7 +400,7 @@ function OPSZONE:SetMarkZone(Switch, ReadOnly)
self.marker:Remove() self.marker:Remove()
end end
self.marker=nil self.marker=nil
self.marker=false --self.marker=false
end end
return self return self
end end

View File

@ -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: -- ### Authors:
-- --
@ -7,6 +7,7 @@
-- ### Contributions: -- ### Contributions:
-- --
-- * FlightControl : Rework to OO framework. -- * FlightControl : Rework to OO framework.
-- * And many more
-- --
-- @module Utils -- @module Utils
-- @image MOOSE.JPG -- @image MOOSE.JPG
@ -130,6 +131,62 @@ CALLSIGN={
Dublin=9, Dublin=9,
Perth=10, 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 } --#CALLSIGN
--- Utilities static class. --- Utilities static class.
@ -1684,9 +1741,20 @@ function UTILS.IsLoadingDoorOpen( unit_name )
ret_val = true ret_val = true
end 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 if ret_val == false then
BASE:T(unit_name .. " all doors are closed") BASE:T(unit_name .. " all doors are closed")
end end
return ret_val return ret_val
end -- nil end -- nil