2015-10-16 18:46:11 +02:00
|
|
|
-- simple mesh-based round trees mod
|
|
|
|
-- by VanessaEzekowitz
|
|
|
|
--
|
|
|
|
-- Textures borrowed/derived from Mossmanikin's alternate trunks mod, cc-by-sa
|
|
|
|
-- code: WTFPL
|
|
|
|
|
|
|
|
local trees={
|
|
|
|
{ "default:tree", "round_default_tree_top.png" },
|
|
|
|
{ "default:jungletree", "default_jungletree_top.png" },
|
|
|
|
{ "default:pine_tree", "round_pine_tree_top.png" },
|
|
|
|
{ "default:acacia_tree", "round_acacia_tree_top.png" },
|
|
|
|
{ "default:cactus", "default_cactus_top.png" }
|
|
|
|
}
|
|
|
|
|
2016-03-30 09:48:02 +02:00
|
|
|
local trees2 = {}
|
2015-10-16 18:46:11 +02:00
|
|
|
|
2016-03-29 15:32:40 +02:00
|
|
|
for _,tree in pairs(trees) do
|
|
|
|
local nodename, top = unpack(tree)
|
2015-10-16 18:46:11 +02:00
|
|
|
|
|
|
|
local oldnode = minetest.registered_nodes[nodename]
|
2016-03-29 15:32:40 +02:00
|
|
|
if not oldnode then
|
|
|
|
error("[round_trunks] "..nodename.." is not a node.")
|
|
|
|
end
|
|
|
|
|
|
|
|
local def = {}
|
|
|
|
for i in pairs(oldnode) do
|
|
|
|
def[i] = rawget(oldnode, i)
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.override_item(nodename, {
|
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "round_trunks_mesh.obj",
|
|
|
|
tiles = {top, top, def.tiles[3]},
|
|
|
|
paramtype = "light",
|
|
|
|
})
|
2015-10-16 20:20:43 +02:00
|
|
|
|
2016-03-30 09:48:02 +02:00
|
|
|
trees2[#trees2+1] = nodename
|
2015-10-16 18:46:11 +02:00
|
|
|
|
2016-03-29 15:32:40 +02:00
|
|
|
minetest.register_node(":"..nodename.."_cube", def)
|
2015-10-16 18:46:11 +02:00
|
|
|
|
2015-10-16 20:20:43 +02:00
|
|
|
|
|
|
|
minetest.register_craft({
|
2016-03-29 15:32:40 +02:00
|
|
|
output = nodename.." 4",
|
2015-10-16 20:20:43 +02:00
|
|
|
recipe = {
|
2016-03-29 15:32:40 +02:00
|
|
|
{ def.name, def.name },
|
|
|
|
{ def.name, def.name }
|
2015-10-16 20:20:43 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2016-03-29 15:32:40 +02:00
|
|
|
output = def.name.." 4",
|
2015-10-16 20:20:43 +02:00
|
|
|
recipe = {
|
2016-03-29 15:32:40 +02:00
|
|
|
{ nodename, nodename },
|
|
|
|
{ nodename, nodename }
|
2015-10-16 20:20:43 +02:00
|
|
|
}
|
|
|
|
})
|
2015-10-16 18:46:11 +02:00
|
|
|
end
|
|
|
|
|
2016-03-30 09:48:02 +02:00
|
|
|
-- [[ This lbm should fix black trunks.
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "round_trunks:trunkfix",
|
2015-10-16 18:46:11 +02:00
|
|
|
nodenames = trees2,
|
|
|
|
action = function(pos, node)
|
2016-03-30 09:48:02 +02:00
|
|
|
node.param1 = nil
|
|
|
|
minetest.set_node(pos, node)
|
2015-10-16 18:46:11 +02:00
|
|
|
end
|
|
|
|
})
|
2016-03-29 15:32:40 +02:00
|
|
|
--]]
|