bugfixes; upside_down_stairs etc

master
Sokomine 2014-09-25 22:13:22 +02:00
parent 6bd67226b9
commit dc68c7f33b
4 changed files with 33 additions and 11 deletions

View File

@ -1,7 +1,7 @@
default
farming
wool
stairs
stairs?
doors
cottages?
moretrees?
@ -13,3 +13,5 @@ darkage?
deco?
snow?
trees?
metals?
grounds?

View File

@ -119,6 +119,8 @@ mg_villages.replace_materials = function( replacements, pr, original_materials,
table.insert( replacements, { original_materials[ 1 ], new_material..'_stair' } );
table.insert( replacements, { original_materials[ 2 ], new_material..'_slab' } );
table.insert( replacements, { original_materials[ 3 ], new_material } );
table.insert( replacements, { original_materials[ 1 ]..'upside_down', new_material..'_stair_upside_down' } );
table.insert( replacements, { original_materials[ 2 ]..'upside_down', new_material..'_slab_upside_down' } );
return new_material;
end
@ -202,6 +204,8 @@ mg_villages.replace_tree_trunk = function( replacements, wood_type )
-- stairs and slabs made out of default wood
table.insert( replacements, {'stairs:stair_wood', 'trees:'..v..'_planks_stair'});
table.insert( replacements, {'stairs:slab_wood', 'trees:'..v..'_planks_slab'});
table.insert( replacements, {'stairs:stair_woodupside_down','trees:'..v..'_planks_stair_upside_down' } );
table.insert( replacements, {'stairs:slab_woodupside_down', 'trees:'..v..'_planks_slab_upside_down' } );
end
end
else
@ -339,8 +343,10 @@ mg_villages.get_replacement_list = function( housetype, pr )
if( housetype == 'nore' ) then
mg_villages.replace_materials( replacements, pr,
{'stonebrick'},
{'default:'},
-- {'default:stonebrick'},
-- {'default:'},
{'stairs:stair_stonebrick', 'stairs:slab_stonebrick', 'default:stonebrick'},
{'stairs:stair_', 'stairs:slab_', 'default:' },
{'stonebrick', 'desert_stonebrick','sandstonebrick', 'sandstone','stone','desert_stone','stone_flat','desert_stone_flat','stone_bricks','desert_strone_bricks'},
'stonebrick');

View File

@ -782,7 +782,7 @@ local function generate_building(pos, minp, maxp, data, param2_data, a, pr, extr
new_content = t.node.content;
-- replace unkown nodes by name
if( not( new_content) or new_content == c_ignore
and t.node.name ) then
and t.node.name and t.node.name ~= 'mg:ignore') then
if( replacements.table[ t.node.name ] and minetest.registered_nodes[ replacements.table[ t.node.name ]]) then
new_content = minetest.get_content_id( replacements.table[ t.node.name ] );
@ -794,11 +794,13 @@ local function generate_building(pos, minp, maxp, data, param2_data, a, pr, extr
end
end
-- we tried our best, but the replacement node is not defined
else
elseif (t.node.name ~= 'mg:ignore' ) then
print('[mg_villages] ERROR: Did not find a suitable replacement for '..tostring( t.node.name )..' (suggested but inexistant: '..tostring( replacements.table[ t.node.name ] )..').');
new_content = cid.c_air;
end
elseif( new_content == c_ignore or (t.node.name and t.node.name == 'mg:ignore' )) then
-- no change; keep the old content
-- do replacements for normal nodes with facedir or wallmounted
elseif( new_content ~= c_ignore and replacements.ids[ new_content ]) then
new_content = replacements.ids[ new_content ];

24
we.lua
View File

@ -94,12 +94,24 @@ mg_villages.import_scm = function(scm)
end
-- unkown nodes have to be treated specially; they are not allowed to be of type wallmounted or facedir or to need on_construct
if( not( minetest.registered_nodes[ ent.name ] )) then
scm[ent.y][ent.x][ent.z] = {
node = {
name = ent.name,
param2 = ent.param2,
}}
elseif ent.name == "mg:ignore" or not paramtype2 then
-- stairs are always of type facedir
if( string.sub( ent.name, 1, 7 ) == 'stairs:' ) then
scm[ent.y][ent.x][ent.z] = {
node = {
name = ent.name,
param2 = ent.param2,
param2list = mg_villages.get_param2_rotated( 'facedir', ent.param2 ),
}}
else
scm[ent.y][ent.x][ent.z] = {
node = {
name = ent.name,
param2 = ent.param2,
}}
end
elseif ent.name == "mg:ignore" then
scm[ent.y][ent.x][ent.z] = minetest.get_content_id('ignore');
elseif not paramtype2 then
if( on_constr ) then
scm[ent.y][ent.x][ent.z] = {
node = {