Finish and clean the group dig_by_water , and now the fire can be stopped by water

This commit is contained in:
davedevils 2015-07-01 07:56:51 +02:00
parent fe773cd91a
commit 21f6253587
3 changed files with 24 additions and 30 deletions

@ -96,22 +96,37 @@ grow_reeds = function(pos, node)
end end
-- ABMs -- ABMs
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:dig_by_water"}, nodenames = {"group:dig_by_water"},
neighbors = {"group:water"}, neighbors = {"group:water"},
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos) action = function(pos, node, active_object_count, active_object_count_wider)
local originalpos = pos for xp=-1,1 do
for dx=-1,1 do for zp=-1,1 do
for dy=-1,1 do local p = {x=pos.x+xp, y=pos.y, z=pos.z+zp}
pos.x = pos.x+dx local n = minetest.env:get_node(p)
pos.y = pos.y+dy -- On verifie si il y a de l'eau
if minetest.env:get_node(pos).name == "group:water" then if (n.name=="default:water_flowing") then
minetest.env:set_node(pos, {name="default:air"}) drop_attached_node(pos)
minetest.env:dig_node(pos)
break
end end
end end
end end
-- cas rare
for yp=-1,1 do
local p = {x=pos.x, y=pos.y+yp, z=pos.z}
local n = minetest.env:get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") then
drop_attached_node(pos)
minetest.env:dig_node(pos)
break
end
end
end, end,
}) })

@ -65,27 +65,6 @@ function farming:place_seed(itemstack, placer, pointed_thing, plantname)
end end
minetest.register_abm({
nodenames = {"group:dig_by_water"},
neighbors = {"group:water"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for xp=-1,1 do
for zp=-1,1 do
p = {x=pos.x+xp, y=pos.y, z=pos.z+zp}
n = minetest.env:get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") then
drop_attached_node(pos)
minetest.env:dig_node(pos)
break
end
end
end
end,
})
-- ========= SOIL ========= -- ========= SOIL =========
dofile(minetest.get_modpath("farming").."/soil.lua") dofile(minetest.get_modpath("farming").."/soil.lua")

@ -9,7 +9,7 @@ minetest.register_node("fire:basic_flame", {
}}, }},
inventory_image = "fire_basic_flame.png", inventory_image = "fire_basic_flame.png",
light_source = 14, light_source = 14,
groups = {igniter=2,dig_immediate=3,hot=3}, groups = {igniter=2,dig_immediate=3,hot=3,dig_by_water=1},
drop = '', drop = '',
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,