Модуль:Prototypes/Машина/Станок: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 38: | Строка 38: | ||
local function sortRecipesByPriority(recipes) | local function sortRecipesByPriority(recipes) | ||
table.sort(recipes, function(a, b) | table.sort(recipes, function(a, b) | ||
local priority = { Static = 1, Unknown = 2, EMAG = | local priority = { Static = 1, Unknown = 2, EMAG = 4 } | ||
local aPriority = priority[a.discipline] or | local aPriority = priority[a.discipline] or 3 | ||
local bPriority = priority[b.discipline] or | local bPriority = priority[b.discipline] or 3 | ||
if aPriority == bPriority then | if aPriority == bPriority then | ||
| Строка 149: | Строка 149: | ||
end | end | ||
-- Обработка emagStaticRecipes | -- Обработка emagStaticRecipes | ||
if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagStaticRecipes then | if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagStaticRecipes then | ||
for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagStaticRecipes) do | for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagStaticRecipes) do | ||
| Строка 158: | Строка 158: | ||
completetime = recipe.completetime, | completetime = recipe.completetime, | ||
materials = recipe.materials, | materials = recipe.materials, | ||
discipline = "EMAG", | discipline = "EMAG", | ||
tier = 0 | tier = 0 | ||
}) | }) | ||
| Строка 165: | Строка 165: | ||
end | end | ||
-- Обработка emagDynamicRecipes | -- Обработка emagDynamicRecipes | ||
if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagDynamicRecipes then | if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagDynamicRecipes then | ||
for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagDynamicRecipes) do | for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagDynamicRecipes) do | ||
local recipe = getRecipeDetails(recipeId) | local recipe = getRecipeDetails(recipeId) | ||
if recipe then | if recipe then | ||
table.insert(recipes, { | local researchInfo = findInResearch(recipeId) | ||
result = recipe.result, | if researchInfo then | ||
table.insert(recipes, { | |||
result = recipe.result, | |||
completetime = recipe.completetime, | |||
materials = recipe.materials, | |||
discipline = "EMAG", | |||
tier = 0, | |||
researchName = researchInfo.name | |||
}) | |||
else | |||
table.insert(recipes, { | |||
result = recipe.result, | |||
completetime = recipe.completetime, | |||
materials = recipe.materials, | |||
discipline = "EMAG", | |||
tier = 0 | |||
}) | |||
end | |||
end | end | ||
end | end | ||