compatible with K2, SE
This commit is contained in:
parent
febdfcf058
commit
2f8d74c655
6 changed files with 143 additions and 28 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "bzsilicon",
|
"name": "bzsilicon",
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"factorio_version": "1.1",
|
"factorio_version": "1.1",
|
||||||
"title": "Silica & Silicon",
|
"title": "Silica & Silicon",
|
||||||
"author": "Brevven",
|
"author": "Brevven",
|
||||||
"contact": "",
|
"contact": "",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"? Krastorio2",
|
||||||
"base >= 0.18"
|
"base >= 0.18"
|
||||||
],
|
],
|
||||||
"description": "Adds simple Silica and Silicon to the game, along with basic fiber optics."
|
"description": "Adds simple Silica and Silicon to the game, along with basic fiber optics."
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
-- Optical Fiber
|
-- Optical Fiber
|
||||||
|
local util = require("__bzsilicon__.util");
|
||||||
data:extend(
|
data:extend(
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
@ -8,7 +9,7 @@ data:extend(
|
||||||
icon_size = 32,
|
icon_size = 32,
|
||||||
subgroup = "intermediate-product",
|
subgroup = "intermediate-product",
|
||||||
order = "a[optical-fiber]",
|
order = "a[optical-fiber]",
|
||||||
stack_size = 200
|
stack_size = util.get_stack_size(200)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
|
@ -34,8 +35,8 @@ data:extend(
|
||||||
name = "fiber-optics",
|
name = "fiber-optics",
|
||||||
icons =
|
icons =
|
||||||
{
|
{
|
||||||
{ icon = "__base__/graphics/technology/optics.png", icon_size = 128 },
|
{ icon = "__base__/graphics/technology/optics.png", icon_size = 256 },
|
||||||
{ icon = "__bzsilicon__/graphics/icons/optical-fiber.png", icon_size = 32, scale=1.5, shift={32,-48} },
|
{ icon = "__bzsilicon__/graphics/icons/optical-fiber.png", icon_size = 32, scale=3, shift={32,-48} },
|
||||||
},
|
},
|
||||||
effects =
|
effects =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,17 @@
|
||||||
-- Silica
|
-- Silica
|
||||||
|
local util = require("__bzsilicon__.util");
|
||||||
data:extend(
|
data:extend(
|
||||||
{
|
{
|
||||||
{
|
mods["Krastorio2"] and {
|
||||||
|
type = "recipe",
|
||||||
|
name = "silica",
|
||||||
|
category = "crushing",
|
||||||
|
enabled = false,
|
||||||
|
energy_required = 4,
|
||||||
|
ingredients = {{"quartz", 10}},
|
||||||
|
result = "silica",
|
||||||
|
result_count = 30
|
||||||
|
} or {
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "silica",
|
name = "silica",
|
||||||
category = "smelting",
|
category = "smelting",
|
||||||
|
|
@ -30,9 +40,36 @@ data:extend(
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
subgroup = "raw-material",
|
subgroup = "raw-material",
|
||||||
order = "b[silica]",
|
order = "b[silica]",
|
||||||
stack_size = 100
|
stack_size = util.get_stack_size(100)
|
||||||
|
},
|
||||||
|
mods["Krastorio2"] and {
|
||||||
|
type = "technology",
|
||||||
|
name = "silica-processing",
|
||||||
|
icon_size = 128,
|
||||||
|
icon = "__bzsilicon__/graphics/icons/silica-processing.png",
|
||||||
|
effects =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
type = "unlock-recipe",
|
||||||
|
recipe = "silica"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
type = "unlock-recipe",
|
||||||
|
recipe = "quartz"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prerequisites = {"kr-fluids-chemistry"},
|
||||||
|
unit =
|
||||||
|
{
|
||||||
|
count = 10,
|
||||||
|
ingredients =
|
||||||
|
{
|
||||||
|
{"automation-science-pack", 1},
|
||||||
|
},
|
||||||
|
time = 30
|
||||||
|
},
|
||||||
|
order = "b-b"
|
||||||
|
} or {
|
||||||
type = "technology",
|
type = "technology",
|
||||||
name = "silica-processing",
|
name = "silica-processing",
|
||||||
icon_size = 128,
|
icon_size = 128,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,24 @@
|
||||||
-- Silicon
|
-- Silicon
|
||||||
|
local util = require("__bzsilicon__.util");
|
||||||
|
if mods["Krastorio2"] then
|
||||||
|
util.remove_raw("recipe", "silicon-2")
|
||||||
|
end
|
||||||
|
|
||||||
data:extend(
|
data:extend(
|
||||||
{
|
{
|
||||||
{
|
mods["Krastorio2"] and {
|
||||||
|
type = "recipe",
|
||||||
|
name = "silicon",
|
||||||
|
category = "smelting",
|
||||||
|
enabled = false,
|
||||||
|
energy_required = 14.4,
|
||||||
|
ingredients = {
|
||||||
|
{"silica", 18},
|
||||||
|
{"coke", 1}
|
||||||
|
},
|
||||||
|
result = "silicon",
|
||||||
|
result_count = 3
|
||||||
|
} or {
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
name = "silicon",
|
name = "silicon",
|
||||||
category = "smelting",
|
category = "smelting",
|
||||||
|
|
@ -30,8 +47,9 @@ data:extend(
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
subgroup = "raw-material",
|
subgroup = "raw-material",
|
||||||
order = "b[silicon]",
|
order = "b[silicon]",
|
||||||
stack_size = 100
|
stack_size = util.get_stack_size(100)
|
||||||
},
|
},
|
||||||
|
(not mods["Krastorio2"]) and
|
||||||
{
|
{
|
||||||
type = "technology",
|
type = "technology",
|
||||||
name = "silicon-processing",
|
name = "silicon-processing",
|
||||||
|
|
@ -56,6 +74,6 @@ data:extend(
|
||||||
},
|
},
|
||||||
prerequisites = {"silica-processing"},
|
prerequisites = {"silica-processing"},
|
||||||
order = "b-b"
|
order = "b-b"
|
||||||
},
|
} or nil,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
local util = require("__bzsilicon__.util");
|
local util = require("__bzsilicon__.util");
|
||||||
|
|
||||||
|
if not mods["Krastorio2"] then
|
||||||
util.remove_ingredient("concrete", "stone-brick");
|
util.remove_ingredient("concrete", "stone-brick");
|
||||||
util.add_ingredient("concrete", "silica", 25);
|
util.add_ingredient("concrete", "silica", 25);
|
||||||
util.add_prerequisite("concrete", "silica-processing")
|
util.add_prerequisite("concrete", "silica-processing")
|
||||||
|
|
||||||
util.replace_some_ingredient("processing-unit", "electronic-circuit", "silicon", 10)
|
util.replace_some_ingredient("processing-unit", "electronic-circuit", "silicon", 10)
|
||||||
util.add_prerequisite("advanced-electronics-2", "silicon-processing")
|
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", "silicon", 10)
|
||||||
util.add_prerequisite("solar-energy", "silicon-processing")
|
util.add_prerequisite("solar-energy", "silicon-processing")
|
||||||
|
|
@ -13,7 +14,13 @@ util.add_prerequisite("solar-energy", "silicon-processing")
|
||||||
util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon")
|
util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon")
|
||||||
util.replace_ingredient("productivity-module", "electronic-circuit", "silicon")
|
util.replace_ingredient("productivity-module", "electronic-circuit", "silicon")
|
||||||
util.replace_ingredient("speed-module", "electronic-circuit", "silicon")
|
util.replace_ingredient("speed-module", "electronic-circuit", "silicon")
|
||||||
util.add_prerequisite("modules", "silicon-processing")
|
util.add_prerequisite("modules", util.silicon_processing)
|
||||||
|
else
|
||||||
|
util.remove_ingredient("concrete", "stone-brick");
|
||||||
|
if not mods["space-exploration"] then
|
||||||
|
util.add_ingredient("concrete", "sand", 25);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
util.replace_ingredient("beacon", "copper-cable", "optical-fiber")
|
util.replace_ingredient("beacon", "copper-cable", "optical-fiber")
|
||||||
util.add_prerequisite("effect-transmission", "fiber-optics")
|
util.add_prerequisite("effect-transmission", "fiber-optics")
|
||||||
|
|
@ -34,4 +41,29 @@ util.add_ingredient("decider-combinator", "optical-fiber", 1);
|
||||||
util.add_ingredient("programmable-speaker", "optical-fiber", 1);
|
util.add_ingredient("programmable-speaker", "optical-fiber", 1);
|
||||||
|
|
||||||
util.add_prerequisite("circuit-network", "fiber-optics")
|
util.add_prerequisite("circuit-network", "fiber-optics")
|
||||||
util.add_prerequisite("circuit-network", "silicon-processing")
|
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)
|
||||||
|
end
|
||||||
|
|
||||||
|
if mods["aai-signal-transimission"] then
|
||||||
|
util.add_ingredient("aai-signal-receiver", "optical-fiber", 2)
|
||||||
|
util.add_ingredient("aai-signal-sender", "optical-fiber", 2)
|
||||||
|
end
|
||||||
|
if mods["aai-industry"] then
|
||||||
|
util.add_ingredient("beacon", "optical-fiber", 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
if mods["space-exploration"] then
|
||||||
|
util.add_ingredient("se-space-astrometrics-laboratory", "optical-fiber", 10)
|
||||||
|
util.add_ingredient("se-space-gravimetrics-laboratory", "optical-fiber", 10)
|
||||||
|
util.add_ingredient("se-space-laser-laboratory", "optical-fiber", 10)
|
||||||
|
util.add_ingredient("se-space-science-lab", "optical-fiber", 10)
|
||||||
|
util.add_ingredient("se-space-supercomputer-1", "optical-fiber", 100)
|
||||||
|
util.add_ingredient("se-space-supercomputer-2", "optical-fiber", 500)
|
||||||
|
|
||||||
|
util.add_ingredient("se-polarisation-data", "optical-fiber", 1)
|
||||||
|
end
|
||||||
|
|
|
||||||
26
util.lua
26
util.lua
|
|
@ -1,5 +1,25 @@
|
||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
|
util.silicon_processing = mods["Krastorio2"] and "kr-silicon-processing" or "silicon-processing"
|
||||||
|
|
||||||
|
function util.get_stack_size(default)
|
||||||
|
if mods["Krastorio2"] then
|
||||||
|
size = tonumber(krastorio.general.getSafeSettingValue("kr-stack-size"))
|
||||||
|
return size or default
|
||||||
|
end
|
||||||
|
return default
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove an element of type t and name from data.raw
|
||||||
|
function util.remove_raw(t, name)
|
||||||
|
for i, elem in pairs(data.raw[t]) do
|
||||||
|
if elem.name == name then
|
||||||
|
data.raw[t][i] = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Add a prerequisite to a given technology
|
-- Add a prerequisite to a given technology
|
||||||
function util.add_prerequisite(technology_name, prerequisite)
|
function util.add_prerequisite(technology_name, prerequisite)
|
||||||
technology = data.raw.technology[technology_name]
|
technology = data.raw.technology[technology_name]
|
||||||
|
|
@ -8,10 +28,12 @@ end
|
||||||
|
|
||||||
-- Add a given quantity of ingredient to a given recipe
|
-- Add a given quantity of ingredient to a given recipe
|
||||||
function util.add_ingredient(recipe_name, ingredient, quantity)
|
function util.add_ingredient(recipe_name, ingredient, quantity)
|
||||||
|
if data.raw.recipe[recipe_name] then
|
||||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
||||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function add_ingredient(recipe, ingredient, quantity)
|
function add_ingredient(recipe, ingredient, quantity)
|
||||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||||
|
|
@ -21,10 +43,12 @@ end
|
||||||
|
|
||||||
-- Replace one ingredien with another in a recipe
|
-- Replace one ingredien with another in a recipe
|
||||||
function util.replace_ingredient(recipe_name, old, new)
|
function util.replace_ingredient(recipe_name, old, new)
|
||||||
|
if data.raw.recipe[recipe_name] then
|
||||||
replace_ingredient(data.raw.recipe[recipe_name], old, new)
|
replace_ingredient(data.raw.recipe[recipe_name], old, new)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
|
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
|
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function replace_ingredient(recipe, old, new)
|
function replace_ingredient(recipe, old, new)
|
||||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||||
|
|
@ -39,10 +63,12 @@ end
|
||||||
|
|
||||||
-- Remove an ingredient from a recipe
|
-- Remove an ingredient from a recipe
|
||||||
function util.remove_ingredient(recipe_name, old)
|
function util.remove_ingredient(recipe_name, old)
|
||||||
|
if data.raw.recipe[recipe_name] then
|
||||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function remove_ingredient(recipe, old)
|
function remove_ingredient(recipe, old)
|
||||||
index = -1
|
index = -1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue