set objects on fire when in lava cauldron

This commit is contained in:
cora 2022-06-22 11:56:25 +02:00
parent 1401f398ae
commit ca6cf81e24
2 changed files with 10 additions and 2 deletions

View File

@ -129,18 +129,26 @@ local function cauldron_extinguish(obj,pos)
end
end
local etime = 0
minetest.register_globalstep(function(dtime)
etime = dtime + etime
if etime < 0.5 then return end
etime = 0
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)
elseif n and minetest.get_node(n).name:find("lava") then
mcl_burning.set_on_fire(pl, 5)
end
end
for _,ent in pairs(minetest.luaentities) do
if ent.object:get_pos() then
if ent.object:get_pos() and ent.is_mob 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)
elseif n and minetest.get_node(n).name:find("lava") then
mcl_burning.set_on_fire(ent.object, 5)
end
end
end

View File

@ -1,3 +1,3 @@
name = mcl_cauldrons
depends = mcl_core, mcl_sounds
optional_depends = mclx_core, doc
optional_depends = mclx_core, doc, mcl_burning