search for multiple factions

This commit is contained in:
Hendrik Langer 2021-11-29 20:15:00 +01:00
parent 2f16838b19
commit 0e64b5deed

View File

@ -44,12 +44,21 @@ local function playerfactions_detector_scan(pos)
-- abort if no scan results were found -- abort if no scan results were found
if next(objs) == nil then return false end if next(objs) == nil then return false end
local scan_for = {}
for _, str in pairs(string.split(scanname:gsub(" ", ""), ",")) do
scan_for[str] = true
end
for _, obj in pairs(objs) do for _, obj in pairs(objs) do
if obj:is_player() then if obj:is_player() then
if factions.player_is_in_faction(scanname, obj:get_player_name()) then local accepted = true
return true for fname, _ in pairs(scan_for) do
if factions.player_is_in_faction(fname, obj:get_player_name()) ~= true then
accepted = false
end end
end end
if accepted then return true end
end
end end
return false return false