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