added support for ladders in realtest

This commit is contained in:
Sokomine 2014-09-27 04:51:45 +02:00
parent dc68c7f33b
commit ad0fbb75dd
2 changed files with 41 additions and 3 deletions

View File

@ -125,8 +125,28 @@ handle_schematics.analyze_mts_file = function( path )
local p2 = string.byte( data_string, p2offset + math.floor(i/2));
id = id+1;
-- unkown node
local regnode = minetest.registered_nodes[ nodenames[ id ]];
local paramtype2 = regnode and regnode.paramtype2;
-- realtest rotates some nodes diffrently
if( nodenames[ id ] and mg_villages.realtest_trees ) then
if( nodenames[ id ] == 'default:ladder' ) then
paramtype2 = 'facedir';
if( p2 == 2 ) then
p2 = 1;
elseif( p2 == 5 ) then
p2 = 2;
elseif( p2 == 3 ) then
p2 = 3;
elseif( p2 == 4 ) then
p2 = 0;
else
paramtype2 = nil;
end
end
end
-- unkown node
if( not( regnode ) and not( nodenames[ id ] )) then
scm[y][x][z] = c_ignore;
elseif( not( regnode )) then
@ -134,7 +154,6 @@ handle_schematics.analyze_mts_file = function( path )
name = nodenames[ id ],
param2 = p2} };
else
local paramtype2 = regnode.paramtype2;
local needs_on_constr = regnode.on_construct;
if( paramtype2 ~= 'facedir' and paramtype2 ~= 'wallmounted' and not( regnode.on_construct)) then

21
we.lua
View File

@ -92,10 +92,29 @@ mg_villages.import_scm = function(scm)
if( on_constr ) then
on_constr = true;
end
-- realtest rotates some nodes diffrently
if( ent.name and not( minetest.registered_nodes[ent.name] )) then
if( ent.name == 'default:ladder' ) then
paramtype2 = 'facedir';
if( ent.param2 == 2 ) then
ent.param2 = 1;
elseif( ent.param2 == 5 ) then
ent.param2 = 2;
elseif( ent.param2 == 3 ) then
ent.param2 = 3;
elseif( ent.param2 == 4 ) then
ent.param2 = 0;
else
-- do not rotate the ladder at all
paramtype2 = nil;
end
end
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
-- stairs are always of type facedir
if( string.sub( ent.name, 1, 7 ) == 'stairs:' ) then
if( ent.name == 'default:ladder' or string.sub( ent.name, 1, 7 ) == 'stairs:' ) then
scm[ent.y][ent.x][ent.z] = {
node = {
name = ent.name,