MineClone2/mods/ITEMS/mcl_cauldrons/register.lua

48 lines
1.5 KiB
Lua

local S = minetest.get_translator(minetest.get_current_modname())
mcl_cauldrons.register_cauldron_type({
name = "water",
bucket = "mcl_buckets:bucket_water",
bottle = "mcl_potions:water",
desc = S("Cauldron (%s/3 Water)"),
texture = "default_water_source_animated.png"
})
if minetest.get_modpath("mclx_core") then
--register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
--register_filled_cauldron(2, S("Cauldron (2/3 River Water)"), true)
--register_filled_cauldron(3, S("Cauldron (3/3 River Water)"), true)
end
minetest.register_craft({
output = "mcl_cauldrons:cauldron",
recipe = {
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
{ "mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot" },
}
})
minetest.register_abm({
label = "cauldrons",
nodenames = {"group:cauldron_filled"},
interval = 0.5,
chance = 1,
action = function(pos, node)
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do
if mcl_burning.is_burning(obj) then
mcl_burning.extinguish(obj)
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
minetest.swap_node(pos, {name = "mcl_cauldrons:cauldron" .. (new_group == 0 and "" or "_" .. new_group)})
break
end
end
end
})
for i = 1, 3 do --Backward compatibility
minetest.register_alias("mcl_cauldrons:cauldron_"..i, "mcl_cauldrons:cauldron_water_"..i)
end
for i = 1, 3 do
minetest.register_alias("mcl_cauldrons:cauldron_"..i.."r", "mcl_cauldrons:cauldron_river_water_"..i)
end