0
0
Fork 0

Added Dig_By_Water group --> the water dig and remove the node but drop (if the item drop)

This commit is contained in:
davedevils 2015-07-01 07:37:51 +02:00
parent f836f85170
commit fe773cd91a
2 changed files with 29 additions and 10 deletions

View File

@ -96,6 +96,25 @@ 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"})
end
end
end
end,
})
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},

View File

@ -623,7 +623,7 @@ minetest.register_node("default:junglegrass", {
buildable_to = true,
is_ground_content = true,
stack_max = 64,
groups = {snappy=3,flammable=2,attached_node=1},
groups = {snappy=3,flammable=2,attached_node=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
@ -1678,7 +1678,7 @@ minetest.register_node("default:grass", {
walkable = false,
buildable_to = true,
is_ground_content = true,
groups = {snappy=3,flammable=3,attached_node=1,dig_immediate=3},
groups = {snappy=3,flammable=3,attached_node=1,dig_immediate=3,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item()
@ -1735,24 +1735,24 @@ minetest.register_node("default:sponge", {
on_water = true
end
for i=-1,1 do
p = {x=pos.x+i, y=pos.y, z=pos.z}
n = minetest.env:get_node(p)
local p = {x=pos.x+i, y=pos.y, 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") or (n.name == "default:water_source") then
on_water = true
end
end
for i=-1,1 do
p = {x=pos.x, y=pos.y+i, z=pos.z}
n = minetest.env:get_node(p)
local p = {x=pos.x, y=pos.y+i, 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") or (n.name == "default:water_source") then
on_water = true
end
end
for i=-1,1 do
p = {x=pos.x, y=pos.y, z=pos.z+i}
n = minetest.env:get_node(p)
local p = {x=pos.x, y=pos.y, z=pos.z+i}
local n = minetest.env:get_node(p)
-- On verifie si il y a de l'eau
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
on_water = true
@ -1774,8 +1774,8 @@ minetest.register_node("default:sponge", {
end
end
end
p = {x=pos.x, y=pos.y, z=pos.z}
n = minetest.env:get_node(p)
local p = {x=pos.x, y=pos.y, z=pos.z}
local n = minetest.env:get_node(p)
if change == true then
minetest.env:add_node(pointed_thing.above, {name = "default:sponge_wet"})
else