diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0cbb6b5 --- /dev/null +++ b/LICENSE.md @@ -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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..627c0e5 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +# General makefile for factorio mods. +# +# Presumes the development work is done in a /dev// +# directory where this makefile resides. This directory must be parallel to +# the /mods/ directory where mods are installed. Run `make +# install` from dev/ 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/ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..20a99ab --- /dev/null +++ b/README.md @@ -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) diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..efe5a6c --- /dev/null +++ b/changelog.txt @@ -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 diff --git a/data-final-fixes.lua b/data-final-fixes.lua new file mode 100644 index 0000000..b372dfd --- /dev/null +++ b/data-final-fixes.lua @@ -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 diff --git a/data-updates.lua b/data-updates.lua new file mode 100644 index 0000000..634ae8f --- /dev/null +++ b/data-updates.lua @@ -0,0 +1,2 @@ +require("lead-recipe-updates") +require("lead-matter") diff --git a/data.lua b/data.lua new file mode 100644 index 0000000..3d5231d --- /dev/null +++ b/data.lua @@ -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) + diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-1.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-1.png new file mode 100644 index 0000000..55bd024 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-1.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-2.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-2.png new file mode 100644 index 0000000..769bb73 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-2.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-3.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-3.png new file mode 100644 index 0000000..95b8b01 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-3.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-4.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-4.png new file mode 100644 index 0000000..a14a83c Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-4.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-1.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-1.png new file mode 100644 index 0000000..ebef3b3 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-1.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-2.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-2.png new file mode 100644 index 0000000..b9fc4f5 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-2.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-3.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-3.png new file mode 100644 index 0000000..a3b24e4 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-3.png differ diff --git a/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-4.png b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-4.png new file mode 100644 index 0000000..48315a2 Binary files /dev/null and b/graphics/entity/lead-ore-particle/hr-lead-ore-particle-shadow-4.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-1.png b/graphics/entity/lead-ore-particle/lead-ore-particle-1.png new file mode 100644 index 0000000..38de1b7 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-1.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-2.png b/graphics/entity/lead-ore-particle/lead-ore-particle-2.png new file mode 100644 index 0000000..24de07c Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-2.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-3.png b/graphics/entity/lead-ore-particle/lead-ore-particle-3.png new file mode 100644 index 0000000..c66eaed Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-3.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-4.png b/graphics/entity/lead-ore-particle/lead-ore-particle-4.png new file mode 100644 index 0000000..1695d15 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-4.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-1.png b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-1.png new file mode 100644 index 0000000..89bfee9 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-1.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-2.png b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-2.png new file mode 100644 index 0000000..7834934 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-2.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-3.png b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-3.png new file mode 100644 index 0000000..6ef2544 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-3.png differ diff --git a/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-4.png b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-4.png new file mode 100644 index 0000000..a8aa006 Binary files /dev/null and b/graphics/entity/lead-ore-particle/lead-ore-particle-shadow-4.png differ diff --git a/graphics/entity/ores/hr-lead-ore.png b/graphics/entity/ores/hr-lead-ore.png new file mode 100644 index 0000000..0e00b3f Binary files /dev/null and b/graphics/entity/ores/hr-lead-ore.png differ diff --git a/graphics/entity/ores/hr-lead-ore.xcf b/graphics/entity/ores/hr-lead-ore.xcf new file mode 100644 index 0000000..50b8505 Binary files /dev/null and b/graphics/entity/ores/hr-lead-ore.xcf differ diff --git a/graphics/entity/ores/lead-ore.png b/graphics/entity/ores/lead-ore.png new file mode 100644 index 0000000..888f03e Binary files /dev/null and b/graphics/entity/ores/lead-ore.png differ diff --git a/graphics/entity/ores/lead-ore.xcf b/graphics/entity/ores/lead-ore.xcf new file mode 100644 index 0000000..3901752 Binary files /dev/null and b/graphics/entity/ores/lead-ore.xcf differ diff --git a/graphics/icons/enriched-lead-1.xcf b/graphics/icons/enriched-lead-1.xcf new file mode 100644 index 0000000..c9b850d Binary files /dev/null and b/graphics/icons/enriched-lead-1.xcf differ diff --git a/graphics/icons/enriched-lead-2.png b/graphics/icons/enriched-lead-2.png new file mode 100644 index 0000000..ff9bb2e Binary files /dev/null and b/graphics/icons/enriched-lead-2.png differ diff --git a/graphics/icons/enriched-lead-2.xcf b/graphics/icons/enriched-lead-2.xcf new file mode 100644 index 0000000..ea1a225 Binary files /dev/null and b/graphics/icons/enriched-lead-2.xcf differ diff --git a/graphics/icons/enriched-lead-3.png b/graphics/icons/enriched-lead-3.png new file mode 100644 index 0000000..5b75762 Binary files /dev/null and b/graphics/icons/enriched-lead-3.png differ diff --git a/graphics/icons/enriched-lead-3.xcf b/graphics/icons/enriched-lead-3.xcf new file mode 100644 index 0000000..847f6d8 Binary files /dev/null and b/graphics/icons/enriched-lead-3.xcf differ diff --git a/graphics/icons/enriched-lead-4.png b/graphics/icons/enriched-lead-4.png new file mode 100644 index 0000000..0f54d9a Binary files /dev/null and b/graphics/icons/enriched-lead-4.png differ diff --git a/graphics/icons/enriched-lead-4.xcf b/graphics/icons/enriched-lead-4.xcf new file mode 100644 index 0000000..9ff197b Binary files /dev/null and b/graphics/icons/enriched-lead-4.xcf differ diff --git a/graphics/icons/enriched-lead-stacked.png b/graphics/icons/enriched-lead-stacked.png new file mode 100644 index 0000000..977d89c Binary files /dev/null and b/graphics/icons/enriched-lead-stacked.png differ diff --git a/graphics/icons/enriched-lead-stacked.xcf b/graphics/icons/enriched-lead-stacked.xcf new file mode 100644 index 0000000..621e3a8 Binary files /dev/null and b/graphics/icons/enriched-lead-stacked.xcf differ diff --git a/graphics/icons/enriched-lead.png b/graphics/icons/enriched-lead.png new file mode 100644 index 0000000..9f1a481 Binary files /dev/null and b/graphics/icons/enriched-lead.png differ diff --git a/graphics/icons/enriched-lead.xcf b/graphics/icons/enriched-lead.xcf new file mode 100644 index 0000000..1af5f52 Binary files /dev/null and b/graphics/icons/enriched-lead.xcf differ diff --git a/graphics/icons/hr-lead-ore.png b/graphics/icons/hr-lead-ore.png new file mode 100644 index 0000000..40d4bc7 Binary files /dev/null and b/graphics/icons/hr-lead-ore.png differ diff --git a/graphics/icons/lead-ore - Copy.png b/graphics/icons/lead-ore - Copy.png new file mode 100644 index 0000000..40d4bc7 Binary files /dev/null and b/graphics/icons/lead-ore - Copy.png differ diff --git a/graphics/icons/lead-ore-2.png b/graphics/icons/lead-ore-2.png new file mode 100644 index 0000000..04479b2 Binary files /dev/null and b/graphics/icons/lead-ore-2.png differ diff --git a/graphics/icons/lead-ore-3.png b/graphics/icons/lead-ore-3.png new file mode 100644 index 0000000..7f9baf3 Binary files /dev/null and b/graphics/icons/lead-ore-3.png differ diff --git a/graphics/icons/lead-ore-4.png b/graphics/icons/lead-ore-4.png new file mode 100644 index 0000000..da77f46 Binary files /dev/null and b/graphics/icons/lead-ore-4.png differ diff --git a/graphics/icons/lead-ore-n-2.xcf b/graphics/icons/lead-ore-n-2.xcf new file mode 100644 index 0000000..97bd4ea Binary files /dev/null and b/graphics/icons/lead-ore-n-2.xcf differ diff --git a/graphics/icons/lead-ore-n-3.xcf b/graphics/icons/lead-ore-n-3.xcf new file mode 100644 index 0000000..a924f76 Binary files /dev/null and b/graphics/icons/lead-ore-n-3.xcf differ diff --git a/graphics/icons/lead-ore-n-4.xcf b/graphics/icons/lead-ore-n-4.xcf new file mode 100644 index 0000000..6e35a1d Binary files /dev/null and b/graphics/icons/lead-ore-n-4.xcf differ diff --git a/graphics/icons/lead-ore-n.png b/graphics/icons/lead-ore-n.png new file mode 100644 index 0000000..b7779a6 Binary files /dev/null and b/graphics/icons/lead-ore-n.png differ diff --git a/graphics/icons/lead-ore-n.xcf b/graphics/icons/lead-ore-n.xcf new file mode 100644 index 0000000..80fca74 Binary files /dev/null and b/graphics/icons/lead-ore-n.xcf differ diff --git a/graphics/icons/lead-ore-stacked.png b/graphics/icons/lead-ore-stacked.png new file mode 100644 index 0000000..177521f Binary files /dev/null and b/graphics/icons/lead-ore-stacked.png differ diff --git a/graphics/icons/lead-ore-stacked.xcf b/graphics/icons/lead-ore-stacked.xcf new file mode 100644 index 0000000..825731b Binary files /dev/null and b/graphics/icons/lead-ore-stacked.xcf differ diff --git a/graphics/icons/lead-ore-x-2.xcf b/graphics/icons/lead-ore-x-2.xcf new file mode 100644 index 0000000..f029d1d Binary files /dev/null and b/graphics/icons/lead-ore-x-2.xcf differ diff --git a/graphics/icons/lead-ore-x-3.xcf b/graphics/icons/lead-ore-x-3.xcf new file mode 100644 index 0000000..1d19b35 Binary files /dev/null and b/graphics/icons/lead-ore-x-3.xcf differ diff --git a/graphics/icons/lead-ore-x-4.xcf b/graphics/icons/lead-ore-x-4.xcf new file mode 100644 index 0000000..b0111a9 Binary files /dev/null and b/graphics/icons/lead-ore-x-4.xcf differ diff --git a/graphics/icons/lead-ore-x.xcf b/graphics/icons/lead-ore-x.xcf new file mode 100644 index 0000000..8390c02 Binary files /dev/null and b/graphics/icons/lead-ore-x.xcf differ diff --git a/graphics/icons/lead-ore.png b/graphics/icons/lead-ore.png new file mode 100644 index 0000000..58c7115 Binary files /dev/null and b/graphics/icons/lead-ore.png differ diff --git a/graphics/icons/lead-plate-2.xcf b/graphics/icons/lead-plate-2.xcf new file mode 100644 index 0000000..b8f17d1 Binary files /dev/null and b/graphics/icons/lead-plate-2.xcf differ diff --git a/graphics/icons/lead-plate-3.xcf b/graphics/icons/lead-plate-3.xcf new file mode 100644 index 0000000..90ec7ba Binary files /dev/null and b/graphics/icons/lead-plate-3.xcf differ diff --git a/graphics/icons/lead-plate-old.png b/graphics/icons/lead-plate-old.png new file mode 100644 index 0000000..aba7eea Binary files /dev/null and b/graphics/icons/lead-plate-old.png differ diff --git a/graphics/icons/lead-plate-stacked.png b/graphics/icons/lead-plate-stacked.png new file mode 100644 index 0000000..17f6ef5 Binary files /dev/null and b/graphics/icons/lead-plate-stacked.png differ diff --git a/graphics/icons/lead-plate-stacked.xcf b/graphics/icons/lead-plate-stacked.xcf new file mode 100644 index 0000000..772fe11 Binary files /dev/null and b/graphics/icons/lead-plate-stacked.xcf differ diff --git a/graphics/icons/lead-plate.png b/graphics/icons/lead-plate.png new file mode 100644 index 0000000..eb888d3 Binary files /dev/null and b/graphics/icons/lead-plate.png differ diff --git a/graphics/icons/lead-plate.xcf b/graphics/icons/lead-plate.xcf new file mode 100644 index 0000000..ef9d82b Binary files /dev/null and b/graphics/icons/lead-plate.xcf differ diff --git a/graphics/icons/lead-powder.png b/graphics/icons/lead-powder.png new file mode 100644 index 0000000..7340f60 Binary files /dev/null and b/graphics/icons/lead-powder.png differ diff --git a/graphics/icons/lead-powder.xcf b/graphics/icons/lead-powder.xcf new file mode 100644 index 0000000..17fd057 Binary files /dev/null and b/graphics/icons/lead-powder.xcf differ diff --git a/graphics/icons/lead-processing.png b/graphics/icons/lead-processing.png new file mode 100644 index 0000000..f37ae04 Binary files /dev/null and b/graphics/icons/lead-processing.png differ diff --git a/graphics/icons/lead-processing.xcf b/graphics/icons/lead-processing.xcf new file mode 100644 index 0000000..6c958e9 Binary files /dev/null and b/graphics/icons/lead-processing.xcf differ diff --git a/info.json b/info.json new file mode 100644 index 0000000..62b2ae2 --- /dev/null +++ b/info.json @@ -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." +} + diff --git a/lead-enriched.lua b/lead-enriched.lua new file mode 100644 index 0000000..2a56e26 --- /dev/null +++ b/lead-enriched.lua @@ -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 diff --git a/lead-matter.lua b/lead-matter.lua new file mode 100644 index 0000000..7165681 --- /dev/null +++ b/lead-matter.lua @@ -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 diff --git a/lead-ore-particle.lua b/lead-ore-particle.lua new file mode 100644 index 0000000..556a29a --- /dev/null +++ b/lead-ore-particle.lua @@ -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 + } + } + } + } +} +) diff --git a/lead-ore.lua b/lead-ore.lua new file mode 100644 index 0000000..6ce070e --- /dev/null +++ b/lead-ore.lua @@ -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) + }, +}) + diff --git a/lead-recipe-final-stacking.lua b/lead-recipe-final-stacking.lua new file mode 100644 index 0000000..ae83b15 --- /dev/null +++ b/lead-recipe-final-stacking.lua @@ -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 + diff --git a/lead-recipe-final.lua b/lead-recipe-final.lua new file mode 100644 index 0000000..dbc7a1e --- /dev/null +++ b/lead-recipe-final.lua @@ -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 + + diff --git a/lead-recipe-modules.lua b/lead-recipe-modules.lua new file mode 100644 index 0000000..d8cf8e6 --- /dev/null +++ b/lead-recipe-modules.lua @@ -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 diff --git a/lead-recipe-se.lua b/lead-recipe-se.lua new file mode 100644 index 0000000..dae009a --- /dev/null +++ b/lead-recipe-se.lua @@ -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 diff --git a/lead-recipe-updates.lua b/lead-recipe-updates.lua new file mode 100644 index 0000000..8032369 --- /dev/null +++ b/lead-recipe-updates.lua @@ -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 + diff --git a/lead-recipe.lua b/lead-recipe.lua new file mode 100644 index 0000000..c0e4771 --- /dev/null +++ b/lead-recipe.lua @@ -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 + diff --git a/lead-thumbnail.png b/lead-thumbnail.png new file mode 100644 index 0000000..1df17e3 Binary files /dev/null and b/lead-thumbnail.png differ diff --git a/lead-thumbnail.xcf b/lead-thumbnail.xcf new file mode 100644 index 0000000..8c08463 Binary files /dev/null and b/lead-thumbnail.xcf differ diff --git a/locale/en/lead.cfg b/locale/en/lead.cfg new file mode 100644 index 0000000..292bec0 --- /dev/null +++ b/locale/en/lead.cfg @@ -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). diff --git a/thumbnail.png b/thumbnail.png new file mode 100644 index 0000000..5ba52ab Binary files /dev/null and b/thumbnail.png differ diff --git a/util.lua b/util.lua new file mode 100644 index 0000000..2d7a6ca --- /dev/null +++ b/util.lua @@ -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