Модуль:Prototypes/Роль/Экипировка: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 82: | Строка 82: | ||
local gearEquipment = gear.equipment or {} | local gearEquipment = gear.equipment or {} | ||
-- 1. Сначала пытаемся получить экипировку из gearData | -- 1. Сначала пытаемся получить экипировку из gearData | ||
local itemId = gearEquipment[slot] or "" | local itemId = gearEquipment[slot] or "" | ||
| Строка 94: | Строка 94: | ||
for _, groupId in ipairs(roleLoadoutData.groups or {}) do | for _, groupId in ipairs(roleLoadoutData.groups or {}) do | ||
if groupId ~= "Trinkets" then -- исключаем Trinkets | if groupId ~= "Trinkets" then -- исключаем Trinkets | ||
local groupFound = | local groupFound = findById(gearloadoutGroup, groupId) | ||
if groupFound and type(groupFound.loadouts) == "table" then | |||
for _, loadoutID in ipairs(groupFound.loadouts) do | |||
local loadout = findById(gearloadout, loadoutID) | |||
if loadout and not loadout.effects and loadout.equipment and loadout.equipment[slot] then | |||
itemId = loadout.equipment[slot] | |||
sourceGear = loadout | |||
if groupFound | break | ||
end | end | ||
end | end | ||
| Строка 125: | Строка 109: | ||
end | end | ||
end | end | ||
end | |||
-- 3. Если экипировка не найдена в roleLoadout, проверяем gearData (startingGear) | |||
if itemId == "" then | |||
itemId = gearEquipment[slot] or "" | |||
end | end | ||
-- | -- 4. Если экипировка так и не найдена, возвращаем пустую строку | ||
if itemId == "" then | if itemId == "" then | ||
return "" | return "" | ||
end | end | ||
-- | -- 5. Если слот "back", добавляем содержимое из storage | ||
local result | local result | ||
if slot == "back" and sourceGear.storage and sourceGear.storage.back then | if slot == "back" and sourceGear.storage and sourceGear.storage.back then | ||