mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
globalstep instead of abm to extinguish objects
This commit is contained in:
parent
3a7022ab66
commit
1401f398ae
1 changed files with 22 additions and 13 deletions
|
@ -120,19 +120,28 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
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
|
||||
local function cauldron_extinguish(obj,pos)
|
||||
local node = minetest.get_node(pos)
|
||||
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
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _,pl in pairs(minetest.get_connected_players()) do
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue