2018-04-04 19:19:33 +02:00
|
|
|
metal_melter.melts = {}
|
|
|
|
|
|
|
|
-- fluidity.molten_metals - metals
|
|
|
|
|
|
|
|
function metal_melter.register_melt(item, metal, type)
|
|
|
|
if not metal_melter.melts[metal] then
|
|
|
|
metal_melter.melts[metal] = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
if not metal_melter.melts[metal][type] then
|
|
|
|
metal_melter.melts[metal][type] = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
table.insert(metal_melter.melts[metal][type], item)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Autofind meltable
|
|
|
|
local autofind = {"ingot", "lump", "crystal", "ore", "block"}
|
2018-07-28 18:15:16 +02:00
|
|
|
local modfind = {"default", "technic", "moreores", "elepower_dynamics"}
|
2018-04-04 19:19:33 +02:00
|
|
|
|
2018-07-28 18:28:43 +02:00
|
|
|
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
|
2018-04-04 19:19:33 +02:00
|
|
|
|
|
|
|
if minetest.registered_items[name] then
|
|
|
|
metal_melter.register_melt(name, metal, k)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Manually register default blocks, for now
|
|
|
|
metal_melter.register_melt("default:mese", "mese", "block")
|
|
|
|
metal_melter.register_melt("default:obsidian", "obsidian", "block")
|
|
|
|
metal_melter.register_melt("default:goldblock", "gold", "block")
|
|
|
|
metal_melter.register_melt("default:steelblock", "steel", "block")
|
|
|
|
metal_melter.register_melt("default:copperblock", "copper", "block")
|
|
|
|
metal_melter.register_melt("default:tinblock", "tin", "block")
|
|
|
|
|
|
|
|
-- Special snowflake
|
|
|
|
metal_melter.register_melt("default:iron_lump", "steel", "lump")
|
2019-02-08 22:05:19 +01:00
|
|
|
|
|
|
|
-- Register melts after all mods have loaded
|
|
|
|
minetest.register_on_mods_loaded(function ()
|
|
|
|
for metal,_ in pairs(fluidity.molten_metals) do
|
|
|
|
metal_melter.auto_detect_metal_forms(metal)
|
|
|
|
end
|
|
|
|
end)
|