up
This commit is contained in:
parent
37e7c393a2
commit
645a9d3222
1 changed files with 27 additions and 9 deletions
|
|
@ -54,6 +54,19 @@ function util.contains(table, sought)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Set/override a technology's prerequisites
|
||||||
|
function util.set_prerequisite(technology_name, prerequisites)
|
||||||
|
local technology = data.raw.technology[technology_name]
|
||||||
|
if technology then
|
||||||
|
technology.prerequisites = {}
|
||||||
|
for i, prerequisite in pairs(prerequisites) do
|
||||||
|
if data.raw.technology[prerequisite] then
|
||||||
|
table.insert(technology.prerequisites, prerequisite)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Add a prerequisite to a given technology
|
-- Add a prerequisite to a given technology
|
||||||
function util.add_prerequisite(technology_name, prerequisite)
|
function util.add_prerequisite(technology_name, prerequisite)
|
||||||
local technology = data.raw.technology[technology_name]
|
local technology = data.raw.technology[technology_name]
|
||||||
|
|
@ -444,14 +457,19 @@ function util.replace_product(recipe_name, old, new)
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_product(recipe, old, new)
|
function replace_product(recipe, old, new)
|
||||||
if recipe ~= nil and recipe.results ~= nil then
|
if recipe then
|
||||||
|
if recipe.main_product == old then
|
||||||
|
recipe.main_product = new
|
||||||
|
end
|
||||||
if recipe.result == old then
|
if recipe.result == old then
|
||||||
recipe.results = new
|
recipe.result = new
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i, result in pairs(recipe.results) do
|
if recipe.results then
|
||||||
if result.name == old then result.name = new end
|
for i, result in pairs(recipe.results) do
|
||||||
if result[1] == old then result[1] = new end
|
if result.name == old then result.name = new end
|
||||||
|
if result[1] == old then result[1] = new end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -541,10 +559,10 @@ end
|
||||||
|
|
||||||
-- Set recipe icons
|
-- Set recipe icons
|
||||||
function util.set_item_icons(item_name, icons)
|
function util.set_item_icons(item_name, icons)
|
||||||
if data.raw.recipe[item_name] then
|
if data.raw.item[item_name] then
|
||||||
data.raw.recipe[item_name].icons = icons
|
data.raw.item[item_name].icons = icons
|
||||||
data.raw.recipe[item_name].icon = nil
|
data.raw.item[item_name].icon = nil
|
||||||
data.raw.recipe[item_name].icon_size = nil
|
data.raw.item[item_name].icon_size = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue