return c_fire
else
local node_drops = minetest.get_node_drops(def.name, "")
- for _, item in ipairs(node_drops) do
+ for _, item in pairs(node_drops) do
add_drop(drops, item)
end
return c_air
}, nil)
end
end
- for _, item in ipairs(entity_drops) do
+ for _, item in pairs(entity_drops) do
add_drop(drops, item)
end
end
})
end
-function tnt.burn(pos)
- local name = minetest.get_node(pos).name
+function tnt.burn(pos, nodename)
+ local name = nodename or minetest.get_node(pos).name
local group = minetest.get_item_group(name, "tnt")
if group > 0 then
minetest.sound_play("tnt_ignite", {pos = pos})
vm:update_liquids()
-- call nodeupdate for everything within 1.5x blast radius
+ for y = -radius * 1.5, radius * 1.5 do
for z = -radius * 1.5, radius * 1.5 do
for x = -radius * 1.5, radius * 1.5 do
- for y = -radius * 1.5, radius * 1.5 do
- local s = vector.add(pos, {x = x, y = y, z = z})
- local r = vector.distance(pos, s)
+ local rad = {x = x, y = y, z = z}
+ local s = vector.add(pos, rad)
+ local r = vector.length(rad)
if r / radius < 1.4 then
- nodeupdate(s)
+ nodeupdate_single(s)
end
end
end
end
- for _, queued_data in ipairs(on_blast_queue) do
+ for _, queued_data in pairs(on_blast_queue) do
local dist = math.max(1, vector.distance(queued_data.pos, pos))
local intensity = (radius * radius) / (dist * dist)
local node_drops = queued_data.on_blast(queued_data.pos, intensity)
if node_drops then
- for _, item in ipairs(node_drops) do
+ for _, item in pairs(node_drops) do
add_drop(drops, item)
end
end
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
- tnt.burn(pos)
+ tnt.burn(pos, node.name)
end
end,
on_blast = function(pos, intensity)
- tnt.burn(pos)
+ tnt.burn(pos, "tnt:gunpowder")
end,
})
neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"},
interval = 4,
chance = 1,
- action = tnt.burn,
+ action = function(pos, node)
+ tnt.burn(pos, node.name)
+ end,
})
end