round_trunks/init.lua

69 lines
1.4 KiB
Lua
Raw Normal View History

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
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]
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",
})
2016-03-30 09:48:02 +02:00
trees2[#trees2+1] = nodename
2015-10-16 18:46:11 +02:00
minetest.register_node(":"..nodename.."_cube", def)
2015-10-16 18:46:11 +02:00
minetest.register_craft({
output = nodename.." 4",
recipe = {
{ def.name, def.name },
{ def.name, def.name }
}
})
minetest.register_craft({
output = def.name.." 4",
recipe = {
{ nodename, nodename },
{ nodename, nodename }
}
})
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
})
--]]