mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#Smaller Changes
This commit is contained in:
parent
6ac452ff15
commit
1856754614
@ -2519,6 +2519,35 @@ do -- SET_UNIT
|
|||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Builds a set of units which belong to groups with certain **group names**.
|
||||||
|
-- @param #SET_UNIT self
|
||||||
|
-- @param #string Prefixes The (partial) group names to look for. Can be a single string or a table of strings.
|
||||||
|
-- @return #SET_UNIT self
|
||||||
|
function SET_UNIT:FilterGroupPrefixes(Prefixes)
|
||||||
|
if type(Prefixes) == "string" then
|
||||||
|
Prefixes = {Prefixes}
|
||||||
|
end
|
||||||
|
self:FilterFunction(
|
||||||
|
function(unit,prefixes)
|
||||||
|
local outcome = false
|
||||||
|
if unit then
|
||||||
|
local grp = unit:GetGroup()
|
||||||
|
local gname = grp ~= nil and grp:GetName() or "none"
|
||||||
|
for _,_fix in pairs(prefixes or {}) do
|
||||||
|
if string.find(gname,_fix) then
|
||||||
|
outcome = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return outcome
|
||||||
|
end, Prefixes
|
||||||
|
)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Builds a set of units having a radar of give types.
|
--- Builds a set of units having a radar of give types.
|
||||||
-- All the units having a radar of a given type will be included within the set.
|
-- All the units having a radar of a given type will be included within the set.
|
||||||
@ -4434,6 +4463,35 @@ do -- SET_CLIENT
|
|||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Builds a set of clients which belong to groups with certain **group names**.
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param #string Prefixes The (partial) group names to look for. Can be anywhere in the group name. Can be a single string or a table of strings.
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:FilterGroupPrefixes(Prefixes)
|
||||||
|
if type(Prefixes) == "string" then
|
||||||
|
Prefixes = {Prefixes}
|
||||||
|
end
|
||||||
|
self:FilterFunction(
|
||||||
|
function(unit,prefixes)
|
||||||
|
local outcome = false
|
||||||
|
if unit then
|
||||||
|
local grp = unit:GetGroup()
|
||||||
|
local gname = grp ~= nil and grp:GetName() or "none"
|
||||||
|
for _,_fix in pairs(prefixes or {}) do
|
||||||
|
if string.find(gname,_fix) then
|
||||||
|
outcome = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return outcome
|
||||||
|
end, Prefixes
|
||||||
|
)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Builds a set of clients that are only active.
|
--- Builds a set of clients that are only active.
|
||||||
-- Only the clients that are active will be included within the set.
|
-- Only the clients that are active will be included within the set.
|
||||||
|
|||||||
@ -4222,7 +4222,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local client = _clientobj -- Wrapper.Client#CLIENT
|
local client = _clientobj -- Wrapper.Client#CLIENT
|
||||||
if client:IsGround() then
|
if client:IsGround() then
|
||||||
local cname = client:GetName()
|
local cname = client:GetName()
|
||||||
--self:I(self.lid.."Adding: "..cname)
|
self:T(self.lid.."Adding: "..cname)
|
||||||
_UnitList[cname] = cname
|
_UnitList[cname] = cname
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -4256,7 +4256,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local menus = {}
|
local menus = {}
|
||||||
for _, _unitName in pairs(self.CtldUnits) do
|
for _, _unitName in pairs(self.CtldUnits) do
|
||||||
if (not self.MenusDone[_unitName]) or (self.showstockinmenuitems == true) then
|
if (not self.MenusDone[_unitName]) or (self.showstockinmenuitems == true) then
|
||||||
--self:I(self.lid.."Menu not done yet")
|
self:T(self.lid.."Menu not done yet for ".._unitName)
|
||||||
local _unit = UNIT:FindByName(_unitName)
|
local _unit = UNIT:FindByName(_unitName)
|
||||||
if not _unit and self.allowCATransport then
|
if not _unit and self.allowCATransport then
|
||||||
_unit = CLIENT:FindByName(_unitName)
|
_unit = CLIENT:FindByName(_unitName)
|
||||||
@ -4264,7 +4264,7 @@ function CTLD:_RefreshF10Menus()
|
|||||||
if _unit and _unit:IsAlive() then
|
if _unit and _unit:IsAlive() then
|
||||||
local _group = _unit:GetGroup()
|
local _group = _unit:GetGroup()
|
||||||
if _group then
|
if _group then
|
||||||
--self:I(self.lid.."Unit and Group exist")
|
self:T(self.lid.."Unit and Group exist")
|
||||||
local capabilities = self:_GetUnitCapabilities(_unit)
|
local capabilities = self:_GetUnitCapabilities(_unit)
|
||||||
local cantroops = capabilities.troops
|
local cantroops = capabilities.troops
|
||||||
local cancrates = capabilities.crates
|
local cancrates = capabilities.crates
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user