mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
xx
This commit is contained in:
parent
093c3fe7c9
commit
367d1c6715
@ -532,6 +532,21 @@ do -- SET_BASE
|
|||||||
return self.SomeIteratorLimit or self:Count()
|
return self.SomeIteratorLimit or self:Count()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get max threat level of all objects in the SET.
|
||||||
|
-- @param #SET_BASE self
|
||||||
|
-- @return #number Max threat level found.
|
||||||
|
function SET_BASE:GetThreatLevelMax()
|
||||||
|
local ThreatMax = 0
|
||||||
|
for _,_unit in pairs(self.Set or {}) do
|
||||||
|
local unit = _unit -- Wrapper.Unit#UNIT
|
||||||
|
local threat = unit.GetThreatLevel and unit:GetThreatLevel() or 0
|
||||||
|
if threat > ThreatMax then
|
||||||
|
ThreatMax = threat
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ThreatMax
|
||||||
|
end
|
||||||
|
|
||||||
--- Filters for the defined collection.
|
--- Filters for the defined collection.
|
||||||
-- @param #SET_BASE self
|
-- @param #SET_BASE self
|
||||||
-- @return #SET_BASE self
|
-- @return #SET_BASE self
|
||||||
|
|||||||
@ -994,10 +994,11 @@ function AUTOLASE:_Prescient()
|
|||||||
-- loop found units
|
-- loop found units
|
||||||
if hasunits then
|
if hasunits then
|
||||||
self:T(self.lid.."Checking possibly visible UNITs for Recce "..unit:GetName())
|
self:T(self.lid.."Checking possibly visible UNITs for Recce "..unit:GetName())
|
||||||
for _,_target in pairs(Units) do -- _, Wrapper.Unit#UNIT
|
for _,_target in pairs(Units) do -- Wrapper.Unit#UNIT object here
|
||||||
if _target:GetCoalition() ~= self.coalition then
|
local target = _target -- Wrapper.Unit#UNIT
|
||||||
if unit:IsLOS(_target) and (not _target:IsUnitDetected(unit))then
|
if target and target:GetCoalition() ~= self.coalition then
|
||||||
unit:KnowUnit(_target,true,true)
|
if unit:IsLOS(target) and (not target:IsUnitDetected(unit))then
|
||||||
|
unit:KnowUnit(target,true,true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1005,11 +1006,12 @@ function AUTOLASE:_Prescient()
|
|||||||
-- loop found statics
|
-- loop found statics
|
||||||
if hasstatics then
|
if hasstatics then
|
||||||
self:T(self.lid.."Checking possibly visible STATICs for Recce "..unit:GetName())
|
self:T(self.lid.."Checking possibly visible STATICs for Recce "..unit:GetName())
|
||||||
for _,_static in pairs(Statics) do -- _, Wrapper.Unit#UNIT
|
for _,_static in pairs(Statics) do -- DCS static object here
|
||||||
if _static:GetCoalition() ~= self.coalition then
|
local static = STATIC:Find(_static)
|
||||||
local IsLOS = position:IsLOS(_static:GetCoordinate())
|
if static and static:GetCoalition() ~= self.coalition then
|
||||||
|
local IsLOS = position:IsLOS(static:GetCoordinate())
|
||||||
if IsLOS then
|
if IsLOS then
|
||||||
unit:KnowUnit(_static,true,true)
|
unit:KnowUnit(static,true,true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -723,6 +723,7 @@ end
|
|||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
-- @param #string Event Event.
|
-- @param #string Event Event.
|
||||||
-- @param #string To To state.
|
-- @param #string To To state.
|
||||||
|
-- @return #OPSZONE self
|
||||||
function OPSZONE:onafterStart(From, Event, To)
|
function OPSZONE:onafterStart(From, Event, To)
|
||||||
|
|
||||||
-- Info.
|
-- Info.
|
||||||
@ -739,6 +740,7 @@ function OPSZONE:onafterStart(From, Event, To)
|
|||||||
self:HandleEvent(EVENTS.BaseCaptured)
|
self:HandleEvent(EVENTS.BaseCaptured)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stop OPSZONE FSM.
|
--- Stop OPSZONE FSM.
|
||||||
|
|||||||
@ -387,6 +387,8 @@ function TARGET:AddObject(Object)
|
|||||||
|
|
||||||
if Object:IsInstanceOf("OPSGROUP") then
|
if Object:IsInstanceOf("OPSGROUP") then
|
||||||
self:_AddObject(Object:GetGroup()) -- We add the MOOSE GROUP object not the OPSGROUP object.
|
self:_AddObject(Object:GetGroup()) -- We add the MOOSE GROUP object not the OPSGROUP object.
|
||||||
|
--elseif Object:IsInstanceOf("OPSZONE") then
|
||||||
|
--self:_AddObject(Object:GetZone())
|
||||||
else
|
else
|
||||||
self:_AddObject(Object)
|
self:_AddObject(Object)
|
||||||
end
|
end
|
||||||
@ -1297,10 +1299,26 @@ function TARGET:GetTargetThreatLevelMax(Target)
|
|||||||
|
|
||||||
elseif Target.Type==TARGET.ObjectType.ZONE then
|
elseif Target.Type==TARGET.ObjectType.ZONE then
|
||||||
|
|
||||||
return 0
|
local zone = Target.Object -- Core.Zone#ZONE_RADIUS
|
||||||
|
local foundunits = {}
|
||||||
|
if zone:IsInstanceOf("ZONE_RADIUS") or zone:IsInstanceOf("ZONE_POLYGON") then
|
||||||
|
zone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT,Unit.Category.SHIP})
|
||||||
|
foundunits = zone:GetScannedSetUnit()
|
||||||
|
else
|
||||||
|
foundunits = SET_UNIT:New():FilterZones({zone}):FilterOnce()
|
||||||
|
end
|
||||||
|
local ThreatMax = foundunits:GetThreatLevelMax() or 0
|
||||||
|
return ThreatMax
|
||||||
|
|
||||||
|
elseif Target.Type==TARGET.ObjectType.OPSZONE then
|
||||||
|
|
||||||
|
local unitset = Target.Object:GetScannedUnitSet() -- Core.Set#SET_UNIT
|
||||||
|
local ThreatMax = unitset:GetThreatLevelMax()
|
||||||
|
return ThreatMax
|
||||||
|
|
||||||
else
|
else
|
||||||
self:E("ERROR: unknown target object type in GetTargetThreatLevel!")
|
self:E("ERROR: unknown target object type in GetTargetThreatLevel!")
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user