Initial working version

This commit is contained in:
Brevven 2021-01-18 03:42:15 -08:00
parent 57813953d4
commit 4c4f13aadc
82 changed files with 893 additions and 0 deletions

20
LICENSE.md Normal file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Brevven
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.

24
Makefile Normal file
View file

@ -0,0 +1,24 @@
# General makefile for factorio mods.
#
# Presumes the development work is done in a <factoriodir>/dev/<modname>/
# directory where this makefile resides. This directory must be parallel to
# the <factoriodir>/mods/ directory where mods are installed. Run `make
# install` from dev/<modname> to install the mod as a zip file. That zip file
# should also be ready to upload to the mod portal
.PHONY: copy install
pwd = $(shell pwd)
v = $(shell basename "$(pwd)")_$(shell jq -r .version info.json)
copy:
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"
install: copy
cp -f ../$(v).zip ../../mods/

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# Lead
[factorio mod page](https://mods.factorio.com/mod/bzlead)
Adds lead ore and plates to the base game, an early-game resource.
Modifies ammunition, pipes, batteries and a few other things. Further mod compatibility is planned.
## Version History
See changelog.txt
## Created by
- [brevven](https://mods.factorio.com/user/brevven)

6
changelog.txt Normal file
View file

@ -0,0 +1,6 @@
---------------------------------------------------------------------------------------------------
Version: 0.1.0
Date: 2021-01-18
Features:
- Lead added to game.
- Compatible with space exploration, krastorio2, deadlock stacking/crating

35
data-final-fixes.lua Normal file
View file

@ -0,0 +1,35 @@
require("lead-recipe-final-stacking")
require("lead-recipe-modules")
----
local util = require("__bzlead__.util");
if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting"]) then
-- If furnaces are treated as furnaces, we need 2 outputs
for i, entity in pairs(data.raw.furnace) do
if entity.result_inventory_size ~= nil and entity.result_inventory_size < 2 and util.contains(entity.crafting_categories, "smelting") then
entity.result_inventory_size = 2
end
end
end
if mods["Krastorio2"] then
util.replace_ingredient("rifle-magazine", "iron-plate", "lead-plate")
util.replace_ingredient("anti-material-rifle-magazine", "iron-plate", "lead-plate")
util.replace_some_ingredient("kr-crusher", "iron-beam", "lead-plate", 5)
util.replace_ingredient("kr-shelter", "iron-plate", "lead-plate")
util.add_ingredient("kr-advanced-furnace", "lead-plate", 20)
util.replace_ingredient("uranium-fuel-cell", "steel-plate", "lead-plate")
util.replace_some_ingredient("kr-fluid-storage-1", "steel-plate", "lead-plate", 10)
util.replace_some_ingredient("kr-fluid-storage-2", "steel-plate", "lead-plate", 30)
end
if mods["space-exploration"] then
util.replace_some_ingredient("se-pulveriser", "iron-plate", "lead-plate", 10)
util.replace_some_ingredient("se-canister", "copper-plate", "lead-plate", 5)
util.add_ingredient("industrial-furnace", "lead-plate", 20)
util.add_ingredient("se-material-testing-pack", "lead-plate", 1)
end

2
data-updates.lua Normal file
View file

@ -0,0 +1,2 @@
require("lead-recipe-updates")
require("lead-matter")

6
data.lua Normal file
View file

@ -0,0 +1,6 @@
require("lead-ore")
require("lead-ore-particle")
require("lead-recipe")
require("lead-enriched") -- Enriched Ti for Krastorio 2
require("lead-recipe-se") -- Space Exploration special recipes (depends on K2 if present)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
graphics/icons/lead-ore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

18
info.json Normal file
View file

@ -0,0 +1,18 @@
{
"name": "bzlead",
"version": "0.1.0",
"factorio_version": "1.1",
"title": "Lead",
"author": "Brevven",
"contact": "",
"homepage": "",
"dependencies": [
"base >= 1.1.0",
"? space-exploration",
"? Krastorio2",
"? deadlock-beltboxes-loaders",
"? DeadlockCrating"
],
"description": "Adds lead ore and plates to the base game as an early game resource.\n\nLead is used in ammunition, pipes, batteries and a few other places.\n\nCompatible with Krastorio 2, Space Exploration and other mods."
}

124
lead-enriched.lua Normal file
View file

@ -0,0 +1,124 @@
-- Enriched Lead for Krastorio2
local util = require("__bzlead__.util");
if mods["Krastorio2"] then
data:extend(
{
{
type = "item",
name = "enriched-lead",
icon_size = 64,
icon = "__bzlead__/graphics/icons/enriched-lead.png",
pictures = {
{filename="__bzlead__/graphics/icons/enriched-lead.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/enriched-lead-2.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/enriched-lead-3.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/enriched-lead-4.png", size=64, scale=0.25},
},
subgroup = "raw-material",
order = "e05-a[enriched-ores]-a1[enriched-lead]",
stack_size = util.get_k2_stack_size(),
},
{
type = "recipe",
name = "enriched-lead",
icon = "__bzlead__/graphics/icons/enriched-lead.png",
icon_size = 64,
category = "chemistry",
energy_required = 3,
enabled = false,
always_show_made_in = true,
always_show_products = true,
allow_productivity = true,
ingredients =
{
{type = "fluid", name = "sulfuric-acid", amount = 3},
{type = "fluid", name = "water", amount = 25, catalyst_amount = 25},
{type = "item", name = "lead-ore", amount = 9}
},
results =
{
{type = "item", name = "enriched-lead", amount = 5},
{type = "item", name = "copper-ore", amount = 2},
{type = "fluid", name = "dirty-water", amount = 25, catalyst_amount = 25}
},
crafting_machine_tint =
{
primary = {r = 0.721, g = 0.525, b = 0.043, a = 0.000},
secondary = {r = 0.200, g = 0.680, b = 0.300, a = 0.357},
tertiary = {r = 0.690, g = 0.768, b = 0.870, a = 0.000},
quaternary = {r = 0.0, g = 0.980, b = 0.603, a = 0.900}
},
subgroup = "raw-material",
order = "e03[enriched-lead]"
},
{
type = "recipe",
name = "enriched-lead-plate",
icons =
{
{ icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64 },
{ icon = "__bzlead__/graphics/icons/enriched-lead.png", icon_size = 64, scale=0.25, shift= {-8, -8}},
},
category = "smelting",
energy_required = 16,
enabled = false,
always_show_made_in = true,
always_show_products = true,
allow_productivity = true,
ingredients =
{
{"enriched-lead", 5}
},
result = "lead-plate",
result_count = 5,
order = "b[lead-plate]-b[enriched-lead-plate]"
},
{
type = "recipe",
name = "dirty-water-filtration-lead",
category = "fluid-filtration",
icons =
{
{
icon = data.raw.fluid["dirty-water"].icon,
icon_size = data.raw.fluid["dirty-water"].icon_size
},
{
icon = data.raw.item["lead-ore"].icon,
icon_size = data.raw.item["lead-ore"].icon_size,
scale = 0.20 * (data.raw.fluid["dirty-water"].icon_size/data.raw.item["lead-ore"].icon_size),
shift = {0, 4}
}
},
icon_size = data.raw.fluid["dirty-water"].icon_size,
energy_required = 2,
enabled = false,
allow_as_intermediate = false,
always_show_made_in = true,
always_show_products = true,
ingredients =
{
{type = "fluid", name = "dirty-water", amount = 100, catalyst_amount = 100},
},
results =
{
{type = "fluid", name = "water", amount = 100, catalyst_amount = 100},
{type = "item", name = "stone", probability = 0.30, amount = 1},
{type = "item", name = "lead-ore", probability = 0.20, amount_min = 1, amount_max = 4},
{type = "item", name = "copper-ore", probability = 0.05, amount = 1},
},
crafting_machine_tint =
{
primary = {r = 0.60, g = 0.20, b = 0, a = 0.6},
secondary = {r = 1.0, g = 0.843, b = 0.0, a = 0.9}
},
subgroup = "raw-material",
order = "w013[dirty-water-filtration-lead]"
}
}
)
util.add_effect("kr-enriched-ores", { type = "unlock-recipe", recipe = "enriched-lead" })
util.add_effect("kr-enriched-ores", { type = "unlock-recipe", recipe = "enriched-lead-plate" })
util.add_effect("kr-enriched-ores", { type = "unlock-recipe", recipe = "dirty-water-filtration-lead" })
end

61
lead-matter.lua Normal file
View file

@ -0,0 +1,61 @@
-- Matter recipes for Krastorio2
if mods["Krastorio2"] then
local matter = require("__Krastorio2__/lib/public/data-stages/matter-util")
data:extend(
{
{
type = "technology",
name = "lead-matter-processing",
icons =
{
{
icon = "__Krastorio2__/graphics/technologies/matter-stone.png",
icon_size = 128,
},
{
icon = "__bzlead__/graphics/icons/lead-ore.png",
icon_size = 64,
scale = 0.85,
}
},
prerequisites = {"kr-matter-processing"},
unit =
{
count = 350,
ingredients =
{
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"matter-tech-card", 1}
},
time = 45
}
},
})
local lead_ore_matter =
{
item_name = "lead-ore",
minimum_conversion_quantity = 10,
matter_value = 5,
energy_required = 1,
need_stabilizer = false,
unlocked_by_technology = "lead-matter-processing"
}
matter.createMatterRecipe(lead_ore_matter)
local lead_plate_matter =
{
item_name = "lead-plate",
minimum_conversion_quantity = 10,
matter_value = 7.5,
energy_required = 2,
only_deconversion = true,
need_stabilizer = true,
unlocked_by_technology = "lead-matter-processing"
}
matter.createMatterRecipe(lead_plate_matter)
end

144
lead-ore-particle.lua Normal file
View file

@ -0,0 +1,144 @@
data:extend(
{
{
type = "optimized-particle",
name = "lead-ore-particle",
flags = {"not-on-map"},
life_time = 180,
pictures =
{
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-1.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-1.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-2.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-2.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-3.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-3.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-4.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-4.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
}
},
shadows =
{
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-1.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-1.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-2.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-2.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-3.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-3.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
},
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-4.png",
priority = "extra-high",
width = 16,
height = 16,
frame_count = 1,
hr_version =
{
filename = "__bzlead__/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-4.png",
priority = "extra-high",
width = 32,
height = 32,
frame_count = 1,
scale = 0.5
}
}
}
}
}
)

82
lead-ore.lua Normal file
View file

@ -0,0 +1,82 @@
local resource_autoplace = require('resource-autoplace');
local util = require("__bzlead__.util");
data:extend({
{
type = "autoplace-control",
category = "resource",
name = "lead-ore",
richness = true,
order = "b-e"
},
{
type = "noise-layer",
name = "lead-ore"
},
{
type = "resource",
icon_size = 64,
name = "lead-ore",
icon = "__bzlead__/graphics/icons/lead-ore.png",
flags = {"placeable-neutral"},
order="a-b-a",
map_color = {r=0.35, g=0.10, b=0.10},
minable =
{
hardness = 1,
mining_particle = "lead-ore-particle",
mining_time = 1,
result = "lead-ore"
},
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
autoplace = resource_autoplace.resource_autoplace_settings{
name = "lead-ore",
order = "b-z",
base_density = 5,
has_starting_area_placement = true,
regular_rq_factor_multiplier = 1.3,
starting_rq_factor_multiplier = 1.7
},
stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80},
stages =
{
sheet =
{
filename = "__bzlead__/graphics/entity/ores/lead-ore.png",
priority = "extra-high",
size = 64,
frame_count = 8,
variation_count = 8,
hr_version =
{
filename = "__bzlead__/graphics/entity/ores/hr-lead-ore.png",
priority = "extra-high",
size = 128,
frame_count = 8,
variation_count = 8,
scale = 0.5
}
}
},
},
{
type = "item",
name = "lead-ore",
icon_size = 64,
icon = "__bzlead__/graphics/icons/lead-ore.png",
pictures = {
{filename="__bzlead__/graphics/icons/lead-ore.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/lead-ore-2.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/lead-ore-3.png", size=64, scale=0.25},
{filename="__bzlead__/graphics/icons/lead-ore-4.png", size=64, scale=0.25},
},
subgroup = "raw-resource",
order = "t-c-a",
stack_size = (mods["Krastorio2"] and util.get_k2_stack_size() or 50)
},
})

View file

@ -0,0 +1,18 @@
-- Deadlock stacking recipes
if deadlock then
deadlock.add_stack("lead-ore", "__bzlead__/graphics/icons/lead-ore-stacked.png", "deadlock-stacking-1", 64)
deadlock.add_stack("lead-plate", "__bzlead__/graphics/icons/lead-plate-stacked.png" , "deadlock-stacking-1", 64)
if mods["Krastorio2"] then
deadlock.add_stack("enriched-lead", "__bzlead__/graphics/icons/enriched-lead-stacked.png" , "deadlock-stacking-1", 64)
end
end
-- Deadlock crating recipes
if deadlock_crating then
deadlock_crating.add_crate("lead-ore", "deadlock-crating-1")
deadlock_crating.add_crate("lead-plate", "deadlock-crating-1")
if mods["Krastorio2"] then
deadlock_crating.add_crate("enriched-lead", "deadlock-crating-1")
end
end

10
lead-recipe-final.lua Normal file
View file

@ -0,0 +1,10 @@
-- Titanium recipe & tech changes
-- These are in "final" for compatibility with other mods such as Space Exploration, AAI and Krastorio 2
local util = require("__bztitanium__.util");
if (mods["bobrevamp"] and not mods["bobplates"] and not mods["angelssmelting"]) then
-- TODO
end

27
lead-recipe-modules.lua Normal file
View file

@ -0,0 +1,27 @@
-- Enable prod modules for all lead plate and ore recipes
recipes = {"lead-plate"}
if mods["Krastorio2"] then
table.insert(recipes, "enriched-lead-plate")
table.insert(recipes, "enriched-lead")
end
if mods["space-exploration"] then
table.insert(recipes, "lead-smelting-vulcanite")
if mods["Krastorio2"] then
table.insert(recipes, "enriched-lead-smelting-vulcanite")
end
end
for i, recipe in pairs(recipes) do
if data.raw.recipe[recipe] then
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)
end
end
end
end
end
end

65
lead-recipe-se.lua Normal file
View file

@ -0,0 +1,65 @@
-- Additional recipes if Space Exploration mod is enabled
local util = require("__bzlead__.util");
if mods["space-exploration"] then
if mods["Krastorio2"] then
data:extend({
{
type = "recipe",
name = "enriched-lead-smelting-vulcanite",
category = "smelting",
order = "d[lead-plate]",
energy_required = 24,
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
ingredients = {
{name = "enriched-lead", amount = 8},
{name = "se-vulcanite-block", amount = 1},
},
results = {
{name = util.lead_plate, amount = 12},
},
icons =
{
{ icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64 },
{ icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
},
},
})
table.insert(data.raw.technology["se-processing-vulcanite"].effects,
{type = "unlock-recipe", recipe= "enriched-lead-smelting-vulcanite"})
data.raw.recipe["enriched-lead-plate"].order= "d[lead-plate]"
else
data:extend({
{
type = "recipe",
name = "lead-smelting-vulcanite",
category = "smelting",
order = "d[lead-plate]",
energy_required = 48,
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
ingredients = {
{name = "lead-ore", amount = 20},
{name = "se-vulcanite-block", amount = 1},
},
results = {
{name = util.lead_plate, amount = 6},
},
icons =
{
{ icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64 },
{ icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
},
},
})
table.insert(data.raw.technology["se-processing-vulcanite"].effects,
{type = "unlock-recipe", recipe= "lead-smelting-vulcanite"})
util.add_lead_prerequisite(data.raw.technology["se-processing-vulcanite"])
end
end

28
lead-recipe-updates.lua Normal file
View file

@ -0,0 +1,28 @@
-- Titanium recipe & tech changes
--
local util = require("__bzlead__.util");
if (not mods["bobplates"] and not mods["angelssmelting"]) then
util.replace_ingredient("pipe", "iron-plate", "lead-plate")
util.replace_ingredient("pipe-to-ground", "iron-plate", "lead-plate")
util.replace_some_ingredient("storage-tank", "iron-plate", "lead-plate", 10)
util.replace_ingredient("battery", "iron-plate", "lead-plate")
util.replace_ingredient("uranium-fuel-cell", "iron-plate", "lead-plate")
util.replace_some_ingredient("gun-turret", "iron-plate", "lead-plate", 5)
util.add_ingredient("big-electric-pole", "lead-plate", 2)
util.add_ingredient("substation", "lead-plate", 2)
util.add_ingredient("electric-furnace", "lead-plate", 5)
util.add_ingredient("solar-panel", "lead-plate", 5)
-- ammunition
util.replace_ingredient("firearm-magazine", "iron-plate", "lead-plate")
util.replace_ingredient("shotgun-shell", "iron-plate", "lead-plate")
end
-- Krastorio 2 changes
if mods["Krastorio2"] then
-- todo
end

67
lead-recipe.lua Normal file
View file

@ -0,0 +1,67 @@
-- Lead smelting
local util = require("__bzlead__.util");
if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting"]) then
data:extend(
{
{
type = "recipe",
name = util.lead_plate,
category = "smelting",
subgroup = "raw-material",
order = "d[lead-plate]",
icons = (mods["Krastorio2"] and
{
{ icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64 },
{ icon = "__bzlead__/graphics/icons/lead-ore.png", icon_size = 64, scale=0.25, shift= {-8, -8}},
} or {
{ icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64 },
}
),
normal = (mods["Krastorio2"] and
{
enabled = true,
energy_required = 16,
ingredients = {{"lead-ore", 10}},
results = {
{type="item", name = util.lead_plate, amount_min=4, amount_max=5},
{type="item", name = "copper-ore", amount_min=1, amount_max=2},
}
} or
{
enabled = true,
energy_required = 6.4,
ingredients = {{"lead-ore", 2}},
results = {
{type="item", name = util.lead_plate, amount=2, probability=5/6},
{type="item", name = "copper-ore", amount=1, probability=1/3},
}
}),
expensive =
{
enabled = true,
energy_required = 12.8,
ingredients = {{"lead-ore", 4}},
results = {
{type="item", name = util.lead_plate, amount=2, probability=0.8333},
{type="item", name = "copper-ore", amount=2, probability=0.333},
}
}
},
{
type = "item",
name = util.lead_plate,
icon = "__bzlead__/graphics/icons/lead-plate.png",
icon_size = 64,
subgroup = "raw-material",
order = "b[lead-plate]",
stack_size = (mods["Krastorio2"] and util.get_k2_stack_size() or 100)
},
}
)
end

BIN
lead-thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
lead-thumbnail.xcf Normal file

Binary file not shown.

32
locale/en/lead.cfg Normal file
View file

@ -0,0 +1,32 @@
[entity-name]
lead-ore=Lead
[autoplace-control-names]
lead-ore=Lead ore
[item-name]
lead-ore=Lead ore
lead-dust=Lead dust
lead-plate=Lead plate
lead-alloy=__ITEM__lead-plate__
enriched-lead=Enriched lead
[item-description]
lead-ore=Can be smelted into lead plates
enriched-lead=Can be efficiently smelted into lead plates
[technology-name]
enriched-lead=Enriched Lead
lead-matter-processing=Lead conversion
[technology-description]
enriched-lead=Enrich lead ore, purifying with sulfuric acid [fluid=sulfuric-acid] and water [fluid=water], improving the final yield. Produce dirty water [fluid=dirty-water] as a byproduct.
[recipe-name]
enriched-lead=__ITEM__enriched-lead__
dirty-water-filtration-lead=Filter dirty water [item=lead-ore]
[recipe-description]
enriched-lead=Enrich lead ore, purifying with sulfuric acid [fluid=sulfuric-acid] and water [fluid=water], improving the final yield. Produce dirty water [fluid=dirty-water] as a byproduct.
dirty-water-filtration-lead=Filter dirty water, giving lead ore [item=lead-ore], copper ore [item=coppper-ore] and stone [item=stone] (probabilistically).

BIN
thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

111
util.lua Normal file
View file

@ -0,0 +1,111 @@
local util = {}
util.lead_ore = "lead-ore"
util.lead_plate = "lead-plate"
function util.get_k2_stack_size()
return tonumber(krastorio.general.getSafeSettingValue("kr-stack-size"))
end
-- check if a table contains a sought value
function util.contains(table, sought)
log(serpent.dump(table))
log(sought)
for i, value in pairs(table) do
if value == sought then
return true
end
end
return false
end
-- Add a prerequisite to a given technology
function util.add_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name]
table.insert(technology.prerequisites, prerequisite)
end
-- Add an effect to a given technology
function util.add_effect(technology_name, effect)
technology = data.raw.technology[technology_name]
table.insert(technology.effects, effect)
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)
end
function add_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
-- Replace one ingredien with another in a recipe
function util.replace_ingredient(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].expensive, old, new)
end
function replace_ingredient(recipe, old, new)
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.name = new end
-- For updates
if ingredient[1] == old then ingredient[1] = new end
end
end
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)
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 or ingredient[1] == 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, 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)
end
function replace_some_ingredient(recipe, old, 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)
end
-- For updates
if ingredient[1] == old then
ingredient[2] = math.max(1, ingredient[2] - amount)
end
end
add_ingredient(recipe, new, amount)
end
end
return util