mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/OpsRat
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
--
|
||||
-- @module Functional.Stratego
|
||||
-- @image Functional.Stratego.png
|
||||
-- Last Update April 2024
|
||||
|
||||
|
||||
---
|
||||
@@ -42,6 +43,7 @@
|
||||
-- @field #number CaptureUnits
|
||||
-- @field #number CaptureThreatlevel
|
||||
-- @field #boolean ExcludeShips
|
||||
-- @field Core.Zone#ZONE StrategoZone
|
||||
-- @extends Core.Base#BASE
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
@@ -154,6 +156,7 @@
|
||||
-- @{#STRATEGO.FindRoute}(): Find a route between two nodes.
|
||||
-- @{#STRATEGO.SetCaptureOptions}(): Set how many units of which minimum threat level are needed to capture one node (i.e. the underlying OpsZone).
|
||||
-- @{#STRATEGO.SetDebug}(): Set debug and draw options.
|
||||
-- @{#STRATEGO.SetStrategoZone}(): Set a zone to restrict STRATEGO analytics to, can be any kind of ZONE Object.
|
||||
--
|
||||
--
|
||||
-- ## Visualisation example code for the Syria map:
|
||||
@@ -177,7 +180,7 @@ STRATEGO = {
|
||||
debug = false,
|
||||
drawzone = false,
|
||||
markzone = false,
|
||||
version = "0.2.5",
|
||||
version = "0.2.7",
|
||||
portweight = 3,
|
||||
POIweight = 1,
|
||||
maxrunways = 3,
|
||||
@@ -377,6 +380,15 @@ function STRATEGO:SetDebug(Debug,DrawZones,MarkZones)
|
||||
return self
|
||||
end
|
||||
|
||||
--- [USER] Restrict Stratego to analyse this zone only.
|
||||
-- @param #STRATEGO self
|
||||
-- @param Core.Zone#ZONE Zone The Zone to restrict Stratego to, can be any kind of ZONE Object.
|
||||
-- @return #STRATEGO self
|
||||
function STRATEGO:SetStrategoZone(Zone)
|
||||
self.StrategoZone = Zone
|
||||
return self
|
||||
end
|
||||
|
||||
--- [USER] Set weights for nodes and routes to determine their importance.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #number MaxRunways Set the maximum number of runways the big (equals strategic) airbases on the map have. Defaults to 3. The weight of an airbase node hence equals the number of runways.
|
||||
@@ -425,12 +437,19 @@ function STRATEGO:AnalyseBases()
|
||||
local airbasetable = self.airbasetable
|
||||
local nonconnectedab = self.nonconnectedab
|
||||
local easynames = self.easynames
|
||||
local zone = self.StrategoZone -- Core.Zone#ZONE_POLYGON
|
||||
|
||||
-- find bases with >= 1 runways
|
||||
self.bases:ForEach(
|
||||
function(afb)
|
||||
local ab = afb -- Wrapper.Airbase#AIRBASE
|
||||
local abvec2 = ab:GetVec2()
|
||||
if self.ExcludeShips and ab:IsShip() then return end
|
||||
if zone ~= nil then
|
||||
if not zone:IsVec2InZone(abvec2) then
|
||||
return
|
||||
end
|
||||
end
|
||||
local abname = ab:GetName()
|
||||
local runways = ab:GetRunways()
|
||||
local numrwys = #runways
|
||||
@@ -759,9 +778,39 @@ function STRATEGO:GetNextHighestWeightNodes(Weight, Coalition)
|
||||
return airbases[weight],weight
|
||||
end
|
||||
|
||||
--- [USER] Set the aggregated weight of a single node found by its name manually.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name The name to look for.
|
||||
-- @param #number Weight The weight to be set.
|
||||
-- @return #boolean success
|
||||
function STRATEGO:SetNodeWeight(Name,Weight)
|
||||
self:T(self.lid.."SetNodeWeight")
|
||||
if Name and Weight and self.airbasetable[Name] then
|
||||
self.airbasetable[Name].weight = Weight or 0
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- [USER] Set the base weight of a single node found by its name manually.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name The name to look for.
|
||||
-- @param #number Weight The weight to be set.
|
||||
-- @return #boolean success
|
||||
function STRATEGO:SetNodeBaseWeight(Name,Weight)
|
||||
self:T(self.lid.."SetNodeBaseWeight")
|
||||
if Name and Weight and self.airbasetable[Name] then
|
||||
self.airbasetable[Name].baseweight = Weight or 0
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
--- [USER] Get the aggregated weight of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string Name The name to look for.
|
||||
-- @return #number Weight The weight or 0 if not found.
|
||||
function STRATEGO:GetNodeWeight(Name)
|
||||
self:T(self.lid.."GetNodeWeight")
|
||||
@@ -774,7 +823,7 @@ end
|
||||
|
||||
--- [USER] Get the base weight of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string Name The name to look for.
|
||||
-- @return #number Weight The base weight or 0 if not found.
|
||||
function STRATEGO:GetNodeBaseWeight(Name)
|
||||
self:T(self.lid.."GetNodeBaseWeight")
|
||||
@@ -787,7 +836,7 @@ end
|
||||
|
||||
--- [USER] Get the COALITION of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #number Coalition The coalition.
|
||||
function STRATEGO:GetNodeCoalition(Name)
|
||||
self:T(self.lid.."GetNodeCoalition")
|
||||
@@ -800,7 +849,7 @@ end
|
||||
|
||||
--- [USER] Get the TYPE of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #string Type Type of the node, e.g. STRATEGO.Type.AIRBASE or nil if not found.
|
||||
function STRATEGO:GetNodeType(Name)
|
||||
self:T(self.lid.."GetNodeType")
|
||||
@@ -813,7 +862,7 @@ end
|
||||
|
||||
--- [USER] Get the ZONE of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return Core.Zone#ZONE Zone The Zone of the node or nil if not found.
|
||||
function STRATEGO:GetNodeZone(Name)
|
||||
self:T(self.lid.."GetNodeZone")
|
||||
@@ -826,7 +875,7 @@ end
|
||||
|
||||
--- [USER] Get the OPSZONE of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return Ops.OpsZone#OPSZONE OpsZone The OpsZone of the node or nil if not found.
|
||||
function STRATEGO:GetNodeOpsZone(Name)
|
||||
self:T(self.lid.."GetNodeOpsZone")
|
||||
@@ -839,7 +888,7 @@ end
|
||||
|
||||
--- [USER] Get the COORDINATE of a node by its name.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return Core.Point#COORDINATE Coordinate The Coordinate of the node or nil if not found.
|
||||
function STRATEGO:GetNodeCoordinate(Name)
|
||||
self:T(self.lid.."GetNodeCoordinate")
|
||||
@@ -852,7 +901,7 @@ end
|
||||
|
||||
--- [USER] Check if the TYPE of a node is AIRBASE.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #boolean Outcome
|
||||
function STRATEGO:IsAirbase(Name)
|
||||
self:T(self.lid.."IsAirbase")
|
||||
@@ -865,7 +914,7 @@ end
|
||||
|
||||
--- [USER] Check if the TYPE of a node is PORT.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #boolean Outcome
|
||||
function STRATEGO:IsPort(Name)
|
||||
self:T(self.lid.."IsPort")
|
||||
@@ -878,7 +927,7 @@ end
|
||||
|
||||
--- [USER] Check if the TYPE of a node is POI.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #boolean Outcome
|
||||
function STRATEGO:IsPOI(Name)
|
||||
self:T(self.lid.."IsPOI")
|
||||
@@ -891,7 +940,7 @@ end
|
||||
|
||||
--- [USER] Check if the TYPE of a node is FARP.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #boolean Outcome
|
||||
function STRATEGO:IsFARP(Name)
|
||||
self:T(self.lid.."IsFARP")
|
||||
@@ -904,7 +953,7 @@ end
|
||||
|
||||
--- [USER] Check if the TYPE of a node is SHIP.
|
||||
-- @param #STRATEGO self
|
||||
-- @param #string Name.
|
||||
-- @param #string The name to look for.
|
||||
-- @return #boolean Outcome
|
||||
function STRATEGO:IsShip(Name)
|
||||
self:T(self.lid.."IsShip")
|
||||
|
||||
Reference in New Issue
Block a user