update
This commit is contained in:
@@ -76,6 +76,44 @@ local function mergeByList(baseByList, extraByList)
|
||||
return merged
|
||||
end
|
||||
|
||||
local function isMagazineType(itemType)
|
||||
local s = tostring(itemType or ""):lower()
|
||||
if s == "" then
|
||||
return false
|
||||
end
|
||||
if s:sub(1, 10) == "base.clip_" then
|
||||
return true
|
||||
end
|
||||
if s:find("magazine", 1, true) then
|
||||
return true
|
||||
end
|
||||
if s:find("drum", 1, true) then
|
||||
return true
|
||||
end
|
||||
if s:find("clip", 1, true) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function collectMagazines(values)
|
||||
local out = {}
|
||||
local seen = {}
|
||||
if type(values) ~= "table" then
|
||||
return out
|
||||
end
|
||||
for _, value in ipairs(values) do
|
||||
if isMagazineType(value) then
|
||||
local key = tostring(value):lower()
|
||||
if not seen[key] then
|
||||
seen[key] = true
|
||||
out[#out + 1] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
local defaults = safeRequire("OFBlockRules_Default")
|
||||
local user = safeRequire("OFBlockRules_User")
|
||||
local sourceCatalog = safeRequire("OFSourceCatalog")
|
||||
@@ -83,6 +121,7 @@ local sourceCatalog = safeRequire("OFSourceCatalog")
|
||||
local aliasCatalog = {
|
||||
firearms = sourceCatalog.firearms or {},
|
||||
attachments = sourceCatalog.attachments or {},
|
||||
magazines = sourceCatalog.magazines or collectMagazines(sourceCatalog.attachments),
|
||||
ggs_all = sourceCatalog.ggs_all or {},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user