Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist
2025-11-09 16:53:39 +01:00
+55 -153
View File
@@ -89,11 +89,23 @@ do -- SET_BASE
Index = {}, Index = {},
Database = nil, Database = nil,
CallScheduler = nil, CallScheduler = nil,
Filter = {},
FilterCoalitionNumbers = {
[coalition.side.RED+1] = "red",
[coalition.side.BLUE+1] = "blue",
[coalition.side.NEUTRAL+1] = "neutral",
},
FilterMeta = {
Coalitions = {
["red"] = coalition.side.RED,
["blue"] = coalition.side.BLUE,
["neutral"] = coalition.side.NEUTRAL,
},
},
} }
--- Filters --- Filters
-- @type SET_BASE.Filters -- @type SET_BASE.Filter
-- @field #table Coalition Coalitions -- @field #table Coalition Coalitions
-- @field #table Prefix Prefixes. -- @field #table Prefix Prefixes.
@@ -198,6 +210,32 @@ do -- SET_BASE
return self return self
end end
--- Builds a set of objects of same coalitions.
-- Possible current coalitions are red, blue and neutral.
-- @param #SET_BASE self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral" and coalition.side.RED, coalition.side.BLUE,coalition.side.NEUTRAL
-- @param #boolean Clear If `true`, clear any previously defined filters.
-- @return #SET_BASE self
function SET_BASE:FilterCoalitions( Coalitions, Clear )
if Clear or (not self.Filter.Coalitions) then
self.Filter.Coalitions = {}
end
-- Ensure table.
if type(Coalitions) ~= "table" then Coalitions = {Coalitions} end
for CoalitionID, Coalition in pairs( Coalitions ) do
local coalition = Coalition
if type(Coalition) == "number" then
coalition = self.FilterCoalitionNumbers[Coalition+1] or "unknown"
--self:I("Filter Coaltion for "..coalition)
end
self.Filter.Coalitions[coalition] = coalition
end
return self
end
--- Finds an @{Core.Base#BASE} object based on the object Name. --- Finds an @{Core.Base#BASE} object based on the object Name.
-- @param #SET_BASE self -- @param #SET_BASE self
-- @param #string ObjectName -- @param #string ObjectName
@@ -1343,21 +1381,6 @@ do
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @param #boolean Clear If `true`, clear any previously defined filters. -- @param #boolean Clear If `true`, clear any previously defined filters.
-- @return #SET_GROUP self -- @return #SET_GROUP self
function SET_GROUP:FilterCoalitions( Coalitions, Clear )
if Clear or (not self.Filter.Coalitions) then
self.Filter.Coalitions = {}
end
-- Ensure table.
Coalitions = UTILS.EnsureTable(Coalitions, false)
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of groups out of categories. --- Builds a set of groups out of categories.
-- Possible current categories are plane, helicopter, ground, ship. -- Possible current categories are plane, helicopter, ground, ship.
@@ -2387,19 +2410,7 @@ do -- SET_UNIT
-- @param #SET_UNIT self -- @param #SET_UNIT self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_UNIT self -- @return #SET_UNIT self
function SET_UNIT:FilterCoalitions( Coalitions )
self.Filter.Coalitions = {}
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of units out of categories. --- Builds a set of units out of categories.
-- Possible current categories are plane, helicopter, ground, ship. -- Possible current categories are plane, helicopter, ground, ship.
@@ -3603,18 +3614,6 @@ do -- SET_STATIC
-- @param #SET_STATIC self -- @param #SET_STATIC self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_STATIC self -- @return #SET_STATIC self
function SET_STATIC:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of statics in zones. --- Builds a set of statics in zones.
@@ -4396,18 +4395,6 @@ do -- SET_CLIENT
-- @param #SET_CLIENT self -- @param #SET_CLIENT self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_CLIENT self -- @return #SET_CLIENT self
function SET_CLIENT:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of clients out of categories. --- Builds a set of clients out of categories.
-- Possible current categories are plane, helicopter, ground, ship. -- Possible current categories are plane, helicopter, ground, ship.
@@ -5112,18 +5099,6 @@ do -- SET_PLAYER
-- @param #SET_PLAYER self -- @param #SET_PLAYER self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_PLAYER self -- @return #SET_PLAYER self
function SET_PLAYER:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of players in zones. --- Builds a set of players in zones.
-- @param #SET_PLAYER self -- @param #SET_PLAYER self
@@ -5598,18 +5573,6 @@ do -- SET_AIRBASE
-- @param #SET_AIRBASE self -- @param #SET_AIRBASE self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_AIRBASE self -- @return #SET_AIRBASE self
function SET_AIRBASE:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of airbases out of categories. --- Builds a set of airbases out of categories.
-- Possible current categories are plane, helicopter, ground, ship. -- Possible current categories are plane, helicopter, ground, ship.
@@ -5896,7 +5859,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Add CARGO to SET_CARGO. --- Add CARGO to SET_CARGO.
-- @param Core.Set#SET_CARGO self -- @param Core.Set#SET_CARGO self
-- @param Cargo.Cargo#CARGO Cargo A single cargo. -- @param Cargo.Cargo#CARGO Cargo A single cargo.
-- @return Core.Set#SET_CARGO self -- @return Core.Set#SET_CARGO self
@@ -5907,7 +5870,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Add CARGOs to SET_CARGO. --- Add CARGOs to SET_CARGO.
-- @param Core.Set#SET_CARGO self -- @param Core.Set#SET_CARGO self
-- @param #string AddCargoNames A single name or an array of CARGO names. -- @param #string AddCargoNames A single name or an array of CARGO names.
-- @return Core.Set#SET_CARGO self -- @return Core.Set#SET_CARGO self
@@ -5922,7 +5885,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Remove CARGOs from SET_CARGO. --- Remove CARGOs from SET_CARGO.
-- @param Core.Set#SET_CARGO self -- @param Core.Set#SET_CARGO self
-- @param Cargo.Cargo#CARGO RemoveCargoNames A single name or an array of CARGO names. -- @param Cargo.Cargo#CARGO RemoveCargoNames A single name or an array of CARGO names.
-- @return Core.Set#SET_CARGO self -- @return Core.Set#SET_CARGO self
@@ -5937,7 +5900,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Finds a Cargo based on the Cargo Name. --- Finds a Cargo based on the Cargo Name.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param #string CargoName -- @param #string CargoName
-- @return Cargo.Cargo#CARGO The found Cargo. -- @return Cargo.Cargo#CARGO The found Cargo.
@@ -5947,25 +5910,13 @@ do -- SET_CARGO
return CargoFound return CargoFound
end end
--- (R2.1) Builds a set of cargos of coalitions. --- Builds a set of cargos of coalitions.
-- Possible current coalitions are red, blue and neutral. -- Possible current coalitions are red, blue and neutral.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_CARGO self -- @return #SET_CARGO self
function SET_CARGO:FilterCoalitions( Coalitions ) -- R2.1
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- (R2.1) Builds a set of cargos of defined cargo types. --- Builds a set of cargos of defined cargo types.
-- Possible current types are those types known within DCS world. -- Possible current types are those types known within DCS world.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param #string Types Can take those type strings known within DCS world. -- @param #string Types Can take those type strings known within DCS world.
@@ -5983,7 +5934,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Builds a set of cargos of defined countries. --- Builds a set of cargos of defined countries.
-- Possible current countries are those known within DCS world. -- Possible current countries are those known within DCS world.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param #string Countries Can take those country strings known within DCS world. -- @param #string Countries Can take those country strings known within DCS world.
@@ -6019,7 +5970,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Starts the filtering. --- Starts the filtering.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @return #SET_CARGO self -- @return #SET_CARGO self
function SET_CARGO:FilterStart() -- R2.1 function SET_CARGO:FilterStart() -- R2.1
@@ -6044,7 +5995,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Handles the Database to check on an event (birth) that the Object was added in the Database. --- Handles the Database to check on an event (birth) that the Object was added in the Database.
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event! -- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
@@ -6056,7 +6007,7 @@ do -- SET_CARGO
return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName]
end end
--- (R2.1) Handles the Database to check on any event that Object exists in the Database. --- Handles the Database to check on any event that Object exists in the Database.
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa! -- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
@@ -6068,7 +6019,7 @@ do -- SET_CARGO
return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName] return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName]
end end
--- (R2.1) Iterate the SET_CARGO and call an iterator function for each CARGO, providing the CARGO and optional parameters. --- Iterate the SET_CARGO and call an iterator function for each CARGO, providing the CARGO and optional parameters.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param #function IteratorFunction The function that will be called when there is an alive CARGO in the SET_CARGO. The function needs to accept a CARGO parameter. -- @param #function IteratorFunction The function that will be called when there is an alive CARGO in the SET_CARGO. The function needs to accept a CARGO parameter.
-- @return #SET_CARGO self -- @return #SET_CARGO self
@@ -6080,7 +6031,7 @@ do -- SET_CARGO
return self return self
end end
--- (R2.1) Iterate the SET_CARGO while identifying the nearest @{Cargo.Cargo#CARGO} from a @{Core.Point#COORDINATE}. --- Iterate the SET_CARGO while identifying the nearest @{Cargo.Cargo#CARGO} from a @{Core.Point#COORDINATE}.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param Core.Point#COORDINATE Coordinate A @{Core.Point#COORDINATE} object from where to evaluate the closest @{Cargo.Cargo#CARGO}. -- @param Core.Point#COORDINATE Coordinate A @{Core.Point#COORDINATE} object from where to evaluate the closest @{Cargo.Cargo#CARGO}.
-- @return Cargo.Cargo#CARGO The closest @{Cargo.Cargo#CARGO}. -- @return Cargo.Cargo#CARGO The closest @{Cargo.Cargo#CARGO}.
@@ -6155,7 +6106,7 @@ do -- SET_CARGO
return FirstCargo return FirstCargo
end end
--- (R2.1) ---
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param AI.AI_Cargo#AI_CARGO MCargo -- @param AI.AI_Cargo#AI_CARGO MCargo
-- @return #SET_CARGO self -- @return #SET_CARGO self
@@ -6214,7 +6165,7 @@ do -- SET_CARGO
return MCargoInclude return MCargoInclude
end end
--- (R2.1) Handles the OnEventNewCargo event for the Set. --- Handles the OnEventNewCargo event for the Set.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function SET_CARGO:OnEventNewCargo( EventData ) -- R2.1 function SET_CARGO:OnEventNewCargo( EventData ) -- R2.1
@@ -6228,7 +6179,7 @@ do -- SET_CARGO
end end
end end
--- (R2.1) Handles the OnDead or OnCrash event for alive units set. --- Handles the OnDead or OnCrash event for alive units set.
-- @param #SET_CARGO self -- @param #SET_CARGO self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function SET_CARGO:OnEventDeleteCargo( EventData ) -- R2.1 function SET_CARGO:OnEventDeleteCargo( EventData ) -- R2.1
@@ -7320,23 +7271,6 @@ do -- SET_OPSZONE
-- @param #SET_OPSZONE self -- @param #SET_OPSZONE self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral" or combinations as a table, for example `{"red", "neutral"}`. -- @param #string Coalitions Can take the following values: "red", "blue", "neutral" or combinations as a table, for example `{"red", "neutral"}`.
-- @return #SET_OPSZONE self -- @return #SET_OPSZONE self
function SET_OPSZONE:FilterCoalitions(Coalitions)
-- Create an empty set.
if not self.Filter.Coalitions then
self.Filter.Coalitions={}
end
-- Ensure we got a table.
Coalitions=UTILS.EnsureTable(Coalitions, false)
-- Set filter.
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Filters for the defined collection. --- Filters for the defined collection.
-- @param #SET_OPSZONE self -- @param #SET_OPSZONE self
@@ -7930,26 +7864,6 @@ do -- SET_OPSGROUP
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral" or combinations as a table, for example `{"red", "neutral"}`. -- @param #string Coalitions Can take the following values: "red", "blue", "neutral" or combinations as a table, for example `{"red", "neutral"}`.
-- @param #boolean Clear If `true`, clear any previously defined filters. -- @param #boolean Clear If `true`, clear any previously defined filters.
-- @return #SET_OPSGROUP self -- @return #SET_OPSGROUP self
function SET_OPSGROUP:FilterCoalitions(Coalitions, Clear)
-- Create an empty set.
if Clear or not self.Filter.Coalitions then
self.Filter.Coalitions={}
end
-- Ensure we got a table.
if type(Coalitions)~="table" then
Coalitions = {Coalitions}
end
-- Set filter.
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of groups out of categories. --- Builds a set of groups out of categories.
-- --
@@ -8927,18 +8841,6 @@ do -- SET_DYNAMICCARGO
-- @param #SET_DYNAMICCARGO self -- @param #SET_DYNAMICCARGO self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral". -- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET_DYNAMICCARGO self -- @return #SET_DYNAMICCARGO self
function SET_DYNAMICCARGO:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of dynamic cargo of defined dynamic cargo type names. --- Builds a set of dynamic cargo of defined dynamic cargo type names.
-- @param #SET_DYNAMICCARGO self -- @param #SET_DYNAMICCARGO self