use pilzadam's clone-node method to modify trunks

master
Vanessa Ezekowitz 2013-11-07 12:35:43 -05:00
parent a8bafd455e
commit a76117a208
1 changed files with 19 additions and 25 deletions

View File

@ -1,7 +1,18 @@
-- Code by Mossmanikin & Neuromancer -- Code by Mossmanikin, Neuromancer, and others
local function clone_node(name)
node2={}
node=minetest.registered_nodes[name]
for k,v in pairs(node) do
node2[k]=v
end
return node2
end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- TWiGS -- TWiGS
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
abstract_trunks.place_twig = function(pos) abstract_trunks.place_twig = function(pos)
local twig_size = math.random(1,27) local twig_size = math.random(1,27)
@ -217,32 +228,15 @@ for i in pairs(TRuNKS) do
local NR = TRuNKS[i][3] local NR = TRuNKS[i][3]
if minetest.get_modpath(MoD) ~= nil if minetest.get_modpath(MoD) ~= nil
and NR < 6 then -- moretrees trunks allready have facedir and NR < 6 then -- moretrees trunks allready have facedir
local des = minetest.registered_nodes[MoD..":"..TRuNK].description trunkname = MoD..":"..TRuNK
local par = minetest.registered_nodes[MoD..":"..TRuNK].paramtype temptrunk = clone_node(trunkname)
local tls = minetest.registered_nodes[MoD..":"..TRuNK].tiles temptrunk.paramtype2 = "facedir"
local tli = minetest.registered_nodes[MoD..":"..TRuNK].tile_images minetest.register_node(":"..trunkname, temptrunk)
-- local igc = minetest.registered_nodes[MoD..":"..TRuNK].is_ground_content
local grp = minetest.registered_nodes[MoD..":"..TRuNK].groups
-- local drp = minetest.registered_nodes[MoD..":"..TRuNK].drop
local snd = minetest.registered_nodes[MoD..":"..TRuNK].sounds
minetest.register_node(":"..MoD..":"..TRuNK, {
description = des,
paramtype = par,
paramtype2 = "facedir", -- main change for lying trunks
tiles = tls,
tile_images = tli,
-- is_ground_content = igc,
groups = grp,
-- drop = drp,
sounds = snd,
})
end end
end end
end end
abstract_trunks.place_trunk = function(pos) abstract_trunks.place_trunk = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
@ -558,4 +552,4 @@ plantslib:register_generate_plant({
"abstract_trunks.grow_roots" "abstract_trunks.grow_roots"
) )
end end