Модуль:Prototypes/Хранилище/Предмет: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 13: | Строка 13: | ||
min, max = tonumber(min), tonumber(max) | min, max = tonumber(min), tonumber(max) | ||
if min and max then | if min and max then | ||
result[#result + 1] = string.format(' | result[#result + 1] = string.format('[%d-%d]', min + 1, max + 1) | ||
else | else | ||
result[#result + 1] = 'Некорректный формат для range.' | result[#result + 1] = 'Некорректный формат для range.' | ||
| Строка 19: | Строка 19: | ||
elseif rolls and rolls.value then | elseif rolls and rolls.value then | ||
-- Если указано value | -- Если указано value | ||
result[#result + 1] = string.format(' | result[#result + 1] = string.format('[%d]', rolls.value) | ||
else | else | ||
result[#result + 1] = 'Не указан параметр rolls.' | result[#result + 1] = 'Не указан параметр rolls.' | ||
| Строка 179: | Строка 179: | ||
-- Проверка для контейнера EntityTableContainerFill | -- Проверка для контейнера EntityTableContainerFill | ||
if groupSelector.weight and groupSelector.weight ~= "default" then | if groupSelector.weight and groupSelector.weight ~= "default" then | ||
wrapperStart = string.format(' | wrapperStart = string.format('{{LinkСard/Сollapsible|name=Группа [%s]|content=', groupSelector.weight) | ||
wrapperEnd = " | wrapperEnd = "}}" | ||
elseif groupSelector["!type"] == "GroupSelector" and not groupSelector.weight then | elseif groupSelector["!type"] == "GroupSelector" and not groupSelector.weight then | ||
wrapperStart = ' | wrapperStart = '{{LinkСard/Сollapsible|name=Попадаётся только один из|content=' | ||
wrapperEnd = " | wrapperEnd = "}}" | ||
end | end | ||
| Строка 190: | Строка 190: | ||
result[#result + 1] = handleGroupSelector(child) | result[#result + 1] = handleGroupSelector(child) | ||
elseif child["!type"] == "AllSelector" then | elseif child["!type"] == "AllSelector" then | ||
result[#result + 1] = string.format(' | result[#result + 1] = string.format('{{LinkСard/Сollapsible|name=Попадаются только вместе|content=%s}}', handleAllSelector(child)) | ||
elseif child.id then | elseif child.id then | ||
result[#result + 1] = formatContent(child) | result[#result + 1] = formatContent(child) | ||
| Строка 206: | Строка 206: | ||
local result = {} | local result = {} | ||
if wrapped then | if wrapped then | ||
if nestedSelector.rolls and nestedSelector.rolls.range then | if nestedSelector.rolls and nestedSelector.rolls.range then | ||
local classesRolls = processRolls(nestedSelector.rolls) | |||
end | end | ||
if nestedSelector.prob then | if nestedSelector.prob then | ||
local classesProb = string.format(" <div>%s%%</div>", content.prob * 100 >= 1 and math.floor(content.prob * 100) or content.prob * 100) | |||
end | end | ||
end | end | ||
if wrapped and #classes > 0 then | if wrapped and #classes > 0 then | ||
result[#result + 1] = string.format(' | result[#result + 1] = string.format('{{LinkСard/Сollapsible|name=Группа %s%s|content=', classesRolls, classesProb) | ||
end | end | ||
result[#result + 1] = getTableOutput(nestedSelector.tableId) | result[#result + 1] = getTableOutput(nestedSelector.tableId) | ||
if wrapped and | if wrapped and classesRolls and classesProb > 0 then | ||
result[#result + 1] = " | result[#result + 1] = "}}" | ||
end | end | ||
| Строка 286: | Строка 285: | ||
end | end | ||
return ' | return '' | ||
else | else | ||
return 'Неизвестный режим: ' .. mode | return 'Неизвестный режим: ' .. mode | ||