New Roots

Sheets instead of complex nodes.
Support for More Trees! and Tiny Trees.
Now generate.
master
Mossmanikin 2013-10-16 19:01:50 +02:00
parent 55d960cf4c
commit 51f05ac72a
3 changed files with 78 additions and 21 deletions

View File

@ -495,4 +495,67 @@ plantslib:register_generate_plant({
},
"abstract_trunks.grow_moss_on_trunk"
)
end
-----------------------------------------------------------------------------------------------
-- RooTS
-----------------------------------------------------------------------------------------------
if Roots == true then -- see settings.txt
abstract_trunks.grow_roots = function(pos)
local twig_size = math.random(1,27)
local right_here = {x=pos.x , y=pos.y , z=pos.z }
local below = {x=pos.x , y=pos.y-1, z=pos.z }
local north = {x=pos.x , y=pos.y , z=pos.z+1}
local east = {x=pos.x+1, y=pos.y , z=pos.z }
local south = {x=pos.x , y=pos.y , z=pos.z-1}
local west = {x=pos.x-1, y=pos.y , z=pos.z }
local node_here = minetest.get_node(right_here)
local node_below = minetest.get_node(below)
local node_north = minetest.get_node(north)
local node_east = minetest.get_node(east)
local node_south = minetest.get_node(south)
local node_west = minetest.get_node(west)
for i in pairs(TRuNKS) do
local MoD = TRuNKS[i][1]
local TRuNK = TRuNKS[i][2]
if minetest.get_modpath(MoD) ~= nil
and node_here.name == MoD..":"..TRuNK
and string.find(node_below.name, "dirt")
and node_here.param2 == 0 then
if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name="trunks:"..TRuNK.."root", param2=2})
end
if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name="trunks:"..TRuNK.."root", param2=3})
end
if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name="trunks:"..TRuNK.."root", param2=0})
end
if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name="trunks:"..TRuNK.."root", param2=1})
end
end
end
end
plantslib:register_generate_plant({
surface = {"group:tree"},
max_count = 1000,
rarity = 1,
min_elevation = 1,
max_elevation = 40,
near_nodes = {"default:dirt_with_grass"},
near_nodes_size = 1,
near_nodes_vertical = 1,
near_nodes_count = 1,
plantlife_limit = -1,
check_air = false,
},
"abstract_trunks.grow_roots"
)
end

View File

@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------
local title = "Trunks"
local version = "0.1.3"
local version = "0.1.4"
local mname = "trunks"
-----------------------------------------------------------------------------------------------
-- Code by Mossmanikin & Neuromancer

View File

@ -293,24 +293,9 @@ end
-----------------------------------------------------------------------------------------------
if Roots == true then -- see settings.txt
local roots_cube = {-4/16, -1/2, 3/16, 4/16, -3/16, 1/2}
local roots_cube = {-2/16, -1/2, -3/16, 2/16, 1/16, 1/2}
local trunk_roots = {
-- { left , bottom , front , right , top , back }
{-1/16 , -8/16 , 3/16 , 1/16 , -7/16 , 8/16 },
{-2/16 , -8/16 , 5/16 , 2/16 , -7/16 , 8/16 },
{-3/16 , -8/16 , 6/16 , 3/16 , -7/16 , 8/16 },
{-4/16 , -8/16 , 7/16 , 4/16 , -7/16 , 9/16 },
{-1/16 , -7/16 , 5/16 , 1/16 , -6/16 , 8/16 },
{-2/16 , -7/16 , 6/16 , 2/16 , -6/16 , 8/16 },
{-3/16 , -7/16 , 7/16 , 3/16 , -6/16 , 8/16 },
{-1/16 , -6/16 , 6/16 , 1/16 , -5/16 , 8/16 },
{-2/16 , -6/16 , 7/16 , 2/16 , -5/16 , 8/16 },
{-1/16 , -5/16 , 7/16 , 1/16 , -3/16 , 8/16 },
}
local roots_sheet = {0, -1/2, -1/2, 0, 1/16, 1/2}
local TRuNKS = {
-- MoD TRuNK
@ -346,17 +331,26 @@ for i in pairs(TRuNKS) do
description = des.." Root",
paramtype = "light",
paramtype2 = "facedir",
tiles = {MoD.."_"..TRuNK..".png"},
tiles = {
--[[top]] MoD.."_"..TRuNK..".png",
--[[bottom]] MoD.."_"..TRuNK..".png",
--[[right]] MoD.."_"..TRuNK..".png^trunks_root_mask.png^[makealpha:0,0,0",
--[[left]] MoD.."_"..TRuNK..".png^trunks_root_mask.png^[transformFX^[makealpha:0,0,0",
--[[back]] MoD.."_"..TRuNK..".png",
--[[front]] MoD.."_"..TRuNK..".png"
},
drawtype = "nodebox",
selection_box = {type = "fixed", fixed = roots_cube},
node_box = {type = "fixed", fixed = trunk_roots},
node_box = {type = "fixed", fixed = roots_sheet},
groups = {
tree=1,
snappy=1,
choppy=2,
oddly_breakable_by_hand=1,
flammable=2
flammable=2--,
--not_in_creative_inventory=1 -- atm in inv for testing
},
--drop = "trunks:twig_1", -- not sure about this yet
sounds = default.node_sound_wood_defaults(),
})