mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#TARGET - add threat level determination for ZONE and OPSZONE
This commit is contained in:
parent
5e24e8658b
commit
b9ad5b5ba7
@ -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
|
||||||
@ -1296,11 +1298,27 @@ function TARGET:GetTargetThreatLevelMax(Target)
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
elseif Target.Type==TARGET.ObjectType.ZONE then
|
elseif Target.Type==TARGET.ObjectType.ZONE then
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
return 0
|
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