added support for ethereal trees/wood

master
Sokomine 2014-08-28 05:27:02 +02:00
parent d0a91eb2b8
commit 9c286363a5
2 changed files with 31 additions and 2 deletions

View File

@ -171,9 +171,9 @@ mg_villages.lower_or_raise_terrain_at_point = function( x, z, target_height, min
if( has_snow ) then
data[ a:index( x, target_height+1, z)] = cid.c_snow;
elseif tree then
elseif( tree and not( mg_villages.ethereal_trees )) then
data[ a:index( x, target_height+1, z)] = cid.c_sapling
elseif jtree then
elseif( jtree and not( mg_villages.ethereal_trees )) then
data[ a:index( x, target_height+1, z)] = cid.c_jsapling
end
data[ a:index( x, target_height, z)] = surface_node;

View File

@ -1,4 +1,8 @@
-- ethereal comes with some intresting trees
if( minetest.get_modpath( 'ethereal' )) then
mg_villages.ethereal_trees = {'willow','redwood','frost','mushroom','yellow','palm','banana'};
end
-- only the function mg_villages.get_replacement_table(..) is called from outside this file
@ -34,6 +38,14 @@ mg_villages.replace_materials = function( replacements, pr, original_materials,
end
end
if( wood_found and mg_villages.ethereal_trees ) then
for _,v in ipairs( mg_villages.ethereal_trees ) do
if( minetest.registered_nodes[ "ethereal:"..v.."_wood"] ) then
table.insert( known_materials, "ethereal:"..v.."_wood" );
end
end
end
local new_material = known_materials[ pr:next( 1, #known_materials )];
-- no replacement necessary if we did choose the same material as before
@ -55,12 +67,23 @@ mg_villages.replace_tree_trunk = function( replacements, wood_type )
table.insert( replacements, {'default:tree', 'mg:savannatree'});
elseif( wood_type == 'mg:pinewood' ) then
table.insert( replacements, {'default:tree', 'mg:pinetree'});
elseif( moretrees and moretrees.treelist ) then
for _,v in ipairs( moretrees.treelist ) do
if( wood_type == "moretrees:"..v[1].."_planks" ) then
table.insert( replacements, {'default:tree', "moretrees:"..v[1].."_trunk"});
end
end
elseif( wood_type == 'ethereal:frost_wood' ) then
table.insert( replacements, {'default:tree', "ethereal:frost_tree"});
elseif( mg_villages.ethereal_trees ) then
for _,v in ipairs( mg_villages.ethereal_trees ) do
if( wood_type == "ethereal:"..v.."_wood" ) then
table.insert( replacements, {'default:tree', "ethereal:"..v.."_trunk"});
end
end
else
return nil;
end
@ -83,6 +106,12 @@ mg_villages.replace_saplings = function( replacements, wood_type )
table.insert( replacements, {'default:sapling', "moretrees:"..v[1].."_sapling_ongen"});
end
end
elseif( mg_villages.ethereal_trees ) then
for _,v in ipairs( mg_villages.ethereal_trees ) do
if( wood_type == "moretrees:"..v.."_wood" ) then
table.insert( replacements, {'default:sapling', "moretrees:"..v.."_tree_sapling"});
end
end
end
end