diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bbf3e21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 11be59f..0000000 --- a/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# General makefile for factorio mods. -# -# Presumes the development work is done in a /dev// -# directory where this makefile resides. This directory must be parallel to -# the /mods/ directory where mods are installed. Run `make -# install` from dev/ 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 - diff --git a/README.md b/README.md index e570eca..fce99fe 100644 --- a/README.md +++ b/README.md @@ -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) 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 diff --git a/LICENSE b/bzfoundry2/LICENSE similarity index 100% rename from LICENSE rename to bzfoundry2/LICENSE diff --git a/changelog.txt b/bzfoundry2/changelog.txt similarity index 82% rename from changelog.txt rename to bzfoundry2/changelog.txt index d0e2aae..1b1200e 100644 --- a/changelog.txt +++ b/bzfoundry2/changelog.txt @@ -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 Date: 2023-03-06 Features: diff --git a/control-util.lua b/bzfoundry2/control-util.lua similarity index 100% rename from control-util.lua rename to bzfoundry2/control-util.lua diff --git a/data-final-fixes.lua b/bzfoundry2/data-final-fixes.lua similarity index 100% rename from data-final-fixes.lua rename to bzfoundry2/data-final-fixes.lua diff --git a/data-updates.lua b/bzfoundry2/data-updates.lua similarity index 100% rename from data-updates.lua rename to bzfoundry2/data-updates.lua diff --git a/data-util.lua b/bzfoundry2/data-util.lua similarity index 80% rename from data-util.lua rename to bzfoundry2/data-util.lua index 6b923b4..4547d4f 100644 --- a/data-util.lua +++ b/bzfoundry2/data-util.lua @@ -64,17 +64,7 @@ function util.fe_plus(sub) 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 return "__Krastorio2Assets__" end @@ -111,8 +101,8 @@ function util.se_landfill(params) category = "hard-recycling", order = "z-b-"..params.ore, subgroup = "terrain", - result = "landfill", - ingredients = {{params.ore, 50}}, + results = {{type="item", name="landfill", amount=1}}, + ingredients = {{type="item", name=params.ore, amount=50}}, } }) util.add_unlock("se-recycling-facility", lname) @@ -123,7 +113,7 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} 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 params.k2matter.need_stabilizer = true end @@ -131,6 +121,13 @@ function util.k2matter(params) params.k2matter.minimum_conversion_quantity = 10 end 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( { { @@ -139,7 +136,7 @@ function util.k2matter(params) icons = { { - icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png", + icon = icon, icon_size = 256, }, params.icon, @@ -148,18 +145,29 @@ function util.k2matter(params) unit = { 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}, {"utility-science-pack", 1}, - {"matter-tech-card", 1} + {"kr-matter-tech-card", 1} }, time = 45, - } + }, + localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, }, }) end - matter.createMatterRecipe(params.k2matter) + matter.make_recipes(params.k2matter) end @@ -193,16 +201,16 @@ function util.se_matter(params) energy_required = params.energy_required, enabled = false, ingredients = { - {sedata, 1}, + {type="item", name=sedata, amount=1}, {type="fluid", name="se-particle-stream", amount=50}, {type="fluid", name="se-space-coolant-supercooled", amount=25}, }, results = { - {params.ore, params.quant_out}, - {"se-contaminated-scrap", 1}, - {type=item, name=sedata, amount=1, probability=.99}, - {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, + {type="item", name=params.ore, amount=params.quant_out}, + {type="item", name="se-contaminated-scrap", amount=1}, + {type="item", name=sedata, amount=1, probability=.99}, + {type="item", name=sejunk, amount=1, probability=.01}, + {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, enabled = false, ingredients = { - {"se-kr-matter-liberation-data", 1}, - {params.ore, params.quant_in}, + {type="item", name="se-kr-matter-liberation-data", amount=1}, + {type="item", name=params.ore, amount=params.quant_in}, {type="fluid", name="se-particle-stream", amount=50}, }, results = { - {type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99}, - {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, + {type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99}, + {type="item", name=sejunk, amount=1, probability=.01}, + {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-energy-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}, } @@ -280,18 +288,6 @@ function util.se_matter(params) 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 function util.set_prerequisite(technology_name, prerequisites) local technology = data.raw.technology[technology_name] @@ -358,7 +354,7 @@ function util.add_unlock(technology_name, recipe) end -- 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] if technology and technology.effects then for i, effect in pairs(technology.effects) do @@ -403,17 +399,13 @@ end function util.set_enabled(recipe_name, enabled) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end - 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 + data.raw.recipe[recipe_name].enabled = enabled end end function util.set_hidden(recipe_name) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end - 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 + data.raw.recipe[recipe_name].hidden = true 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 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].normal, ingredient, quantity) - add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) 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 me.add_modified(recipe_name) 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 @@ -462,7 +450,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid) if is_fluid then table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) else - table.insert(recipe.ingredients, {ingredient, quantity}) + table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity}) 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 me.add_modified(recipe_name) 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 @@ -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 me.add_modified(recipe_name) 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 @@ -523,29 +507,18 @@ end -- Only works for recipes with multiple products function util.add_product(recipe_name, product, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and - (data.raw.item[product[1]] or data.raw.item[product.name] or - data.raw.fluid[product[1]] or data.raw.fluid[product.name] - ) then + if data.raw.recipe[recipe_name] and + (data.raw.item[product.name] or data.raw.fluid[product.name]) then 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 function add_product(recipe, product) 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 - recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} - end - recipe.result = nil - recipe.result_count = nil - table.insert(recipe.results, product) + if recipe.results == nil then + recipe.results = {} end - end + table.insert(recipe.results, product) end end @@ -553,18 +526,13 @@ end function util.get_ingredient_amount(recipe_name, ingredient_name) local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.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 + if recipe.ingredients then for i, ingredient in pairs(recipe.ingredients) do if ingredient[1] == ingredient_name then return ingredient[2] end if ingredient.name == ingredient_name then return ingredient.amount end end end - return 0 + return 1 end return 0 end @@ -574,14 +542,7 @@ function util.get_amount(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.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 + if recipe.results then for i, result in pairs(recipe.results) do if result[1] == product then return result[2] 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 local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.results then - return #(recipe.normal.results) - elseif recipe.results then + if recipe.results then return #(recipe.results) end 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 me.add_modified(recipe_name) 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 @@ -659,8 +616,6 @@ function util.remove_ingredient(recipe_name, old, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) 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 @@ -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 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].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 -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.result == new then return end if recipe.results then for i, existing in pairs(recipe.results) do - if existing[1] == new or existing.name == new then + if existing.name == new then return 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 if product.name == old then 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 @@ -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 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].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 @@ -750,8 +698,6 @@ function util.set_product_amount(recipe_name, product, amount, options) me.add_modified(recipe_name) 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].normal, product, amount) - set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -790,8 +736,6 @@ function util.multiply_recipe(recipe_name, multiple, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -799,8 +743,6 @@ function multiply_recipe(recipe, multiple) if recipe then if recipe.energy_required then recipe.energy_required = recipe.energy_required * multiple - else - recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default end if recipe.result_count then 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_max = result.amount_max * multiple end - if result.catalyst_amount then - result.catalyst_amount = result.catalyst_amount * multiple + if result.ignored_by_productivity then + 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 if result[1] then @@ -843,9 +788,8 @@ end -- Returns true if a recipe has an ingredient function util.has_ingredient(recipe_name, ingredient) - return data.raw.recipe[recipe_name] and ( - has_ingredient(data.raw.recipe[recipe_name], ingredient) or - has_ingredient(data.raw.recipe[recipe_name].normal, ingredient)) + return data.raw.recipe[recipe_name] and + has_ingredient(data.raw.recipe[recipe_name], ingredient) end function has_ingredient(recipe, ingredient) @@ -865,8 +809,6 @@ function util.remove_product(recipe_name, old, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -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 data.raw.recipe[recipe_name] then 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 @@ -904,13 +844,11 @@ end function util.replace_product(recipe_name, old, new, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then - replace_product(data.raw.recipe[recipe_name], old, new, options) - replace_product(data.raw.recipe[recipe_name].normal, old, new, options) - replace_product(data.raw.recipe[recipe_name].expensive, old, new, options) + replace_product(data.raw.recipe[recipe_name], old, new) end end -function replace_product(recipe, old, new, options) +function replace_product(recipe, old, new) if recipe then if recipe.main_product == old then recipe.main_product = new @@ -950,8 +888,6 @@ function util.set_recipe_time(recipe_name, time, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -969,8 +905,6 @@ function util.multiply_time(recipe_name, factor, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -988,8 +922,6 @@ function util.add_time(recipe_name, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -1013,7 +945,7 @@ end -- Set recipe subgroup function util.set_subgroup(recipe_name, subgroup, options) 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) data.raw.recipe[recipe_name].subgroup = subgroup end @@ -1032,34 +964,16 @@ function util.add_icon(recipe_name, icon, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then - if data.raw.recipe[recipe_name].icon then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.recipe[recipe_name].icon, - icon_size=data.raw.recipe[recipe_name].icon_size, - 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_size = nil + data.raw.recipe[recipe_name].icons = {} + if data.raw.recipe[recipe_name].icon then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.recipe[recipe_name].icon, + icon_size=data.raw.recipe[recipe_name].icon_size, + icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, + }} + data.raw.recipe[recipe_name].icon = nil + data.raw.recipe[recipe_name].icon_size = nil + end end table.insert(data.raw.recipe[recipe_name].icons, icon) 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 data.raw.recipe[recipe] then 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 @@ -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 data.raw.recipe[recipe_name] then 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 @@ -1267,10 +1177,8 @@ function remove_prior_unlocks(tech, recipe) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) - end + -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) end end end @@ -1312,9 +1220,7 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - replace_ingredients_prior_to(prerequisite, old, new, multiplier) - end + replace_ingredients_prior_to(prerequisite, old, new, multiplier) end end end diff --git a/data.lua b/bzfoundry2/data.lua similarity index 100% rename from data.lua rename to bzfoundry2/data.lua index ad46555..05aea8a 100644 --- a/data.lua +++ b/bzfoundry2/data.lua @@ -5,6 +5,6 @@ require("prototypes/categories") if util.me.enable() then require("prototypes/coke") require("prototypes/foundry") - require("prototypes/entity/foundry") require("prototypes/entity/electric-foundry") + require("prototypes/entity/foundry") end diff --git a/foundry-updates.lua b/bzfoundry2/foundry-updates.lua similarity index 92% rename from foundry-updates.lua rename to bzfoundry2/foundry-updates.lua index 67a9c34..2b97a61 100644 --- a/foundry-updates.lua +++ b/bzfoundry2/foundry-updates.lua @@ -10,8 +10,8 @@ if util.me.enable() then util.add_ingredient("tungsten-carbide", util.me.carbon(), 1) util.set_to_founding("cuw") - util.set_to_founding("silicon") - util.add_ingredient("silicon", util.me.carbon(), 1) + util.set_to_founding(mods.Krastorio2 and "kr-silicon" or "silicon") + 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("crucible") -- from graphite diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png new file mode 100644 index 0000000..05442be Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-1.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png new file mode 100644 index 0000000..30bfc2c Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights-2.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua new file mode 100644 index 0000000..18e2ef4 --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-lights.lua @@ -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, +} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png new file mode 100644 index 0000000..e00bae3 Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-1.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png new file mode 100644 index 0000000..c56d7f3 Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-main-2.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua new file mode 100644 index 0000000..9783293 --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-main.lua @@ -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, +} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua new file mode 100644 index 0000000..28a41b5 --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.lua @@ -0,0 +1,7 @@ +return +{ + width = 38, + height = 46, + shift = util.by_pixel( -0.5, 6.5), + line_length = 1, +} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png new file mode 100644 index 0000000..e851180 Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-reflection.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png new file mode 100644 index 0000000..04e9b7c Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-remnants.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png new file mode 100644 index 0000000..5d6859c Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-1.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png new file mode 100644 index 0000000..b22657e Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow-2.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua new file mode 100644 index 0000000..15673da --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-shadow.lua @@ -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, +} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua new file mode 100644 index 0000000..c5f5b9d --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.lua @@ -0,0 +1,7 @@ +return +{ + width = 122, + height = 142, + shift = util.by_pixel( 26.5, -42.5), + line_length = 1, +} diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png new file mode 100644 index 0000000..549a2d3 Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-status-lamp.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png new file mode 100644 index 0000000..203413f Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-1.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png new file mode 100644 index 0000000..3486d1e Binary files /dev/null and b/bzfoundry2/graphics/entity/electric-foundry/foundry-working-2.png differ diff --git a/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua b/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua new file mode 100644 index 0000000..53a1c56 --- /dev/null +++ b/bzfoundry2/graphics/entity/electric-foundry/foundry-working.lua @@ -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, +} diff --git a/bzfoundry2/graphics/entity/foundry/foundry-main-1.png b/bzfoundry2/graphics/entity/foundry/foundry-main-1.png new file mode 100644 index 0000000..d163387 Binary files /dev/null and b/bzfoundry2/graphics/entity/foundry/foundry-main-1.png differ diff --git a/bzfoundry2/graphics/entity/foundry/foundry-main-2.png b/bzfoundry2/graphics/entity/foundry/foundry-main-2.png new file mode 100644 index 0000000..ceb411b Binary files /dev/null and b/bzfoundry2/graphics/entity/foundry/foundry-main-2.png differ diff --git a/bzfoundry2/graphics/entity/foundry/foundry-remnants.png b/bzfoundry2/graphics/entity/foundry/foundry-remnants.png new file mode 100644 index 0000000..334a31d Binary files /dev/null and b/bzfoundry2/graphics/entity/foundry/foundry-remnants.png differ diff --git a/graphics/icons/coke-1.png b/bzfoundry2/graphics/icons/coke-1.png similarity index 100% rename from graphics/icons/coke-1.png rename to bzfoundry2/graphics/icons/coke-1.png diff --git a/graphics/icons/coke-2.png b/bzfoundry2/graphics/icons/coke-2.png similarity index 100% rename from graphics/icons/coke-2.png rename to bzfoundry2/graphics/icons/coke-2.png diff --git a/graphics/icons/coke-3.png b/bzfoundry2/graphics/icons/coke-3.png similarity index 100% rename from graphics/icons/coke-3.png rename to bzfoundry2/graphics/icons/coke-3.png diff --git a/graphics/icons/coke-icon.png b/bzfoundry2/graphics/icons/coke-icon.png similarity index 100% rename from graphics/icons/coke-icon.png rename to bzfoundry2/graphics/icons/coke-icon.png diff --git a/graphics/icons/coke-stacked.png b/bzfoundry2/graphics/icons/coke-stacked.png similarity index 100% rename from graphics/icons/coke-stacked.png rename to bzfoundry2/graphics/icons/coke-stacked.png diff --git a/graphics/icons/coke.png b/bzfoundry2/graphics/icons/coke.png similarity index 100% rename from graphics/icons/coke.png rename to bzfoundry2/graphics/icons/coke.png diff --git a/bzfoundry2/graphics/icons/electric-foundry.png b/bzfoundry2/graphics/icons/electric-foundry.png new file mode 100644 index 0000000..da78bc2 Binary files /dev/null and b/bzfoundry2/graphics/icons/electric-foundry.png differ diff --git a/bzfoundry2/graphics/icons/foundry.afphoto b/bzfoundry2/graphics/icons/foundry.afphoto new file mode 100644 index 0000000..a42754a Binary files /dev/null and b/bzfoundry2/graphics/icons/foundry.afphoto differ diff --git a/bzfoundry2/graphics/icons/foundry.png b/bzfoundry2/graphics/icons/foundry.png new file mode 100644 index 0000000..f54b677 Binary files /dev/null and b/bzfoundry2/graphics/icons/foundry.png differ diff --git a/bzfoundry2/graphics/icons/technology/electric-foundry.png b/bzfoundry2/graphics/icons/technology/electric-foundry.png new file mode 100644 index 0000000..4fe8669 Binary files /dev/null and b/bzfoundry2/graphics/icons/technology/electric-foundry.png differ diff --git a/bzfoundry2/graphics/icons/technology/foundry.png b/bzfoundry2/graphics/icons/technology/foundry.png new file mode 100644 index 0000000..c645699 Binary files /dev/null and b/bzfoundry2/graphics/icons/technology/foundry.png differ diff --git a/info.json b/bzfoundry2/info.json similarity index 51% rename from info.json rename to bzfoundry2/info.json index 0764d9f..68de52d 100644 --- a/info.json +++ b/bzfoundry2/info.json @@ -1,19 +1,20 @@ { "name": "bzfoundry", - "version": "0.2.10", - "factorio_version": "1.1", + "version": "2.0.0", + "factorio_version": "2.0", "title": "Foundry", "author": "Brevven", "contact": "", "homepage": "", "dependencies": [ - "? space-exploration", - "(?) Krastorio2", - "? bzsilicon", + "base >= 2.0.0", + "rusty-locale >= 1.0.17", + "? space-exploration >= 0.7.34", + "(?) Krastorio2 >= 2.0.8", + "? bzsilicon >= 2.0.18", "? bztungsten", - "? bzzirconium", - "rusty-locale", - "base >= 1.1.0" + "? bzzirconium >= 2.1.13", + "! space-age" ], "description": "Adds a foundry building for making alloys, etc.\n\nA standalone accessory from BZ Mods." } diff --git a/locale/cs/foundry.cfg b/bzfoundry2/locale/cs/foundry.cfg similarity index 100% rename from locale/cs/foundry.cfg rename to bzfoundry2/locale/cs/foundry.cfg diff --git a/locale/en/foundry.cfg b/bzfoundry2/locale/en/foundry.cfg similarity index 100% rename from locale/en/foundry.cfg rename to bzfoundry2/locale/en/foundry.cfg diff --git a/locale/ja/foundry.cfg b/bzfoundry2/locale/ja/foundry.cfg similarity index 87% rename from locale/ja/foundry.cfg rename to bzfoundry2/locale/ja/foundry.cfg index c38d455..d04e086 100644 --- a/locale/ja/foundry.cfg +++ b/bzfoundry2/locale/ja/foundry.cfg @@ -39,6 +39,7 @@ bzfoundry-smelt=鋳造所で製錬可能 bzfoundry-plates=耐熱レシピを追加 (実験的) bzfoundry-hydrocarbon=鋳造に使用する炭化水素類 bzfoundry-other-machines=鋳造所以外に鋳造を行える設備 +bzfoundry-woodcoke=木材を使用するコークスのレシピ bzfoundry-minimal=ミニマルモード (建造物を取り除く) [mod-setting-description] @@ -48,3 +49,12 @@ bzfoundry-hydrocarbon=鋳造に使用する炭化水素類。コークス化に bzfoundry-other-machines=鋳造所以外に "founding" レシピを実行できる "assembling-machine" エンティティの一覧。例: K2の "kr-advanced-furnace" や AAII の "industrial-furnace" (コンマ区切り) bzfoundry-plates=[color=orange]実験的[/color] 材料、生産物などあらゆる点が変更される可能性があります。\n一つ以上の耐熱素材を使うことで鋳造所における板材の生産量を向上することが出来ます。\n警告: 煩雑なレシピです。 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=なし diff --git a/locale/ko/foundry.cfg b/bzfoundry2/locale/ko/foundry.cfg similarity index 100% rename from locale/ko/foundry.cfg rename to bzfoundry2/locale/ko/foundry.cfg diff --git a/locale/ru/foundry.cfg b/bzfoundry2/locale/ru/foundry.cfg similarity index 100% rename from locale/ru/foundry.cfg rename to bzfoundry2/locale/ru/foundry.cfg diff --git a/locale/zh-CN/bzfoundry.cfg b/bzfoundry2/locale/zh-CN/bzfoundry.cfg similarity index 100% rename from locale/zh-CN/bzfoundry.cfg rename to bzfoundry2/locale/zh-CN/bzfoundry.cfg diff --git a/me.lua b/bzfoundry2/me.lua similarity index 89% rename from me.lua rename to bzfoundry2/me.lua index bb06f1c..09fd319 100644 --- a/me.lua +++ b/bzfoundry2/me.lua @@ -3,7 +3,7 @@ local me = {} me.name = "bzfoundry" function me.basic_founding() - return mods.bztin or mods.bzaluminum + return mods.bztin or mods.bzaluminum2 end function me.woodcoke() @@ -23,14 +23,15 @@ function me.enable() end function me.carbon() + if mods["Krastorio2"] then return "kr-coke" end if me.get_setting("bz-all-intermediates") then return "coke" end return me.get_setting("bzfoundry-hydrocarbon") end function me.carbonrecipe() local carbon = me.carbon() - if carbon == "coke" then - return "coke" + if carbon == "coke" or carbon == "kr-coke" then + return me.carbon() elseif carbon == "solid-fuel" then return "solid-fuel-from-coal" end diff --git a/prototypes/categories.lua b/bzfoundry2/prototypes/categories.lua similarity index 83% rename from prototypes/categories.lua rename to bzfoundry2/prototypes/categories.lua index 16c53e5..1bea4d5 100644 --- a/prototypes/categories.lua +++ b/bzfoundry2/prototypes/categories.lua @@ -2,8 +2,9 @@ local util = require("data-util") data:extend({ { type = "recipe-category", name = "founding"}, - { type = "item-subgroup", name = "founding-machines", group = "production"}, - { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"}, + { type = "item-subgroup", name = "founding-machines", group = "production", order = "d-f"}, + { 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 diff --git a/prototypes/coke.lua b/bzfoundry2/prototypes/coke.lua similarity index 77% rename from prototypes/coke.lua rename to bzfoundry2/prototypes/coke.lua index fad2cfa..98a70d8 100644 --- a/prototypes/coke.lua +++ b/bzfoundry2/prototypes/coke.lua @@ -24,9 +24,9 @@ data:extend({ { type = "recipe", name = "coke", - result = "coke", category = "founding", - ingredients = {{"coal", 2}}, + ingredients = {{type="item", name="coal", amount=2}}, + results = {{ type = "item", name = "coke", amount = 1 }}, energy_required = 3.2, enabled=false, }, @@ -36,9 +36,9 @@ data:extend({ { type = "recipe", name = "woodcoke", - result = "coke", 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, enabled=false, icons = { @@ -53,9 +53,9 @@ data:extend({ { type = "recipe", name = "solid-fuel-from-coal", - result = "solid-fuel", category = "founding", - ingredients = {{"coal", 4}}, + ingredients = {{type="item", name="coal", amount=4}}, + results = {{ type = "item", name = "solid-fuel", amount = 1 }}, energy_required = 3.2, enabled=false, }, @@ -65,9 +65,9 @@ data:extend({ { type = "recipe", name = "woodcoke", - result = "solid-fuel", 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, enabled=false, icons = { diff --git a/bzfoundry2/prototypes/entity/electric-foundry.lua b/bzfoundry2/prototypes/entity/electric-foundry.lua new file mode 100644 index 0000000..d0cc05b --- /dev/null +++ b/bzfoundry2/prototypes/entity/electric-foundry.lua @@ -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") diff --git a/bzfoundry2/prototypes/entity/foundry-pictures.lua b/bzfoundry2/prototypes/entity/foundry-pictures.lua new file mode 100644 index 0000000..7018d00 --- /dev/null +++ b/bzfoundry2/prototypes/entity/foundry-pictures.lua @@ -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() + } + } +} diff --git a/bzfoundry2/prototypes/entity/foundry.lua b/bzfoundry2/prototypes/entity/foundry.lua new file mode 100644 index 0000000..2f828a4 --- /dev/null +++ b/bzfoundry2/prototypes/entity/foundry.lua @@ -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") diff --git a/prototypes/foundry.lua b/bzfoundry2/prototypes/foundry.lua similarity index 79% rename from prototypes/foundry.lua rename to bzfoundry2/prototypes/foundry.lua index a5d3c06..74ef89b 100644 --- a/prototypes/foundry.lua +++ b/bzfoundry2/prototypes/foundry.lua @@ -1,11 +1,13 @@ local util = require("data-util") -local foundry_ingredients = {{"stone-brick", 20}, {"iron-plate", 10}, {"copper-plate", 5}} -if mods.bzlead then table.insert(foundry_ingredients, {"lead-plate", 8}) end -if mods.Krastorio2 or mods["aai-industry"] then - table.insert(foundry_ingredients, {"sand", 10}) +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, {type="item", name="lead-plate", amount=8}) end +if mods.Krastorio2 then + 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 - table.insert(foundry_ingredients, {"silica", 20}) + table.insert(foundry_ingredients, {type="item", name="silica", amount=20}) end data:extend({ @@ -22,9 +24,9 @@ data:extend({ { type = "recipe", name = "foundry", - result = "foundry", enabled = false, ingredients = foundry_ingredients, + results = {{ type = "item", name = "foundry", amount = 1 }} }, { type = "technology", @@ -61,7 +63,7 @@ data:extend({ type = "item", name = "electric-foundry", icon = "__bzfoundry__/graphics/icons/electric-foundry.png", - icon_size = 128, + icon_size = 64, subgroup = "founding-machines", order = "z[foundryelectric]", place_result = "electric-foundry", @@ -76,16 +78,16 @@ data:extend({ }, type = "recipe", name = "electric-foundry", - result = "electric-foundry", enabled = false, ingredients = { - {"foundry", 1}, - {"steel-plate", 10}, - {"processing-unit", 4}, - {"concrete", 10}, - (data.raw.item["zirconia"] and {"zirconia", 10} or {"stone-brick", 10}), - (data.raw.item["tungsten-plate"] and {"tungsten-plate", 5} or nil), + {type="item", name="foundry", amount=1}, + {type="item", name="steel-plate", amount=10}, + {type="item", name="processing-unit", amount=4}, + {type="item", name="concrete", amount=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 {type="item", name="tungsten-plate", amount=5} or nil), }, + results = {{ type = "item", name = "electric-foundry", amount = 1 }} }, { type = "technology", @@ -125,8 +127,8 @@ if util.me.founding_plates() then or (mods.bzzirconium and { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.5, shift={32, -32}}) - or (mods.bzaluminum and - { icon = "__bzaluminum__/graphics/icons/alumina.png", + or (mods.bzaluminum2 and + { icon = "__bzaluminum2__/graphics/icons/alumina.png", icon_size = 128, scale=0.5, shift={32, -32}}) or { icon = "__base__/graphics/icons/stone-brick.png", 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 { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.5, shift={32, -32}}) - or (mods.bzaluminum and - { icon = "__bzaluminum__/graphics/icons/alumina.png", + or (mods.bzaluminum2 and + { icon = "__bzaluminum2__/graphics/icons/alumina.png", icon_size = 128, scale=0.5, shift={32, -32}}) or { icon = "__base__/graphics/icons/stone-brick.png", icon_size = 64, scale=1, icon_mipmaps = 4, shift={32, -32}} diff --git a/refractory-updates.lua b/bzfoundry2/refractory-updates.lua similarity index 59% rename from refractory-updates.lua rename to bzfoundry2/refractory-updates.lua index 10c6eeb..b053d8c 100644 --- a/refractory-updates.lua +++ b/bzfoundry2/refractory-updates.lua @@ -1,11 +1,8 @@ local rusty_locale = require("__rusty-locale__.locale") 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 util = require("data-util") - function has_suffix(s, suffix) return string.sub(s, -string.len(suffix), -1) == suffix end @@ -23,84 +20,34 @@ function check_name(name) for i, suffix in pairs(suffixes) do if has_suffix(name, suffix) then return true 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 return false end function make_recipe(recipe) local found_result = false - local has_normal = false - local has_exp = false - - local new_results = {} - local new_normal_results = {} - local new_exp_results = {} if recipe.results then -- standard recipes for i, result in pairs(recipe.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] + if result.name and check_name(result.name) then + found_result = result.name new_results = futil.table.deepcopy(recipe.results) break 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 log("Attempting to make refractory recipe for " .. recipe.name) local r = futil.table.deepcopy(recipe) r.name = r.name .. "-refractory" - r.result = nil - r.result_count = nil + r.main_product = found_result + r.results = {} r.enabled = false 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]) table.insert( icons, @@ -113,8 +60,8 @@ function make_recipe(recipe) or (mods.bzzirconium and { icon = "__bzzirconium__/graphics/icons/zirconia.png", icon_size = 128, scale=0.125, shift={8, -8}}) - or (mods.bzaluminum and - { icon = "__bzaluminum__/graphics/icons/alumina.png", + or (mods.bzaluminum2 and + { icon = "__bzaluminum2__/graphics/icons/alumina.png", icon_size = 128, scale=0.125, shift={8, -8}}) or { icon = "__base__/graphics/icons/stone-brick.png", icon_size = 64, scale=0.25, icon_mipmaps = 4, shift={8, -8}} @@ -122,25 +69,9 @@ function make_recipe(recipe) r.icons = icons locale = rusty_locale.of_recipe(data.raw.recipe[recipe.name]) r.localised_name = {"recipe-name.with-refractory", locale.name} - - if not has_normal and not has_exp then - r.results = new_results - make_ingredients_and_products(r, r.name) - end - 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 + r.results = new_results + make_ingredients_and_products(r, r.name) + r.allow_productivity = true return r end return nil @@ -154,7 +85,7 @@ function get_refractories(recipe, name) if mods.bzcarbon then table.insert(refractories, "graphite") 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.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 return refractories end @@ -163,9 +94,6 @@ function make_ingredients_and_products(r, name) local refractories = get_refractories(r, name) local max_count = 1 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 max_count = ingredient.amount end @@ -177,20 +105,16 @@ function make_ingredients_and_products(r, name) end for i, refractory in pairs(refractories) 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") goto skip end end - table.insert(r.ingredients, {refractory, refractory_amount}) + table.insert(r.ingredients, {type = "item", name = refractory, amount = refractory_amount}) end ::skip:: 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.amount then result.amount = result.amount * 2 @@ -205,8 +129,8 @@ function make_ingredients_and_products(r, name) end end for i, refractory in pairs(refractories) do - table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, catalyst_amount=refractory_amount, - probability=get_probability(#refractories)}) + table.insert(r.results, {type="item", name=refractory, amount=refractory_amount, ignored_by_productivity=refractory_amount, + ignored_by_stats=refractory_amount, probability=get_probability(#refractories)}) end end @@ -239,16 +163,5 @@ if util.me.founding_plates() then else util.add_effect("advanced-founding", {type="unlock-recipe", recipe=recipe.name}) 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 diff --git a/settings-util.lua b/bzfoundry2/settings-util.lua similarity index 100% rename from settings-util.lua rename to bzfoundry2/settings-util.lua diff --git a/settings.lua b/bzfoundry2/settings.lua similarity index 84% rename from settings.lua rename to bzfoundry2/settings.lua index ac02318..ee0bb8a 100644 --- a/settings.lua +++ b/bzfoundry2/settings.lua @@ -11,8 +11,8 @@ data:extend({ type = "string-setting", name = "bzfoundry-hydrocarbon", setting_type = "startup", - allowed_values = {"coke", "solid-fuel", "coal", "none"}, - default_value = "coke", + allowed_values = {mods["Krastorio2"] and "kr-coke" or "coke", "solid-fuel", "coal", "none"}, + default_value = mods["Krastorio2"] and "kr-coke" or "coke", order = "aba", }, { @@ -42,7 +42,7 @@ data:extend({ name = "bzfoundry-minimal", setting_type = "startup", default_value = false, - hidden = not mods.bzaluminum, + hidden = not mods.bzaluminum2, order = "zza", }, }) diff --git a/bzfoundry2/sound/entity/foundry/foundry-blade.ogg b/bzfoundry2/sound/entity/foundry/foundry-blade.ogg new file mode 100644 index 0000000..55b8cfa Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-blade.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg b/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg new file mode 100644 index 0000000..4af3ab0 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-clamp.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg new file mode 100644 index 0000000..0468045 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-1.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg new file mode 100644 index 0000000..81dd873 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-2.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg new file mode 100644 index 0000000..de49d67 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-fire-whoosh-3.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg b/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg new file mode 100644 index 0000000..d9930a2 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-metal-clunk.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg b/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg new file mode 100644 index 0000000..2c8e75c Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-metal-scrape.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg b/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg new file mode 100644 index 0000000..0b99e4d Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-pipe-in.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg b/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg new file mode 100644 index 0000000..739c03f Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-pipe-out.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg b/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg new file mode 100644 index 0000000..dcbd613 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-pour-1.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg b/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg new file mode 100644 index 0000000..8b97744 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-pour-2.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg b/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg new file mode 100644 index 0000000..da5c514 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-rocks.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg new file mode 100644 index 0000000..e8818d9 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-slide-close.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg new file mode 100644 index 0000000..42d8f1b Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-slide-open.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg b/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg new file mode 100644 index 0000000..23fc4ae Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-slide-stop.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg b/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg new file mode 100644 index 0000000..218802d Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry-smoke-puff.ogg differ diff --git a/bzfoundry2/sound/entity/foundry/foundry.ogg b/bzfoundry2/sound/entity/foundry/foundry.ogg new file mode 100644 index 0000000..806eaa7 Binary files /dev/null and b/bzfoundry2/sound/entity/foundry/foundry.ogg differ diff --git a/thumbnail.png b/bzfoundry2/thumbnail.png similarity index 100% rename from thumbnail.png rename to bzfoundry2/thumbnail.png diff --git a/thumbnail.xcf b/bzfoundry2/thumbnail.xcf similarity index 100% rename from thumbnail.xcf rename to bzfoundry2/thumbnail.xcf diff --git a/graphics/entity/electric-foundry-glow.png b/graphics/entity/electric-foundry-glow.png deleted file mode 100644 index cada06d..0000000 Binary files a/graphics/entity/electric-foundry-glow.png and /dev/null differ diff --git a/graphics/entity/electric-foundry-glow.xcf b/graphics/entity/electric-foundry-glow.xcf deleted file mode 100644 index 50e36e3..0000000 Binary files a/graphics/entity/electric-foundry-glow.xcf and /dev/null differ diff --git a/graphics/entity/electric-foundry.png b/graphics/entity/electric-foundry.png deleted file mode 100644 index 29447ef..0000000 Binary files a/graphics/entity/electric-foundry.png and /dev/null differ diff --git a/graphics/entity/electric-foundry.xcf b/graphics/entity/electric-foundry.xcf deleted file mode 100644 index ac61109..0000000 Binary files a/graphics/entity/electric-foundry.xcf and /dev/null differ diff --git a/graphics/entity/foundry.png b/graphics/entity/foundry.png deleted file mode 100644 index ae391eb..0000000 Binary files a/graphics/entity/foundry.png and /dev/null differ diff --git a/graphics/entity/foundry.xcf b/graphics/entity/foundry.xcf deleted file mode 100644 index 25b4b75..0000000 Binary files a/graphics/entity/foundry.xcf and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry-1.png b/graphics/entity/hr-electric-foundry-1.png deleted file mode 100644 index 18e9d1b..0000000 Binary files a/graphics/entity/hr-electric-foundry-1.png and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry-2.png b/graphics/entity/hr-electric-foundry-2.png deleted file mode 100644 index 237e82d..0000000 Binary files a/graphics/entity/hr-electric-foundry-2.png and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry-3.png b/graphics/entity/hr-electric-foundry-3.png deleted file mode 100644 index c6ddb8e..0000000 Binary files a/graphics/entity/hr-electric-foundry-3.png and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry-4.png b/graphics/entity/hr-electric-foundry-4.png deleted file mode 100644 index b4fa48a..0000000 Binary files a/graphics/entity/hr-electric-foundry-4.png and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry-animation.png b/graphics/entity/hr-electric-foundry-animation.png deleted file mode 100644 index 0b05c3d..0000000 Binary files a/graphics/entity/hr-electric-foundry-animation.png and /dev/null differ diff --git a/graphics/entity/hr-electric-foundry.png b/graphics/entity/hr-electric-foundry.png deleted file mode 100644 index 2b4490c..0000000 Binary files a/graphics/entity/hr-electric-foundry.png and /dev/null differ diff --git a/graphics/entity/hr-foundry.png b/graphics/entity/hr-foundry.png deleted file mode 100644 index 6aec925..0000000 Binary files a/graphics/entity/hr-foundry.png and /dev/null differ diff --git a/graphics/icons/electric-foundry-tech.xcf b/graphics/icons/electric-foundry-tech.xcf deleted file mode 100644 index 19658d4..0000000 Binary files a/graphics/icons/electric-foundry-tech.xcf and /dev/null differ diff --git a/graphics/icons/electric-foundry.png b/graphics/icons/electric-foundry.png deleted file mode 100644 index d08236d..0000000 Binary files a/graphics/icons/electric-foundry.png and /dev/null differ diff --git a/graphics/icons/electric-foundry.xcf b/graphics/icons/electric-foundry.xcf deleted file mode 100644 index d08b5bd..0000000 Binary files a/graphics/icons/electric-foundry.xcf and /dev/null differ diff --git a/graphics/icons/foundry.png b/graphics/icons/foundry.png deleted file mode 100644 index a743f2d..0000000 Binary files a/graphics/icons/foundry.png and /dev/null differ diff --git a/graphics/icons/foundry.xcf b/graphics/icons/foundry.xcf deleted file mode 100644 index 5f5e755..0000000 Binary files a/graphics/icons/foundry.xcf and /dev/null differ diff --git a/graphics/icons/technology/electric-foundry.png b/graphics/icons/technology/electric-foundry.png deleted file mode 100644 index 604f0cb..0000000 Binary files a/graphics/icons/technology/electric-foundry.png and /dev/null differ diff --git a/graphics/icons/technology/foundry.png b/graphics/icons/technology/foundry.png deleted file mode 100644 index ddc8673..0000000 Binary files a/graphics/icons/technology/foundry.png and /dev/null differ diff --git a/graphics/icons/technology/foundry.xcf b/graphics/icons/technology/foundry.xcf deleted file mode 100644 index 3c2d594..0000000 Binary files a/graphics/icons/technology/foundry.xcf and /dev/null differ diff --git a/prototypes/entity/electric-foundry.lua b/prototypes/entity/electric-foundry.lua deleted file mode 100644 index e6b6570..0000000 --- a/prototypes/entity/electric-foundry.lua +++ /dev/null @@ -1,162 +0,0 @@ -require("util") -local futil = require("data-util") - -data:extend({ - { - type = "assembling-machine", - name = "electric-foundry", - fast_replaceable_group = "foundry", - icon = "__bzfoundry__/graphics/icons/foundry.png", - icon_size = 64, - flags = {"placeable-neutral", "placeable-player", "player-creation"}, - minable = {mining_time = 0.2, result = "electric-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/electric-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 = "360kW", - drain = "12kW", - crafting_speed = 4, - energy_source = - { - type = "electric", - fuel_category = "chemical", - effectivity = 1, - emissions_per_minute = 2, - usage_priority = "secondary-input", - }, - module_specification = - { - module_slots = 3, - module_info_icon_shift = {0, 0.8} - }, - allowed_effects = {"consumption", "speed", "productivity", "pollution"}, - animation = - { - layers = - { - { - -- 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, - } - }, - } - }, - 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 = "__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, - 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, - } - }, - }, - { - fadeout = true, - draw_as_light = true, - effect = "flicker", - animation = - { - filename = "__bzfoundry__/graphics/entity/electric-foundry-glow.png", - priority = "extra-high", - width = 25, - height = 29, - frame_count = 1, - shift = util.by_pixel(0, 36), - } - }, - { - draw_as_light = true, - draw_as_sprite = false, - fadeout = true, - effect = "flicker", - animation = - { - filename = "__base__/graphics/entity/steel-furnace/steel-furnace-ground-light.png", - priority = "high", - line_length = 1, - draw_as_sprite = false, - width = 78, - height = 64, - frame_count = 1, - direction_count = 1, - shift = util.by_pixel(0, 72), - blend_mode = "additive", - 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, - } - }, - }, - }, - - }, - -}) - -futil.add_crafting_category("assembling-machine", "electric-foundry", "basic-founding") diff --git a/prototypes/entity/foundry.lua b/prototypes/entity/foundry.lua deleted file mode 100644 index 54ddb32..0000000 --- a/prototypes/entity/foundry.lua +++ /dev/null @@ -1,118 +0,0 @@ -require("util") -local futil = require("data-util") - -local fuel = {"chemical"} -if mods.Krastorio2 then table.insert(fuel, "vehicle-fuel") end -if mods["aai-industry"] then table.insert(fuel, "processed-chemical") end - -data:extend({ - { - type = "assembling-machine", - name = "foundry", - fast_replaceable_group = "foundry", - icon = "__bzfoundry__/graphics/icons/foundry.png", - icon_size = 64, - flags = {"placeable-neutral", "placeable-player", "player-creation"}, - 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", - crafting_speed = 4, - energy_source = - { - type = "burner", - fuel_categories = fuel, - effectivity = 1, - emissions_per_minute = 8, - fuel_inventory_size = 1, - smoke = - { - { - name = "smoke", - frequency = 20, - position = {1, -1.7}, - starting_vertical_speed = 0.1, - starting_frame_deviation = 60 - } - } - }, - animation = - { - layers = - { - { - filename = "__bzfoundry__/graphics/entity/foundry.png", - priority = "high", - width = 140, - height = 120, - 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, - shift = util.by_pixel(-1, 9), - scale=1.1, - 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") diff --git a/sources/graphics/entity/foundry/foundry-main-1.afphoto b/sources/graphics/entity/foundry/foundry-main-1.afphoto new file mode 100644 index 0000000..4443bdf Binary files /dev/null and b/sources/graphics/entity/foundry/foundry-main-1.afphoto differ diff --git a/sources/graphics/entity/foundry/foundry-main-2.afphoto b/sources/graphics/entity/foundry/foundry-main-2.afphoto new file mode 100644 index 0000000..373c24a Binary files /dev/null and b/sources/graphics/entity/foundry/foundry-main-2.afphoto differ diff --git a/sources/graphics/entity/foundry/foundry-remnants.afphoto b/sources/graphics/entity/foundry/foundry-remnants.afphoto new file mode 100644 index 0000000..20ac4dd Binary files /dev/null and b/sources/graphics/entity/foundry/foundry-remnants.afphoto differ diff --git a/graphics/icons/coke-1.xcf b/sources/graphics/icons/coke-1.xcf similarity index 100% rename from graphics/icons/coke-1.xcf rename to sources/graphics/icons/coke-1.xcf diff --git a/graphics/icons/coke-2.xcf b/sources/graphics/icons/coke-2.xcf similarity index 100% rename from graphics/icons/coke-2.xcf rename to sources/graphics/icons/coke-2.xcf diff --git a/graphics/icons/coke-3.xcf b/sources/graphics/icons/coke-3.xcf similarity index 100% rename from graphics/icons/coke-3.xcf rename to sources/graphics/icons/coke-3.xcf diff --git a/graphics/icons/coke-icon.xcf b/sources/graphics/icons/coke-icon.xcf similarity index 100% rename from graphics/icons/coke-icon.xcf rename to sources/graphics/icons/coke-icon.xcf diff --git a/graphics/icons/coke.xcf b/sources/graphics/icons/coke.xcf similarity index 100% rename from graphics/icons/coke.xcf rename to sources/graphics/icons/coke.xcf diff --git a/sources/graphics/icons/foundry.afphoto b/sources/graphics/icons/foundry.afphoto new file mode 100644 index 0000000..a42754a Binary files /dev/null and b/sources/graphics/icons/foundry.afphoto differ diff --git a/sources/graphics/icons/technology/foundry.afphoto b/sources/graphics/icons/technology/foundry.afphoto new file mode 100644 index 0000000..f0bf6ab Binary files /dev/null and b/sources/graphics/icons/technology/foundry.afphoto differ