use remove_node instead of dig_node to fix a crash

This commit is contained in:
HybridDog 2015-08-05 10:07:02 +02:00
parent 32d776293b
commit 6ccf260370

View File

@ -683,7 +683,7 @@ minetest.register_abm({
neighbors = {"technic:corium_source"},
interval = 1,
chance = 1,
action = function (pos, node)
action = function(pos)
minetest.remove_node(pos)
end,
})
@ -693,7 +693,7 @@ minetest.register_abm({
neighbors = {"group:water"},
interval = 1,
chance = 1,
action = function (pos, node)
action = function(pos)
minetest.set_node(pos, {name="technic:chernobylite_block"})
end,
})
@ -704,28 +704,35 @@ minetest.register_abm({
nodenames = {"technic:corium_flowing"},
interval = 5,
chance = (griefing and 10 or 1),
action = function (pos, node)
action = function (pos)
minetest.set_node(pos, {name="technic:chernobylite_block"})
end,
})
if griefing then
minetest.register_abm({
nodenames = { "technic:corium_source", "technic:corium_flowing" },
interval = 4,
chance = 4,
action = function (pos, node)
for _, offset in ipairs({
if not griefing then
return
end
local offsets = {
vector.new(1,0,0),
vector.new(-1,0,0),
vector.new(0,0,1),
vector.new(0,0,-1),
vector.new(0,-1,0),
}) do
}
minetest.register_abm({
nodenames = {"technic:corium_source", "technic:corium_flowing"},
interval = 4,
chance = 4,
action = function(pos)
for _,offset in pairs(offsets) do
if math.random(8) == 1 then
minetest.dig_node(vector.add(pos, offset))
local pos = vector.add(pos, offset)
if minetest.get_node(pos).name ~= "air" then
minetest.remove_node(pos)
end
end
end
end,
})
end