Add (optional) silicon wafer
This commit is contained in:
parent
8a03a3e487
commit
3a821d15bc
8 changed files with 104 additions and 19 deletions
|
|
@ -1,4 +1,9 @@
|
|||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.4.0
|
||||
Date: 2021-02-27
|
||||
Features:
|
||||
- New optional intermediates: Silicon wafer
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.3.7
|
||||
Date: 2021-02-15
|
||||
Changes:
|
||||
|
|
|
|||
BIN
graphics/icons/silicon-wafer.png
Normal file
BIN
graphics/icons/silicon-wafer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bzsilicon",
|
||||
"version": "0.3.7",
|
||||
"version": "0.4.0",
|
||||
"factorio_version": "1.1",
|
||||
"title": "Silica & Silicon",
|
||||
"author": "Brevven",
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
[entity-name]
|
||||
silica=Silica
|
||||
silicon=Silicon
|
||||
silicon-wafer=Silicon wafer
|
||||
optical-fiber=Optical Fiber
|
||||
|
||||
[item-name]
|
||||
silica=Silica
|
||||
silicon=Silicon
|
||||
silicon-wafer=Silicon wafer
|
||||
optical-fiber=Optical Fiber
|
||||
|
||||
[item-description]
|
||||
silica=Can be used directly or processed further.
|
||||
silicon=Needed for various electrical and electronic applications
|
||||
silicon-wafer=Use silicon in circuits
|
||||
optical-fiber=Cable used for fiber optics, including circuit network.
|
||||
|
||||
[technology-name]
|
||||
|
|
@ -27,3 +30,12 @@ fiber-optics=Optical fiber for circuit network
|
|||
silica=__ITEM__silica__
|
||||
silicon=__ITEM__silicon__
|
||||
optical-fiber=__ITEM__optical-fiber__
|
||||
|
||||
|
||||
# Settings
|
||||
|
||||
[mod-setting-name]
|
||||
bzsilicon-more-intermediates=Enable more intermediate recipes such as silicon wafers. More complex production chains.
|
||||
|
||||
[mod-setting-description]
|
||||
bzsilicon-more-intermediates=Optional in vanilla, Krastorio 2, etc. Requried for Bio Industries.
|
||||
|
|
|
|||
|
|
@ -60,8 +60,14 @@ data:extend(
|
|||
{
|
||||
{
|
||||
type = "unlock-recipe",
|
||||
recipe = "silicon"
|
||||
}
|
||||
recipe = "silicon",
|
||||
},
|
||||
util.more_intermediates() and
|
||||
{
|
||||
type = "unlock-recipe",
|
||||
recipe = "silicon-wafer",
|
||||
} or nil,
|
||||
|
||||
},
|
||||
unit =
|
||||
{
|
||||
|
|
@ -78,3 +84,32 @@ data:extend(
|
|||
} or nil,
|
||||
}
|
||||
)
|
||||
if util.more_intermediates() then
|
||||
data:extend({
|
||||
{
|
||||
type = "item",
|
||||
name = "silicon-wafer",
|
||||
icon = "__bzsilicon__/graphics/icons/silicon-wafer.png",
|
||||
icon_size = "64",
|
||||
subgroup = "intermediate-product",
|
||||
stack_size = util.get_stack_size(100),
|
||||
},
|
||||
{
|
||||
type = "recipe",
|
||||
name = "silicon-wafer",
|
||||
category = "crafting-with-fluid",
|
||||
subgroup = "intermediate-product",
|
||||
enabled = false,
|
||||
energy_required = 20,
|
||||
ingredients = (mods["Krastorio2"] and {
|
||||
{type= "item", name="silicon", amount=20},
|
||||
{type= "fluid", name="hydrogen-chloride", amount=50},
|
||||
} or {
|
||||
{type= "item", name="silicon", amount=20},
|
||||
{type= "fluid", name="sulfuric-acid", amount=50},
|
||||
}),
|
||||
result = "silicon-wafer",
|
||||
result_count = 10,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@ if not mods["Krastorio2"] then
|
|||
util.add_ingredient("concrete", "silica", 25);
|
||||
util.add_prerequisite("concrete", "silica-processing")
|
||||
|
||||
util.replace_some_ingredient("processing-unit", "electronic-circuit", "silicon", 10)
|
||||
util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon-wafer", 5)
|
||||
util.add_prerequisite("advanced-electronics-2", util.silicon_processing)
|
||||
|
||||
util.replace_some_ingredient("solar-panel", "electronic-circuit", "silicon", 10)
|
||||
util.replace_some_ingredient("solar-panel", "electronic-circuit", 10, "silicon", 10)
|
||||
util.add_prerequisite("solar-energy", "silicon-processing")
|
||||
|
||||
util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon")
|
||||
util.replace_ingredient("productivity-module", "electronic-circuit", "silicon")
|
||||
util.replace_ingredient("speed-module", "electronic-circuit", "silicon")
|
||||
util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon-wafer")
|
||||
util.replace_ingredient("productivity-module", "electronic-circuit", "silicon-wafer")
|
||||
util.replace_ingredient("speed-module", "electronic-circuit", "silicon-wafer")
|
||||
util.add_prerequisite("modules", util.silicon_processing)
|
||||
else
|
||||
util.add_ingredient("concrete", "silica", 15);
|
||||
|
|
@ -48,9 +48,15 @@ util.add_prerequisite("circuit-network", "fiber-optics")
|
|||
util.add_prerequisite("circuit-network", util.silicon_processing)
|
||||
|
||||
if mods["Krastorio2"] then
|
||||
util.add_prerequisite("kr-silicon-processing", "silica-processing")
|
||||
util.add_ingredient("biusart-lab", "optical-fiber", 10)
|
||||
util.add_ingredient("ai-core", "optical-fiber", 2)
|
||||
|
||||
util.add_prerequisite(util.silicon_processing, "silica-processing")
|
||||
if util.more_intermediates() then
|
||||
util.add_effect(util.silicon_processing, {type = "unlock-recipe", recipe="silicon-wafer"})
|
||||
util.remove_ingredient("electronic-components", "silicon")
|
||||
util.add_ingredient("electronic-components", "silicon-wafer", 1)
|
||||
end
|
||||
end
|
||||
|
||||
if mods["aai-signal-transimission"] then
|
||||
|
|
|
|||
10
settings.lua
Normal file
10
settings.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
data:extend(
|
||||
{
|
||||
{
|
||||
type = "string-setting",
|
||||
name = "bzsilicon-more-intermediates",
|
||||
setting_type = "startup",
|
||||
default_value = "no",
|
||||
allowed_values = {"yes", "no"},
|
||||
},
|
||||
})
|
||||
37
util.lua
37
util.lua
|
|
@ -2,6 +2,17 @@ local util = {}
|
|||
|
||||
util.silicon_processing = mods["Krastorio2"] and "kr-silicon-processing" or "silicon-processing"
|
||||
|
||||
function util.get_setting(name)
|
||||
if settings.startup[name] == nil then
|
||||
return nil
|
||||
end
|
||||
return settings.startup[name].value
|
||||
end
|
||||
|
||||
function util.more_intermediates()
|
||||
return mods["Bio_Industries"] or util.get_setting("bzsilicon-more-intermediates") == "yes"
|
||||
end
|
||||
|
||||
function util.get_stack_size(default)
|
||||
if mods["Krastorio2"] then
|
||||
size = tonumber(krastorio.general.getSafeSettingValue("kr-stack-size"))
|
||||
|
|
@ -92,25 +103,31 @@ end
|
|||
|
||||
|
||||
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
|
||||
function util.replace_some_ingredient(recipe_name, old, new, amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, new, amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount)
|
||||
function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount)
|
||||
end
|
||||
|
||||
function replace_some_ingredient(recipe, old, new, amount)
|
||||
function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
-- For final fixes
|
||||
if ingredient.name == old then
|
||||
ingredient.amount = math.max(1, ingredient.amount - amount)
|
||||
ingredient.amount = math.max(1, ingredient.amount - old_amount)
|
||||
end
|
||||
-- For updates
|
||||
if ingredient[1] == old then
|
||||
ingredient[2] = math.max(1, ingredient[2] - amount)
|
||||
ingredient[2] = math.max(1, ingredient[2] - old_amount)
|
||||
end
|
||||
end
|
||||
add_ingredient(recipe, new, amount)
|
||||
add_ingredient(recipe, new, new_amount)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add an effect to a given technology
|
||||
function util.add_effect(technology_name, effect)
|
||||
technology = data.raw.technology[technology_name]
|
||||
if technology then
|
||||
table.insert(technology.effects, effect)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue