Модуль:Prototypes/Роль/Экипировка: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 21: | Строка 21: | ||
if not str or str == "" then return "" end | if not str or str == "" then return "" end | ||
return str:sub(1,1):upper() .. str:sub(2) | return str:sub(1,1):upper() .. str:sub(2) | ||
end | end | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | local args = frame.args | ||
local | local slot = mw.text.trim(args[1] or "") | ||
local jobId = mw.text.trim(args[2] or "") | local jobId = mw.text.trim(args[2] or "") | ||
| Строка 82: | Строка 36: | ||
if not job then | if not job then | ||
return "Ошибка: не найдена должность с id " .. jobId | return "Ошибка: не найдена должность с id " .. jobId | ||
end | |||
-- Новый режим обработки special | |||
if slot == "special" then | |||
local implants = {} | |||
if job.special then | |||
for _, special in ipairs(job.special) do | |||
if special["!type"] == "AddImplantSpecial" and special.implants then | |||
for _, implant in ipairs(special.implants) do | |||
table.insert(implants, string.format("{{#invoke:Entity Lookup|getname|%s}}", implant)) | |||
end | |||
end | |||
end | |||
end | |||
return table.concat(implants, ", ") | |||
end | end | ||
| Строка 96: | Строка 65: | ||
local gearEquipment = gear.equipment or {} | local gearEquipment = gear.equipment or {} | ||
local itemId = gearEquipment[slot] or "" | local itemId = gearEquipment[slot] or "" | ||
local sourceGear = gear | local sourceGear = gear | ||
if itemId == "" then | if itemId == "" then | ||
local function capitalize(s) | |||
return (s:gsub("^%l", string.upper)) | |||
end | |||
local groupID = jobId .. capitalize(slot) | local groupID = jobId .. capitalize(slot) | ||
local groupFound = nil | local groupFound = nil | ||
for _, group in ipairs(gearloadoutGroup) do | for _, group in ipairs(gearloadoutGroup) do | ||
| Строка 110: | Строка 83: | ||
if not groupFound then | if not groupFound then | ||
return " | return "" | ||
end | end | ||
| Строка 131: | Строка 104: | ||
end | end | ||
if slot == "back" and sourceGear.storage and sourceGear.storage.back then | if slot == "back" and sourceGear.storage and sourceGear.storage.back then | ||
local storageBack = "" | local storageBack = "" | ||