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

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

View File

@ -96,22 +96,37 @@ grow_reeds = function(pos, node)
end
-- ABMs
minetest.register_abm({
nodenames = {"group:dig_by_water"},
neighbors = {"group:water"},
interval = 1,
chance = 1,
action = function(pos)
local originalpos = pos
for dx=-1,1 do
for dy=-1,1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
if minetest.env:get_node(pos).name == "group:water" then
minetest.env:set_node(pos, {name="default:air"})
action = function(pos, node, active_object_count, active_object_count_wider)
for xp=-1,1 do
for zp=-1,1 do
local p = {x=pos.x+xp, y=pos.y, z=pos.z+zp}
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
-- 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,
})

View File

@ -65,27 +65,6 @@ function farming:place_seed(itemstack, placer, pointed_thing, plantname)
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 =========
dofile(minetest.get_modpath("farming").."/soil.lua")

View File

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