Update to 2.0
3
.editorconfig
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
.idea
|
||||||
|
|
@ -12,9 +12,11 @@ This work is released under a CC license instead of MIT. Contact me on github if
|
||||||
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||||
See LICENSE
|
See LICENSE
|
||||||
|
|
||||||
## Created by
|
## Credits
|
||||||
|
|
||||||
- [brevven](https://mods.factorio.com/user/brevven) (code, design, graphics)
|
- [brevven](https://mods.factorio.com/user/brevven) (code, design)
|
||||||
|
- [cackling fiend](https://mods.factorio.com/user/cackling.fiend) (Update to 2.0)
|
||||||
|
- Wube (Graphics)
|
||||||
|
|
||||||
### Localization
|
### Localization
|
||||||
|
|
||||||
|
|
|
||||||
200
data-util.lua
|
|
@ -64,16 +64,6 @@ function util.fe_plus(sub)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.get_stack_size(default)
|
|
||||||
if mods.Krastorio2 then
|
|
||||||
local size = get_setting("kr-stack-size")
|
|
||||||
if size and tonumber(size) then
|
|
||||||
return tonumber(size)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return default
|
|
||||||
end
|
|
||||||
|
|
||||||
function util.k2assets()
|
function util.k2assets()
|
||||||
if mods["Krastorio2Assets"] then
|
if mods["Krastorio2Assets"] then
|
||||||
return "__Krastorio2Assets__"
|
return "__Krastorio2Assets__"
|
||||||
|
|
@ -111,8 +101,8 @@ function util.se_landfill(params)
|
||||||
category = "hard-recycling",
|
category = "hard-recycling",
|
||||||
order = "z-b-"..params.ore,
|
order = "z-b-"..params.ore,
|
||||||
subgroup = "terrain",
|
subgroup = "terrain",
|
||||||
result = "landfill",
|
results = {{type="item", name="landfill", amount=1}},
|
||||||
ingredients = {{params.ore, 50}},
|
ingredients = {{type="item", name=params.ore, amount=50}},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
util.add_unlock("se-recycling-facility", lname)
|
util.add_unlock("se-recycling-facility", lname)
|
||||||
|
|
@ -123,7 +113,7 @@ end
|
||||||
-- k2 matter
|
-- k2 matter
|
||||||
-- params: {k2matter}, k2baseicon , {icon}
|
-- params: {k2matter}, k2baseicon , {icon}
|
||||||
function util.k2matter(params)
|
function util.k2matter(params)
|
||||||
local matter = require("__Krastorio2__/lib/public/data-stages/matter-util")
|
local matter = require("__Krastorio2__/prototypes/libraries/matter")
|
||||||
if mods["space-exploration"] then
|
if mods["space-exploration"] then
|
||||||
params.k2matter.need_stabilizer = true
|
params.k2matter.need_stabilizer = true
|
||||||
end
|
end
|
||||||
|
|
@ -169,15 +159,15 @@ function util.k2matter(params)
|
||||||
{
|
{
|
||||||
{"production-science-pack", 1},
|
{"production-science-pack", 1},
|
||||||
{"utility-science-pack", 1},
|
{"utility-science-pack", 1},
|
||||||
{"matter-tech-card", 1}
|
{"kr-matter-tech-card", 1}
|
||||||
},
|
},
|
||||||
time = 45,
|
time = 45,
|
||||||
},
|
},
|
||||||
-- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}},
|
localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
matter.createMatterRecipe(params.k2matter)
|
matter.make_recipes(params.k2matter)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -211,16 +201,16 @@ function util.se_matter(params)
|
||||||
energy_required = params.energy_required,
|
energy_required = params.energy_required,
|
||||||
enabled = false,
|
enabled = false,
|
||||||
ingredients = {
|
ingredients = {
|
||||||
{sedata, 1},
|
{type="item", name=sedata, amount=1},
|
||||||
{type="fluid", name="se-particle-stream", amount=50},
|
{type="fluid", name="se-particle-stream", amount=50},
|
||||||
{type="fluid", name="se-space-coolant-supercooled", amount=25},
|
{type="fluid", name="se-space-coolant-supercooled", amount=25},
|
||||||
},
|
},
|
||||||
results = {
|
results = {
|
||||||
{params.ore, params.quant_out},
|
{type="item", name=params.ore, amount=params.quant_out},
|
||||||
{"se-contaminated-scrap", 1},
|
{type="item", name="se-contaminated-scrap", amount=1},
|
||||||
{type=item, name=sedata, amount=1, probability=.99},
|
{type="item", name=sedata, amount=1, probability=.99},
|
||||||
{type=item, name=sejunk, amount=1, probability=.01},
|
{type="item", name=sejunk, amount=1, probability=.01},
|
||||||
{type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25},
|
{type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_productivity=25, ignored_by_stats=25},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -250,14 +240,14 @@ function util.se_matter(params)
|
||||||
energy_required = 30,
|
energy_required = 30,
|
||||||
enabled = false,
|
enabled = false,
|
||||||
ingredients = {
|
ingredients = {
|
||||||
{"se-kr-matter-liberation-data", 1},
|
{type="item", name="se-kr-matter-liberation-data", amount=1},
|
||||||
{params.ore, params.quant_in},
|
{type="item", name=params.ore, amount=params.quant_in},
|
||||||
{type="fluid", name="se-particle-stream", amount=50},
|
{type="fluid", name="se-particle-stream", amount=50},
|
||||||
},
|
},
|
||||||
results = {
|
results = {
|
||||||
{type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99},
|
{type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99},
|
||||||
{type=item, name=sejunk, amount=1, probability=.01},
|
{type="item", name=sejunk, amount=1, probability=.01},
|
||||||
{type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50},
|
{type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_productivity=50, ignored_by_stats=50},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -284,7 +274,7 @@ function util.se_matter(params)
|
||||||
{"se-astronomic-science-pack-4", 1},
|
{"se-astronomic-science-pack-4", 1},
|
||||||
{"se-energy-science-pack-4", 1},
|
{"se-energy-science-pack-4", 1},
|
||||||
{"se-material-science-pack-4", 1},
|
{"se-material-science-pack-4", 1},
|
||||||
{"matter-tech-card", 1},
|
{"kr-matter-tech-card", 1},
|
||||||
{"se-deep-space-science-pack-1", 1},
|
{"se-deep-space-science-pack-1", 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,18 +288,6 @@ function util.se_matter(params)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the normal prototype for a recipe -- either .normal or the recipe itself
|
|
||||||
function util.get_normal(recipe_name)
|
|
||||||
if data.raw.recipe[recipe_name] then
|
|
||||||
recipe = data.raw.recipe[recipe_name]
|
|
||||||
if recipe.normal and recipe.normal.ingredients then
|
|
||||||
return recipe.normal
|
|
||||||
elseif recipe.ingredients then
|
|
||||||
return recipe
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set/override a technology's prerequisites
|
-- Set/override a technology's prerequisites
|
||||||
function util.set_prerequisite(technology_name, prerequisites)
|
function util.set_prerequisite(technology_name, prerequisites)
|
||||||
local technology = data.raw.technology[technology_name]
|
local technology = data.raw.technology[technology_name]
|
||||||
|
|
@ -376,7 +354,7 @@ function util.add_unlock(technology_name, recipe)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if a tech unlocks a recipe
|
-- Check if a tech unlocks a recipe
|
||||||
function util.check_unlock(technology_name, recipe_name)
|
function util.check_unlock(technology_name, recipe)
|
||||||
local technology = data.raw.technology[technology_name]
|
local technology = data.raw.technology[technology_name]
|
||||||
if technology and technology.effects then
|
if technology and technology.effects then
|
||||||
for i, effect in pairs(technology.effects) do
|
for i, effect in pairs(technology.effects) do
|
||||||
|
|
@ -421,17 +399,13 @@ end
|
||||||
|
|
||||||
function util.set_enabled(recipe_name, enabled)
|
function util.set_enabled(recipe_name, enabled)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end
|
data.raw.recipe[recipe_name].enabled = enabled
|
||||||
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end
|
|
||||||
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.set_hidden(recipe_name)
|
function util.set_hidden(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end
|
data.raw.recipe[recipe_name].hidden = true
|
||||||
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.hidden = true end
|
|
||||||
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].hidden = true end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -441,8 +415,6 @@ function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity, option
|
||||||
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -465,8 +437,6 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options)
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
||||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid)
|
|
||||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -480,7 +450,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid)
|
||||||
if is_fluid then
|
if is_fluid then
|
||||||
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
|
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
|
||||||
else
|
else
|
||||||
table.insert(recipe.ingredients, {ingredient, quantity})
|
table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -491,8 +461,6 @@ function util.add_ingredient_raw(recipe_name, ingredient, options)
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
|
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name].normal, ingredient)
|
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name].expensive, ingredient)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -516,8 +484,6 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options)
|
||||||
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
set_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
|
||||||
set_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -542,47 +508,31 @@ end
|
||||||
function util.add_product(recipe_name, product, options)
|
function util.add_product(recipe_name, product, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe_name] and
|
if data.raw.recipe[recipe_name] and
|
||||||
(data.raw.item[product[1]] or data.raw.item[product.name] or
|
(data.raw.item[product.name] or data.raw.fluid[product.name]) then
|
||||||
data.raw.fluid[product[1]] or data.raw.fluid[product.name]
|
|
||||||
) then
|
|
||||||
add_product(data.raw.recipe[recipe_name], product)
|
add_product(data.raw.recipe[recipe_name], product)
|
||||||
add_product(data.raw.recipe[recipe_name].normal, product)
|
|
||||||
add_product(data.raw.recipe[recipe_name].expensive, product)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_product(recipe, product)
|
function add_product(recipe, product)
|
||||||
if recipe ~= nil then
|
if recipe ~= nil then
|
||||||
if (product[1] and data.raw.item[product[1]]) or
|
|
||||||
(product.name and data.raw[product.type][product.name]) then
|
|
||||||
if not recipe.normal then
|
|
||||||
if recipe.results == nil then
|
if recipe.results == nil then
|
||||||
recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}}
|
recipe.results = {}
|
||||||
end
|
end
|
||||||
recipe.result = nil
|
|
||||||
recipe.result_count = nil
|
|
||||||
table.insert(recipe.results, product)
|
table.insert(recipe.results, product)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the amount of the ingredient, will check base/normal not expensive
|
-- Get the amount of the ingredient, will check base/normal not expensive
|
||||||
function util.get_ingredient_amount(recipe_name, ingredient_name)
|
function util.get_ingredient_amount(recipe_name, ingredient_name)
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
local recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.normal and recipe.normal.ingredients then
|
if recipe.ingredients then
|
||||||
for i, ingredient in pairs(recipe.normal.ingredients) do
|
|
||||||
if ingredient[1] == ingredient_name then return ingredient[2] end
|
|
||||||
if ingredient.name == ingredient_name then return ingredient.amount end
|
|
||||||
end
|
|
||||||
elseif recipe.ingredients then
|
|
||||||
for i, ingredient in pairs(recipe.ingredients) do
|
for i, ingredient in pairs(recipe.ingredients) do
|
||||||
if ingredient[1] == ingredient_name then return ingredient[2] end
|
if ingredient[1] == ingredient_name then return ingredient[2] end
|
||||||
if ingredient.name == ingredient_name then return ingredient.amount end
|
if ingredient.name == ingredient_name then return ingredient.amount end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 0
|
return 1
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
@ -592,14 +542,7 @@ function util.get_amount(recipe_name, product)
|
||||||
if not product then product = recipe_name end
|
if not product then product = recipe_name end
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
local recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.normal and recipe.normal.results then
|
if recipe.results then
|
||||||
for i, result in pairs(recipe.normal.results) do
|
|
||||||
if result[1] == product then return result[2] end
|
|
||||||
if result.name == product then return result.amount end
|
|
||||||
end
|
|
||||||
elseif recipe.normal and recipe.normal.result_count then
|
|
||||||
return recipe.normal.result_count
|
|
||||||
elseif recipe.results then
|
|
||||||
for i, result in pairs(recipe.results) do
|
for i, result in pairs(recipe.results) do
|
||||||
if result[1] == product then return result[2] end
|
if result[1] == product then return result[2] end
|
||||||
if result.name == product then return result.amount end
|
if result.name == product then return result.amount end
|
||||||
|
|
@ -617,9 +560,7 @@ function util.get_result_count(recipe_name, product)
|
||||||
if not product then product = recipe_name end
|
if not product then product = recipe_name end
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
local recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.normal and recipe.normal.results then
|
if recipe.results then
|
||||||
return #(recipe.normal.results)
|
|
||||||
elseif recipe.results then
|
|
||||||
return #(recipe.results)
|
return #(recipe.results)
|
||||||
end
|
end
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -634,8 +575,6 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount, multiply)
|
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount, multiply)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -677,8 +616,6 @@ function util.remove_ingredient(recipe_name, old, options)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -704,28 +641,23 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
||||||
replace_some_product(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
replace_some_product(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_some_product(recipe, old, old_amount, new, new_amount)
|
function replace_some_product(recipe, old, old_amount, new, new_amount, is_fluid)
|
||||||
if recipe ~= nil then
|
if recipe ~= nil then
|
||||||
if recipe.result == new then return end
|
if recipe.result == new then return end
|
||||||
if recipe.results then
|
if recipe.results then
|
||||||
for i, existing in pairs(recipe.results) do
|
for i, existing in pairs(recipe.results) do
|
||||||
if existing[1] == new or existing.name == new then
|
if existing.name == new then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
add_product(recipe, {new, new_amount})
|
add_product(recipe, {type=is_fluid and "fluid" or "item", name=new, amount=new_amount})
|
||||||
for i, product in pairs(recipe.results) do
|
for i, product in pairs(recipe.results) do
|
||||||
if product.name == old then
|
if product.name == old then
|
||||||
product.amount = math.max(1, product.amount - old_amount)
|
product.amount = math.max(1, product.amount - old_amount)
|
||||||
end
|
|
||||||
if product[1] == old then
|
|
||||||
product[2] = math.max(1, product[2] - old_amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -738,8 +670,6 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -768,8 +698,6 @@ function util.set_product_amount(recipe_name, product, amount, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_product_amount(data.raw.recipe[recipe_name], product, amount)
|
set_product_amount(data.raw.recipe[recipe_name], product, amount)
|
||||||
set_product_amount(data.raw.recipe[recipe_name].normal, product, amount)
|
|
||||||
set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -808,8 +736,6 @@ function util.multiply_recipe(recipe_name, multiple, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
multiply_recipe(data.raw.recipe[recipe_name], multiple)
|
multiply_recipe(data.raw.recipe[recipe_name], multiple)
|
||||||
multiply_recipe(data.raw.recipe[recipe_name].normal, multiple)
|
|
||||||
multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -817,8 +743,6 @@ function multiply_recipe(recipe, multiple)
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.energy_required then
|
if recipe.energy_required then
|
||||||
recipe.energy_required = recipe.energy_required * multiple
|
recipe.energy_required = recipe.energy_required * multiple
|
||||||
else
|
|
||||||
recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default
|
|
||||||
end
|
end
|
||||||
if recipe.result_count then
|
if recipe.result_count then
|
||||||
recipe.result_count = recipe.result_count * multiple
|
recipe.result_count = recipe.result_count * multiple
|
||||||
|
|
@ -833,8 +757,11 @@ function multiply_recipe(recipe, multiple)
|
||||||
result.amount_min = result.amount_min * multiple
|
result.amount_min = result.amount_min * multiple
|
||||||
result.amount_max = result.amount_max * multiple
|
result.amount_max = result.amount_max * multiple
|
||||||
end
|
end
|
||||||
if result.catalyst_amount then
|
if result.ignored_by_productivity then
|
||||||
result.catalyst_amount = result.catalyst_amount * multiple
|
result.ignored_by_productivity = result.ignored_by_productivity * multiple
|
||||||
|
end
|
||||||
|
if result.ignored_by_stats then
|
||||||
|
result.ignored_by_stats = result.ignored_by_stats * multiple
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if result[1] then
|
if result[1] then
|
||||||
|
|
@ -861,9 +788,8 @@ end
|
||||||
|
|
||||||
-- Returns true if a recipe has an ingredient
|
-- Returns true if a recipe has an ingredient
|
||||||
function util.has_ingredient(recipe_name, ingredient)
|
function util.has_ingredient(recipe_name, ingredient)
|
||||||
return data.raw.recipe[recipe_name] and (
|
return data.raw.recipe[recipe_name] and
|
||||||
has_ingredient(data.raw.recipe[recipe_name], ingredient) or
|
has_ingredient(data.raw.recipe[recipe_name], ingredient)
|
||||||
has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function has_ingredient(recipe, ingredient)
|
function has_ingredient(recipe, ingredient)
|
||||||
|
|
@ -883,8 +809,6 @@ function util.remove_product(recipe_name, old, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
remove_product(data.raw.recipe[recipe_name], old)
|
remove_product(data.raw.recipe[recipe_name], old)
|
||||||
remove_product(data.raw.recipe[recipe_name].normal, old)
|
|
||||||
remove_product(data.raw.recipe[recipe_name].expensive, old)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -907,8 +831,6 @@ function util.set_main_product(recipe_name, product, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_main_product(data.raw.recipe[recipe_name], product)
|
set_main_product(data.raw.recipe[recipe_name], product)
|
||||||
set_main_product(data.raw.recipe[recipe_name].normal, product)
|
|
||||||
set_main_product(data.raw.recipe[recipe_name].expensive, product)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -922,13 +844,11 @@ end
|
||||||
function util.replace_product(recipe_name, old, new, options)
|
function util.replace_product(recipe_name, old, new, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
replace_product(data.raw.recipe[recipe_name], old, new, options)
|
replace_product(data.raw.recipe[recipe_name], old, new)
|
||||||
replace_product(data.raw.recipe[recipe_name].normal, old, new, options)
|
|
||||||
replace_product(data.raw.recipe[recipe_name].expensive, old, new, options)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_product(recipe, old, new, options)
|
function replace_product(recipe, old, new)
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.main_product == old then
|
if recipe.main_product == old then
|
||||||
recipe.main_product = new
|
recipe.main_product = new
|
||||||
|
|
@ -968,8 +888,6 @@ function util.set_recipe_time(recipe_name, time, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_recipe_time(data.raw.recipe[recipe_name], time)
|
set_recipe_time(data.raw.recipe[recipe_name], time)
|
||||||
set_recipe_time(data.raw.recipe[recipe_name].normal, time)
|
|
||||||
set_recipe_time(data.raw.recipe[recipe_name].expensive, time)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -987,8 +905,6 @@ function util.multiply_time(recipe_name, factor, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
multiply_time(data.raw.recipe[recipe_name], factor)
|
multiply_time(data.raw.recipe[recipe_name], factor)
|
||||||
multiply_time(data.raw.recipe[recipe_name].normal, factor)
|
|
||||||
multiply_time(data.raw.recipe[recipe_name].expensive, factor)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1006,8 +922,6 @@ function util.add_time(recipe_name, amount, options)
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
add_time(data.raw.recipe[recipe_name], amount)
|
add_time(data.raw.recipe[recipe_name], amount)
|
||||||
add_time(data.raw.recipe[recipe_name].normal, amount)
|
|
||||||
add_time(data.raw.recipe[recipe_name].expensive, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1031,7 +945,7 @@ end
|
||||||
-- Set recipe subgroup
|
-- Set recipe subgroup
|
||||||
function util.set_subgroup(recipe_name, subgroup, options)
|
function util.set_subgroup(recipe_name, subgroup, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then
|
if data.raw.recipe[recipe_name] then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
data.raw.recipe[recipe_name].subgroup = subgroup
|
data.raw.recipe[recipe_name].subgroup = subgroup
|
||||||
end
|
end
|
||||||
|
|
@ -1050,35 +964,17 @@ function util.add_icon(recipe_name, icon, options)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
me.add_modified(recipe_name)
|
me.add_modified(recipe_name)
|
||||||
if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then
|
if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then
|
||||||
|
data.raw.recipe[recipe_name].icons = {}
|
||||||
if data.raw.recipe[recipe_name].icon then
|
if data.raw.recipe[recipe_name].icon then
|
||||||
data.raw.recipe[recipe_name].icons = {{
|
data.raw.recipe[recipe_name].icons = {{
|
||||||
icon=data.raw.recipe[recipe_name].icon,
|
icon=data.raw.recipe[recipe_name].icon,
|
||||||
icon_size=data.raw.recipe[recipe_name].icon_size,
|
icon_size=data.raw.recipe[recipe_name].icon_size,
|
||||||
icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps,
|
icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps,
|
||||||
}}
|
}}
|
||||||
elseif data.raw.item[data.raw.recipe[recipe_name].main_product] then
|
|
||||||
data.raw.recipe[recipe_name].icons = {{
|
|
||||||
icon=data.raw.item[data.raw.recipe[recipe_name].main_product].icon,
|
|
||||||
icon_size=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_size,
|
|
||||||
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_mipmaps,
|
|
||||||
}}
|
|
||||||
elseif data.raw.item[data.raw.recipe[recipe_name].result] then
|
|
||||||
data.raw.recipe[recipe_name].icons = {{
|
|
||||||
icon=data.raw.item[data.raw.recipe[recipe_name].result].icon,
|
|
||||||
icon_size=data.raw.item[data.raw.recipe[recipe_name].result].icon_size,
|
|
||||||
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].result].icon_mipmaps,
|
|
||||||
}}
|
|
||||||
elseif data.raw.recipe[recipe_name].normal and
|
|
||||||
data.raw.item[data.raw.recipe[recipe_name].normal.result] then
|
|
||||||
data.raw.recipe[recipe_name].icons = {{
|
|
||||||
icon=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon,
|
|
||||||
icon_size=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_size,
|
|
||||||
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_mipmaps,
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
data.raw.recipe[recipe_name].icon = nil
|
data.raw.recipe[recipe_name].icon = nil
|
||||||
data.raw.recipe[recipe_name].icon_size = nil
|
data.raw.recipe[recipe_name].icon_size = nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
table.insert(data.raw.recipe[recipe_name].icons, icon)
|
table.insert(data.raw.recipe[recipe_name].icons, icon)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1137,8 +1033,6 @@ function util.add_to_ingredient(recipe, ingredient, amount, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe] then
|
if data.raw.recipe[recipe] then
|
||||||
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
|
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
|
||||||
add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)
|
|
||||||
add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1161,8 +1055,6 @@ function util.add_to_product(recipe_name, product, amount, options)
|
||||||
if not should_force(options) and bypass(recipe_name) then return end
|
if not should_force(options) and bypass(recipe_name) then return end
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
add_to_product(data.raw.recipe[recipe_name], product, amount)
|
add_to_product(data.raw.recipe[recipe_name], product, amount)
|
||||||
add_to_product(data.raw.recipe[recipe_name].normal, product, amount)
|
|
||||||
add_to_product(data.raw.recipe[recipe_name].expensive, product, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1285,13 +1177,11 @@ function remove_prior_unlocks(tech, recipe)
|
||||||
util.remove_recipe_effect(tech, recipe)
|
util.remove_recipe_effect(tech, recipe)
|
||||||
if technology.prerequisites then
|
if technology.prerequisites then
|
||||||
for i, prerequisite in pairs(technology.prerequisites) do
|
for i, prerequisite in pairs(technology.prerequisites) do
|
||||||
if string.sub(prerequisite, 1, 3) ~= 'ei_' then
|
-- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
|
||||||
-- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
|
|
||||||
remove_prior_unlocks(prerequisite, recipe)
|
remove_prior_unlocks(prerequisite, recipe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.replace_ingredients_prior_to(tech, old, new, multiplier)
|
function util.replace_ingredients_prior_to(tech, old, new, multiplier)
|
||||||
|
|
@ -1330,12 +1220,10 @@ function replace_ingredients_prior_to(tech, old, new, multiplier)
|
||||||
if technology.prerequisites then
|
if technology.prerequisites then
|
||||||
for i, prerequisite in pairs(technology.prerequisites) do
|
for i, prerequisite in pairs(technology.prerequisites) do
|
||||||
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
|
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
|
||||||
if string.sub(prerequisite, 1, 3) ~= 'ei_' then
|
|
||||||
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
|
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.remove_all_recipe_effects(recipe_name)
|
function util.remove_all_recipe_effects(recipe_name)
|
||||||
|
|
|
||||||
2
data.lua
|
|
@ -5,6 +5,6 @@ require("prototypes/categories")
|
||||||
if util.me.enable() then
|
if util.me.enable() then
|
||||||
require("prototypes/coke")
|
require("prototypes/coke")
|
||||||
require("prototypes/foundry")
|
require("prototypes/foundry")
|
||||||
require("prototypes/entity/foundry")
|
|
||||||
require("prototypes/entity/electric-foundry")
|
require("prototypes/entity/electric-foundry")
|
||||||
|
require("prototypes/entity/foundry")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ if util.me.enable() then
|
||||||
util.add_ingredient("tungsten-carbide", util.me.carbon(), 1)
|
util.add_ingredient("tungsten-carbide", util.me.carbon(), 1)
|
||||||
util.set_to_founding("cuw")
|
util.set_to_founding("cuw")
|
||||||
|
|
||||||
util.set_to_founding("silicon")
|
util.set_to_founding(mods.Krastorio2 and "kr-silicon" or "silicon")
|
||||||
util.add_ingredient("silicon", util.me.carbon(), 1)
|
util.add_ingredient(mods.Krastorio2 and "kr-silicon" or "silicon", util.me.carbon(), 1)
|
||||||
|
|
||||||
util.set_to_founding("cermet") -- from zirconium
|
util.set_to_founding("cermet") -- from zirconium
|
||||||
util.set_to_founding("crucible") -- from graphite
|
util.set_to_founding("crucible") -- from graphite
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 23 KiB |
BIN
graphics/entity/electric-foundry/foundry-lights-1.png
Normal file
|
After Width: | Height: | Size: 593 KiB |
BIN
graphics/entity/electric-foundry/foundry-lights-2.png
Normal file
|
After Width: | Height: | Size: 641 KiB |
12
graphics/entity/electric-foundry/foundry-lights.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 442,
|
||||||
|
height = 356,
|
||||||
|
shift = util.by_pixel( 30.5, -7.5),
|
||||||
|
line_length = 8,
|
||||||
|
filenames = {
|
||||||
|
"-1.png",
|
||||||
|
"-2.png",
|
||||||
|
},
|
||||||
|
lines_per_file = 8,
|
||||||
|
}
|
||||||
BIN
graphics/entity/electric-foundry/foundry-main-1.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
graphics/entity/electric-foundry/foundry-main-2.png
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
12
graphics/entity/electric-foundry/foundry-main.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 376,
|
||||||
|
height = 398,
|
||||||
|
shift = util.by_pixel( 0.0, -6.0),
|
||||||
|
line_length = 8,
|
||||||
|
filenames = {
|
||||||
|
"-1.png",
|
||||||
|
"-2.png",
|
||||||
|
},
|
||||||
|
lines_per_file = 8,
|
||||||
|
}
|
||||||
7
graphics/entity/electric-foundry/foundry-reflection.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 38,
|
||||||
|
height = 46,
|
||||||
|
shift = util.by_pixel( -0.5, 6.5),
|
||||||
|
line_length = 1,
|
||||||
|
}
|
||||||
BIN
graphics/entity/electric-foundry/foundry-reflection.png
Normal file
|
After Width: | Height: | Size: 810 B |
BIN
graphics/entity/electric-foundry/foundry-remnants.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
graphics/entity/electric-foundry/foundry-shadow-1.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
graphics/entity/electric-foundry/foundry-shadow-2.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
12
graphics/entity/electric-foundry/foundry-shadow.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 514,
|
||||||
|
height = 214,
|
||||||
|
shift = util.by_pixel( 47.5, 29.0),
|
||||||
|
line_length = 6,
|
||||||
|
filenames = {
|
||||||
|
"-1.png",
|
||||||
|
"-2.png",
|
||||||
|
},
|
||||||
|
lines_per_file = 11,
|
||||||
|
}
|
||||||
7
graphics/entity/electric-foundry/foundry-status-lamp.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 122,
|
||||||
|
height = 142,
|
||||||
|
shift = util.by_pixel( 26.5, -42.5),
|
||||||
|
line_length = 1,
|
||||||
|
}
|
||||||
BIN
graphics/entity/electric-foundry/foundry-status-lamp.png
Normal file
|
After Width: | Height: | Size: 885 B |
BIN
graphics/entity/electric-foundry/foundry-working-1.png
Normal file
|
After Width: | Height: | Size: 450 KiB |
BIN
graphics/entity/electric-foundry/foundry-working-2.png
Normal file
|
After Width: | Height: | Size: 357 KiB |
12
graphics/entity/electric-foundry/foundry-working.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
return
|
||||||
|
{
|
||||||
|
width = 314,
|
||||||
|
height = 290,
|
||||||
|
shift = util.by_pixel( 25.0, -9.5),
|
||||||
|
line_length = 8,
|
||||||
|
filenames = {
|
||||||
|
"-1.png",
|
||||||
|
"-2.png",
|
||||||
|
},
|
||||||
|
lines_per_file = 8,
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 24 KiB |
BIN
graphics/entity/foundry/foundry-main-1.afphoto
Normal file
BIN
graphics/entity/foundry/foundry-main-1.png
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
BIN
graphics/entity/foundry/foundry-main-2.afphoto
Normal file
BIN
graphics/entity/foundry/foundry-main-2.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
graphics/entity/foundry/foundry-remnants.afphoto
Normal file
BIN
graphics/entity/foundry/foundry-remnants.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 12 KiB |
BIN
graphics/icons/foundry.afphoto
Normal file
|
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 143 KiB |
BIN
graphics/icons/technology/foundry.afphoto
Normal file
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 146 KiB |
17
info.json
|
|
@ -1,19 +1,20 @@
|
||||||
{
|
{
|
||||||
"name": "bzfoundry",
|
"name": "bzfoundry",
|
||||||
"version": "0.2.14",
|
"version": "2.0.0",
|
||||||
"factorio_version": "1.1",
|
"factorio_version": "2.0",
|
||||||
"title": "Foundry",
|
"title": "Foundry",
|
||||||
"author": "Brevven",
|
"author": "Brevven",
|
||||||
"contact": "",
|
"contact": "",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"? space-exploration",
|
"base >= 2.0.0",
|
||||||
"(?) Krastorio2",
|
"rusty-locale >= 1.0.17",
|
||||||
"? bzsilicon",
|
"? space-exploration >= 0.7.34",
|
||||||
|
"(?) Krastorio2 >= 2.0.8",
|
||||||
|
"? bzsilicon >= 2.0.18",
|
||||||
"? bztungsten",
|
"? bztungsten",
|
||||||
"? bzzirconium",
|
"? bzzirconium >= 2.1.13",
|
||||||
"rusty-locale",
|
"! space-age"
|
||||||
"base >= 1.1.0"
|
|
||||||
],
|
],
|
||||||
"description": "Adds a foundry building for making alloys, etc.\n\nA standalone accessory from BZ Mods."
|
"description": "Adds a foundry building for making alloys, etc.\n\nA standalone accessory from BZ Mods."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
me.lua
|
|
@ -23,14 +23,15 @@ function me.enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
function me.carbon()
|
function me.carbon()
|
||||||
|
if mods["Krastorio2"] then return "kr-coke" end
|
||||||
if me.get_setting("bz-all-intermediates") then return "coke" end
|
if me.get_setting("bz-all-intermediates") then return "coke" end
|
||||||
return me.get_setting("bzfoundry-hydrocarbon")
|
return me.get_setting("bzfoundry-hydrocarbon")
|
||||||
end
|
end
|
||||||
|
|
||||||
function me.carbonrecipe()
|
function me.carbonrecipe()
|
||||||
local carbon = me.carbon()
|
local carbon = me.carbon()
|
||||||
if carbon == "coke" then
|
if carbon == "coke" or carbon == "kr-coke" then
|
||||||
return "coke"
|
return me.carbon()
|
||||||
elseif carbon == "solid-fuel" then
|
elseif carbon == "solid-fuel" then
|
||||||
return "solid-fuel-from-coal"
|
return "solid-fuel-from-coal"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "coke",
|
name = "coke",
|
||||||
result = "coke",
|
|
||||||
category = "founding",
|
category = "founding",
|
||||||
ingredients = {{"coal", 2}},
|
ingredients = {{type="item", name="coal", amount=2}},
|
||||||
|
results = {{ type = "item", name = "coke", amount = 1 }},
|
||||||
energy_required = 3.2,
|
energy_required = 3.2,
|
||||||
enabled=false,
|
enabled=false,
|
||||||
},
|
},
|
||||||
|
|
@ -36,9 +36,9 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "woodcoke",
|
name = "woodcoke",
|
||||||
result = "coke",
|
|
||||||
category = "founding",
|
category = "founding",
|
||||||
ingredients = {{"coal", 1}, {"wood", 2}},
|
ingredients = {{type="item", name="coal", amount=1}, {type="item", name="wood", amount=2}},
|
||||||
|
results = {{ type = "item", name = "coke", amount = 1 }},
|
||||||
energy_required = 3.2,
|
energy_required = 3.2,
|
||||||
enabled=false,
|
enabled=false,
|
||||||
icons = {
|
icons = {
|
||||||
|
|
@ -53,9 +53,9 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "solid-fuel-from-coal",
|
name = "solid-fuel-from-coal",
|
||||||
result = "solid-fuel",
|
|
||||||
category = "founding",
|
category = "founding",
|
||||||
ingredients = {{"coal", 4}},
|
ingredients = {{type="item", name="coal", amount=4}},
|
||||||
|
results = {{ type = "item", name = "solid-fuel", amount = 1 }},
|
||||||
energy_required = 3.2,
|
energy_required = 3.2,
|
||||||
enabled=false,
|
enabled=false,
|
||||||
},
|
},
|
||||||
|
|
@ -65,9 +65,9 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "woodcoke",
|
name = "woodcoke",
|
||||||
result = "solid-fuel",
|
|
||||||
category = "founding",
|
category = "founding",
|
||||||
ingredients = {{"coal", 3}, {"wood", 2}},
|
ingredients = {{type="item", name="coal", amount=3}, {type="item", name="wood", amount=2}},
|
||||||
|
results = {{ type = "item", name = "solid-fuel", amount = 1 }},
|
||||||
energy_required = 3.2,
|
energy_required = 3.2,
|
||||||
enabled=false,
|
enabled=false,
|
||||||
icons = {
|
icons = {
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,26 @@
|
||||||
require("util")
|
require("util")
|
||||||
local futil = require("data-util")
|
local futil = require("data-util")
|
||||||
|
require ("sound-util")
|
||||||
|
require ("circuit-connector-sprites")
|
||||||
|
local hit_effects = require("__base__.prototypes.entity.hit-effects")
|
||||||
|
local sounds = require("__base__.prototypes.entity.sounds")
|
||||||
|
local explosion_animations = require("__base__/prototypes/entity/explosion-animations")
|
||||||
|
local particle_animations = require("__base__/prototypes/particle-animations")
|
||||||
|
|
||||||
data:extend({
|
data:extend({
|
||||||
{
|
{
|
||||||
type = "assembling-machine",
|
type = "assembling-machine",
|
||||||
name = "electric-foundry",
|
name = "electric-foundry",
|
||||||
fast_replaceable_group = "foundry",
|
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
|
||||||
icon = "__bzfoundry__/graphics/icons/foundry.png",
|
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
flags = {"placeable-neutral", "placeable-player", "player-creation"},
|
flags = {"placeable-neutral","player-creation"},
|
||||||
minable = {mining_time = 0.2, result = "electric-foundry"},
|
minable = {mining_time = 0.2, result = "electric-foundry"},
|
||||||
max_health = 300,
|
max_health = 300,
|
||||||
corpse = "medium-small-remnants",
|
fast_replaceable_group = "foundry",
|
||||||
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
|
corpse = "electric-foundry-remnants",
|
||||||
working_sound =
|
dying_explosion = "foundry-explosion",
|
||||||
{
|
circuit_wire_max_distance = assembling_machine_circuit_wire_max_distance,
|
||||||
sound = { filename = "__base__/sound/electric-furnace.ogg" }
|
circuit_connector = circuit_connector_definitions["foundry"],
|
||||||
},
|
|
||||||
resistances =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
type = "fire",
|
|
||||||
percent = 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
collision_box = {{-1.7, -1.7}, {1.7, 1.7}},
|
collision_box = {{-1.7, -1.7}, {1.7, 1.7}},
|
||||||
selection_box = {{-2, -2}, {2, 2}},
|
selection_box = {{-2, -2}, {2, 2}},
|
||||||
crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil},
|
crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil},
|
||||||
|
|
@ -33,130 +30,308 @@ data:extend({
|
||||||
energy_source =
|
energy_source =
|
||||||
{
|
{
|
||||||
type = "electric",
|
type = "electric",
|
||||||
fuel_category = "chemical",
|
emissions_per_minute = { pollution = 2 },
|
||||||
effectivity = 1,
|
|
||||||
emissions_per_minute = 2,
|
|
||||||
usage_priority = "secondary-input",
|
usage_priority = "secondary-input",
|
||||||
},
|
},
|
||||||
module_specification =
|
|
||||||
{
|
|
||||||
module_slots = 3,
|
|
||||||
module_info_icon_shift = {0, 0.8}
|
|
||||||
},
|
|
||||||
allowed_effects = {"consumption", "speed", "productivity", "pollution"},
|
allowed_effects = {"consumption", "speed", "productivity", "pollution"},
|
||||||
animation =
|
damaged_trigger_effect = hit_effects.entity(),
|
||||||
|
drawing_box_vertical_extension = 1.3,
|
||||||
|
module_slots = 3,
|
||||||
|
icon_draw_specification = {scale = 2, shift = {0, -0.3}},
|
||||||
|
icons_positioning =
|
||||||
{
|
{
|
||||||
layers =
|
{inventory_index = defines.inventory.assembling_machine_modules, shift = {0, 1.25}}
|
||||||
{
|
|
||||||
{
|
|
||||||
-- TODO make a non-hr version
|
|
||||||
filename = "__bzfoundry__/graphics/entity/hr-electric-foundry.png",
|
|
||||||
priority = "high",
|
|
||||||
width = 280,
|
|
||||||
height = 239,
|
|
||||||
frame_count = 1,
|
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
scale = 0.5,
|
|
||||||
hr_version =
|
|
||||||
{
|
|
||||||
filename = "__bzfoundry__/graphics/entity/hr-electric-foundry.png",
|
|
||||||
priority = "high",
|
|
||||||
width = 280,
|
|
||||||
height = 239,
|
|
||||||
frame_count = 1,
|
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
scale = 0.5,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
perceived_performance = {minimum = 0.25, maximum = 20},
|
||||||
|
graphics_set = require("foundry-pictures").graphics_set,
|
||||||
|
open_sound = sounds.steam_open,
|
||||||
|
close_sound = sounds.steam_close,
|
||||||
|
working_sound =
|
||||||
|
{
|
||||||
|
sound =
|
||||||
|
{
|
||||||
|
filename = "__bzfoundry__/sound/entity/foundry/foundry.ogg",
|
||||||
|
volume = 0.5,
|
||||||
|
audible_distance_modifier = 0.6
|
||||||
},
|
},
|
||||||
working_visualisations =
|
fade_in_ticks = 4,
|
||||||
|
fade_out_ticks = 20,
|
||||||
|
sound_accents =
|
||||||
{
|
{
|
||||||
{
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-pipe-out.ogg", volume = 0.9, audible_distance_modifier = 0.4}, frame = 2},
|
||||||
north_position = {0.0, 0.0},
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-close.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 18},
|
||||||
east_position = {0.0, 0.0},
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-clamp.ogg", volume = 0.45, audible_distance_modifier = 0.3}, frame = 39},
|
||||||
south_position = {0.0, 0.0},
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-stop.ogg", volume = 0.7, audible_distance_modifier = 0.4}, frame = 43},
|
||||||
west_position = {0.0, 0.0},
|
{sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-fire-whoosh", 3, 0.8), audible_distance_modifier = 0.3}, frame = 64},
|
||||||
animation =
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-metal-clunk.ogg", volume = 0.65, audible_distance_modifier = 0.4}, frame = 64},
|
||||||
{
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-open.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 74},
|
||||||
filename = "__bzfoundry__/graphics/entity/hr-electric-foundry-animation.png",
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-pipe-in.ogg", volume = 0.75, audible_distance_modifier = 0.4}, frame = 106},
|
||||||
priority = "extra-high",
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-smoke-puff.ogg", volume = 0.8, audible_distance_modifier = 0.3}, frame = 106},
|
||||||
animation_speed = 0.05,
|
{sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-pour", 2, 0.7)}, frame = 110},
|
||||||
line_length = 4,
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-rocks.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 120},
|
||||||
width = 280,
|
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-blade.ogg", volume = 0.7}, frame = 126},
|
||||||
height = 239,
|
|
||||||
frame_count = 4,
|
|
||||||
axially_symmetrical = false,
|
|
||||||
direction_count = 1,
|
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
scale = 0.5,
|
|
||||||
hr_version =
|
|
||||||
{
|
|
||||||
filename = "__bzfoundry__/graphics/entity/hr-electric-foundry-animation.png",
|
|
||||||
priority = "extra-high",
|
|
||||||
animation_speed = 0.05,
|
|
||||||
line_length = 4,
|
|
||||||
width = 280,
|
|
||||||
height = 239,
|
|
||||||
frame_count = 4,
|
|
||||||
axially_symmetrical = false,
|
|
||||||
direction_count = 1,
|
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
scale = 0.5,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
max_sounds_per_prototype = 2
|
||||||
},
|
},
|
||||||
|
water_reflection =
|
||||||
{
|
{
|
||||||
fadeout = true,
|
pictures = util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-reflection",
|
||||||
draw_as_light = true,
|
|
||||||
effect = "flicker",
|
|
||||||
animation =
|
|
||||||
{
|
{
|
||||||
filename = "__bzfoundry__/graphics/entity/electric-foundry-glow.png",
|
scale = 4,
|
||||||
priority = "extra-high",
|
shift = {0,2}
|
||||||
width = 25,
|
}),
|
||||||
height = 29,
|
rotate = false
|
||||||
frame_count = 1,
|
|
||||||
shift = util.by_pixel(0, 36),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
draw_as_light = true,
|
type = "corpse",
|
||||||
draw_as_sprite = false,
|
name = "electric-foundry-remnants",
|
||||||
fadeout = true,
|
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
|
||||||
effect = "flicker",
|
flags = {"placeable-neutral", "not-on-map"},
|
||||||
|
hidden_in_factoriopedia = true,
|
||||||
|
subgroup = "smelting-machine-remnants",
|
||||||
|
order = "d[foundry]",
|
||||||
|
selection_box = {{-2.5, -2.5}, {2.5, 2.5}},
|
||||||
|
tile_width = 5,
|
||||||
|
tile_height = 5,
|
||||||
|
selectable_in_game = false,
|
||||||
|
time_before_removed = 60 * 60 * 15, -- 15 minutes
|
||||||
|
expires = false,
|
||||||
|
final_render_layer = "remnants",
|
||||||
|
remove_on_tile_placement = false,
|
||||||
animation =
|
animation =
|
||||||
{
|
{
|
||||||
filename = "__base__/graphics/entity/steel-furnace/steel-furnace-ground-light.png",
|
filename = "__bzfoundry__/graphics/entity/electric-foundry/foundry-remnants.png",
|
||||||
priority = "high",
|
|
||||||
line_length = 1,
|
line_length = 1,
|
||||||
draw_as_sprite = false,
|
width = 494,
|
||||||
width = 78,
|
height = 478,
|
||||||
height = 64,
|
|
||||||
frame_count = 1,
|
frame_count = 1,
|
||||||
direction_count = 1,
|
direction_count = 1,
|
||||||
shift = util.by_pixel(0, 72),
|
shift = util.by_pixel( -1.5, -5.5),
|
||||||
blend_mode = "additive",
|
scale = 0.4
|
||||||
hr_version =
|
|
||||||
{
|
|
||||||
filename = "__base__/graphics/entity/steel-furnace/hr-steel-furnace-ground-light.png",
|
|
||||||
priority = "high",
|
|
||||||
line_length = 1,
|
|
||||||
draw_as_sprite = false,
|
|
||||||
width = 152,
|
|
||||||
height = 126,
|
|
||||||
frame_count = 1,
|
|
||||||
direction_count = 1,
|
|
||||||
shift = util.by_pixel(1, 72),
|
|
||||||
blend_mode = "additive",
|
|
||||||
scale = 0.5,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "explosion",
|
||||||
|
name = "foundry-explosion",
|
||||||
|
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
|
||||||
|
flags = {"not-on-map"},
|
||||||
|
hidden = true,
|
||||||
|
subgroup = "smelting-machine-explosions",
|
||||||
|
order = "d[foundry]",
|
||||||
|
height = 0,
|
||||||
|
animations = explosion_animations.big_explosion(),
|
||||||
|
smoke = "smoke-fast",
|
||||||
|
smoke_count = 2,
|
||||||
|
smoke_slow_down_factor = 1,
|
||||||
|
sound = sounds.large_explosion(0.7, 1.0),
|
||||||
|
created_effect =
|
||||||
|
{
|
||||||
|
type = "direct",
|
||||||
|
action_delivery =
|
||||||
|
{
|
||||||
|
type = "instant",
|
||||||
|
target_effects =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 10,
|
||||||
|
probability = 1,
|
||||||
|
particle_name = "oil-refinery-metal-particle-big",
|
||||||
|
offsets =
|
||||||
|
{
|
||||||
|
{ 0.7734, -0.6484 },
|
||||||
|
{ -0.7266, 0.5859 }
|
||||||
},
|
},
|
||||||
|
offset_deviation = { { -0.6875, -0.6875 }, { 0.6875, 0.6875 } },
|
||||||
|
initial_height = 0.8,
|
||||||
|
initial_height_deviation = 0.49,
|
||||||
|
initial_vertical_speed = 0.088,
|
||||||
|
initial_vertical_speed_deviation = 0.05,
|
||||||
|
speed_from_center = 0.03,
|
||||||
|
speed_from_center_deviation = 0.05
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 38,
|
||||||
|
probability = 1,
|
||||||
|
particle_name = "oil-refinery-metal-particle-medium",
|
||||||
|
offsets = { { 0, 0 } },
|
||||||
|
offset_deviation = { { -0.9805, -0.8867 }, { 0.9805, 0.8867 } },
|
||||||
|
initial_height = 0.6,
|
||||||
|
initial_height_deviation = 0.5,
|
||||||
|
initial_vertical_speed = 0.098,
|
||||||
|
initial_vertical_speed_deviation = 0.05,
|
||||||
|
speed_from_center = 0.07,
|
||||||
|
speed_from_center_deviation = 0.05
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 10,
|
||||||
|
probability = 1,
|
||||||
|
particle_name = "foundry-metal-particle-big",
|
||||||
|
offsets =
|
||||||
|
{
|
||||||
|
{ -1.492, -1.453 },
|
||||||
|
{ 1.555, -1.469 },
|
||||||
|
{ 1.477, 1.469 },
|
||||||
|
{ -0.6172, 0.3281 }
|
||||||
|
},
|
||||||
|
offset_deviation = { { -0.9961, -0.5938 }, { 0.9961, 0.5938 } },
|
||||||
|
initial_height = 0.4,
|
||||||
|
initial_height_deviation = 0.5,
|
||||||
|
initial_vertical_speed = 0.075,
|
||||||
|
initial_vertical_speed_deviation = 0.05,
|
||||||
|
speed_from_center = 0.04,
|
||||||
|
speed_from_center_deviation = 0.05
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 35,
|
||||||
|
probability = 1,
|
||||||
|
particle_name = "foundry-metal-particle-medium",
|
||||||
|
offsets =
|
||||||
|
{
|
||||||
|
{ -0.02344, -0.8984 }
|
||||||
|
},
|
||||||
|
offset_deviation = { { -0.5, -0.2969 }, { 0.5, 0.2969 } },
|
||||||
|
initial_height = 0.7,
|
||||||
|
initial_height_deviation = 0.15,
|
||||||
|
initial_vertical_speed = 0.166,
|
||||||
|
initial_vertical_speed_deviation = 0.047,
|
||||||
|
speed_from_center = 0.05,
|
||||||
|
speed_from_center_deviation = 0.005
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 20,
|
||||||
|
particle_name = "foundry-metal-particle-small",
|
||||||
|
offset_deviation = { { -0.5, -0.5 }, { 0.5, 0.5 } },
|
||||||
|
initial_height = 0.5,
|
||||||
|
initial_height_deviation = 0.5,
|
||||||
|
initial_vertical_speed = 0.06,
|
||||||
|
initial_vertical_speed_deviation = 0.05,
|
||||||
|
speed_from_center = 0.04,
|
||||||
|
speed_from_center_deviation = 0.05
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
},
|
local make_particle = function(params)
|
||||||
|
return {
|
||||||
|
type = "optimized-particle",
|
||||||
|
name = params.name,
|
||||||
|
life_time = 60 * 15,
|
||||||
|
render_layer = "object",
|
||||||
|
render_layer_when_on_ground = "corpse",
|
||||||
|
|
||||||
|
regular_trigger_effect_frequency = 2,
|
||||||
|
regular_trigger_effect = params.regular_trigger_effect,
|
||||||
|
ended_in_water_trigger_effect = {
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
probability = 1,
|
||||||
|
affects_target = false,
|
||||||
|
show_in_tooltip = false,
|
||||||
|
particle_name = "tintable-water-particle",
|
||||||
|
apply_tile_tint = "secondary",
|
||||||
|
offset_deviation = { { -0.05, -0.05 }, { 0.05, 0.05 } },
|
||||||
|
initial_height = 0,
|
||||||
|
initial_height_deviation = 0.02,
|
||||||
|
initial_vertical_speed = 0.05,
|
||||||
|
initial_vertical_speed_deviation = 0.05,
|
||||||
|
speed_from_center = 0.01,
|
||||||
|
speed_from_center_deviation = 0.006,
|
||||||
|
frame_speed = 1,
|
||||||
|
frame_speed_deviation = 0,
|
||||||
|
tail_length = 2,
|
||||||
|
tail_length_deviation = 1,
|
||||||
|
tail_width = 3,
|
||||||
|
only_when_visible = true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "create-particle",
|
||||||
|
repeat_count = 10,
|
||||||
|
repeat_count_deviation = 6,
|
||||||
|
probability = 0.03,
|
||||||
|
affects_target = false,
|
||||||
|
show_in_tooltip = false,
|
||||||
|
particle_name = "tintable-water-particle",
|
||||||
|
apply_tile_tint = "primary",
|
||||||
|
offsets =
|
||||||
|
{
|
||||||
|
{ 0, 0 },
|
||||||
|
{ 0.01563, -0.09375 },
|
||||||
|
{ 0.0625, 0.09375 },
|
||||||
|
{ -0.1094, 0.0625 }
|
||||||
|
},
|
||||||
|
offset_deviation = { { -0.2969, -0.1992 }, { 0.2969, 0.1992 } },
|
||||||
|
initial_height = 0,
|
||||||
|
initial_height_deviation = 0.02,
|
||||||
|
initial_vertical_speed = 0.053,
|
||||||
|
initial_vertical_speed_deviation = 0.005,
|
||||||
|
speed_from_center = 0.02,
|
||||||
|
speed_from_center_deviation = 0.006,
|
||||||
|
frame_speed = 1,
|
||||||
|
frame_speed_deviation = 0,
|
||||||
|
tail_length = 9,
|
||||||
|
tail_length_deviation = 0,
|
||||||
|
tail_width = 1,
|
||||||
|
only_when_visible = true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "play-sound",
|
||||||
|
sound = sounds.small_splash
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pictures = params.pictures,
|
||||||
|
shadows = params.shadows,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local small_smoke_trigger_effect = function()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
type = "create-trivial-smoke",
|
||||||
|
smoke_name = "smoke-explosion-particle-small",
|
||||||
|
starting_frame_deviation = 0,
|
||||||
|
offset_deviation = {{-0.03, -0.03}, {0.03, 0.03}},
|
||||||
|
speed_from_center = nil
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_smoke_trigger_effect = function()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
type = "create-trivial-smoke",
|
||||||
|
smoke_name = "smoke-explosion-particle",
|
||||||
|
starting_frame_deviation = 5,
|
||||||
|
offset_deviation = {{-0.06, -0.06}, {0.06, 0.06}},
|
||||||
|
speed_from_center = 0.007
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
data:extend({
|
||||||
|
make_particle({
|
||||||
|
name = "foundry-metal-particle-small",
|
||||||
|
pictures = particle_animations.get_metal_particle_small_pictures({tint = {0.606, 0.408, 0.512, 1}}),
|
||||||
|
shadows = particle_animations.get_metal_particle_small_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}),
|
||||||
|
regular_trigger_effect = nil,
|
||||||
|
}),
|
||||||
|
make_particle({
|
||||||
|
name = "foundry-metal-particle-medium",
|
||||||
|
pictures = particle_animations.get_metal_particle_medium_pictures({tint = {0.5, 0.5, 0.5, 1}}),
|
||||||
|
shadows = particle_animations.get_metal_particle_medium_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}),
|
||||||
|
regular_trigger_effect = small_smoke_trigger_effect()
|
||||||
|
}),
|
||||||
|
make_particle({
|
||||||
|
name = "foundry-metal-particle-big",
|
||||||
|
pictures = particle_animations.get_metal_particle_big_pictures({tint = {0.65, 0.40, 0.35, 1}}),
|
||||||
|
regular_trigger_effect = default_smoke_trigger_effect()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding")
|
futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding")
|
||||||
|
|
|
||||||
111
prototypes/entity/foundry-pictures.lua
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
local foundry_animation_speed = 0.16
|
||||||
|
local frames = 128
|
||||||
|
|
||||||
|
local function foundry_main_pictures()
|
||||||
|
return util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-main",
|
||||||
|
{
|
||||||
|
animation_speed = foundry_animation_speed,
|
||||||
|
frame_count = frames,
|
||||||
|
scale = 0.4
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function foundry_main_shadow_pictures()
|
||||||
|
return util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-shadow",
|
||||||
|
{
|
||||||
|
animation_speed = foundry_animation_speed,
|
||||||
|
frame_count = frames,
|
||||||
|
draw_as_shadow = true,
|
||||||
|
scale = 0.4
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function foundry_working_pictures()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
fadeout = true,
|
||||||
|
animation =
|
||||||
|
util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-working",
|
||||||
|
{
|
||||||
|
animation_speed = foundry_animation_speed,
|
||||||
|
frame_count = frames,
|
||||||
|
scale = 0.4
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function foundry_lights_pictures()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
effect = "flicker",
|
||||||
|
fadeout = true,
|
||||||
|
animation =
|
||||||
|
util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-lights",
|
||||||
|
{
|
||||||
|
draw_as_glow = true,
|
||||||
|
animation_speed = foundry_animation_speed,
|
||||||
|
frame_count = frames,
|
||||||
|
blend_mode = "additive",
|
||||||
|
scale = 0.4
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function foundry_status_lamp_pictures()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
animation =
|
||||||
|
util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-status-lamp",
|
||||||
|
{
|
||||||
|
draw_as_glow = true,
|
||||||
|
repeat_count = frames,
|
||||||
|
blend_mode = "additive",
|
||||||
|
scale = 0.4
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function foundry_chimney_smoke()
|
||||||
|
return
|
||||||
|
{
|
||||||
|
fadeout = true,
|
||||||
|
constant_speed = true,
|
||||||
|
render_layer = "wires",
|
||||||
|
animation =
|
||||||
|
{
|
||||||
|
filename = "__base__/graphics/entity/chemical-plant/chemical-plant-smoke-outer.png",
|
||||||
|
frame_count = 47,
|
||||||
|
line_length = 16,
|
||||||
|
width = 90,
|
||||||
|
height = 188,
|
||||||
|
animation_speed = 0.5,
|
||||||
|
shift = util.by_pixel(52, -131),
|
||||||
|
tint = {0.4, 0.4, 0.4, 1},
|
||||||
|
scale = 0.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
graphics_set =
|
||||||
|
{
|
||||||
|
animation =
|
||||||
|
{
|
||||||
|
layers =
|
||||||
|
{
|
||||||
|
foundry_main_pictures(),
|
||||||
|
foundry_main_shadow_pictures()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
working_visualisations =
|
||||||
|
{
|
||||||
|
foundry_working_pictures(),
|
||||||
|
foundry_lights_pictures(),
|
||||||
|
foundry_status_lamp_pictures(),
|
||||||
|
foundry_chimney_smoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,45 +1,23 @@
|
||||||
require("util")
|
require("util")
|
||||||
local futil = require("data-util")
|
local futil = require("data-util")
|
||||||
|
local meld = require("meld")
|
||||||
|
|
||||||
local fuel = {"chemical"}
|
local fuel = {"chemical"}
|
||||||
if mods.Krastorio2 then table.insert(fuel, "vehicle-fuel") end
|
if mods.Krastorio2 then table.insert(fuel, "kr-vehicle-fuel") end
|
||||||
if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end
|
if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end
|
||||||
|
|
||||||
data:extend({
|
local foundry = table.deepcopy(data.raw["assembling-machine"]["electric-foundry"])
|
||||||
{
|
meld(foundry, {
|
||||||
type = "assembling-machine",
|
|
||||||
name = "foundry",
|
name = "foundry",
|
||||||
fast_replaceable_group = "foundry",
|
|
||||||
next_upgrade = "electric-foundry",
|
next_upgrade = "electric-foundry",
|
||||||
icon = "__bzfoundry__/graphics/icons/foundry.png",
|
icon = "__bzfoundry__/graphics/icons/foundry.png",
|
||||||
icon_size = 64,
|
|
||||||
flags = {"placeable-neutral", "placeable-player", "player-creation"},
|
|
||||||
minable = {mining_time = 0.2, result = "foundry"},
|
minable = {mining_time = 0.2, result = "foundry"},
|
||||||
max_health = 300,
|
|
||||||
corpse = "medium-small-remnants",
|
|
||||||
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
|
|
||||||
working_sound =
|
|
||||||
{
|
|
||||||
sound = { filename = "__base__/sound/furnace.ogg" }
|
|
||||||
},
|
|
||||||
resistances =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
type = "fire",
|
|
||||||
percent = 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
collision_box = {{-1.7, -1.7}, {1.7, 1.7}},
|
|
||||||
selection_box = {{-2, -2}, {2, 2}},
|
|
||||||
crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil},
|
|
||||||
energy_usage = "180kW",
|
energy_usage = "180kW",
|
||||||
crafting_speed = 4,
|
energy_source = {
|
||||||
energy_source =
|
|
||||||
{
|
|
||||||
type = "burner",
|
type = "burner",
|
||||||
fuel_categories = fuel,
|
fuel_categories = fuel,
|
||||||
effectivity = 1,
|
effectivity = 1,
|
||||||
emissions_per_minute = 8,
|
emissions_per_minute = { pollution = 8 },
|
||||||
fuel_inventory_size = 1,
|
fuel_inventory_size = 1,
|
||||||
smoke =
|
smoke =
|
||||||
{
|
{
|
||||||
|
|
@ -52,68 +30,42 @@ data:extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
})
|
||||||
|
foundry.graphics_set.animation.layers[1].filenames = {
|
||||||
|
"__bzfoundry__/graphics/entity/foundry/foundry-main-1.png",
|
||||||
|
"__bzfoundry__/graphics/entity/foundry/foundry-main-2.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
data:extend({
|
||||||
|
foundry,
|
||||||
|
{
|
||||||
|
type = "corpse",
|
||||||
|
name = "foundry-remnants",
|
||||||
|
icon = "__bzfoundry__/graphics/icons/foundry.png",
|
||||||
|
flags = {"placeable-neutral", "not-on-map"},
|
||||||
|
hidden_in_factoriopedia = true,
|
||||||
|
subgroup = "smelting-machine-remnants",
|
||||||
|
order = "d[foundry]",
|
||||||
|
selection_box = {{-2.5, -2.5}, {2.5, 2.5}},
|
||||||
|
tile_width = 5,
|
||||||
|
tile_height = 5,
|
||||||
|
selectable_in_game = false,
|
||||||
|
time_before_removed = 60 * 60 * 15, -- 15 minutes
|
||||||
|
expires = false,
|
||||||
|
final_render_layer = "remnants",
|
||||||
|
remove_on_tile_placement = false,
|
||||||
animation =
|
animation =
|
||||||
{
|
{
|
||||||
layers =
|
filename = "__bzfoundry__/graphics/entity/foundry/foundry-remnants.png",
|
||||||
{
|
line_length = 1,
|
||||||
{
|
width = 494,
|
||||||
filename = "__bzfoundry__/graphics/entity/foundry.png",
|
height = 478,
|
||||||
priority = "high",
|
|
||||||
width = 140,
|
|
||||||
height = 120,
|
|
||||||
frame_count = 1,
|
frame_count = 1,
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
hr_version =
|
|
||||||
{
|
|
||||||
filename = "__bzfoundry__/graphics/entity/hr-foundry.png",
|
|
||||||
priority = "high",
|
|
||||||
width = 280,
|
|
||||||
height = 239,
|
|
||||||
frame_count = 1,
|
|
||||||
shift = util.by_pixel(8, 4),
|
|
||||||
scale = 0.5
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
working_visualisations =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
north_position = {0.0, 0.0},
|
|
||||||
east_position = {0.0, 0.0},
|
|
||||||
south_position = {0.0, 0.0},
|
|
||||||
west_position = {0.0, 0.0},
|
|
||||||
animation =
|
|
||||||
{
|
|
||||||
filename = "__base__/graphics/entity/stone-furnace/hr-stone-furnace-fire.png",
|
|
||||||
priority = "extra-high",
|
|
||||||
line_length = 8,
|
|
||||||
width = 41,
|
|
||||||
height = 100,
|
|
||||||
frame_count = 48,
|
|
||||||
axially_symmetrical = false,
|
|
||||||
direction_count = 1,
|
direction_count = 1,
|
||||||
shift = util.by_pixel(-1, 9),
|
shift = util.by_pixel( -1.5, -5.5),
|
||||||
scale=1.1,
|
scale = 0.4
|
||||||
hr_version =
|
|
||||||
{
|
|
||||||
filename = "__base__/graphics/entity/stone-furnace/hr-stone-furnace-fire.png",
|
|
||||||
priority = "extra-high",
|
|
||||||
line_length = 8,
|
|
||||||
width = 41,
|
|
||||||
height = 100,
|
|
||||||
frame_count = 48,
|
|
||||||
axially_symmetrical = false,
|
|
||||||
direction_count = 1,
|
|
||||||
shift = util.by_pixel(-1, 9),
|
|
||||||
scale=1.1,
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
futil.add_crafting_category("assembling-machine", "foundry", "basic-founding")
|
futil.add_crafting_category("assembling-machine", "foundry", "basic-founding")
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
local util = require("data-util")
|
local util = require("data-util")
|
||||||
|
|
||||||
local foundry_ingredients = {{"stone-brick", 20}, {"iron-plate", 10}, {"copper-plate", 5}}
|
local foundry_ingredients = {{type="item", name="stone-brick", amount=20}, {type="item", name="iron-plate", amount=10}, {type="item", name="copper-plate", amount=5}}
|
||||||
if mods.bzlead then table.insert(foundry_ingredients, {"lead-plate", 8}) end
|
if mods.bzlead then table.insert(foundry_ingredients, {type="item", name="lead-plate", amount=8}) end
|
||||||
if mods.Krastorio2 or mods["aai-industry"] then
|
if mods.Krastorio2 then
|
||||||
table.insert(foundry_ingredients, {"sand", 10})
|
table.insert(foundry_ingredients, {type="item", name="kr-sand", amount=10})
|
||||||
|
elseif mods["aai-industry"] then
|
||||||
|
table.insert(foundry_ingredients, {type="item", name="sand", amount=10})
|
||||||
elseif data.raw.item["silica"] and data.raw.technology["silica-processing"] then
|
elseif data.raw.item["silica"] and data.raw.technology["silica-processing"] then
|
||||||
table.insert(foundry_ingredients, {"silica", 20})
|
table.insert(foundry_ingredients, {type="item", name="silica", amount=20})
|
||||||
end
|
end
|
||||||
|
|
||||||
data:extend({
|
data:extend({
|
||||||
|
|
@ -22,9 +24,9 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "foundry",
|
name = "foundry",
|
||||||
result = "foundry",
|
|
||||||
enabled = false,
|
enabled = false,
|
||||||
ingredients = foundry_ingredients,
|
ingredients = foundry_ingredients,
|
||||||
|
results = {{ type = "item", name = "foundry", amount = 1 }}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "technology",
|
type = "technology",
|
||||||
|
|
@ -61,7 +63,7 @@ data:extend({
|
||||||
type = "item",
|
type = "item",
|
||||||
name = "electric-foundry",
|
name = "electric-foundry",
|
||||||
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
|
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
|
||||||
icon_size = 128,
|
icon_size = 64,
|
||||||
subgroup = "founding-machines",
|
subgroup = "founding-machines",
|
||||||
order = "z[foundryelectric]",
|
order = "z[foundryelectric]",
|
||||||
place_result = "electric-foundry",
|
place_result = "electric-foundry",
|
||||||
|
|
@ -76,16 +78,16 @@ data:extend({
|
||||||
},
|
},
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "electric-foundry",
|
name = "electric-foundry",
|
||||||
result = "electric-foundry",
|
|
||||||
enabled = false,
|
enabled = false,
|
||||||
ingredients = {
|
ingredients = {
|
||||||
{"foundry", 1},
|
{type="item", name="foundry", amount=1},
|
||||||
{"steel-plate", 10},
|
{type="item", name="steel-plate", amount=10},
|
||||||
{"processing-unit", 4},
|
{type="item", name="processing-unit", amount=4},
|
||||||
{"concrete", 10},
|
{type="item", name="concrete", amount=10},
|
||||||
(data.raw.item["zirconia"] and {"zirconia", 10} or {"stone-brick", 10}),
|
(data.raw.item["zirconia"] and {type="item", name="zirconia", amount=10} or {type="item", name="stone-brick", amount=10}),
|
||||||
(data.raw.item["tungsten-plate"] and {"tungsten-plate", 5} or nil),
|
(data.raw.item["tungsten-plate"] and {type="item", name="tungsten-plate", amount=5} or nil),
|
||||||
},
|
},
|
||||||
|
results = {{ type = "item", name = "electric-foundry", amount = 1 }}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "technology",
|
type = "technology",
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
local rusty_locale = require("__rusty-locale__.locale")
|
local rusty_locale = require("__rusty-locale__.locale")
|
||||||
local rusty_icons = require("__rusty-locale__.icons")
|
local rusty_icons = require("__rusty-locale__.icons")
|
||||||
local rusty_recipes = require("__rusty-locale__.recipes")
|
|
||||||
local rusty_prototypes = require("__rusty-locale__.prototypes")
|
|
||||||
local futil = require("util")
|
local futil = require("util")
|
||||||
local util = require("data-util")
|
local util = require("data-util")
|
||||||
|
|
||||||
|
|
||||||
function has_suffix(s, suffix)
|
function has_suffix(s, suffix)
|
||||||
return string.sub(s, -string.len(suffix), -1) == suffix
|
return string.sub(s, -string.len(suffix), -1) == suffix
|
||||||
end
|
end
|
||||||
|
|
@ -23,82 +20,31 @@ function check_name(name)
|
||||||
for i, suffix in pairs(suffixes) do
|
for i, suffix in pairs(suffixes) do
|
||||||
if has_suffix(name, suffix) then return true end
|
if has_suffix(name, suffix) then return true end
|
||||||
end
|
end
|
||||||
if name == "rare-metals" then return true end
|
if name == "kr-rare-metals" then return true end
|
||||||
if name == "tungsten-carbide" then return true end
|
if name == "tungsten-carbide" then return true end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function make_recipe(recipe)
|
function make_recipe(recipe)
|
||||||
local found_result = false
|
local found_result = false
|
||||||
local has_normal = false
|
|
||||||
local has_exp = false
|
|
||||||
|
|
||||||
|
|
||||||
local new_results = {}
|
local new_results = {}
|
||||||
local new_normal_results = {}
|
|
||||||
local new_exp_results = {}
|
|
||||||
|
|
||||||
if recipe.results then -- standard recipes
|
if recipe.results then -- standard recipes
|
||||||
for i, result in pairs(recipe.results) do
|
for i, result in pairs(recipe.results) do
|
||||||
if (result.name and check_name(result.name)) or
|
if result.name and check_name(result.name) then
|
||||||
(result[1] and check_name(result[1])) then
|
found_result = result.name
|
||||||
found_result = result.name and result.name or result[1]
|
|
||||||
new_results = futil.table.deepcopy(recipe.results)
|
new_results = futil.table.deepcopy(recipe.results)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if recipe.result and check_name(recipe.result) then
|
|
||||||
found_result = recipe.result
|
|
||||||
new_results = {{recipe.result, recipe.result_count or 1}}
|
|
||||||
end
|
|
||||||
|
|
||||||
if recipe.normal then
|
|
||||||
has_normal = true
|
|
||||||
if recipe.normal.results then
|
|
||||||
for i, result in pairs(recipe.normal.results) do
|
|
||||||
if (result.name and check_name(result.name)) or
|
|
||||||
(result[1] and check_name(result[1])) then
|
|
||||||
found_result = result.name and result.name or result[1]
|
|
||||||
new_normal_results = futil.table.deepcopy(recipe.normal.results)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if recipe.normal.result and check_name(recipe.normal.result) then
|
|
||||||
found_result = recipe.normal.result
|
|
||||||
new_normal_results = {{recipe.normal.result, recipe.normal.result_count or 1}}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if recipe.expensive then
|
|
||||||
has_exp = true
|
|
||||||
if recipe.expensive.results then
|
|
||||||
for i, result in pairs(recipe.expensive.results) do
|
|
||||||
if (result.name and check_name(result.name)) or
|
|
||||||
(result[1] and check_name(result[1])) then
|
|
||||||
found_result = result.name and result.name or result[1]
|
|
||||||
new_exp_results = futil.table.deepcopy(recipe.expensive.results)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if recipe.expensive.result and check_name(recipe.expensive.result) then
|
|
||||||
found_result = recipe.expensive.result
|
|
||||||
new_exp_results = {{recipe.expensive.result, recipe.expensive.result_count or 1}}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if found_result then
|
if found_result then
|
||||||
log("Attempting to make refractory recipe for " .. recipe.name)
|
log("Attempting to make refractory recipe for " .. recipe.name)
|
||||||
local r = futil.table.deepcopy(recipe)
|
local r = futil.table.deepcopy(recipe)
|
||||||
r.name = r.name .. "-refractory"
|
r.name = r.name .. "-refractory"
|
||||||
r.main_product = found_result
|
r.main_product = found_result
|
||||||
r.result = nil
|
r.results = {}
|
||||||
r.result_count = nil
|
|
||||||
r.enabled = false
|
r.enabled = false
|
||||||
r.category = recipe.category == "casting" and "casting" or "founding"
|
r.category = recipe.category == "casting" and "casting" or "founding"
|
||||||
r.subgroup = data.raw.item[found_result] and data.raw.item[found_result].subgroup or "foundry-intermediate"
|
r.subgroup = data.raw.item[found_result] and data.raw.item[found_result].subgroup or "foundry-intermediate"
|
||||||
|
|
@ -123,25 +69,9 @@ function make_recipe(recipe)
|
||||||
r.icons = icons
|
r.icons = icons
|
||||||
locale = rusty_locale.of_recipe(data.raw.recipe[recipe.name])
|
locale = rusty_locale.of_recipe(data.raw.recipe[recipe.name])
|
||||||
r.localised_name = {"recipe-name.with-refractory", locale.name}
|
r.localised_name = {"recipe-name.with-refractory", locale.name}
|
||||||
|
|
||||||
if not has_normal and not has_exp then
|
|
||||||
r.results = new_results
|
r.results = new_results
|
||||||
make_ingredients_and_products(r, r.name)
|
make_ingredients_and_products(r, r.name)
|
||||||
end
|
r.allow_productivity = true
|
||||||
if has_normal then
|
|
||||||
r.normal.results = new_normal_results
|
|
||||||
r.normal.result = nil
|
|
||||||
r.normal.result_count = nil
|
|
||||||
r.normal.enabled = false
|
|
||||||
make_ingredients_and_products(r.normal, r.name)
|
|
||||||
end
|
|
||||||
if has_exp then
|
|
||||||
r.expensive.results = new_exp_results
|
|
||||||
r.expensive.result = nil
|
|
||||||
r.expensive.result_count = nil
|
|
||||||
r.expensive.enabled = false
|
|
||||||
make_ingredients_and_products(r.expensive, r.name)
|
|
||||||
end
|
|
||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -164,9 +94,6 @@ function make_ingredients_and_products(r, name)
|
||||||
local refractories = get_refractories(r, name)
|
local refractories = get_refractories(r, name)
|
||||||
local max_count = 1
|
local max_count = 1
|
||||||
for i, ingredient in pairs(r.ingredients) do
|
for i, ingredient in pairs(r.ingredients) do
|
||||||
if ingredient[2] and ingredient[2] > max_count then
|
|
||||||
max_count = ingredient[2]
|
|
||||||
end
|
|
||||||
if ingredient.amount and ingredient.amount > max_count then
|
if ingredient.amount and ingredient.amount > max_count then
|
||||||
max_count = ingredient.amount
|
max_count = ingredient.amount
|
||||||
end
|
end
|
||||||
|
|
@ -178,20 +105,16 @@ function make_ingredients_and_products(r, name)
|
||||||
end
|
end
|
||||||
for i, refractory in pairs(refractories) do
|
for i, refractory in pairs(refractories) do
|
||||||
for j, existing in pairs(r.ingredients) do
|
for j, existing in pairs(r.ingredients) do
|
||||||
if existing[1] == refractory or existing.name == refractory then
|
if existing.name == refractory then
|
||||||
log("Warning: "..name.." refractory recipe recipe unbalanced due to skipped ingredients")
|
log("Warning: "..name.." refractory recipe recipe unbalanced due to skipped ingredients")
|
||||||
goto skip
|
goto skip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(r.ingredients, {refractory, refractory_amount})
|
table.insert(r.ingredients, {type = "item", name = refractory, amount = refractory_amount})
|
||||||
end
|
end
|
||||||
::skip::
|
::skip::
|
||||||
|
|
||||||
for i, result in pairs(r.results) do
|
for i, result in pairs(r.results) do
|
||||||
if result[1] and check_name(result[1]) then
|
|
||||||
result[2] = result[2]*2
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if result.name and check_name(result.name) then
|
if result.name and check_name(result.name) then
|
||||||
if result.amount then
|
if result.amount then
|
||||||
result.amount = result.amount * 2
|
result.amount = result.amount * 2
|
||||||
|
|
@ -206,8 +129,8 @@ function make_ingredients_and_products(r, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i, refractory in pairs(refractories) do
|
for i, refractory in pairs(refractories) do
|
||||||
table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, catalyst_amount=refractory_amount,
|
table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, ignored_by_productivity=refractory_amount,
|
||||||
probability=get_probability(#refractories)})
|
ignored_by_stats=refractory_amount, probability=get_probability(#refractories)})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -240,16 +163,5 @@ if util.me.founding_plates() then
|
||||||
else
|
else
|
||||||
util.add_effect("advanced-founding", {type="unlock-recipe", recipe=recipe.name})
|
util.add_effect("advanced-founding", {type="unlock-recipe", recipe=recipe.name})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- prod modules
|
|
||||||
for j, module in pairs(data.raw.module) do
|
|
||||||
if module.effect then
|
|
||||||
for effect_name, effect in pairs(module.effect) do
|
|
||||||
if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then
|
|
||||||
table.insert(module.limitation, recipe.name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ data:extend({
|
||||||
type = "string-setting",
|
type = "string-setting",
|
||||||
name = "bzfoundry-hydrocarbon",
|
name = "bzfoundry-hydrocarbon",
|
||||||
setting_type = "startup",
|
setting_type = "startup",
|
||||||
allowed_values = {"coke", "solid-fuel", "coal", "none"},
|
allowed_values = {mods["Krastorio2"] and "kr-coke" or "coke", "solid-fuel", "coal", "none"},
|
||||||
default_value = "coke",
|
default_value = mods["Krastorio2"] and "kr-coke" or "coke",
|
||||||
order = "aba",
|
order = "aba",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||