globalstep instead of abm to extinguish objects

This commit is contained in:
cora 2022-06-21 14:24:15 +02:00
parent 3a7022ab66
commit 1401f398ae
1 changed files with 22 additions and 13 deletions

View File

@ -120,19 +120,28 @@ minetest.register_craft({
} }
}) })
minetest.register_abm({ local function cauldron_extinguish(obj,pos)
label = "cauldrons", local node = minetest.get_node(pos)
nodenames = {"group:cauldron_filled"}, if mcl_burning.is_burning(obj) then
interval = 0.5, mcl_burning.extinguish(obj)
chance = 1, local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
action = function(pos, node) minetest.swap_node(pos, {name = "mcl_cauldrons:cauldron" .. (new_group == 0 and "" or "_" .. new_group)})
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do end
if mcl_burning.is_burning(obj) then end
mcl_burning.extinguish(obj)
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1 minetest.register_globalstep(function(dtime)
minetest.swap_node(pos, {name = "mcl_cauldrons:cauldron" .. (new_group == 0 and "" or "_" .. new_group)}) for _,pl in pairs(minetest.get_connected_players()) do
break local n = minetest.find_node_near(pl:get_pos(),0.4,{"group:cauldron_filled"},true)
if n and not minetest.get_node(n).name:find("lava") then
cauldron_extinguish(pl,n)
end
end
for _,ent in pairs(minetest.luaentities) do
if ent.object:get_pos() then
local n = minetest.find_node_near(ent.object:get_pos(),0.4,{"group:cauldron_filled"},true)
if n and not minetest.get_node(n).name:find("lava") then
cauldron_extinguish(ent.object,n)
end end
end end
end end
}) end)