Merge pull request #2472 from FlightControl-Master/master

Merge
This commit is contained in:
Thomas
2025-12-16 08:41:03 +01:00
committed by GitHub
5 changed files with 90 additions and 29 deletions
+10 -3
View File
@@ -140,6 +140,9 @@ CTLD_CARGO = {
self.DontShowInMenu = DontShowInMenu or false
self.ResourceMap = nil
self.StaticType = "container_cargo" -- "container_cargo"
if self:IsStatic() then
self.StaticType = self.Templates
end
self.StaticShape = nil
self.TypeNames = nil
self.StaticCategory = "Cargos"
@@ -7760,7 +7763,7 @@ end
for _, _cgo in pairs(loadedcargo) do
local cargo = _cgo
local type = cargo.CargoType
local gname = cargo.Name
local gname = cargo:GetName()
local gcargo = self:_FindCratesCargoObject(gname) or self:_FindTroopsCargoObject(gname)
self:T("Looking at " .. gname .. " in the helo - type = "..tostring(type))
if (type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS or type == CTLD_CARGO.Enum.VEHICLE or type == CTLD_CARGO.Enum.FOB) then
@@ -9235,8 +9238,12 @@ end
elseif cargotype == CTLD_CARGO.Enum.STATIC or cargotype == CTLD_CARGO.Enum.REPAIR then
injectstatic = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape)
local map=cargotype:GetStaticResourceMap()
injectstatic:SetStaticResourceMap(map)
local unittemplate = _DATABASE:GetStaticUnitTemplate(cargoname)
local ResourceMap = nil
if unittemplate and unittemplate.resourcePayload then
ResourceMap = UTILS.DeepCopy(unittemplate.resourcePayload)
end
injectstatic:SetStaticResourceMap(ResourceMap)
end
if injectstatic then
self:InjectStatics(dropzone,injectstatic,false,true)
+7 -7
View File
@@ -41,7 +41,7 @@
-- @field #number statusupdate Time interval in seconds after which the status is refreshed. Default 60 sec. Should be negative.
-- @field #boolean DetectAccoustic If true, also detect by sound (ie proximity).
-- @field #number DetectAccousticRadius Radius dfor accoustic detection, defaults to 2000 meters.
-- @field #table DetectAccousticUnitTypes Types of units we can detect accousticly. Defaults to {Unit.Category.GROUND_UNIT,Unit.Category.HELICOPTER}
-- @field #table DetectAccousticUnitTypes Types of units we can detect accousticly. Defaults to {Unit.Category.HELICOPTER}
-- @extends Core.Fsm#FSM
--- Top Secret!
@@ -107,7 +107,7 @@ INTEL = {
detectStatics = false,
DetectAccoustic = false,
DetectAccousticRadius = 1000,
DetectAccousticUnitTypes = {Unit.Category.GROUND_UNIT,Unit.Category.HELICOPTER},
DetectAccousticUnitTypes = {Unit.Category.HELICOPTER},
}
--- Detected item info.
@@ -412,7 +412,7 @@ end
function INTEL:SetAccousticDetectionOn(Radius,UnitCategories)
self.DetectAccoustic = true
self.DetectAccousticRadius = Radius or 1000
self.DetectAccousticUnitTypes = UnitCategories or {Unit.Category.GROUND_UNIT,Unit.Category.HELICOPTER}
self.DetectAccousticUnitTypes = UnitCategories or {Unit.Category.HELICOPTER}
return self
end
@@ -865,7 +865,7 @@ function INTEL:UpdateIntel()
detectionzone = ZONE_GROUP:New(group.IdentifiableName.."INTEL_DETECT_ACCZONE",group,self.DetectAccousticRadius or 2000)
group:SetProperty("INTEL_DETECT_ACCZONE",detectionzone)
end
if recce then
if recce and recce:IsGround() then
self:GetDetectedUnitsAccoustic(recce,DetectedUnits,RecceDetecting,detectionzone)
end
end
@@ -1252,18 +1252,18 @@ function INTEL:GetDetectedUnitsAccoustic(Recce,DetectedUnits,RecceDetecting,dete
if detectionzone then
-- Get detected units
local reccename = Recce:GetName()
detectionzone:Scan({Object.Category.UNIT},self.DetectAccousticUnitTypes)
local DetectAccousticUnitTypes = self.DetectAccousticUnitTypes or {Unit.Category.HELICOPTER}
detectionzone:Scan({Object.Category.UNIT},DetectAccousticUnitTypes)
local unitset = detectionzone:GetScannedSetUnit(othercoalition) -- Core.Set#SET_UNIT
self:T("Accoustic detection found #Units "..unitset:CountAlive())
for _,_unit in pairs(unitset.Set or {}) do
if _unit and _unit:IsAlive() then
if _unit and _unit:IsAlive() and _unit:GetCoalition() ~= self.coalition then
local name = _unit:GetName() or "none"
DetectedUnits[name]=_unit
RecceDetecting[name]=reccename
self:T("Unit name = "..name)
end
end
unitset = nil
end
end