| | |
| | | |
| | | local S = technic.getter |
| | | |
| | | if unified_inventory and unified_inventory.register_craft_type then |
| | | unified_inventory.register_craft_type("alloy", { |
| | | description = S("Alloy cooking"), |
| | | height = 2, |
| | | width = 1, |
| | | }) |
| | | end |
| | | |
| | | -- Register alloy recipes |
| | | technic.alloy_recipes = {} |
| | | |
| | | -- Register recipe in a table |
| | | technic.register_alloy_recipe = function(metal1, count1, metal2, count2, result, count3) |
| | | in1 = { |
| | | local in1 = { |
| | | name = metal1, |
| | | count = count1, |
| | | } |
| | | in2 = { |
| | | local in2 = { |
| | | name = metal2, |
| | | count = count2, |
| | | } |
| | |
| | | type = "alloy", |
| | | output = result.." "..count3, |
| | | items = {metal1.." "..count1, metal2.." "..count2}, |
| | | width = 2, |
| | | width = 0, |
| | | }) |
| | | end |
| | | end |
| | | |
| | | minetest.after(0.01, function () |
| | | for _, recipe in pairs(technic.alloy_recipes) do |
| | | local in1 = recipe.input[1] |
| | | local in2 = recipe.input[2] |
| | | local in1n = in1.name |
| | | local in2n = in2.name |
| | | while minetest.registered_aliases[in1n] do |
| | | in1n = minetest.registered_aliases[in1n] |
| | | end |
| | | while minetest.registered_aliases[in2n] do |
| | | in2n = minetest.registered_aliases[in2n] |
| | | end |
| | | if in1n > in2n then |
| | | local temp = in1 |
| | | in1 = in2 |
| | | in2 = temp |
| | | temp = in1n |
| | | in1n = in2n |
| | | in2n = temp |
| | | end |
| | | technic.alloy_recipes[in1n.." "..in2n] = { |
| | | input = { |
| | | { name = in1n, count = in1.count }, |
| | | { name = in2n, count = in2.count }, |
| | | }, |
| | | output = recipe.output, |
| | | } |
| | | end |
| | | end) |
| | | |
| | | -- Retrieve a recipe given the input metals. |
| | | function technic.get_alloy_recipe(stack1, stack2) |
| | |
| | | |
| | | technic.register_alloy_recipe("technic:copper_dust", 3, "technic:tin_dust", 1, "technic:bronze_dust", 4) |
| | | technic.register_alloy_recipe("default:copper_ingot", 3, "moreores:tin_ingot", 1, "moreores:bronze_ingot", 4) |
| | | technic.register_alloy_recipe("technic:iron_dust", 3, "technic:chromium_dust", 1, "technic:stainless_steel_dust", 4) |
| | | technic.register_alloy_recipe("default:steel_ingot", 3, "technic:chromium_ingot", 1, "technic:stainless_steel_ingot", 4) |
| | | technic.register_alloy_recipe("technic:wrought_iron_dust", 1, "technic:coal_dust", 1, "technic:carbon_steel_dust", 1) |
| | | technic.register_alloy_recipe("technic:wrought_iron_ingot", 1, "technic:coal_dust", 1, "technic:carbon_steel_ingot", 1) |
| | | technic.register_alloy_recipe("technic:carbon_steel_dust", 1, "technic:coal_dust", 1, "technic:cast_iron_dust", 1) |
| | | technic.register_alloy_recipe("technic:carbon_steel_ingot", 1, "technic:coal_dust", 1, "technic:cast_iron_ingot", 1) |
| | | technic.register_alloy_recipe("technic:carbon_steel_dust", 3, "technic:chromium_dust", 1, "technic:stainless_steel_dust", 4) |
| | | technic.register_alloy_recipe("technic:carbon_steel_ingot", 3, "technic:chromium_ingot", 1, "technic:stainless_steel_ingot", 4) |
| | | technic.register_alloy_recipe("technic:copper_dust", 2, "technic:zinc_dust", 1, "technic:brass_dust", 3) |
| | | technic.register_alloy_recipe("default:copper_ingot", 2, "technic:zinc_ingot", 1, "technic:brass_ingot", 3) |
| | | technic.register_alloy_recipe("default:sand", 2, "technic:coal_dust", 2, "technic:silicon_wafer", 1) |
| | |
| | | formspec = formspec.. |
| | | "list[current_name;upgrade1;1,4;1,1;]".. |
| | | "list[current_name;upgrade2;2,4;1,1;]".. |
| | | "label[1,5;Upgrade Slots]" |
| | | "label[1,5;"..S("Upgrade Slots").."]" |
| | | end |
| | | |
| | | minetest.register_node("technic:"..ltier.."_alloy_furnace", { |
| | |
| | | end |
| | | if not result or |
| | | not inv:room_for_item("dst", result) then |
| | | hacky_swap_node(pos, machine_node) |
| | | technic.swap_node(pos, machine_node) |
| | | meta:set_string("infotext", S("%s Idle"):format(machine_name)) |
| | | meta:set_int(tier.."_EU_demand", 0) |
| | | return |
| | |
| | | |
| | | if eu_input < machine_demand[EU_upgrade+1] then |
| | | -- Unpowered - go idle |
| | | hacky_swap_node(pos, machine_node) |
| | | technic.swap_node(pos, machine_node) |
| | | meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |
| | | elseif eu_input >= machine_demand[EU_upgrade+1] then |
| | | -- Powered |
| | | hacky_swap_node(pos, machine_node.."_active") |
| | | technic.swap_node(pos, machine_node.."_active") |
| | | meta:set_string("infotext", S("%s Active"):format(machine_name)) |
| | | meta:set_int("src_time", meta:get_int("src_time") + 1) |
| | | if meta:get_int("src_time") == data.cook_time then |