Compare commits

...

10 commits

Author SHA1 Message Date
Simon Brodtmann
4cfe87fcf0 Restructure repository 2025-10-18 23:50:18 +02:00
Simon Brodtmann
16fdf8a220 Update to bzaluminum2 2025-10-18 23:47:47 +02:00
Simon Brodtmann
fbd8f08c5c Update to 2.0 2025-10-16 00:20:48 +02:00
Brevven
c090985a08 avoid nil subgroups 2024-02-07 09:04:13 -08:00
Brevven
71b7c40fd4 up 2024-02-07 09:03:54 -08:00
Brevven
eec059429f Merge branch 'main' of github.com:brevven/foundry into main 2024-02-06 19:20:37 -08:00
Brevven
ce65c1c2ce upgrade planner 2023-12-27 17:01:30 -08:00
brevven
c0f608f96c
Merge pull request #11 from sakuro/update-ja-202305
Update ja 202305
2023-12-22 10:24:33 -08:00
OZAWA Sakuro
50d9fe1a10 Translate coke recipe with woods 2023-10-04 22:33:39 +09:00
Brevven
3e1d5fdc00 recipe order issues 2023-04-09 23:51:56 -07:00
112 changed files with 771 additions and 639 deletions

3
.editorconfig Normal file
View file

@ -0,0 +1,3 @@
[*]
indent_style = space
indent_size = 2

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea

View file

@ -1,37 +0,0 @@
# General makefile for factorio mods.
#
# Presumes the development work is done in a <factoriodir>/dev/<modname>/
# directory where this makefile resides. This directory must be parallel to
# the <factoriodir>/mods/ directory where mods are installed. Run `make
# install` from dev/<modname> to install the mod as a zip file. That zip file
# should also be ready to upload to the mod portal
.PHONY: copy lint-changelog install
libdir = "../bzlib"
libfiles = $(shell ls $(libdir)/*.lua | grep -o '[^/]*.lua')
pwd = $(shell pwd)
v = $(shell basename "$(pwd)")_$(shell jq -r .version info.json)
link:
for f in $(libfiles) ; do \
echo "using $(libdir)/$$f" ;\
cp $(libdir)/$$f .; \
done;
copy: link
rm -rf ../$(v)
mkdir -p ../$(v)
cp -rf * ../$(v)
rm -f ../$(v).zip
cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak" -x "*.blend*"
install: lint-changelog copy
cp -f ../$(v).zip ../../mods/
lint-changelog: copy
python3 ../da-changelog-tools_0.0.14/changelog-checker.py --changelog ../$(v).zip
zorro:
python3 ../da-changelog-tools_0.0.14/changelog-checker.py --zorro --changelog ../$(v).zip

View file

@ -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

View file

@ -1,4 +1,32 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.2.14
Date: 2024-02-07
Fixes:
- Attempt to fix a rare compatibility issue related to indexing nil value
---------------------------------------------------------------------------------------------------
Version: 0.2.13
Date: 2023-12-28
Changes:
- Some recipes moved in crafting menus, they were defaulting to appearing at the top:
- In vanilla: recipes for certain intermediates created in foundries moved after
"raw-material" recipes (such as most plates, etc), and before "intermediate-product"
recipes (eg circuits). There's not a perfect place for this right now, but this seems to be
thematically a decent place to put it.
- In Space Exploration (SE): Similar to above, but after gears, sticks, etc
- In vanilla and SE: recipes for foundry entities moved after furnace entities but before
assemblers. This seems to be the right location, thematically.
Localization:
- ja locale updates thanks to Sakuro
---------------------------------------------------------------------------------------------------
Version: 0.2.12
Date: 2023-04-18
Features:
- Default upgrade planner now upgrades foundry to electric foundry.
---------------------------------------------------------------------------------------------------
Version: 0.2.11
Fixes:
- Fix some minor recipe ordering issues
---------------------------------------------------------------------------------------------------
Version: 0.2.10 Version: 0.2.10
Date: 2023-03-06 Date: 2023-03-06
Features: Features:

View file

@ -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
@ -131,6 +121,13 @@ function util.k2matter(params)
params.k2matter.minimum_conversion_quantity = 10 params.k2matter.minimum_conversion_quantity = 10
end end
if not data.raw.technology[params.k2matter.unlocked_by_technology] then if not data.raw.technology[params.k2matter.unlocked_by_technology] then
local icon = ""
if params.k2baseicon then
icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png"
else
icon = util.k2assets().."/technologies/backgrounds/matter.png"
end
data:extend( data:extend(
{ {
{ {
@ -139,7 +136,7 @@ function util.k2matter(params)
icons = icons =
{ {
{ {
icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png", icon = icon,
icon_size = 256, icon_size = 256,
}, },
params.icon, params.icon,
@ -148,18 +145,29 @@ function util.k2matter(params)
unit = unit =
{ {
count = 350, count = 350,
ingredients = ingredients = mods["space-exploration"] and
{
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"se-astronomic-science-pack-4", 1},
{"se-energy-science-pack-4", 1},
{"se-material-science-pack-4", 1},
{"se-deep-space-science-pack-2", 1},
{"se-kr-matter-science-pack-2", 1},
} or
{ {
{"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,
} },
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
@ -193,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},
} }
} }
}) })
@ -232,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},
} }
} }
}) })
@ -266,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},
} }
@ -280,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]
@ -358,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
@ -403,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
@ -423,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
@ -447,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
@ -462,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
@ -473,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
@ -498,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
@ -524,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
@ -574,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
@ -599,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
@ -616,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
@ -659,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
@ -686,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
@ -720,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
@ -750,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
@ -790,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
@ -799,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
@ -815,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
@ -843,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)
@ -865,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
@ -889,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
@ -904,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
@ -950,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
@ -969,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
@ -988,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
@ -1013,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
@ -1032,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
@ -1119,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
@ -1143,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
@ -1267,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)
@ -1312,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)

View file

@ -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

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

View 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,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View 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,
}

View file

@ -0,0 +1,7 @@
return
{
width = 38,
height = 46,
shift = util.by_pixel( -0.5, 6.5),
line_length = 1,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View 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,
}

View file

@ -0,0 +1,7 @@
return
{
width = 122,
height = 142,
shift = util.by_pixel( 26.5, -42.5),
line_length = 1,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

View 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,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View file

@ -1,19 +1,20 @@
{ {
"name": "bzfoundry", "name": "bzfoundry",
"version": "0.2.10", "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."
} }

View file

@ -39,6 +39,7 @@ bzfoundry-smelt=鋳造所で製錬可能
bzfoundry-plates=耐熱レシピを追加 (実験的) bzfoundry-plates=耐熱レシピを追加 (実験的)
bzfoundry-hydrocarbon=鋳造に使用する炭化水素類 bzfoundry-hydrocarbon=鋳造に使用する炭化水素類
bzfoundry-other-machines=鋳造所以外に鋳造を行える設備 bzfoundry-other-machines=鋳造所以外に鋳造を行える設備
bzfoundry-woodcoke=木材を使用するコークスのレシピ
bzfoundry-minimal=ミニマルモード (建造物を取り除く) bzfoundry-minimal=ミニマルモード (建造物を取り除く)
[mod-setting-description] [mod-setting-description]
@ -48,3 +49,12 @@ bzfoundry-hydrocarbon=鋳造に使用する炭化水素類。コークス化に
bzfoundry-other-machines=鋳造所以外に "founding" レシピを実行できる "assembling-machine" エンティティの一覧。例: K2の "kr-advanced-furnace" や AAII の "industrial-furnace" (コンマ区切り) bzfoundry-other-machines=鋳造所以外に "founding" レシピを実行できる "assembling-machine" エンティティの一覧。例: K2の "kr-advanced-furnace" や AAII の "industrial-furnace" (コンマ区切り)
bzfoundry-plates=[color=orange]実験的[/color] 材料、生産物などあらゆる点が変更される可能性があります。\n一つ以上の耐熱素材を使うことで鋳造所における板材の生産量を向上することが出来ます。\n警告: 煩雑なレシピです。 bzfoundry-plates=[color=orange]実験的[/color] 材料、生産物などあらゆる点が変更される可能性があります。\n一つ以上の耐熱素材を使うことで鋳造所における板材の生産量を向上することが出来ます。\n警告: 煩雑なレシピです。
bzfoundry-minimal=[color=yellow]注意して使用のこと![/color]\nFactorioのMOD依存関係システムの問題回避を意図した設定。鋳造所とそれに依存したレシピを無効化します。デフォルトのMOD設定でFoundry MODを依存関係に残したまま、Aluminium MODをFoundry MODを使わずにプレイすることが可能になります。 bzfoundry-minimal=[color=yellow]注意して使用のこと![/color]\nFactorioのMOD依存関係システムの問題回避を意図した設定。鋳造所とそれに依存したレシピを無効化します。デフォルトのMOD設定でFoundry MODを依存関係に残したまま、Aluminium MODをFoundry MODを使わずにプレイすることが可能になります。
bzfoundry-woodcoke=他の炭化水素類としては、固形燃料にも対応しますが石炭には対応しません。
[string-mod-setting]
bzfoundry-plates-yes=はい
bzfoundry-plates-no=いいえ
bzfoundry-hydrocarbon-coke=__ITEM__coke__
bzfoundry-hydrocarbon-solid-fuel=__ITEM__solid-fuel__
bzfoundry-hydrocarbon-coal=__ITEM__coal__
bzfoundry-hydrocarbon-none=なし

View file

@ -3,7 +3,7 @@ local me = {}
me.name = "bzfoundry" me.name = "bzfoundry"
function me.basic_founding() function me.basic_founding()
return mods.bztin or mods.bzaluminum return mods.bztin or mods.bzaluminum2
end end
function me.woodcoke() function me.woodcoke()
@ -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

View file

@ -2,8 +2,9 @@ local util = require("data-util")
data:extend({ data:extend({
{ type = "recipe-category", name = "founding"}, { type = "recipe-category", name = "founding"},
{ type = "item-subgroup", name = "founding-machines", group = "production"}, { type = "item-subgroup", name = "founding-machines", group = "production", order = "d-f"},
{ type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"}, { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products",
order = util.se6() and "a-b-z" or "c-z"},
}) })
if util.me.basic_founding() then if util.me.basic_founding() then

View file

@ -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 = {

View file

@ -0,0 +1,337 @@
require("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({
{
type = "assembling-machine",
name = "electric-foundry",
icon = "__bzfoundry__/graphics/icons/electric-foundry.png",
icon_size = 64,
flags = {"placeable-neutral","player-creation"},
minable = {mining_time = 0.2, result = "electric-foundry"},
max_health = 300,
fast_replaceable_group = "foundry",
corpse = "electric-foundry-remnants",
dying_explosion = "foundry-explosion",
circuit_wire_max_distance = assembling_machine_circuit_wire_max_distance,
circuit_connector = circuit_connector_definitions["foundry"],
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 = "360kW",
drain = "12kW",
crafting_speed = 4,
energy_source =
{
type = "electric",
emissions_per_minute = { pollution = 2 },
usage_priority = "secondary-input",
},
allowed_effects = {"consumption", "speed", "productivity", "pollution"},
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 =
{
{inventory_index = defines.inventory.assembling_machine_modules, shift = {0, 1.25}}
},
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
},
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},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-close.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 18},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-clamp.ogg", volume = 0.45, audible_distance_modifier = 0.3}, frame = 39},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-slide-stop.ogg", volume = 0.7, audible_distance_modifier = 0.4}, frame = 43},
{sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-fire-whoosh", 3, 0.8), audible_distance_modifier = 0.3}, frame = 64},
{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},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-pipe-in.ogg", volume = 0.75, audible_distance_modifier = 0.4}, frame = 106},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-smoke-puff.ogg", volume = 0.8, audible_distance_modifier = 0.3}, frame = 106},
{sound = {variations = sound_variations("__bzfoundry__/sound/entity/foundry/foundry-pour", 2, 0.7)}, frame = 110},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-rocks.ogg", volume = 0.65, audible_distance_modifier = 0.3}, frame = 120},
{sound = {filename = "__bzfoundry__/sound/entity/foundry/foundry-blade.ogg", volume = 0.7}, frame = 126},
},
max_sounds_per_prototype = 2
},
water_reflection =
{
pictures = util.sprite_load("__bzfoundry__/graphics/entity/electric-foundry/foundry-reflection",
{
scale = 4,
shift = {0,2}
}),
rotate = false
}
},
{
type = "corpse",
name = "electric-foundry-remnants",
icon = "__bzfoundry__/graphics/icons/electric-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 =
{
filename = "__bzfoundry__/graphics/entity/electric-foundry/foundry-remnants.png",
line_length = 1,
width = 494,
height = 478,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel( -1.5, -5.5),
scale = 0.4
}
},
{
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")

View 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()
}
}
}

View file

@ -0,0 +1,71 @@
require("util")
local futil = require("data-util")
local meld = require("meld")
local fuel = {"chemical"}
if mods.Krastorio2 then table.insert(fuel, "kr-vehicle-fuel") end
if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end
local foundry = table.deepcopy(data.raw["assembling-machine"]["electric-foundry"])
meld(foundry, {
name = "foundry",
next_upgrade = "electric-foundry",
icon = "__bzfoundry__/graphics/icons/foundry.png",
minable = {mining_time = 0.2, result = "foundry"},
energy_usage = "180kW",
energy_source = {
type = "burner",
fuel_categories = fuel,
effectivity = 1,
emissions_per_minute = { pollution = 8 },
fuel_inventory_size = 1,
smoke =
{
{
name = "smoke",
frequency = 20,
position = {1, -1.7},
starting_vertical_speed = 0.1,
starting_frame_deviation = 60
}
}
},
})
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 =
{
filename = "__bzfoundry__/graphics/entity/foundry/foundry-remnants.png",
line_length = 1,
width = 494,
height = 478,
frame_count = 1,
direction_count = 1,
shift = util.by_pixel( -1.5, -5.5),
scale = 0.4
}
}
})
futil.add_crafting_category("assembling-machine", "foundry", "basic-founding")

View file

@ -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",
@ -125,8 +127,8 @@ if util.me.founding_plates() then
or (mods.bzzirconium and or (mods.bzzirconium and
{ icon = "__bzzirconium__/graphics/icons/zirconia.png", { icon = "__bzzirconium__/graphics/icons/zirconia.png",
icon_size = 128, scale=0.5, shift={32, -32}}) icon_size = 128, scale=0.5, shift={32, -32}})
or (mods.bzaluminum and or (mods.bzaluminum2 and
{ icon = "__bzaluminum__/graphics/icons/alumina.png", { icon = "__bzaluminum2__/graphics/icons/alumina.png",
icon_size = 128, scale=0.5, shift={32, -32}}) icon_size = 128, scale=0.5, shift={32, -32}})
or { icon = "__base__/graphics/icons/stone-brick.png", or { icon = "__base__/graphics/icons/stone-brick.png",
icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}} icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}}
@ -161,8 +163,8 @@ if util.me.founding_plates() then
or (mods.bzzirconium and or (mods.bzzirconium and
{ icon = "__bzzirconium__/graphics/icons/zirconia.png", { icon = "__bzzirconium__/graphics/icons/zirconia.png",
icon_size = 128, scale=0.5, shift={32, -32}}) icon_size = 128, scale=0.5, shift={32, -32}})
or (mods.bzaluminum and or (mods.bzaluminum2 and
{ icon = "__bzaluminum__/graphics/icons/alumina.png", { icon = "__bzaluminum2__/graphics/icons/alumina.png",
icon_size = 128, scale=0.5, shift={32, -32}}) icon_size = 128, scale=0.5, shift={32, -32}})
or { icon = "__base__/graphics/icons/stone-brick.png", or { icon = "__base__/graphics/icons/stone-brick.png",
icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}} icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}}

View file

@ -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,84 +20,34 @@ 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.result = nil r.main_product = found_result
r.result_count = nil r.results = {}
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].subgroup r.subgroup = data.raw.item[found_result] and data.raw.item[found_result].subgroup or "foundry-intermediate"
icons = rusty_icons.of(data.raw.recipe[recipe.name]) icons = rusty_icons.of(data.raw.recipe[recipe.name])
table.insert( table.insert(
icons, icons,
@ -113,8 +60,8 @@ function make_recipe(recipe)
or (mods.bzzirconium and or (mods.bzzirconium and
{ icon = "__bzzirconium__/graphics/icons/zirconia.png", { icon = "__bzzirconium__/graphics/icons/zirconia.png",
icon_size = 128, scale=0.125, shift={8, -8}}) icon_size = 128, scale=0.125, shift={8, -8}})
or (mods.bzaluminum and or (mods.bzaluminum2 and
{ icon = "__bzaluminum__/graphics/icons/alumina.png", { icon = "__bzaluminum2__/graphics/icons/alumina.png",
icon_size = 128, scale=0.125, shift={8, -8}}) icon_size = 128, scale=0.125, shift={8, -8}})
or { icon = "__base__/graphics/icons/stone-brick.png", or { icon = "__base__/graphics/icons/stone-brick.png",
icon_size = 64, scale=0.25, icon_mipmaps = 4, shift={8, -8}} icon_size = 64, scale=0.25, icon_mipmaps = 4, shift={8, -8}}
@ -122,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
@ -154,7 +85,7 @@ function get_refractories(recipe, name)
if mods.bzcarbon then table.insert(refractories, "graphite") end if mods.bzcarbon then table.insert(refractories, "graphite") end
if mods.bzsilicon then table.insert(refractories, "silica") end if mods.bzsilicon then table.insert(refractories, "silica") end
if #refractories < 2 and mods.bzzirconium and name ~= "zirconium-plate-refractory" then table.insert(refractories, "zirconia") end if #refractories < 2 and mods.bzzirconium and name ~= "zirconium-plate-refractory" then table.insert(refractories, "zirconia") end
if #refractories < 2 and mods.bzaluminum and name ~= "aluminum-plate-refractory" then table.insert(refractories, "alumina") end if #refractories < 2 and mods.bzaluminum2 and name ~= "aluminum-plate-refractory" then table.insert(refractories, "alumina") end
if #refractories < 2 then table.insert(refractories, "stone-brick") end if #refractories < 2 then table.insert(refractories, "stone-brick") end
return refractories return refractories
end end
@ -163,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
@ -177,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
@ -205,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
@ -239,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

View file

@ -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",
}, },
{ {
@ -42,7 +42,7 @@ data:extend({
name = "bzfoundry-minimal", name = "bzfoundry-minimal",
setting_type = "startup", setting_type = "startup",
default_value = false, default_value = false,
hidden = not mods.bzaluminum, hidden = not mods.bzaluminum2,
order = "zza", order = "zza",
}, },
}) })

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Some files were not shown because too many files have changed in this diff Show more