Compare commits

..

No commits in common. "bzlib" and "main" have entirely different histories.
bzlib ... main

12 changed files with 1314 additions and 38 deletions

View file

@ -1,4 +1,4 @@
local util = require("__bzlib__/data-util")
local util = require("data-util")
require("refractory-updates")
-- Prevent production deadlock

1273
bzfoundry2/data-util.lua Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
local me = require("me")
local util = require("data-util")
require("prototypes/categories")
if me.enable() then
if util.me.enable() then
require("prototypes/coke")
require("prototypes/foundry")
require("prototypes/entity/electric-foundry")

View file

@ -1,18 +1,17 @@
local util = require("__bzlib__/data-util")
local me = require("me")
local util = require("data-util")
if me.enable() then
if util.me.enable() then
util.set_to_founding("steel-plate")
util.replace_some_ingredient("steel-plate", "iron-plate", 1, me.carbon(), 1)
util.replace_some_ingredient("steel-plate", "iron-plate", 1, util.me.carbon(), 1)
util.multiply_time("steel-plate", 4/5)
util.add_prerequisite("steel-processing", "foundry")
util.set_to_founding("tungsten-carbide")
util.add_ingredient("tungsten-carbide", me.carbon(), 1)
util.add_ingredient("tungsten-carbide", util.me.carbon(), 1)
util.set_to_founding("cuw")
util.set_to_founding(mods.Krastorio2 and "kr-silicon" or "silicon")
util.add_ingredient(mods.Krastorio2 and "kr-silicon" or "silicon", me.carbon(), 1)
util.add_ingredient(mods.Krastorio2 and "kr-silicon" or "silicon", util.me.carbon(), 1)
util.set_to_founding("cermet") -- from zirconium
util.set_to_founding("crucible") -- from graphite
@ -21,11 +20,11 @@ if me.enable() then
else
-- If we're not using Foundry buildings, add founding recipes to assemblers in vanilla, or furnaces in K2
local sought = mods.Krastorio2 and "smelting" or "crafting"
for _, machine in pairs(data.raw["assembling-machine"]) do
for _, category in pairs(machine.crafting_categories) do
for i, machine in pairs(data.raw["assembling-machine"]) do
for j, category in pairs(machine.crafting_categories) do
if category == sought then
util.add_crafting_category("assembling-machine", machine.name, "founding")
if me.basic_founding() then
if util.me.basic_founding() then
util.add_crafting_category("assembling-machine", machine.name, "basic-founding")
end
break
@ -34,16 +33,16 @@ else
end
util.add_crafting_category("assembling-machine", "industrial-furnace", "founding")
util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "founding")
if me.basic_founding() then
if util.me.basic_founding() then
util.add_crafting_category("assembling-machine", "industrial-furnace", "basic-founding")
util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "basic-founding")
end
end
for _, machine in pairs(me.get_other_machines()) do
for i, machine in pairs(util.me.get_other_machines()) do
log("Allowing "..machine.." to handle founding")
util.add_crafting_category("assembling-machine", machine, "founding")
if me.basic_founding() then
if util.me.basic_founding() then
util.add_crafting_category("assembling-machine", machine, "basic-founding")
end
end

View file

@ -56,13 +56,13 @@ function me.get_setting(name)
end
me.bypass = {}
if me.get_setting(me.name.."-recipe-bypass") then
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
function me.add_modified(name)
function me.add_modified(name)
if me.get_setting(me.name.."-list") then
table.insert(me.list, name)
end

View file

@ -1,5 +1,4 @@
local util = require("__bzlib__/data-util")
local me = require("me")
local util = require("data-util")
data:extend({
{ type = "recipe-category", name = "founding"},
@ -8,11 +7,11 @@ data:extend({
order = util.se6() and "a-b-z" or "c-z"},
})
if me.basic_founding() then
if util.me.basic_founding() then
data:extend({
{ type = "recipe-category", name = "basic-founding"},
})
for _, character in pairs(data.raw.character) do
for i, character in pairs(data.raw.character) do
if character.crafting_categories then
table.insert(character.crafting_categories, "basic-founding")
end

View file

@ -1,6 +1,6 @@
local me = require("me")
local util = require("data-util")
if me.carbon() == "coke" and not data.raw.item["coke"] then
if util.me.carbon() == "coke" and not data.raw.item["coke"] then
data:extend({
{
type = "item",
@ -31,7 +31,7 @@ data:extend({
enabled=false,
},
})
if me.woodcoke() then
if util.me.woodcoke() then
data:extend({
{
type = "recipe",
@ -48,7 +48,7 @@ data:extend({
},
})
end
elseif me.carbon() == "solid-fuel" then
elseif util.me.carbon() == "solid-fuel" then
data:extend({
{
type = "recipe",
@ -60,7 +60,7 @@ data:extend({
enabled=false,
},
})
if me.woodcoke() then
if util.me.woodcoke() then
data:extend({
{
type = "recipe",

View file

@ -1,12 +1,11 @@
require("util")
local futil = require("__bzlib__/data-util")
local futil = require("data-util")
require ("sound-util")
require ("circuit-connector-sprites")
local hit_effects = require("__base__.prototypes.entity.hit-effects")
local sounds = require("__base__.prototypes.entity.sounds")
local explosion_animations = require("__base__/prototypes/entity/explosion-animations")
local particle_animations = require("__base__/prototypes/particle-animations")
local me = require("me")
data:extend({
{
@ -24,7 +23,7 @@ data:extend({
circuit_connector = circuit_connector_definitions["foundry"],
collision_box = {{-1.7, -1.7}, {1.7, 1.7}},
selection_box = {{-2, -2}, {2, 2}},
crafting_categories = {"founding", me.smelt() and "smelting" or nil},
crafting_categories = {"founding", futil.me.smelt() and "smelting" or nil},
energy_usage = "360kW",
drain = "12kW",
crafting_speed = 4,

View file

@ -1,5 +1,5 @@
require("util")
local futil = require("__bzlib__/data-util")
local futil = require("data-util")
local meld = require("meld")
local fuel = {"chemical"}

View file

@ -1,5 +1,4 @@
local util = require("__bzlib__/data-util")
local me = require("me")
local util = require("data-util")
local foundry_ingredients = {{type="item", name="stone-brick", amount=20}, {type="item", name="iron-plate", amount=10}, {type="item", name="copper-plate", amount=5}}
if mods["bzlead2"] then table.insert(foundry_ingredients, {type="item", name="lead-plate", amount=8}) end
@ -37,7 +36,7 @@ data:extend({
prerequisites = {"automation"},
effects = {
{type = "unlock-recipe", recipe = "foundry"},
me.carbonrecipe() and {type = "unlock-recipe", recipe = me.carbonrecipe()},
util.me.carbonrecipe() and {type = "unlock-recipe", recipe = util.me.carbonrecipe()},
},
unit = {
count = 25,
@ -47,7 +46,7 @@ data:extend({
order = "foundry",
},
})
if me.woodcoke() then
if util.me.woodcoke() then
util.add_unlock("foundry", "woodcoke")
end
@ -112,7 +111,7 @@ data:extend({
})
if me.founding_plates() then
if util.me.founding_plates() then
data:extend({
{
type = "technology",

View file

@ -1,8 +1,7 @@
local rusty_locale = require("__rusty-locale__.locale")
local rusty_icons = require("__rusty-locale__.icons")
local futil = require("util")
local util = require("__bzlib__/data-util")
local me = require("me")
local util = require("data-util")
function has_suffix(s, suffix)
return string.sub(s, -string.len(suffix), -1) == suffix
@ -141,7 +140,7 @@ function get_probability(n)
return roots[n]
end
if me.founding_plates() then
if util.me.founding_plates() then
local new_recipes = {}
for name, recipe in pairs(data.raw.recipe) do
if not (recipe.category == "smelting" or (mods["space-exploration"] and recipe.category == "casting")) then goto continue end

View file

@ -1,4 +1,12 @@
data:extend({
{
type = "string-setting",
name = "bzfoundry-recipe-bypass",
setting_type = "startup",
default_value = "",
allow_blank = true,
order = "aaa",
},
{
type = "string-setting",
name = "bzfoundry-hydrocarbon",