1 minetest.register_alias("xdecor:cauldron", "xdecor:cauldron_empty")
3 local cauldron_cbox = {
6 {-0.5, -0.5, -0.5, 0.5, 0.5, -0.5},
7 {-0.5, -0.5, 0.5, 0.5, 0.5, 0.5},
8 {-0.5, -0.5, -0.5, -0.5, 0.5, 0.5},
9 {0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
10 {-0.5, -0.5, -0.5, 0.5, 0, 0.5}
14 xdecor.register("cauldron_empty", {
15 description = "Cauldron",
16 groups = {cracky=2, oddly_breakable_by_hand=1},
17 on_rotate = screwdriver.rotate_simple,
18 tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"},
19 infotext = "Cauldron (empty)",
20 on_rightclick = function(pos, node, clicker, itemstack, _)
21 local wield_item = clicker:get_wielded_item():get_name()
22 if wield_item == "bucket:bucket_water" or
23 wield_item == "bucket:bucket_river_water" then
24 minetest.set_node(pos, {name="xdecor:cauldron_idle", param2=node.param2})
25 itemstack:replace("bucket:bucket_empty")
28 collision_box = cauldron_cbox
31 xdecor.register("cauldron_idle", {
32 groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
33 on_rotate = screwdriver.rotate_simple,
34 tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"},
35 drop = "xdecor:cauldron_empty",
36 infotext = "Cauldron (idle)",
37 collision_box = cauldron_cbox
40 xdecor.register("cauldron_boiling_water", {
41 groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
42 on_rotate = screwdriver.rotate_simple,
43 drop = "xdecor:cauldron_empty",
44 infotext = "Cauldron (active) - Drop foods inside to make a soup",
45 damage_per_second = 2,
47 { name = "xdecor_cauldron_top_anim_boiling_water.png",
48 animation = {type="vertical_frames", length=3.0} },
49 "xdecor_cauldron_sides.png"
51 collision_box = cauldron_cbox
54 xdecor.register("cauldron_soup", {
55 groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
56 on_rotate = screwdriver.rotate_simple,
57 drop = "xdecor:cauldron_empty",
58 infotext = "Cauldron (active) - Use a bowl to eat the soup",
59 damage_per_second = 2,
61 { name = "xdecor_cauldron_top_anim_soup.png",
62 animation = {type="vertical_frames", length=3.0} },
63 "xdecor_cauldron_sides.png"
65 collision_box = cauldron_cbox,
66 on_rightclick = function(pos, node, clicker, itemstack, _)
67 local inv = clicker:get_inventory()
68 if clicker:get_wielded_item():get_name() == "xdecor:bowl" then
69 if inv:room_for_item("main", "xdecor:bowl_soup 1") then
71 inv:add_item("main", "xdecor:bowl_soup 1")
72 minetest.set_node(pos, {name="xdecor:cauldron_empty", param2=node.param2})
74 minetest.chat_send_player(clicker:get_player_name(),
75 "No room in your inventory to add a bowl of soup!")
82 minetest.register_abm({
83 nodenames = {"xdecor:cauldron_idle"},
84 interval = 15, chance = 1,
85 action = function(pos, node, _, _)
86 local below_node = {x=pos.x, y=pos.y-1, z=pos.z}
87 if minetest.get_node(below_node).name:find("fire") then
88 minetest.set_node(pos, {name="xdecor:cauldron_boiling_water", param2=node.param2})
93 minetest.register_abm({
94 nodenames = {"xdecor:cauldron_boiling_water"},
95 interval = 3, chance = 1,
96 action = function(pos, node, _, _)
98 local ingredients = {}
99 objs = minetest.get_objects_inside_radius(pos, 0.5)
100 if not objs then return end
102 for _, obj in pairs(objs) do
103 if obj and obj:get_luaentity() then
104 local itemstring = obj:get_luaentity().itemstring:match("([%w_:]+)%s")
105 if itemstring and not minetest.serialize(ingredients):find(itemstring) and
106 (itemstring:find("apple") or itemstring:find("mushroom") or
107 itemstring:find("honey") or itemstring:find("pumpkin")) then
108 ingredients[#ingredients+1] = itemstring
113 if #ingredients >= 2 then
114 for _, obj in pairs(objs) do
115 if obj and obj:get_luaentity() then
119 minetest.set_node(pos, {name="xdecor:cauldron_soup", param2=node.param2})
122 local below_node = {x=pos.x, y=pos.y-1, z=pos.z}
123 if not minetest.get_node(below_node).name:find("fire") then
124 minetest.set_node(pos, {name="xdecor:cauldron_idle", param2=node.param2})