break tubes on blast

This commit is contained in:
DS-Minetest 2017-04-08 16:47:42 +02:00
parent 2c02d792bf
commit 9ee97e1ed1

View File

@ -38,11 +38,11 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
local outboxes = {} local outboxes = {}
local outsel = {} local outsel = {}
local outimgs = {} local outimgs = {}
for i = 1, 6 do for i = 1, 6 do
outimgs[vti[i]] = plain[i] outimgs[vti[i]] = plain[i]
end end
for _, v in ipairs(connects) do for _, v in ipairs(connects) do
pipeworks.table_extend(outboxes, pipeworks.tube_boxes[v]) pipeworks.table_extend(outboxes, pipeworks.tube_boxes[v])
table.insert(outsel, pipeworks.tube_selectboxes[v]) table.insert(outsel, pipeworks.tube_selectboxes[v])
@ -73,10 +73,10 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 } outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
wscale = {x = 1, y = 1, z = 0.01} wscale = {x = 1, y = 1, z = 0.01}
end end
local rname = string.format("%s_%s", name, tname) local rname = string.format("%s_%s", name, tname)
table.insert(tubenodes, rname) table.insert(tubenodes, rname)
local nodedef = { local nodedef = {
description = tubedesc, description = tubedesc,
drawtype = "nodebox", drawtype = "nodebox",
@ -107,12 +107,20 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
priority = 50 priority = 50
}, },
after_place_node = pipeworks.after_place, after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig after_dig_node = pipeworks.after_dig,
on_blast = function(pos, intensity)
if intensity > 1 + 3^0.5 then
minetest.remove_node(pos)
return {string.format("%s_%s", name, dropname)}
end
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
pipeworks.scan_for_tube_objects(pos)
end
} }
if style == "6d" then if style == "6d" then
nodedef.paramtype2 = "facedir" nodedef.paramtype2 = "facedir"
end end
if special == nil then special = {} end if special == nil then special = {} end
for key, value in pairs(special) do for key, value in pairs(special) do