This commit is contained in:
Simon Brodtmann 2025-10-11 00:56:19 +02:00
parent 3974b6d69c
commit f930a5412d
33 changed files with 1928 additions and 1 deletions

3
.editorconfig Normal file
View file

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

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.idea
*.zip

20
Nylon2/LICENSE.md Normal file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2023 Timeken
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

16
Nylon2/README.md Normal file
View file

@ -0,0 +1,16 @@
# MetalsForYou
## Version History
See changelog.txt
## Created by
## Thanks to
### Compatibility
### Localization

65
Nylon2/changelog.txt Normal file
View file

@ -0,0 +1,65 @@
---------------------------------------------------------------------------------------------------
Version: 0.5.2
Date: 2024-07-24
Features:
- Added ethanolamine to SE vitamelange spice.
- Upped nylon drive belt from 2 -> 8
---------------------------------------------------------------------------------------------------
Version: 0.5.1
Date: 2024-07-16
Features:
- Fixed conflict when using K2 but not bzcarbon.
---------------------------------------------------------------------------------------------------
Version: 0.5.0
Date: 2024-06-27
Features:
- Added nylon drive belt if BrimStuff is installed.
- Fixed error when not using Cobalt mod.
- Fixed missing mod errors.
---------------------------------------------------------------------------------------------------
Version: 0.4.3
Date: 2024-01-21
Features:
- Removed old unused files.
---------------------------------------------------------------------------------------------------
Version: 0.4.2
Date: 2024-01-14
Features:
- Added SE delivery cannon recipe for fluids.
---------------------------------------------------------------------------------------------------
Version: 0.4.1
Date: 2024-01-06
Features:
- Added coal tar solid fuel recipe.
---------------------------------------------------------------------------------------------------
Version: 0.4.0
Date: 2024-01-02
Features:
- Added a new production chain for alternative lubricant and epoxy if K2 is installed.
- Increesed destructive distillation base craft time to 12 from 10.
---------------------------------------------------------------------------------------------------
Version: 0.3.0
Date: 2023-12-25
Features:
- Added bio nitric acid recipe.
- Fixed Nylons K2 progression with few mods.
---------------------------------------------------------------------------------------------------
Version: 0.2.0
Date: 2023-12-24
Features:
- Split cobalt into its own mod.
- Replaced 248k fiberer maker iron gear wheel with nylon machine parts.
- Replaced 248k compound machine iron gear wheel with nylon machine parts.
- Replaced K2 biusart lab copper cable with nylon machine parts.
- Replaced bobassembly electronics machine 2 steel gear wheel with nylon machine parts.
- Replaced aai industry stack filter inserter steel gear wheel with nylon machine parts.
---------------------------------------------------------------------------------------------------
Version: 0.1.1
Date: 2023-12-21
Features:
- Added cobalt ore as a byproduct from nickel if If I Had A Nickel is installed.
---------------------------------------------------------------------------------------------------
Version: 0.1.0
Date: 2023-12-20
Features:
- Alpha release.

View file

@ -0,0 +1 @@
local util = require("recipe-final-fix")

1
Nylon2/data-updates.lua Normal file
View file

@ -0,0 +1 @@
require("recipe-modify")

930
Nylon2/data-util.lua Normal file
View file

@ -0,0 +1,930 @@
local util = {}
-- se landfill
-- params: ore, icon_size
function util.se_landfill(params)
if mods["space-exploration"] then
if not params.icon_size then params.icon_size = 64 end
local lname="landfill-"..params.ore
data:extend({
{
type = "recipe",
icons = {
{ icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 },
{ icon = "__Chromium2__/graphics/icons/"..params.ore..".png", icon_size = params.icon_size, scale = 0.33*64/params.icon_size},
},
energy_required = 1,
enabled=false,
name = lname,
category = "hard-recycling",
order = "z-b-"..params.ore,
subgroup = "terrain",
results = {{type="item", name="landfill", amount=1}},
ingredients = {{type="item", name=params.ore, amount=50}},
}
})
util.add_unlock("se-recycling-facility", lname)
end
end
-- se matter
-- params: ore, energy_required, quant_out, quant_in, icon_size, stream_out
function util.se_matter(params)
if not params.quant_in then params.quant_in = params.quant_out end
if not params.icon_size then params.icon_size = 64 end
local fname = "matter-fusion-"..params.ore
local sedata = mods["Krastorio2"] and "se-kr-matter-synthesis-data" or "se-fusion-test-data"
local sejunk = mods["Krastorio2"] and "se-broken-data" or "se-junk-data"
data:extend({
{
type = "recipe",
name = fname,
localised_name = {"recipe-name.se-matter-fusion-to", {"item-name."..params.ore}},
category = "space-materialisation",
subgroup = "materialisation",
order = "a-b-z",
icons = {
{icon = "__space-exploration-graphics__/graphics/blank.png",
icon_size = 64, scale = 0.5},
{icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
icon_size = 64, scale = 0.33, shift = {8,-8}},
{icon = "__Chromium2__/graphics/icons/"..params.ore..".png",
icon_size = params.icon_size, scale = 0.33 * 64/params.icon_size, shift={-8, 8}},
{icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
icon_size = 64, scale = 0.5},
},
energy_required = params.energy_required,
enabled = false,
ingredients = {
{type = "item", name = sedata, amount=1},
{type="fluid", name="se-particle-stream", amount=50},
{type="fluid", name="se-space-coolant-supercooled", amount=25},
},
results = {
{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},
}
}
})
util.add_unlock("se-space-matter-fusion", fname)
if mods["Krastorio2"] then
local lname = params.ore.."-to-particle-stream"
data:extend({
enabled = false,
{
type = "recipe",
name = lname,
localised_name = {"recipe-name.se-kr-matter-liberation", {"item-name."..params.ore}},
category = "space-materialisation",
subgroup = "advanced-particle-stream",
order = "a-b-z",
icons = {
{icon = "__space-exploration-graphics__/graphics/blank.png",
icon_size = 64, scale = 0.5},
{icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png",
icon_size = 64, scale = 0.33, shift = {-8,8}},
{icon = "__Chromium2__/graphics/icons/"..params.ore..".png",
icon_size = params.icon_size, scale = 0.33 * 64/params.icon_size, shift={8, -8}},
{icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png",
icon_size = 64, scale = 0.5},
},
energy_required = 30,
enabled = false,
ingredients = {
{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, ignored_by_productivity = 50, ignored_by_stats = 50},
}
}
})
if not data.raw.technology["bz-advanced-stream-production"] then
data:extend({
{
type = "technology",
name ="bz-advanced-stream-production",
localised_name = {"", {"technology-name.se-kr-advanced-stream-production"}, " 2"},
icon = "__space-exploration-graphics__/graphics/technology/material-fabricator.png",
icon_size = 128,
effects = {},
unit = {
count = 100,
time = 15,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"se-rocket-science-pack", 1},
{"space-science-pack", 1},
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"se-astronomic-science-pack-4", 1},
{"se-energy-science-pack-4", 1},
{"se-material-science-pack-4", 1},
{"matter-tech-card", 1},
{"se-deep-space-science-pack-1", 1},
}
},
prerequisites = {"se-kr-advanced-stream-production"},
},
})
end
util.add_unlock("bz-advanced-stream-production", lname)
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.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]
if technology then
technology.prerequisites = {}
for i, prerequisite in pairs(prerequisites) do
if data.raw.technology[prerequisite] then
table.insert(technology.prerequisites, prerequisite)
end
end
end
end
-- Add a prerequisite to a given technology
function util.add_prerequisite(technology_name, prerequisite)
local technology = data.raw.technology[technology_name]
if technology and data.raw.technology[prerequisite] then
if technology.prerequisites then
for i, pre in pairs(technology.prerequisites) do
if pre == prerequisite then return end
end
table.insert(technology.prerequisites, prerequisite)
else
technology.prerequisites = {prerequisite}
end
end
end
-- Remove a prerequisite from a given technology
function util.remove_prerequisite(technology_name, prerequisite)
local technology = data.raw.technology[technology_name]
local index = -1
if technology then
for i, prereq in pairs(technology.prerequisites) do
if prereq == prerequisite then
index = i
break
end
end
if index > -1 then
table.remove(technology.prerequisites, index)
end
end
end
-- Add an effect to a given technology
function util.add_effect(technology_name, effect)
local technology = data.raw.technology[technology_name]
if technology then
if not technology.effects then technology.effects = {} end
if effect and effect.type == "unlock-recipe" then
if not data.raw.recipe[effect.recipe] then
return
end
table.insert(technology.effects, effect)
end
end
end
-- Add an effect to a given technology to unlock recipe
function util.add_unlock(technology_name, recipe)
util.add_effect(technology_name, {type="unlock-recipe", recipe=recipe})
end
-- remove recipe unlock effect from a given technology, multiple times if necessary
function util.remove_recipe_effect(technology_name, recipe_name)
local technology = data.raw.technology[technology_name]
local index = -1
local cnt = 0
if technology and technology.effects then
for i, effect in pairs(technology.effects) do
if effect.type == "unlock-recipe" and effect.recipe == recipe_name then
index = i
cnt = cnt + 1
end
end
if index > -1 then
table.remove(technology.effects, index)
if cnt > 1 then -- not over yet, do it again
util.remove_recipe_effect(technology_name, recipe_name)
end
end
end
end
-- Set technology ingredients
function util.set_tech_recipe(technology_name, ingredients)
local technology = data.raw.technology[technology_name]
if technology then
technology.unit.ingredients = ingredients
end
end
function util.set_enabled(recipe_name, enabled)
if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe_name].enabled = enabled
end
end
function util.set_hidden(recipe_name)
if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe_name].hidden = true
end
end
-- Add a given quantity of ingredient to a given recipe
function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity)
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
end
end
function add_or_add_to_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
add_to_ingredient(recipe, ingredient, quantity)
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
-- Add a given quantity of ingredient to a given recipe
function util.add_ingredient(recipe_name, ingredient, quantity)
local is_fluid = not not data.raw.fluid[ingredient]
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
end
end
function add_ingredient(recipe, ingredient, quantity, is_fluid)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing.name == ingredient then
return
end
end
if is_fluid then
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
else
table.insert(recipe.ingredients, {type = "item", name = ingredient, amount = quantity})
end
end
end
-- Add a given ingredient prototype to a given recipe
function util.add_ingredient_raw(recipe_name, ingredient)
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
end
end
function add_ingredient_raw(recipe, ingredient)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if (existing.name and existing.name == ingredient.name) then
return
end
end
table.insert(recipe.ingredients, ingredient)
end
end
-- Set an ingredient to a given quantity
function util.set_ingredient(recipe_name, ingredient, quantity)
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
end
end
function set_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing.name == ingredient then
existing.amount = quantity
existing.amount_min = nil
existing.amount_max = nil
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
-- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products
function util.add_product(recipe_name, product)
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)
end
end
function add_product(recipe, product)
if recipe ~= nil then
if recipe.results == nil then
recipe.results = {}
end
table.insert(recipe.results, product)
end
end
-- Get the amount of the ingredient, will check base/normal not expensive
function util.get_ingredient_amount(recipe_name, ingredient_name)
local recipe = data.raw.recipe[recipe_name]
if recipe then
if recipe.ingredients then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == ingredient_name then return ingredient.amount end
end
end
return 1
end
return 0
end
-- Get the amount of the result, will check base/normal not expensive
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.results then
for i, result in pairs(recipe.results) do
if result.name == product then return result.amount end
end
end
return 1
end
return 0
end
-- Replace one ingredient with another in a recipe
-- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true.
function util.replace_ingredient(recipe_name, old, new, amount, multiply)
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount or 1, multiply)
end
end
function replace_ingredient(recipe, old, new, amount, multiply)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing.name == new then
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then
ingredient.name = new
if multiply then
ingredient.amount = amount * ingredient.amount
else
ingredient.amount = amount
end
end
end
end
end
-- Remove an ingredient from a recipe
function util.remove_ingredient(recipe_name, old)
if data.raw.recipe[recipe_name] then
remove_ingredient(data.raw.recipe[recipe_name], old)
end
end
function remove_ingredient(recipe, old)
index = -1
if recipe ~= nil and recipe.ingredients ~= nil then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then
index = i
break
end
end
if index > -1 then
table.remove(recipe.ingredients, index)
end
end
end
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount)
local is_fluid = not not data.raw.fluid[new]
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
end
end
function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing.name == new then
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then
ingredient.amount = math.max(1, ingredient.amount - old_amount)
end
end
add_ingredient(recipe, new, new_amount, is_fluid)
end
end
-- set the amount of a product.
function util.set_product_amount(recipe_name, product, amount)
if data.raw.recipe[recipe_name] then
set_product_amount(data.raw.recipe[recipe_name], product, amount)
end
end
function set_product_amount(recipe, product, amount)
if recipe then
if recipe.result_count then
recipe.result_count = amount
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name == product then
if result.amount then
result.amount = amount
end
if result.amount_min ~= nil then
result.amount_min = nil
result.amount_max = nil
result.amount = amount
end
end
if result[1] == product then
result[2] = amount
end
end
end
if not recipe.results and not recipe.result_count then
-- implicit one item result
recipe.result_count = amount
end
end
end
-- multiply the cost, energy, and results of a recipe by a multiple
function util.multiply_recipe(recipe_name, multiple)
if data.raw.recipe[recipe_name] then
multiply_recipe(data.raw.recipe[recipe_name], multiple)
end
end
function multiply_recipe(recipe, multiple)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required * multiple
end
if recipe.result_count then
recipe.result_count = recipe.result_count * multiple
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name then
if result.amount then
result.amount = result.amount * multiple
end
if result.amount_min ~= nil then
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
end
end
if result[1] then
result[2] = result[2] * multiple
end
end
end
if not recipe.results and not recipe.result_count then
-- implicit one item result
recipe.result_count = multiple
end
if recipe.ingredients then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name then
ingredient.amount = ingredient.amount * multiple
end
if ingredient[1] then
ingredient[2] = ingredient[2] * multiple
end
end
end
end
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)
end
function has_ingredient(recipe, ingredient)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
return true
end
end
end
return false
end
-- Remove a product from a recipe, WILL NOT remove the only product
function util.remove_product(recipe_name, old)
if data.raw.recipe[recipe_name] then
remove_product(data.raw.recipe[recipe_name], old)
end
end
function remove_product(recipe, old)
index = -1
if recipe ~= nil and recipe.results ~= nil then
for i, result in pairs(recipe.results) do
if result.name == old or result[1] == old then
index = i
break
end
end
if index > -1 then
table.remove(recipe.results, index)
end
end
end
function util.set_main_product(recipe_name, product)
if data.raw.recipe[recipe_name] then
set_main_product(data.raw.recipe[recipe_name], product)
end
end
function set_main_product(recipe, product)
if recipe then
recipe.main_product = product
end
end
-- Replace one product with another in a recipe
function util.replace_product(recipe_name, old, new)
if data.raw.recipe[recipe_name] then
replace_product(data.raw.recipe[recipe_name], old, new)
end
end
function replace_product(recipe, old, new)
if recipe then
if recipe.main_product == old then
recipe.main_product = new
end
if recipe.result == old then
recipe.result = new
return
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name == old then result.name = new end
if result[1] == old then result[1] = new end
end
end
end
end
-- Remove an element of type t and name from data.raw
function util.remove_raw(t, name)
if not data.raw[t] then
log(t.." not found in data.raw")
return
end
if data.raw[t][name] then
for i, elem in pairs(data.raw[t]) do
if elem.name == name then
data.raw[t][i] = nil
break
end
end
end
end
-- Set energy required
function util.set_recipe_time(recipe_name, time)
if data.raw.recipe[recipe_name] then
set_recipe_time(data.raw.recipe[recipe_name], time)
end
end
function set_recipe_time(recipe, time)
if recipe then
if recipe.energy_required then
recipe.energy_required = time
end
end
end
-- Multiply energy required
function util.multiply_time(recipe_name, factor)
if data.raw.recipe[recipe_name] then
multiply_time(data.raw.recipe[recipe_name], factor)
end
end
function multiply_time(recipe, factor)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required * factor
end
end
end
-- Add to energy required
function util.add_time(recipe_name, amount)
if data.raw.recipe[recipe_name] then
add_time(data.raw.recipe[recipe_name], amount)
end
end
function add_time(recipe, amount)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required + amount
end
end
end
-- Set recipe category
function util.set_category(recipe_name, category)
if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then
data.raw.recipe[recipe_name].category = category
end
end
-- Set recipe subgroup
function util.set_subgroup(recipe_name, subgroup)
if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe_name].subgroup = subgroup
end
end
-- Set item subgroup
function util.set_item_subgroup(item, subgroup)
if data.raw.item[item] and data.raw["item-subgroup"][subgroup] then
data.raw.item[item].subgroup = subgroup
end
end
function util.add_icon(recipe_name, icon)
if data.raw.recipe[recipe_name] then
if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) 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
table.insert(data.raw.recipe[recipe_name].icons, icon)
end
end
-- Set recipe icons
function util.set_icons(recipe_name, icons)
if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe_name].icons = icons
data.raw.recipe[recipe_name].icon = nil
data.raw.recipe[recipe_name].icon_size = nil
end
end
-- Set recipe icons
function util.set_item_icons(item_name, icons)
if data.raw.item[item_name] then
data.raw.item[item_name].icons = icons
data.raw.item[item_name].icon = nil
data.raw.item[item_name].icon_size = nil
end
end
-- Gets an item or fluid icon
function util.get_item_or_fluid_icon(name)
icon = ""
if data.raw.item[name] then
icon = data.raw.item[name].icon
if not icon then icon = data.raw.item[name].icons[1].icon end
elseif data.raw.fluid[name] then
icon = data.raw.fluid[name].icon
if not icon then icon = data.raw.fluid[name].icons[1].icon end
end
return icon
end
function util.set_to_founding(recipe)
util.set_category(recipe, "founding")
util.set_subgroup(recipe, "foundry-intermediate")
end
-- Add crafting category to an entity
function util.add_crafting_category(entity_type, entity, category)
if data.raw[entity_type][entity] and data.raw["recipe-category"][category] then
for i, existing in pairs(data.raw[entity_type][entity].crafting_categories) do
if existing == category then
return
end
end
table.insert(data.raw[entity_type][entity].crafting_categories, category)
end
end
function util.add_to_ingredient(recipe, ingredient, amount)
if data.raw.recipe[recipe] then
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
end
end
function add_to_ingredient(recipe, it, amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == it then
ingredient.amount = ingredient.amount + amount
return
end
if ingredient[1] == it then
ingredient[2] = ingredient[2] + amount
return
end
end
end
end
function util.add_to_product(recipe_name, product, amount)
if data.raw.recipe[recipe_name] then
add_to_product(data.raw.recipe[recipe_name], product, amount)
end
end
function add_to_product(recipe, product, amount)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == product then
recipe.result_count = recipe.result_count + amount
return
end
for i, result in pairs(recipe.results) do
if result.name == product then
result.amount = result.amount + amount
return
end
if result[1] == product then
result[2] = result[2] + amount
return
end
end
end
end
-- Adds a result to a mineable type
function util.add_minable_result(t, name, result)
if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable then
if data.raw[t][name].minable.result and not data.raw[t][name].minable.results then
data.raw[t][name].minable.results = {
{data.raw[t][name].minable.result ,data.raw[t][name].minable.count}}
data.raw[t][name].minable.result = nil
data.raw[t][name].minable.result_count = nil
end
if data.raw[t][name].minable.results then
table.insert(data.raw[t][name].minable.results, result)
end
end
end
function util.remove_prior_unlocks(tech, recipe)
if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
remove_prior_unlocks(prerequisite, recipe)
end
end
end
function remove_prior_unlocks(tech, recipe)
local technology = data.raw.technology[tech]
if technology then
util.remove_recipe_effect(tech, recipe)
if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
remove_prior_unlocks(prerequisite, recipe)
end
end
end
end
function util.replace_ingredients_prior_to(tech, old, new, multiplier)
if not data.raw.technology[tech] then
log("Not replacing ingredient "..old.." with "..new.." because tech "..tech.." was not found")
return
end
util.remove_prior_unlocks(tech, old)
for i, recipe in pairs(data.raw.recipe) do
if (recipe.enabled and recipe.enabled ~= 'false')
and (not recipe.hidden or recipe.hidden == 'true') -- probably don't want to change hidden recipes
and string.sub(recipe.name, 1, 3) ~= 'se-' -- have to exlude SE in general :(
then
-- log("BZZZ due to 'enabled' replacing " .. old .. " with " .. new .." in " .. recipe.name) -- Handy Debug :|
util.replace_ingredient(recipe.name, old, new, multiplier, true)
end
end
if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end
end
end
function replace_ingredients_prior_to(tech, old, new, multiplier)
local technology = data.raw.technology[tech]
if technology then
if technology.effects then
for i, effect in pairs(technology.effects) do
if effect.type == "unlock-recipe" then
-- log("BZZZ replacing " .. old .. " with " .. new .." in " .. effect.recipe) -- Handy Debug :|
util.replace_ingredient(effect.recipe, old, new, multiplier, true)
end
end
end
if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end
end
end
end
function util.remove_all_recipe_effects(recipe_name)
for name, _ in pairs(data.raw.technology) do
util.remove_recipe_effect(name, recipe_name)
end
end
function util.add_unlock_force(technology_name, recipe)
util.set_enabled(recipe, false)
util.remove_all_recipe_effects(recipe)
util.add_unlock(technology_name, recipe)
end
-- sum the products of a recipe
function util.sum_products(recipe_name)
-- this is going to end up approximate in some cases, integer division is probs fine
if data.raw.recipe[recipe_name] then
local recipe = data.raw.recipe[recipe_name]
if not recipe.results then return recipe.result_count end
local sum = 0
for i, result in pairs(recipe.results) do
local amt = 0
if result[2] then amt = result[2]
elseif result.amount then amt = result.amount
elseif result.amount_min then amt = (result.amount_min + result.amount_max)/2
end
if result.probability then amt = amt * result.probability end
sum = sum + amt
end
return sum
end
return 0
end
function util.add_productivity(recipe)
data.raw.recipe[recipe].allow_productivity = true
end
return util

2
Nylon2/data.lua Normal file
View file

@ -0,0 +1,2 @@
require("prototypes.recipes")
require("prototypes.technology")

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

24
Nylon2/info.json Normal file
View file

@ -0,0 +1,24 @@
{
"name": "Nylon2",
"version": "2.0.0",
"factorio_version": "2.0",
"title": "Nylon",
"author": "Timeken, cackling fiend",
"homepage": "https://discord.gg/ufvFUJtVwk",
"dependencies": [
"base >= 2.0.0",
"? 248k-Redux",
"? aai-industry",
"? bobassembly",
"? BrimStuff-Updated",
"? bzcarbon",
"? bzchlorine",
"? bzgas",
"? Cobalt2",
"? IfNickel-Updated",
"? Limestone2",
"? Krastorio2",
"? space-exploration"
],
"description": "This mod adds nylon and some chemical intermediates. \n\nThis mod is inspired by Brevven's BZ mods."
}

View file

@ -0,0 +1,65 @@
[technology-name]
nylon-processing=Nylon processing
synthetic-graphite=Synthetic graphite
organic-chemistry=Organic chemistry
nylon-drive-belt=Nylon drive belt
[technology-description]
[autoplace-control-names]
[item-name]
adipic-acid=Adipic acid
nylon=Nylon
cobalt-ore=Cobalt ore
cobalt-plate=Cobalt plate
nylon-machine-parts=Nylon machine parts
raw-graphite=Raw graphite
coke-powder=Coke powder
povidone=Povidone
[item-description]
povidone=Polyvinylpyrrolidone
[fluid-name]
ketone-alcohol-oil=Ketone alcohol oil
hexamethylenediamine=Hexamethylenediamine
coal-tar=Coal tar
ethylene-oxide=Ethylene oxide
acetic-acid=Acetic acid
vinyl-acetate=Vinyl acetate
ethanolamine=Ethanolamine
ethylene-glycol=Ethylene glycol
[fluid-description]
ketone-alcohol-oil=Cyclohexanone
ethylene-glycol=Used to make antifreeze
[entity-name]
[mod-setting-name]
[mod-setting-description]
[recipe-name]
ketone-alcohol-oil=Ketone-alcohol oil
hexamethylenediamine=Hexamethylenediamine
destructive-distillation=Destructive distillation
adipic-acid=Adipic acid
nylon=Nylon
raw-graphite=Raw graphite
synthetic-graphite=Synthetic graphite
coke-powder=Coke powder
bio-nitric-acid=Bio nitric acid
ethylene-oxide=Ethylene oxide
acetic-acid=Acetic acid
vinyl-acetate=Vinyl acetate
ethanolamine=Ethanolamine
povidone=Povidone
povidone-lubricant=Povidone lubricant
ethanolamine-air-scrubbing=Ethanolamine air scrubbing
ethylene-glycol=Ethylene glycol
solid-fuel-coal-tar=Solid fuel coal tar
nylon-drive-belt=Nylon drive belt
[recipe-description]

View file

@ -0,0 +1,565 @@
local util = require("data-util")
if mods["space-exploration"] then
data:extend({{
type = "item-subgroup",
name = "chemical",
group = "resources",
order = "a"
}})
else
data:extend({{
type = "item-subgroup",
name = "chemical",
group = "intermediate-products",
order = "a"
}})
end
local ketone_alcohol_oil_ingredients = {{type="item", name="coal", amount = 5}, (data.raw.fluid["hydrogen"] and { type = "fluid", name = "hydrogen", amount = 10 }) or ({ type = "fluid", name = "water", amount = 10 }), (data.raw.item["cobalt-plate"] and {type="item", name="cobalt-plate", amount = 1}) or {type="item", name="iron-plate", amount=1}}
if mods["bzgas"] then
ketone_alcohol_oil_ingredients = {{type="item", name="phenol", amount = 5}, (data.raw.item["cobalt-plate"] and {type="item", name="cobalt-plate", amount = 1}) or {type="item", name="iron-plate", amount=1}}
if data.raw.fluid["hydrogen"] then
table.insert(ketone_alcohol_oil_ingredients, { type = "fluid", name = "hydrogen", amount = 10 })
end
end
local fuel_refining_category = "chemistry"
local fuel_refining_subgroup = "chemical"
if mods["space-exploration"] then
fuel_refining_category = "fuel-refining"
fuel_refining_subgroup = "fuel"
end
data:extend({
{
type = "fluid",
name = "ketone-alcohol-oil",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/ketone-alcohol-oil.png",
icon_size = 64, icon_mipmaps = 4,
order = "k"
},
{
type = "recipe",
name = "ketone-alcohol-oil",
icon = "__Nylon2__/graphics/icons/ketone-alcohol-oil.png",
icon_size = 64,
main_porduct = "ketone-alcohol-oil",
category = "chemistry",
order = "k",
enabled = false,
energy_required = 5,
ingredients = ketone_alcohol_oil_ingredients,
subgroup = "chemical",
results = {{ type = "fluid", name = "ketone-alcohol-oil", amount = 30 }, (data.raw.item["cobalt-plate"] and {type = "item", name ="cobalt-plate", amount=1, probability=0.4}) or {type = "item", name ="iron-plate", amount=1, probability=0.4}},
},
{
type = "fluid",
name = "ethylene-oxide",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/ethylene-oxide.png",
icon_size = 128, icon_mipmaps = 4,
order = "c"
},
{
type = "fluid",
name = "acetic-acid",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/acetic-acid.png",
icon_size = 128, icon_mipmaps = 4,
order = "c"
},
{
type = "fluid",
name = "vinyl-acetate",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/vinyl-acetate.png",
icon_size = 128, icon_mipmaps = 4,
order = "v"
},
{
type = "fluid",
name = "ethanolamine",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/ethanolamine.png",
icon_size = 128, icon_mipmaps = 4,
order = "v"
},
{
type = "item",
name = "povidone",
icon = "__Nylon2__/graphics/icons/povidone.png",
icon_size = 128,
subgroup = "chemical",
order = "p",
stack_size = 100,
},
{
type = "fluid",
name = "ethylene-glycol",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/ethylene-glycol.png",
icon_size = 128, icon_mipmaps = 4,
order = "e"
},
{
type = "recipe",
name = "ethylene-oxide",
icon = "__Nylon2__/graphics/icons/ethylene-oxide.png",
icon_size = 128,
main_porduct = "ethylene-oxide",
category = "chemistry",
subgroup = "chemical",
order = "n",
enabled = false,
energy_required = 30,
ingredients = {(data.raw.fluid["biomethanol"] and { type = "fluid", name = "biomethanol", amount = 50 }) or { type = "fluid", name = "light-oil", amount = 50 }, (data.raw.fluid["chlorine"] and { type = "fluid", name = "chlorine", amount = 50 }) or { type = "fluid", name = "water", amount = 50 }},
results = {{ type = "fluid", name = "ethylene-oxide", amount = 50 }, { type = "fluid", name = "acetic-acid", amount = 50 }},
}
})
local vinyl_acetate_ingredients = {{ type = "fluid", name = "acetic-acid", amount = 25 },(data.raw.fluid["oxygen"] and { type = "fluid", name = "oxygen", amount = 25 }) or { type = "fluid", name = "water", amount = 25 }}
if data.raw.item["palladium-plate"] then
table.insert(vinyl_acetate_ingredients, {type="item", name="palladium-plate", amount=1})
end
local vinyl_acetate_results = {{ type = "fluid", name = "vinyl-acetate", amount = 50 }}
if data.raw.item["palladium-plate"] then
table.insert(vinyl_acetate_results, {type = "item", name ="palladium-plate", amount=1, probability=0.8})
end
data:extend({
{
type = "recipe",
name = "vinyl-acetate",
icon = "__Nylon2__/graphics/icons/vinyl-acetate.png",
icon_size = 128,
main_porduct = "vinyl-acetate",
category = "chemistry",
subgroup = "chemical",
order = "v",
enabled = false,
energy_required = 5,
ingredients = vinyl_acetate_ingredients,
results = vinyl_acetate_results,
},
{
type = "recipe",
name = "povidone",
icon = "__Nylon2__/graphics/icons/povidone.png",
icon_size = 128,
category = "chemistry",
subgroup = "chemical",
order = "p",
enabled = false,
energy_required = 5,
ingredients = {{ type = "fluid", name = "vinyl-acetate", amount = 25 }},
results = {{type="item", name="povidone", amount=10}},
},
{
type = "recipe",
name = "povidone-lubricant",
icons = {
{ icon = "__base__/graphics/icons/fluid/lubricant.png", icon_size = 64},
{ icon = "__Nylon2__/graphics/icons/povidone.png", icon_size = 128, scale=0.125, shift= {-8, -8}},
},
category = "chemistry",
subgroup = "chemical",
order = "p",
enabled = false,
energy_required = 3,
ingredients = {{ type = "fluid", name = "water", amount = 10 }, {type="item", name="povidone", amount=2}},
results = {{ type = "fluid", name = "lubricant", amount = 10 }},
},
{
type = "recipe",
name = "ethanolamine",
icon = "__Nylon2__/graphics/icons/ethanolamine.png",
icon_size = 128,
category = "chemistry",
subgroup = "chemical",
order = "e",
enabled = false,
energy_required = 4,
ingredients = {{ type = "fluid", name = "ethylene-oxide", amount = 10 }, (data.raw.fluid["ammonia"] and { type = "fluid", name = "ammonia", amount = 10 }) or { type = "fluid", name = "water", amount = 10 }},
results = {{ type = "fluid", name = "ethanolamine", amount = 20 }},
},
{
type = "recipe",
name = "ethanolamine-air-scrubbing",
icon = "__Nylon2__/graphics/icons/ethanolamine-air-scrubbing.png",
icon_size = 128,
main_porduct = "coal",
category = "chemistry",
subgroup = "chemical",
order = "e",
enabled = false,
energy_required = 30,
ingredients = {{ type = "fluid", name = "ethanolamine", amount = 10 }},
results = {{type="item", name="coal", amount=5}, {type = "item", name ="sulfur", amount=1, probability=0.05}},
},
{
type = "recipe",
name = "ethylene-glycol",
icon = "__Nylon2__/graphics/icons/ethylene-glycol.png",
icon_size = 128,
category = "chemistry",
subgroup = "chemical",
order = "e",
enabled = false,
energy_required = 6,
ingredients = {{ type = "fluid", name = "water", amount = 25 }, { type = "fluid", name = "ethylene-oxide", amount = 25 }},
results = {{ type = "fluid", name = "ethylene-glycol", amount = 50 }},
},
{
type = "recipe",
name = "solid-fuel-coal-tar",
icons = {
{ icon = "__base__/graphics/icons/solid-fuel.png", icon_size = 64},
{ icon = "__Nylon2__/graphics/icons/coal-tar.png", icon_size = 64, scale=0.3, shift= {-8, -8}},
},
category = fuel_refining_category,
subgroup = fuel_refining_subgroup,
order = "b[fluid-chemistry]-e[solid-fuel]",
enabled = false,
energy_required = 1,
ingredients = {{ type = "fluid", name = "coal-tar", amount = 20 }},
results = {{type="item", name="solid-fuel", amount=1}},
},
{
type = "item",
name = "adipic-acid",
icon = "__Nylon2__/graphics/icons/adipic-acid.png",
icon_size = 64,
subgroup = "chemical",
order = "a",
stack_size = 100,
}
})
local adipic_acid_ingredients = {{ type = "fluid", name = "ketone-alcohol-oil", amount = 10 }}
if data.raw.fluid["kr-nitric-acid"] then
table.insert(adipic_acid_ingredients, { type = "fluid", name = "kr-nitric-acid", amount = 10 })
end
local adipic_acid_results = {{type="item", name="adipic-acid", amount=5}}
if data.raw.fluid["depleted-acid"] then
table.insert({ type = "fluid", name = "depleted-acid", amount = 10 })
end
local hexamethylenediamine_ingredients = {{ type = "fluid", name = "petroleum-gas", amount = 10 }, (data.raw.item["cobalt-plate"] and {type="item", name="cobalt-plate", amount = 1}) or {type="item", name="iron-plate", amount=1}}
if data.raw.fluid["ammonia"] then
table.insert(hexamethylenediamine_ingredients, { type = "fluid", name = "ammonia", amount = 10 })
end
local hexamethylenediamine_results = {{ type = "fluid", name = "hexamethylenediamine", amount = 10 }, (data.raw.item["cobalt-plate"] and {type = "item", name ="cobalt-plate", amount=1, probability=0.4}) or {type = "item", name ="iron-plate", amount=1, probability=0.4}}
if data.raw.fluid["chemical-waste"] then
table.insert(hexamethylenediamine_results, { type = "fluid", name = "chemical-waste", amount = 10 })
end
local destructive_distillation_ingredients = {{type="item", name="coal", amount=10}}
if data.raw.item["phenol"] then
table.insert(destructive_distillation_ingredients, {type="item", name="phenol", amount=5})
end
local destructive_distillation_results = {{ type = "fluid", name = "coal-tar", amount = 20 }}
if data.raw.fluid["ammonia"] then
table.insert(destructive_distillation_results, { type = "fluid", name = "ammonia", amount = 10 })
end
if data.raw.item["kr-coke"] then
table.insert(destructive_distillation_results, {type="item", name="kr-coke", amount=7})
end
data:extend({
{
type = "recipe",
name = "adipic-acid",
icon = "__Nylon2__/graphics/icons/adipic-acid.png",
icon_size = 64,
main_porduct = "adipic-acid",
category = "chemistry",
subgroup = "chemical",
order = "a",
enabled = false,
energy_required = 10,
ingredients = adipic_acid_ingredients,
results = adipic_acid_results,
},
{
type = "fluid",
name = "hexamethylenediamine",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/hexamethylenediamine.png",
icon_size = 64, icon_mipmaps = 4,
order = "h"
},
{
type = "recipe",
name = "hexamethylenediamine",
icon = "__Nylon2__/graphics/icons/hexamethylenediamine.png",
icon_size = 64,
main_porduct = "hexamethylenediamine",
category = "chemistry",
subgroup = "chemical",
order = "h",
enabled = false,
energy_required = 5,
ingredients = hexamethylenediamine_ingredients,
results = hexamethylenediamine_results,
},
{
type = "fluid",
name = "coal-tar",
default_temperature = 25,
max_temperature = 100,
auto_barrel = true,
base_color = { r = 0.50, g = 0.50, b = 0.50 },
flow_color = { r = 0.50, g = 0.50, b = 0.50 },
gas_temperature = 25,
icon = "__Nylon2__/graphics/icons/coal-tar.png",
icon_size = 64, icon_mipmaps = 4,
order = "c"
},
{
type = "recipe",
name = "destructive-distillation",
icon = "__Nylon2__/graphics/icons/destructive-distillation.png",
icon_size = 64,
main_porduct = "ammonia",
category = "chemistry",
subgroup = "chemical",
order = "a",
enabled = false,
energy_required = 12,
ingredients = destructive_distillation_ingredients,
results = destructive_distillation_results,
}
})
util.add_productivity("destructive-distillation")
if mods["Krastorio2"] then
local bio_nitric_acid_ingredients = {{ type = "fluid", name = "coal-tar", amount = 10 }, { type = "fluid", name = "water", amount = 10 }, {type="item", name="wood", 10}}
if data.raw.item["limestone"] then
table.insert(bio_nitric_acid_ingredients, {type="item", name="limestone", amount=4})
end
data:extend({
{
type = "recipe",
name = "bio-nitric-acid",
icons = {
{ icon = "__Krastorio2Assets__/icons/fluids/nitric-acid.png", icon_size = 64},
{ icon = "__base__/graphics/icons/wood.png", icon_size = 64, scale=0.3, shift= {-8, -8}},
},
main_porduct = "kr-nitric-acid",
category = "chemistry",
subgroup = "chemical",
order = "n",
enabled = false,
energy_required = 12,
ingredients = bio_nitric_acid_ingredients,
results = {{ type = "fluid", name = "kr-nitric-acid", amount = 10 }},
}
})
if mods["bzchlorine"] then
local ethylene_oxide_epoxy_ingredients = {{ type = "fluid", name = "ethylene-oxide", amount = 10 }}
if mods["Limestone2"] then
table.insert(ethylene_oxide_epoxy_ingredients, {type="item", name="quicklime", amount=4})
end
data:extend({
{
type = "recipe",
name = "ethylene-oxide-epoxy",
icons = {
{ icon = "__bzchlorine__/graphics/icons/epoxy.png", icon_size = 128},
{ icon = "__Nylon2__/graphics/icons/ethylene-oxide.png", icon_size = 128, scale=0.125, shift= {-8, -8}},
},
category = "chemistry",
subgroup = "chemical",
order = "e",
enabled = false,
energy_required = 3,
ingredients = ethylene_oxide_epoxy_ingredients,
results = {{ type = "fluid", name = "epoxy", amount = 10 }},
}
})
end
util.add_productivity("bio-nitric-acid")
end
if mods["bzcarbon"] and mods["Krastorio2"] then
data:extend({
{
type = "item",
name = "raw-graphite",
icon = "__Nylon2__/graphics/icons/raw-graphite.png",
icon_size = 128,
subgroup = "intermediate-product",
order = "c",
stack_size = 100,
},
{
type = "recipe",
name = "raw-graphite",
icon = "__Nylon2__/graphics/icons/raw-graphite.png",
icon_size = 128,
category = "chemistry",
subgroup = "chemical",
order = "r",
enabled = false,
energy_required = 10,
ingredients = {{ type = "fluid", name = "coal-tar", amount = 20 }, {type="item", name="coke-powder", amount=10}},
results = {{type="item", name="raw-graphite", amount=5}},
},
{
type = "recipe",
name = "synthetic-graphite",
category = "smelting",
order = "d[graphite]",
icons = (mods["Krastorio2"] and
{
{ icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128},
{ icon = "__Nylon2__/graphics/icons/raw-graphite.png", icon_size = 128, scale=0.125, shift= {-8, -8}},
} or {
{ icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128},
}),
enabled = false,
energy_required = 12,
ingredients = {{type="item", name="raw-graphite", amount=10}},
results = {
{type="item", name = "graphite", amount=10}
}
},
{
type = "item",
name = "coke-powder",
icon = "__Nylon2__/graphics/icons/coke-powder.png",
icon_size = 64,
subgroup = "intermediate-product",
order = "c",
stack_size = 100,
},
{
type = "recipe",
name = "coke-powder",
category = "crushing",
order = "l",
enabled = false,
energy_required = 4,
ingredients = {{type="item", name="kr-coke", amount=10}},
results = {{type="item", name="coke-powder", amount=10}},
}
})
util.add_productivity("coke-powder")
util.add_productivity("raw-graphite")
util.add_productivity("synthetic-graphite")
end
local nylon_results = {{type="item", name="nylon", amount=10}}
if data.raw.fluid["chemical-waste"] then
table.insert(nylon_results, { type = "fluid", name = "chemical-waste", amount = 10 })
end
data:extend({
{
type = "item",
name = "nylon",
icon = "__Nylon2__/graphics/icons/nylon.png",
icon_size = 64,
subgroup = "chemical",
order = "n",
stack_size = 100,
},
{
type = "item",
name = "nylon-machine-parts",
icon = "__Nylon2__/graphics/icons/nylon-machine-parts.png",
icon_size = 64,
subgroup = "intermediate-product",
order = "c",
stack_size = 100,
},
{
type = "recipe",
name = "nylon",
icon = "__Nylon2__/graphics/icons/nylon.png",
icon_size = 64,
main_porduct = "nylon",
category = "chemistry",
subgroup = "chemical",
order = "h",
enabled = false,
energy_required = 5,
ingredients = {{type="item", name="adipic-acid", amount=10}, { type = "fluid", name = "hexamethylenediamine", amount = 10 }},
results = nylon_results,
},
{
type = "recipe",
name = "nylon-machine-parts",
category = "crafting",
order = "c",
enabled = false,
energy_required = 2,
ingredients = {{type="item", name="nylon", amount=2}},
results = {{type="item", name="nylon-machine-parts", amount=1}},
}
})
if mods["BrimStuff-Updated"] then
data:extend({
{
type = "recipe",
name = "nylon-drive-belt",
icons = {
{ icon = "__BrimStuff-Updated__/graphics/icons/drive-belt.png", icon_size = 64},
{ icon = "__Nylon2__/graphics/icons/nylon-machine-parts.png", icon_size = 64, scale=0.3, shift= {-8, -8}},
},
category = "crafting",
subgroup = "intermediate-product",
order = "d",
enabled = false,
energy_required = 2,
ingredients = {{type="item", name="nylon", amount=2},{type="item", name="nylon-machine-parts", amount=2},{type="item", name="low-density-structure", amount=1}},
results = {{type="item", name="drive-belt", amount=8}},
}
})
end
util.add_productivity("ketone-alcohol-oil")
util.add_productivity("adipic-acid")
util.add_productivity("hexamethylenediamine")
util.add_productivity("nylon")
util.add_productivity("nylon-machine-parts")

View file

@ -0,0 +1,163 @@
local util = require("data-util")
local nylonPrerqu = {"oil-processing"}
local orgChemPrerqu = {"oil-processing"}
if mods["Cobalt2"] then
nylonPrerqu = {"cobalt-refining", "oil-processing"}
end
if mods["Krastorio2"] then
orgChemPrerqu = {"kr-advanced-chemistry"}
end
data:extend({
{
type = "technology",
name = "nylon-processing",
icons = {{ icon = "__Nylon2__/graphics/icons/nylon.png", icon_size = 64 }},
prerequisites = nylonPrerqu,
effects = {
{
type = "unlock-recipe",
recipe = "ketone-alcohol-oil",
},
{
type = "unlock-recipe",
recipe = "adipic-acid",
},
{
type = "unlock-recipe",
recipe = "hexamethylenediamine",
},
{
type = "unlock-recipe",
recipe = "nylon",
},
{
type = "unlock-recipe",
recipe = "nylon-machine-parts",
}
},
unit =
{
count = 75,
ingredients =
{
{ "automation-science-pack", 1 },
{ "logistic-science-pack", 1 }
},
time = 30
}
},
{
type = "technology",
name = "organic-chemistry",
icons = {{ icon = "__Nylon2__/graphics/icons/ethylene-oxide.png", icon_size = 128 }},
prerequisites = orgChemPrerqu,
effects = {
{
type = "unlock-recipe",
recipe = "ethylene-oxide",
},
{
type = "unlock-recipe",
recipe = "vinyl-acetate",
},
{
type = "unlock-recipe",
recipe = "povidone",
},
{
type = "unlock-recipe",
recipe = "povidone-lubricant",
},
{
type = "unlock-recipe",
recipe = "ethanolamine",
},
{
type = "unlock-recipe",
recipe = "ethanolamine-air-scrubbing",
}
},
unit =
{
count = 100,
ingredients =
{
{ "automation-science-pack", 1 },
{ "logistic-science-pack", 1 },
{ "chemical-science-pack", 1 }
},
time = 30
}
}
})
util.add_prerequisite("logistics-2","nylon-processing")
if mods["bzcarbon"] and mods["Krastorio2"] then
data:extend(
{
{
type = "technology",
name = "synthetic-graphite",
icons = {{ icon = "__Nylon2__/graphics/icons/raw-graphite.png", icon_size = 128 }},
prerequisites = {"nylon-processing"},
effects = {
{
type = "unlock-recipe",
recipe = "raw-graphite",
},
{
type = "unlock-recipe",
recipe = "coke-powder",
},
{
type = "unlock-recipe",
recipe = "synthetic-graphite",
}
},
unit =
{
count = 50,
ingredients =
{
{ "automation-science-pack", 1 },
{ "logistic-science-pack", 1 }
},
time = 30
}
}
})
end
if mods["BrimStuff-Updated"] then
data:extend(
{
{
type = "technology",
name = "nylon-drive-belt",
icons = {
{ icon = "__BrimStuff-Updated__/graphics/icons/drive-belt.png", icon_size = 64},
{ icon = "__Nylon2__/graphics/icons/nylon-machine-parts.png", icon_size = 64, scale=0.3, shift= {-8, -8}},
},
prerequisites = {"nylon-processing"},
effects = {
{
type = "unlock-recipe",
recipe = "nylon-drive-belt",
}
},
unit =
{
count = 100,
ingredients =
{
{ "automation-science-pack", 1 },
{ "logistic-science-pack", 1 },
{ "chemical-science-pack", 1 }
},
time = 30
}
}
})
end

View file

@ -0,0 +1,3 @@
local util = require("data-util")
util.remove_ingredient("fast-transport-belt","rubber")

64
Nylon2/recipe-modify.lua Normal file
View file

@ -0,0 +1,64 @@
local util = require("data-util")
-- Main vanilla changes
util.replace_ingredient("construction-robot", "iron-gear-wheel", "nylon-machine-parts", 2)
-- Mod changes
util.add_ingredient("fast-transport-belt","nylon", 1)
if mods["aai-industry"] then
util.replace_ingredient("stack-filter-inserter", "steel-gear-wheel", "nylon-machine-parts", 3)
end
if mods["bobassembly"] then
util.replace_ingredient("electronics-machine-2", "steel-gear-wheel", "nylon-machine-parts", 8)
end
if mods["space-exploration"] then
se_delivery_cannon_recipes["hexamethylenediamine-barrel"] = {name= "hexamethylenediamine-barrel"}
se_delivery_cannon_recipes["ethanolamine-barrel"] = {name= "ethanolamine-barrel"}
se_delivery_cannon_recipes["ethylene-glycol-barrel"] = {name= "ethylene-glycol-barrel"}
se_delivery_cannon_recipes["ethylene-oxide-barrel"] = {name= "ethylene-oxide-barrel"}
se_delivery_cannon_recipes["vinyl-acetate-barrel"] = {name= "vinyl-acetate-barrel"}
se_delivery_cannon_recipes["coal-tar-barrel"] = {name= "coal-tar-barrel"}
se_delivery_cannon_recipes["ketone-alcohol-oil-barrel"] = {name= "ketone-alcohol-oil-barrel"}
util.set_ingredient("se-vitamelange-spice","se-vitamelange-bloom", 100)
util.add_ingredient("se-vitamelange-spice", "ethanolamine", 100)
util.add_ingredient("se-chemical-gel","povidone", 2)
util.remove_ingredient("se-chemical-gel","toluene")
if mods["Krastorio2"] then
util.add_ingredient("se-space-coolant","ethylene-glycol", 5)
util.remove_ingredient("se-space-coolant","salt")
util.add_unlock("se-space-radiator-1","ethylene-glycol")
end
end
if mods["Krastorio2"] or (mods["bzcarbon"] and mods["bzgas"]) then
util.add_unlock("nylon-processing","destructive-distillation")
end
if mods["Krastorio2"] then
util.add_unlock("nylon-processing","bio-nitric-acid")
util.add_unlock("kr-fuel","solid-fuel-coal-tar")
util.replace_ingredient("kr-advanced-lab", "copper-cable", "nylon-machine-parts", 10)
if mods["bzchlorine"] then
util.add_unlock("organic-chemistry","ethylene-oxide-epoxy")
end
end
if mods["IfNickel-Updated"] then
if data.raw.item["cooling-fan"] then
util.replace_ingredient("cooling-fan", "plastic-bar", "nylon", 3)
end
end
if mods["248k-Redux"] then
util.remove_ingredient("fi_fiberer_recipe", "iron-gear-wheel")
util.add_ingredient("fi_fiberer_recipe", "nylon-machine-parts", 30)
util.remove_ingredient("fi_compound_machine_recipe", "iron-gear-wheel")
util.add_ingredient("fi_compound_machine_recipe", "nylon-machine-parts", 30)
end

BIN
Nylon2/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

@ -1,2 +1,5 @@
# Nylon2 # Nylon
Updated for Factorio 2.0.
Original mod: https://mods.factorio.com/mod/Nylon