diff --git a/bzfoundry2/data-final-fixes.lua b/bzfoundry2/data-final-fixes.lua index 1c18473..19b317d 100644 --- a/bzfoundry2/data-final-fixes.lua +++ b/bzfoundry2/data-final-fixes.lua @@ -1,4 +1,4 @@ -local util = require("data-util") +local util = require("__bzlib__/data-util") require("refractory-updates") -- Prevent production deadlock diff --git a/bzfoundry2/data-util.lua b/bzfoundry2/data-util.lua deleted file mode 100644 index e2cbe2a..0000000 --- a/bzfoundry2/data-util.lua +++ /dev/null @@ -1,4 +0,0 @@ -local me = require("me") -local util = require("__bzlib__/data-util"); -util.initialize(me) -return util \ No newline at end of file diff --git a/bzfoundry2/data.lua b/bzfoundry2/data.lua index 05aea8a..6210765 100644 --- a/bzfoundry2/data.lua +++ b/bzfoundry2/data.lua @@ -1,8 +1,8 @@ -local util = require("data-util") +local me = require("me") require("prototypes/categories") -if util.me.enable() then +if me.enable() then require("prototypes/coke") require("prototypes/foundry") require("prototypes/entity/electric-foundry") diff --git a/bzfoundry2/foundry-updates.lua b/bzfoundry2/foundry-updates.lua index 2b97a61..c8dd446 100644 --- a/bzfoundry2/foundry-updates.lua +++ b/bzfoundry2/foundry-updates.lua @@ -1,17 +1,18 @@ -local util = require("data-util") +local util = require("__bzlib__/data-util") +local me = require("me") -if util.me.enable() then +if me.enable() then util.set_to_founding("steel-plate") - util.replace_some_ingredient("steel-plate", "iron-plate", 1, util.me.carbon(), 1) + util.replace_some_ingredient("steel-plate", "iron-plate", 1, 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", util.me.carbon(), 1) + util.add_ingredient("tungsten-carbide", 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", util.me.carbon(), 1) + util.add_ingredient(mods.Krastorio2 and "kr-silicon" or "silicon", me.carbon(), 1) util.set_to_founding("cermet") -- from zirconium util.set_to_founding("crucible") -- from graphite @@ -20,11 +21,11 @@ if util.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 i, machine in pairs(data.raw["assembling-machine"]) do - for j, category in pairs(machine.crafting_categories) do + for _, machine in pairs(data.raw["assembling-machine"]) do + for _, category in pairs(machine.crafting_categories) do if category == sought then util.add_crafting_category("assembling-machine", machine.name, "founding") - if util.me.basic_founding() then + if me.basic_founding() then util.add_crafting_category("assembling-machine", machine.name, "basic-founding") end break @@ -33,16 +34,16 @@ else end util.add_crafting_category("assembling-machine", "industrial-furnace", "founding") util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "founding") - if util.me.basic_founding() then + if 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 i, machine in pairs(util.me.get_other_machines()) do +for _, machine in pairs(me.get_other_machines()) do log("Allowing "..machine.." to handle founding") util.add_crafting_category("assembling-machine", machine, "founding") - if util.me.basic_founding() then + if me.basic_founding() then util.add_crafting_category("assembling-machine", machine, "basic-founding") end end diff --git a/bzfoundry2/me.lua b/bzfoundry2/me.lua index 0a0f081..cf4d867 100644 --- a/bzfoundry2/me.lua +++ b/bzfoundry2/me.lua @@ -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 diff --git a/bzfoundry2/prototypes/categories.lua b/bzfoundry2/prototypes/categories.lua index 1bea4d5..eb3bdad 100644 --- a/bzfoundry2/prototypes/categories.lua +++ b/bzfoundry2/prototypes/categories.lua @@ -1,4 +1,5 @@ -local util = require("data-util") +local util = require("__bzlib__/data-util") +local me = require("me") data:extend({ { type = "recipe-category", name = "founding"}, @@ -7,11 +8,11 @@ data:extend({ order = util.se6() and "a-b-z" or "c-z"}, }) -if util.me.basic_founding() then +if me.basic_founding() then data:extend({ { type = "recipe-category", name = "basic-founding"}, }) - for i, character in pairs(data.raw.character) do + for _, character in pairs(data.raw.character) do if character.crafting_categories then table.insert(character.crafting_categories, "basic-founding") end diff --git a/bzfoundry2/prototypes/coke.lua b/bzfoundry2/prototypes/coke.lua index 14dba26..f527ba7 100644 --- a/bzfoundry2/prototypes/coke.lua +++ b/bzfoundry2/prototypes/coke.lua @@ -1,6 +1,6 @@ -local util = require("data-util") +local me = require("me") -if util.me.carbon() == "coke" and not data.raw.item["coke"] then +if me.carbon() == "coke" and not data.raw.item["coke"] then data:extend({ { type = "item", @@ -31,7 +31,7 @@ data:extend({ enabled=false, }, }) - if util.me.woodcoke() then + if me.woodcoke() then data:extend({ { type = "recipe", @@ -48,7 +48,7 @@ data:extend({ }, }) end -elseif util.me.carbon() == "solid-fuel" then +elseif me.carbon() == "solid-fuel" then data:extend({ { type = "recipe", @@ -60,7 +60,7 @@ data:extend({ enabled=false, }, }) - if util.me.woodcoke() then + if me.woodcoke() then data:extend({ { type = "recipe", diff --git a/bzfoundry2/prototypes/entity/electric-foundry.lua b/bzfoundry2/prototypes/entity/electric-foundry.lua index b68aadc..365f2cc 100644 --- a/bzfoundry2/prototypes/entity/electric-foundry.lua +++ b/bzfoundry2/prototypes/entity/electric-foundry.lua @@ -1,11 +1,12 @@ require("util") -local futil = require("data-util") +local futil = require("__bzlib__/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({ { @@ -23,7 +24,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", futil.me.smelt() and "smelting" or nil}, + crafting_categories = {"founding", me.smelt() and "smelting" or nil}, energy_usage = "360kW", drain = "12kW", crafting_speed = 4, diff --git a/bzfoundry2/prototypes/entity/foundry.lua b/bzfoundry2/prototypes/entity/foundry.lua index 6141576..3f9bc3e 100644 --- a/bzfoundry2/prototypes/entity/foundry.lua +++ b/bzfoundry2/prototypes/entity/foundry.lua @@ -1,5 +1,5 @@ require("util") -local futil = require("data-util") +local futil = require("__bzlib__/data-util") local meld = require("meld") local fuel = {"chemical"} diff --git a/bzfoundry2/prototypes/foundry.lua b/bzfoundry2/prototypes/foundry.lua index 300b77b..c3fb7fc 100644 --- a/bzfoundry2/prototypes/foundry.lua +++ b/bzfoundry2/prototypes/foundry.lua @@ -1,4 +1,5 @@ -local util = require("data-util") +local util = require("__bzlib__/data-util") +local me = require("me") 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 @@ -36,7 +37,7 @@ data:extend({ prerequisites = {"automation"}, effects = { {type = "unlock-recipe", recipe = "foundry"}, - util.me.carbonrecipe() and {type = "unlock-recipe", recipe = util.me.carbonrecipe()}, + me.carbonrecipe() and {type = "unlock-recipe", recipe = me.carbonrecipe()}, }, unit = { count = 25, @@ -46,7 +47,7 @@ data:extend({ order = "foundry", }, }) -if util.me.woodcoke() then +if me.woodcoke() then util.add_unlock("foundry", "woodcoke") end @@ -111,7 +112,7 @@ data:extend({ }) -if util.me.founding_plates() then +if me.founding_plates() then data:extend({ { type = "technology", diff --git a/bzfoundry2/refractory-updates.lua b/bzfoundry2/refractory-updates.lua index 72f9602..a8a450e 100644 --- a/bzfoundry2/refractory-updates.lua +++ b/bzfoundry2/refractory-updates.lua @@ -1,7 +1,8 @@ local rusty_locale = require("__rusty-locale__.locale") local rusty_icons = require("__rusty-locale__.icons") local futil = require("util") -local util = require("data-util") +local util = require("__bzlib__/data-util") +local me = require("me") function has_suffix(s, suffix) return string.sub(s, -string.len(suffix), -1) == suffix @@ -140,7 +141,7 @@ function get_probability(n) return roots[n] end -if util.me.founding_plates() then +if 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 diff --git a/bzfoundry2/settings.lua b/bzfoundry2/settings.lua index ee0bb8a..9fbc7a6 100644 --- a/bzfoundry2/settings.lua +++ b/bzfoundry2/settings.lua @@ -1,12 +1,4 @@ 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",