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",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"factorio_version": "1.1",
|
||||
"title": "Silica & Silicon",
|
||||
"author": "Brevven",
|
||||
"contact": "",
|
||||
"homepage": "",
|
||||
"dependencies": [
|
||||
"? Krastorio2",
|
||||
"base >= 0.18"
|
||||
],
|
||||
"description": "Adds simple Silica and Silicon to the game, along with basic fiber optics."
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
-- Optical Fiber
|
||||
local util = require("__bzsilicon__.util");
|
||||
data:extend(
|
||||
{
|
||||
{
|
||||
|
|
@ -8,7 +9,7 @@ data:extend(
|
|||
icon_size = 32,
|
||||
subgroup = "intermediate-product",
|
||||
order = "a[optical-fiber]",
|
||||
stack_size = 200
|
||||
stack_size = util.get_stack_size(200)
|
||||
},
|
||||
{
|
||||
type = "recipe",
|
||||
|
|
@ -34,8 +35,8 @@ data:extend(
|
|||
name = "fiber-optics",
|
||||
icons =
|
||||
{
|
||||
{ icon = "__base__/graphics/technology/optics.png", icon_size = 128 },
|
||||
{ icon = "__bzsilicon__/graphics/icons/optical-fiber.png", icon_size = 32, scale=1.5, shift={32,-48} },
|
||||
{ icon = "__base__/graphics/technology/optics.png", icon_size = 256 },
|
||||
{ icon = "__bzsilicon__/graphics/icons/optical-fiber.png", icon_size = 32, scale=3, shift={32,-48} },
|
||||
},
|
||||
effects =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
-- Silica
|
||||
local util = require("__bzsilicon__.util");
|
||||
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",
|
||||
name = "silica",
|
||||
category = "smelting",
|
||||
|
|
@ -30,9 +40,36 @@ data:extend(
|
|||
icon_size = 64,
|
||||
subgroup = "raw-material",
|
||||
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",
|
||||
name = "silica-processing",
|
||||
icon_size = 128,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,24 @@
|
|||
-- Silicon
|
||||
local util = require("__bzsilicon__.util");
|
||||
if mods["Krastorio2"] then
|
||||
util.remove_raw("recipe", "silicon-2")
|
||||
end
|
||||
|
||||
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",
|
||||
name = "silicon",
|
||||
category = "smelting",
|
||||
|
|
@ -30,8 +47,9 @@ data:extend(
|
|||
icon_size = 64,
|
||||
subgroup = "raw-material",
|
||||
order = "b[silicon]",
|
||||
stack_size = 100
|
||||
stack_size = util.get_stack_size(100)
|
||||
},
|
||||
(not mods["Krastorio2"]) and
|
||||
{
|
||||
type = "technology",
|
||||
name = "silicon-processing",
|
||||
|
|
@ -56,6 +74,6 @@ data:extend(
|
|||
},
|
||||
prerequisites = {"silica-processing"},
|
||||
order = "b-b"
|
||||
},
|
||||
} or nil,
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,26 @@
|
|||
local util = require("__bzsilicon__.util");
|
||||
|
||||
util.remove_ingredient("concrete", "stone-brick");
|
||||
util.add_ingredient("concrete", "silica", 25);
|
||||
util.add_prerequisite("concrete", "silica-processing")
|
||||
if not mods["Krastorio2"] then
|
||||
util.remove_ingredient("concrete", "stone-brick");
|
||||
util.add_ingredient("concrete", "silica", 25);
|
||||
util.add_prerequisite("concrete", "silica-processing")
|
||||
|
||||
util.replace_some_ingredient("processing-unit", "electronic-circuit", "silicon", 10)
|
||||
util.add_prerequisite("advanced-electronics-2", "silicon-processing")
|
||||
util.replace_some_ingredient("processing-unit", "electronic-circuit", "silicon", 10)
|
||||
util.add_prerequisite("advanced-electronics-2", util.silicon_processing)
|
||||
|
||||
util.replace_some_ingredient("solar-panel", "electronic-circuit", "silicon", 10)
|
||||
util.add_prerequisite("solar-energy", "silicon-processing")
|
||||
util.replace_some_ingredient("solar-panel", "electronic-circuit", "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.add_prerequisite("modules", "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.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.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_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
|
||||
|
|
|
|||
38
util.lua
38
util.lua
|
|
@ -1,5 +1,25 @@
|
|||
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
|
||||
function util.add_prerequisite(technology_name, prerequisite)
|
||||
technology = data.raw.technology[technology_name]
|
||||
|
|
@ -8,9 +28,11 @@ end
|
|||
|
||||
-- Add a given quantity of ingredient to a given recipe
|
||||
function util.add_ingredient(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].expensive, 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].normal, ingredient, quantity)
|
||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
||||
end
|
||||
end
|
||||
|
||||
function add_ingredient(recipe, ingredient, quantity)
|
||||
|
|
@ -21,9 +43,11 @@ end
|
|||
|
||||
-- Replace one ingredien with another in a recipe
|
||||
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].normal, old, new)
|
||||
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
|
||||
end
|
||||
end
|
||||
|
||||
function replace_ingredient(recipe, old, new)
|
||||
|
|
@ -39,9 +63,11 @@ end
|
|||
|
||||
-- Remove an ingredient from a recipe
|
||||
function util.remove_ingredient(recipe_name, old)
|
||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
||||
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
||||
if data.raw.recipe[recipe_name] then
|
||||
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
|
||||
|
||||
function remove_ingredient(recipe, old)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue