basic founding fix for other machines

This commit is contained in:
Brevven 2022-07-24 14:56:39 -07:00
parent ae2c68379d
commit 699c6fb155
4 changed files with 27 additions and 11 deletions

View file

@ -1,8 +1,11 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.2.4 Version: 0.2.4
Date: 2022-07-16 Date: 2022-07-25
Changes: Changes:
- ru locale thanks to Pergamum663 - ru locale thanks to Pergamum663
Fixes:
- With tin enabled, other machines set to do founding can now do solder or aai glass.
- Clean up some logging
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.2.3 Version: 0.2.3
Date: 2022-07-16 Date: 2022-07-16

View file

@ -20,23 +20,30 @@ if util.me.enable() then
else else
-- If we're not using Foundry buildings, add founding recipes to assemblers in vanilla, or furnaces in K2 -- 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" local sought = mods.Krastorio2 and "smelting" or "crafting"
log ("looking for "..sought)
for i, machine in pairs(data.raw["assembling-machine"]) do for i, machine in pairs(data.raw["assembling-machine"]) do
log(serpent.dump(machine))
for j, category in pairs(machine.crafting_categories) do for j, category in pairs(machine.crafting_categories) do
if category == sought then if category == sought then
log ("found "..category)
util.add_crafting_category("assembling-machine", machine.name, "founding") util.add_crafting_category("assembling-machine", machine.name, "founding")
if util.me.basic_founding() then
util.add_crafting_category("assembling-machine", machine.name, "basic-founding")
end
break break
end end
end end
end end
util.add_crafting_category("assembling-machine", "industrial-furnace", "founding") util.add_crafting_category("assembling-machine", "industrial-furnace", "founding")
util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "founding") util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "founding")
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 end
for i, machine in pairs(util.me.get_other_machines()) do for i, machine in pairs(util.me.get_other_machines()) do
log("Allowing "..machine.." to handle founding") log("Allowing "..machine.." to handle founding")
util.add_crafting_category("assembling-machine", machine, "founding") util.add_crafting_category("assembling-machine", machine, "founding")
if util.me.basic_founding() then
util.add_crafting_category("assembling-machine", machine, "basic-founding")
end
end end

4
me.lua
View file

@ -2,6 +2,10 @@ local me = {}
me.name = "bzfoundry" me.name = "bzfoundry"
function me.basic_founding()
return mods.bztin or mods.bzaluminum
end
function me.founding_plates() function me.founding_plates()
return me.get_setting("bzfoundry-plates") == "yes" return me.get_setting("bzfoundry-plates") == "yes"
end end

View file

@ -1,14 +1,16 @@
local util = require("data-util")
data:extend({ data:extend({
{ type = "recipe-category", name = "founding"}, { type = "recipe-category", name = "founding"},
{ type = "item-subgroup", name = "founding-machines", group = "production"}, { type = "item-subgroup", name = "founding-machines", group = "production"},
{ type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"}, { type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"},
}) })
if mods.bztin or mods.bzaluminum then if util.me.basic_founding() then
data:extend({ data:extend({
{ type = "recipe-category", name = "basic-founding"}, { type = "recipe-category", name = "basic-founding"},
}) })
for i, character in pairs(data.raw.character) do for i, character in pairs(data.raw.character) do
table.insert(character.crafting_categories, "basic-founding") table.insert(character.crafting_categories, "basic-founding")
end end
end end