mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Simplify my own mess... remove code dupe
i'll fix this in cauldrons too, promise
This commit is contained in:
parent
f0241bbf6a
commit
3c2633ee2c
1 changed files with 13 additions and 9 deletions
|
@ -119,23 +119,27 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
local function burn_in_campfire(obj)
|
||||
local p = obj:get_pos()
|
||||
if p then
|
||||
local n = minetest.find_node_near(p,0.4,{"group:lit_campfire"},true)
|
||||
if n then
|
||||
mcl_burning.set_on_fire(obj, 5)
|
||||
end
|
||||
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:lit_campfire"},true)
|
||||
if n then
|
||||
mcl_burning.set_on_fire(pl, 5)
|
||||
end
|
||||
burn_in_campfire(pl)
|
||||
end
|
||||
for _,ent in pairs(minetest.luaentities) do
|
||||
if ent.object:get_pos() and ent.is_mob then
|
||||
local n = minetest.find_node_near(ent.object:get_pos(),0.4,{"group:lit_campfire"},true)
|
||||
if n then
|
||||
mcl_burning.set_on_fire(ent.object, 5)
|
||||
end
|
||||
if ent.is_mob then
|
||||
burn_in_campfire(ent.object)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue