Initial commit

This commit is contained in:
brevven 2022-01-20 21:32:22 -08:00
commit 69ef3d6dd4
89 changed files with 960 additions and 0 deletions

20
LICENSE.md Normal file
View file

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

37
Makefile Normal file
View file

@ -0,0 +1,37 @@
# 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 lint-changelog install
libdir = "../bzlib"
libfiles = $(shell ls $(libdir)/*.lua | grep -o '[^/]*.lua')
pwd = $(shell pwd)
v = $(shell basename "$(pwd)")_$(shell jq -r .version info.json)
link:
for f in $(libfiles) ; do \
echo "using $(libdir)/$$f" ;\
cp $(libdir)/$$f .; \
done;
copy: link
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" -x "*.blend*"
install: lint-changelog copy
cp -f ../$(v).zip ../../mods/
lint-changelog: copy
python3 ../da-changelog-tools_0.0.14/changelog-checker.py --changelog ../$(v).zip
zorro:
python3 ../da-changelog-tools_0.0.14/changelog-checker.py --zorro --changelog ../$(v).zip

17
README.md Normal file
View file

@ -0,0 +1,17 @@
# Mod
[factorio mod page](https://mods.factorio.com/mod/bzmod)
Adds ... to the base game
## Version History
See changelog.txt
## Created by
- [brevven](https://mods.factorio.com/user/brevven) (code, design, graphics)
## Thanks to
- [snouz](https://github.com/snouz) (logo inspiration, ore graphics templates)
### Localization

5
changelog.txt Normal file
View file

@ -0,0 +1,5 @@
---------------------------------------------------------------------------------------------------
Version: 0.0.1
Date: 2021-11-29
Features:
- Alpha version

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

@ -0,0 +1,46 @@
require("lead-recipe-final-stacking")
require("lead-recipe-modules")
require("lead-recipe-colors")
require("lead-recipe-final-5d")
require("lead-recipe-final-rrr")
----
local util = require("__bzlead__.data-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", 5, "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", 10, "lead-plate", 10)
util.replace_some_ingredient("kr-fluid-storage-2", "steel-plate", 30, "lead-plate", 30)
end
if mods["modmashsplintergold"] then
if mods["Krastorio2"] then
util.replace_ingredient("rifle-magazine-with-gold", "iron-plate", "lead-plate")
util.replace_ingredient("anti-material-rifle-magazine-with-gold", "iron-plate", "lead-plate")
end
end
if mods["space-exploration"] then
-- Organization
data.raw.item["lead-plate"].subgroup = "plates"
data.raw.recipe["lead-plate"].subgroup = "plates"
-- core mining balancing
util.add_to_product("se-core-fragment-omni", "lead-ore", -4)
end

5
data-updates.lua Normal file
View file

@ -0,0 +1,5 @@
require("lead-recipe-updates")
require("lead-matter")
require("omni")
require("map-gen-preset-updates")
require("strange-matter")

413
data-util.lua Normal file
View file

@ -0,0 +1,413 @@
-- WARNING WARNING WARNING
-- This file will be overwritten in mod zipfiles, edit bzlib/data-util.lua
-- WARNING WARNING WARNING
local me = require("me")
local util = {}
util.me = me
util.get_setting = util.me.get_setting
function util.fe_plus(sub)
if mods["FactorioExtended-Plus-"..sub] then
return true
end
end
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
function util.k2assets()
if mods["Krastorio2Assets"] then
return "__Krastorio2Assets__"
end
return "__Krastorio2__/graphics"
end
-- check if a table contains a sought value
function util.contains(table, 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)
local technology = data.raw.technology[technology_name]
if technology and data.raw.technology[prerequisite] then
if technology.prerequisites then
table.insert(technology.prerequisites, prerequisite)
else
technology.prerequisites = {prerequisite}
end
end
end
-- Remove a prerequisite from a given technology
function util.remove_prerequisite(technology_name, prerequisite)
local technology = data.raw.technology[technology_name]
local index = -1
if technology and data.raw.technology[prerequisite] then
for i, prereq in pairs(technology.prerequisites) do
if prereq == prerequisite then
index = i
break
end
end
if index > -1 then
table.remove(technology.prerequisites, index)
end
end
end
-- Add an effect to a given technology
function util.add_effect(technology_name, effect)
local technology = data.raw.technology[technology_name]
if technology then
table.insert(technology.effects, effect)
end
end
-- Set technology ingredients
function util.set_tech_recipe(technology_name, ingredients)
local technology = data.raw.technology[technology_name]
if technology then
technology.unit.ingredients = ingredients
end
end
-- Add a given quantity of ingredient to a given recipe
function util.add_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] 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)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
log("Not adding "..ingredient.." -- duplicate")
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
-- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products
function util.add_product(recipe_name, product)
if data.raw.recipe[recipe_name] and data.raw.item[product] then
add_product(data.raw.recipe[recipe_name], product)
add_product(data.raw.recipe[recipe_name].normal, product)
add_product(data.raw.recipe[recipe_name].expensive, product)
end
end
function add_product(recipe, product)
if recipe ~= nil and recipe.results ~= nil then
table.insert(recipe.results, product)
end
end
-- Replace one ingredient with another in a recipe
function util.replace_ingredient(recipe_name, old, new)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[new] 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)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
log("Not adding "..new.." -- duplicate")
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then ingredient.name = new end
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)
if me.bypass[recipe_name] then return end
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)
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, old_amount, new, new_amount)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[new] then
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount)
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount)
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount)
end
end
function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
log("Not adding "..new.." -- duplicate")
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then
ingredient.amount = math.max(1, ingredient.amount - old_amount)
end
if ingredient[1] == old then
ingredient[2] = math.max(1, ingredient[2] - old_amount)
end
end
add_ingredient(recipe, new, new_amount)
end
end
-- multiply the cost, energy, and results of a recipe by a multiple
function util.multiply_recipe(recipe_name, multiple)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then
multiply_recipe(data.raw.recipe[recipe_name], multiple)
multiply_recipe(data.raw.recipe[recipe_name].normal, multiple)
multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple)
end
end
function multiply_recipe(recipe, multiple)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required * multiple
end
if recipe.result_count then
recipe.result_count = recipe.result_count * multiple
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name then
if result.amount then
result.amount = result.amount * multiple
end
if result.amount_min ~= nil then
result.amount_min = result.amount_min * multiple
result.amount_max = result.amount_max * multiple
end
if result.catalyst_amount then
result.catalyst_amount = result.catalyst_amount * multiple
end
end
if result[1] then
result[2] = result[2] * multiple
end
end
end
if not recipe.results and not recipe.result_count then
-- implicit one item result
recipe.result_count = multiple
end
if recipe.ingredients then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name then
ingredient.amount = ingredient.amount * multiple
end
if ingredient[1] then
ingredient[2] = ingredient[2] * multiple
end
end
end
end
end
-- Returns true if a recipe has an ingredient
function util.has_ingredient(recipe_name, ingredient)
return data.raw.recipe[recipe_name] and (
has_ingredient(data.raw.recipe[recipe_name], ingredient) or
has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
end
function has_ingredient(recipe, ingredient)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
return true
end
end
end
return false
end
-- Replace one product with another in a recipe
function util.replace_product(recipe_name, old, new)
if data.raw.recipe[recipe_name] then
replace_product(data.raw.recipe[recipe_name], old, new)
replace_product(data.raw.recipe[recipe_name].normal, old, new)
replace_product(data.raw.recipe[recipe_name].expensive, old, new)
end
end
function replace_product(recipe, old, new)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == old then
recipe.results = new
return
end
for i, result in pairs(recipe.results) do
if result.name == old then result.name = new end
if result[1] == old then result[1] = new end
end
end
end
-- Remove an element of type t and name from data.raw
function util.remove_raw(t, name)
if data.raw[t][name] then
for i, elem in pairs(data.raw[t]) do
if elem.name == name then
data.raw[t][i] = nil
break
end
end
end
end
-- Multiply energy required
function util.multiply_time(recipe, factor)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then
multiply_time(data.raw.recipe[recipe_name], factor)
multiply_time(data.raw.recipe[recipe_name].normal, factor)
multiply_time(data.raw.recipe[recipe_name].expensive, factor)
end
end
function multiply_time(recipe, factor)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required * factor
end
end
end
-- Set recipe category
function util.set_category(recipe, category)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then
data.raw.recipe[recipe].category = category
end
end
-- Set recipe subgroup
function util.set_subgroup(recipe, subgroup)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then
data.raw.recipe[recipe].subgroup = subgroup
end
end
function util.set_to_founding(recipe)
util.set_category(recipe, "founding")
util.set_subgroup(recipe, "foundry-intermediate")
end
-- Add crafting category to an entity
function util.add_crafting_category(entity_type, entity, category)
if data.raw[entity_type][entity] then
for i, existing in pairs(data.raw[entity_type][entity].crafting_categories) do
if existing == category then
log(entity.." not adding "..new.." -- duplicate")
return
end
end
table.insert(data.raw[entity_type][entity].crafting_categories, category)
end
end
function util.add_to_ingredient(recipe, ingredient, amount)
if data.raw.recipe[recipe] then
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount)
end
end
function add_to_ingredient(recipe, it, amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == it then
ingredient.amount = ingredient.amount + amount
return
end
if ingredient[1] == it then
ingredient[2] = ingredients[2] + amount
return
end
end
end
end
function util.add_to_product(recipe, product, amount)
if data.raw.recipe[recipe] then
add_to_product(data.raw.recipe[recipe], product, amount)
add_to_product(data.raw.recipe[recipe].normal, product, amount)
add_to_product(data.raw.recipe[recipe].expensive, product, amount)
end
end
function add_to_product(recipe, product, amount)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == product then
recipe.result_count = recipe.result_count + amount
return
end
for i, result in pairs(recipe.results) do
if result.name == product then
result.amount = result.amount + amount
return
end
if result[1] == product then
result[2] = result[2] + amount
return
end
end
end
end
return util

9
data.lua Normal file
View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

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: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

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

BIN
graphics/icons/cermet.blend Normal file

Binary file not shown.

Binary file not shown.

BIN
graphics/icons/cermet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
graphics/icons/cermet.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 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.

BIN
graphics/icons/zircon-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
graphics/icons/zircon-2.xcf Normal file

Binary file not shown.

BIN
graphics/icons/zircon-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
graphics/icons/zircon-3.xcf Normal file

Binary file not shown.

BIN
graphics/icons/zircon-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
graphics/icons/zircon-4.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Binary file not shown.

BIN
graphics/icons/zircon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
graphics/icons/zircon.xcf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 KiB

Binary file not shown.

BIN
graphics/icons/zirconia.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
graphics/icons/zirconia.xcf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

18
info.json Normal file
View file

@ -0,0 +1,18 @@
{
"name": "bzmod",
"version": "0.0.1",
"factorio_version": "1.1",
"title": "Mod",
"author": "Brevven",
"contact": "",
"homepage": "",
"dependencies": [
"base >= 1.1.0",
"? space-exploration",
"? Krastorio2",
"? deadlock-beltboxes-loaders",
"? DeadlockCrating"
],
"description": "Adds ... to the game"
}

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
}
}
}
}
}
)

96
lead-ore.lua Normal file
View file

@ -0,0 +1,96 @@
local resource_autoplace = require('resource-autoplace');
local noise = require('noise');
local util = require("__bzlead__.data-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, icon_mipmaps = 3,
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 = 6,
base_spots_per_km2 = 1,
has_starting_area_placement = true,
regular_rq_factor_multiplier = 1.2,
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_mipmaps = 3,
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-1.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},
},
subgroup = "raw-resource",
order = "t-c-a",
stack_size = util.get_stack_size(50)
},
})
local richness = data.raw.resource["lead-ore"].autoplace.richness_expression
-- Modify lead autoplace richness:
-- Up to 200 tiles it's standard
-- From 200 to 700 tiles, richness scales linearly down, until
-- From 700 tiles onward, it's about 1/6th the richness.
data.raw.resource["lead-ore"].autoplace.richness_expression =
richness * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(200)), 1,
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(700)),
100 / (noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 100),
0.17)

16
lead-recipe-final-rrr.lua Normal file
View file

@ -0,0 +1,16 @@
local util = require("__bzlead__.data-util");
if mods["Rich-Rocks-Requiem"] then
if data.raw.recipe["rrr-stone-processing"] then
table.insert(data.raw.recipe["rrr-stone-processing"].results,
{name = "lead-ore", probability = 0.25, amount = 1}
)
end
if data.raw.recipe["rrr-raw-ores-processing"] then
table.insert(data.raw.recipe["rrr-raw-ores-processing"].results,
{name = "lead-ore", probability = 0.75, amount = 10}
)
end
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

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

@ -0,0 +1,51 @@
[entity-name]
lead-ore=Lead
lead-chest=Lead chest
[autoplace-control-names]
lead-ore=[item=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
lead-chest=Lead chest
compressed-lead-ore=Compressed lead ore
[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__
lead-plate=__ITEM__lead-plate__
smelt-compressed-lead-ore=__ITEM__lead-plate__
lead-dust=__ITEM__lead-dust__
dirty-water-filtration-lead=Filter dirty water [item=lead-ore]
bz-lead-ingot=Lead ingot
[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).
# Settings
[mod-setting-name]
bzlead-recipe-bypass=Bypass recipes
bzlead-more-entities=Lead entities
bzlead-sulfuric=Use lead in sulfuric acid. Default "yes". Use with care.
[mod-setting-description]
bzlead-recipe-bypass=Skip modifying these recipes (comma-separated list).
bzlead-more-entities=Adds lead entities (currently just a lead chest).
bzlead-sulfuric=Adds compatibility for old saves. Do NOT change to "no" for new saves. Will be removed (and always "yes") in 2022.

View file

@ -0,0 +1,10 @@
if data.raw["map-gen-presets"] and data.raw["map-gen-presets"].default then
for name, preset in pairs(data.raw["map-gen-presets"].default) do
if type(preset) == "table" and
preset.basic_settings and
preset.basic_settings.autoplace_controls and
preset.basic_settings.autoplace_controls["iron-ore"] then
preset.basic_settings.autoplace_controls["lead-ore"] = preset.basic_settings.autoplace_controls["iron-ore"]
end
end
end

23
me.lua Normal file
View file

@ -0,0 +1,23 @@
local me = {}
me.name = "bzmod"
function me.mod_setting()
return me.get_setting("bzmod-setting") == "yes"
end
function me.get_setting(name)
if settings.startup[name] == nil then
return nil
end
return settings.startup[name].value
end
me.bypass = {}
if me.get_setting(me.name.."-recipe-bypass") then
for recipe in string.gmatch(me.get_setting(me.name.."-recipe-bypass"), '[^",%s]+') do
me.bypass[recipe] = true
end
end
return me

23
settings.lua Normal file
View file

@ -0,0 +1,23 @@
data:extend({
{
type = "string-setting",
name = "bzlead-recipe-bypass",
setting_type = "startup",
default_value = "",
allow_blank = true,
},
{
type = "string-setting",
name = "bzlead-more-entities",
setting_type = "startup",
default_value = "no",
allowed_values = {"yes", "no"},
},
{ -- TODO remove this in 2022
type = "string-setting",
name = "bzlead-sulfuric",
setting_type = "startup",
default_value = "yes",
allowed_values = {"yes", "no"},
},
})

BIN
thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
thumbnail.xcf Normal file

Binary file not shown.