This commit is contained in:
Applevangelist 2022-11-17 13:21:57 +01:00
parent 416ea2490c
commit 45b78a2e26
5 changed files with 62 additions and 9 deletions

View File

@ -504,7 +504,7 @@ do -- COORDINATE
local gotscenery=false
local function EvaluateZone(ZoneObject)
BASE:I({ZoneObject})
if ZoneObject then
-- Get category of scanned object.

View File

@ -6814,7 +6814,7 @@ do -- SET_SCENERY
-- @param Core.Zone#ZONE Zone The zone to be scanned. Can be a ZONE_RADIUS (round) or a ZONE_POLYGON (e.g. Quad-Point)
-- @return #SET_SCENERY
function SET_SCENERY:NewFromZone(Zone)
local zone = Zone -- Core.Zone#ZONE_POLYGON
local zone = Zone -- Core.Zone#ZONE_RADIUS
if type(Zone) == "string" then
zone = ZONE:FindByName(Zone)
end

View File

@ -927,7 +927,7 @@ function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
local ZoneCoord = self:GetCoordinate()
local ZoneRadius = self:GetRadius()
self:F({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()})
--self:F({ZoneCoord = ZoneCoord, ZoneRadius = ZoneRadius, ZoneCoordLL = ZoneCoord:ToStringLLDMS()})
local SphereSearch = {
id = world.VolumeType.SPHERE,

View File

@ -114,6 +114,7 @@
-- mycsar.countryneutral = country.id.UN_PEACEKEEPERS
-- mycsar.topmenuname = "CSAR" -- set the menu entry name
-- mycsar.ADFRadioPwr = 1000 -- ADF Beacons sending with 1KW as default
-- mycsar.PilotWeight = 80 -- Loaded pilots weigh 80kgs each
--
-- ## 2.1 Experimental Features
--
@ -233,6 +234,7 @@ CSAR = {
allheligroupset = nil,
topmenuname = "CSAR",
ADFRadioPwr = 1000,
PilotWeight = 80,
}
--- Downed pilots info.
@ -270,7 +272,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
--- CSAR class version.
-- @field #string version
CSAR.version="1.0.15"
CSAR.version="1.0.16"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list
@ -278,7 +280,7 @@ CSAR.version="1.0.15"
-- DONE: SRS Integration (to be tested)
-- TODO: Maybe - add option to smoke/flare closest MASH
-- TODO: shagrat Add cargoWeight to helicopter when pilot boarded
-- DONE: shagrat Add cargoWeight to helicopter when pilot boarded
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Constructor
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -418,10 +420,13 @@ function CSAR:New(Coalition, Template, Alias)
self.wetfeettemplate = nil
self.usewetfeet = false
-- added 0.1.8
-- added 1.0.15
self.allowbronco = false -- set to true to use the Bronco mod as a CSAR plane
self.ADFRadioPwr = 1000
-- added 1.0.16
self.PilotWeight = 80
-- WARNING - here\'ll be dragons
-- for this to work you need to de-sanitize your mission environment in <DCS root>\Scripts\MissionScripting.lua
@ -1397,7 +1402,7 @@ end
-- @return #CSAR self
function CSAR:_UpdateUnitCargoMass(_heliName)
self:T(self.lid .. " _UpdateUnitCargoMass")
local calculatedMass = self:_PilotsOnboard(_heliName)*80
local calculatedMass = self:_PilotsOnboard(_heliName)*(self.PilotWeight or 80)
local Unit = UNIT:FindByName(_heliName)
if Unit then
Unit:SetUnitInternalCargo(calculatedMass)

View File

@ -567,7 +567,7 @@ function PLAYERTASK:IlluminateTarget(Power,Height)
if self.Target then
local coordinate = self.Target:GetAverageCoordinate()
if coordinate then
local bcoord = COORDINATE:NewFromVec2( coordinate:GetVec2(), Height )
local bcoord = COORDINATE:NewFromVec2( coordinate:GetVec2(), Height )
bcoord:IlluminationBomb(Power)
end
end
@ -1799,16 +1799,36 @@ end
-- @param #PLAYERTASKCONTROLLER self
-- @param #string Tag (Optional) The tagname to use to identify commands, defaults to "TASK"
-- @return #PLAYERTASKCONTROLLER self
-- @usage
-- Enable the function like so:
-- mycontroller:EnableMarkerOps("TASK")
-- Then as a player in a client slot, you can add a map marker on the F10 map. Next edit the text
-- in the marker to make it identifiable, e.g
--
-- TASK Name=Tanks Sochi, Text=Destroy tank group located near Sochi!
--
-- Where **TASK** is the tag that tells the controller this mark is a target location (must).
-- **Name=** ended by a comma **,** tells the controller the supposed menu entry name (optional). No extra spaces! End with a comma!
-- **Text=** tells the controller the supposed free text task description (optional, only taken if **Name=** is present first). No extra spaces!
function PLAYERTASKCONTROLLER:EnableMarkerOps(Tag)
self:T(self.lid.."EnableMarkerOps")
local tag = Tag or "TASK"
local MarkerOps = MARKEROPS_BASE:New(tag)
local MarkerOps = MARKEROPS_BASE:New(tag,{"Name","Text"},true)
local function Handler(Keywords,Coord,Text)
if self.verbose then
local m = MESSAGE:New(string.format("Target added from marker at: %s", Coord:ToStringA2G(nil, nil, self.ShowMagnetic)),15,"INFO"):ToAll()
local m = MESSAGE:New(string.format("Text: %s", Text),15,"INFO"):ToAll()
end
local menuname = string.match(Text,"Name=(.+),")
local freetext = string.match(Text,"Text=(.+)")
if menuname then
Coord.menuname = menuname
if freetext then
Coord.freetext = freetext
end
end
self:AddTarget(Coord)
end
@ -2114,6 +2134,12 @@ function PLAYERTASKCONTROLLER:_CheckTargetQueue()
if self.TargetQueue:Count() > 0 then
local object = self.TargetQueue:Pull()
local target = TARGET:New(object)
if object.menuname then
target.menuname = object.menuname
if object.freetext then
target.freetext = object.freetext
end
end
self:_AddTask(target)
end
return self
@ -2543,9 +2569,23 @@ function PLAYERTASKCONTROLLER:_AddTask(Target)
local countg = enemysetg:Count()
local counts = enemysets:Count()
if countg > 0 then
-- observe Tags coming from MarkerOps
if Target.menuname then
enemysetg.menuname = Target.menuname
if Target.freetext then
enemysetg.freetext = Target.freetext
end
end
self:AddTarget(enemysetg)
end
if counts > 0 then
-- observe Tags coming from MarkerOps
if Target.menuname then
enemysets.menuname = Target.menuname
if Target.freetext then
enemysets.freetext = Target.freetext
end
end
self:AddTarget(enemysets)
end
return self
@ -2565,6 +2605,14 @@ function PLAYERTASKCONTROLLER:_AddTask(Target)
local task = PLAYERTASK:New(type,Target,self.repeatonfailed,self.repeattimes,ttstype)
-- observe Tags coming from MarkerOps
if Target.menuname then
task:SetMenuName(Target.menuname)
if Target.freetext then
task:AddFreetext(Target.freetext)
end
end
task.coalition = self.Coalition
if type == AUFTRAG.Type.BOMBRUNWAY then