mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#SET_CLIENT
* Added FilterCallsigns() * Added FilterPlayernames()
This commit is contained in:
commit
a6e7ea6590
@ -3808,6 +3808,8 @@ do -- SET_CLIENT
|
|||||||
Countries = nil,
|
Countries = nil,
|
||||||
ClientPrefixes = nil,
|
ClientPrefixes = nil,
|
||||||
Zones = nil,
|
Zones = nil,
|
||||||
|
Playernames = nil,
|
||||||
|
Callsigns = nil,
|
||||||
},
|
},
|
||||||
FilterMeta = {
|
FilterMeta = {
|
||||||
Coalitions = {
|
Coalitions = {
|
||||||
@ -3880,6 +3882,40 @@ do -- SET_CLIENT
|
|||||||
return ClientFound
|
return ClientFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Builds a set of clients of certain callsigns.
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param #string Callsigns Can be a single string e.g. "Ford", or a table of strings e.g. {"Uzi","Enfield","Chevy"}. Refers to the callsigns as they can be set in the mission editor.
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:FilterCallsigns( Callsigns )
|
||||||
|
if not self.Filter.Callsigns then
|
||||||
|
self.Filter.Callsigns = {}
|
||||||
|
end
|
||||||
|
if type( Callsigns ) ~= "table" then
|
||||||
|
Callsigns = { Callsigns }
|
||||||
|
end
|
||||||
|
for callsignID, callsign in pairs( Callsigns ) do
|
||||||
|
self.Filter.Callsigns[callsign] = callsign
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Builds a set of clients of certain playernames.
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param #string Playernames Can be a single string e.g. "Apple", or a table of strings e.g. {"Walter","Hermann","Gonzo"}. Useful if you have e.g. a common squadron prefix.
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:FilterPlayernames( Playernames )
|
||||||
|
if not self.Filter.Playernames then
|
||||||
|
self.Filter.Playernames = {}
|
||||||
|
end
|
||||||
|
if type( Playernames ) ~= "table" then
|
||||||
|
Playernames = { Playernames }
|
||||||
|
end
|
||||||
|
for PlayernameID, playername in pairs( Playernames ) do
|
||||||
|
self.Filter.Playernames[playername] = playername
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Builds a set of clients of coalitions.
|
--- Builds a set of clients of coalitions.
|
||||||
-- Possible current coalitions are red, blue and neutral.
|
-- Possible current coalitions are red, blue and neutral.
|
||||||
-- @param #SET_CLIENT self
|
-- @param #SET_CLIENT self
|
||||||
@ -4235,7 +4271,6 @@ do -- SET_CLIENT
|
|||||||
self:T( { "Evaluated Prefix", MClientPrefix } )
|
self:T( { "Evaluated Prefix", MClientPrefix } )
|
||||||
MClientInclude = MClientInclude and MClientPrefix
|
MClientInclude = MClientInclude and MClientPrefix
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones then
|
||||||
local MClientZone = false
|
local MClientZone = false
|
||||||
@ -4249,6 +4284,31 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientZone
|
MClientInclude = MClientInclude and MClientZone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.Filter.Playernames then
|
||||||
|
local MClientPlayername = false
|
||||||
|
local playername = MClient:GetPlayerName() or "Unknown"
|
||||||
|
for _,_Playername in pairs(self.Filter.Playernames) do
|
||||||
|
if playername and string.find(playername,_Playername) then
|
||||||
|
MClientPlayername = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:T( { "Evaluated Playername", MClientPlayername } )
|
||||||
|
MClientInclude = MClientInclude and MClientPlayername
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.Filter.Callsigns then
|
||||||
|
local MClientCallsigns = false
|
||||||
|
local callsign = MClient:GetCallsign()
|
||||||
|
for _,_Callsign in pairs(self.Filter.Callsigns) do
|
||||||
|
if callsign and string.find(callsign,_Callsign) then
|
||||||
|
MClientCallsigns = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:T( { "Evaluated Callsign", MClientCallsigns } )
|
||||||
|
MClientInclude = MClientInclude and MClientCallsigns
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
self:T2( MClientInclude )
|
self:T2( MClientInclude )
|
||||||
return MClientInclude
|
return MClientInclude
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user