From 1756ce7afd5cced969cfdf64d9ba2e685acb8082 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sat, 28 Jul 2018 19:28:43 +0300 Subject: [PATCH] Minor tweaks --- metal_melter/caster.lua | 7 +------ metal_melter/meltable.lua | 16 ++++++++++++---- metal_melter/melter.lua | 12 ++++-------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/metal_melter/caster.lua b/metal_melter/caster.lua index 47cbccc..79c8765 100644 --- a/metal_melter/caster.lua +++ b/metal_melter/caster.lua @@ -417,12 +417,7 @@ local function on_construct(pos) inv:set_size('bucket_in', 1) inv:set_size('bucket_out', 1) - -- Fluid buffers - meta:set_int('water_fluid_storage', 0) - meta:set_int('metal_fluid_storage', 0) - - -- Metal source block - meta:set_string('metal_fluid', '') + -- Water source block meta:set_string('water_fluid', 'default:water_source') -- Default infotext diff --git a/metal_melter/meltable.lua b/metal_melter/meltable.lua index 406bf52..e109592 100644 --- a/metal_melter/meltable.lua +++ b/metal_melter/meltable.lua @@ -18,10 +18,14 @@ end local autofind = {"ingot", "lump", "crystal", "ore", "block"} local modfind = {"default", "technic", "moreores", "elepower_dynamics"} -for metal,_ in pairs(fluidity.molten_metals) do - for i,v in pairs(modfind) do - for j,k in pairs(autofind) do - local name = v..":"..metal.."_"..k +function metal_melter.auto_detect_metal_forms(metal, mod) + if mod then + local modfind = { [0] = mod } + end + + for i, v in pairs(modfind) do + for j, k in pairs(autofind) do + local name = v .. ":" .. metal .. "_" .. k if minetest.registered_items[name] then metal_melter.register_melt(name, metal, k) @@ -30,6 +34,10 @@ for metal,_ in pairs(fluidity.molten_metals) do end end +for metal,_ in pairs(fluidity.molten_metals) do + metal_melter.auto_detect_metal_forms(metal) +end + -- Manually register default blocks, for now metal_melter.register_melt("default:mese", "mese", "block") metal_melter.register_melt("default:obsidian", "obsidian", "block") diff --git a/metal_melter/melter.lua b/metal_melter/melter.lua index b7117a4..8ecca60 100644 --- a/metal_melter/melter.lua +++ b/metal_melter/melter.lua @@ -178,7 +178,8 @@ local function melter_node_timer(pos, elapsed) -- Handle input bucket, only allow a molten metal local bucket_in = inv:get_stack("bucket_in", 1) local bucket_name = bucket_in:get_name() - if (bucket_name:find("bucket") and bucket_name ~= "bucket:bucket_empty") or (not fluidity.florbs.get_is_empty_florb(bucket_in) and fluidity.florbs.get_is_florb(bucket_in)) then + if (bucket_name:find("bucket") and bucket_name ~= "bucket:bucket_empty") or (not fluidity.florbs.get_is_empty_florb(bucket_in) and + fluidity.florbs.get_is_florb(bucket_in)) then local is_florb = fluidity.florbs.get_is_florb(bucket_in) if is_florb then local contents, fluid_name, capacity = fluidity.florbs.get_florb_contents(bucket_in) @@ -328,13 +329,8 @@ local function on_construct(pos) inv:set_size('bucket_in', 1) inv:set_size('bucket_out', 1) - -- Fluid buffers - meta:set_int('lava_fluid_storage', 0) - meta:set_int('metal_fluid_storage', 0) - - -- Metal source block - meta:set_string('metal_fluid', '') - meta:set_string('lava_fluid', 'default:lava_source') + -- Lava source block + meta:set_string('lava_fluid', 'default:lava_source') -- Default infotext meta:set_string("infotext", "Metal Melter Inactive")