diff --git a/analyze_we_file.lua b/analyze_we_file.lua index 477b4d0..5771603 100644 --- a/analyze_we_file.lua +++ b/analyze_we_file.lua @@ -62,6 +62,7 @@ mg_villages.analyze_we_file = function(scm, we_origin) scm[ent.y][ent.x][ent.z] = { nodenames_id[ ent.name ], ent.param2 }; --TODO ent.meta end + local c_air = minetest.get_content_id("air") for x = 1, maxx do for y = 1, maxy do @@ -72,13 +73,14 @@ mg_villages.analyze_we_file = function(scm, we_origin) if scm[y][x] == nil then scm[y][x] = {} end - if scm[y][x][z] == nil then - scm[y][x][z] = c_air - end +-- if scm[y][x][z] == nil then +-- scm[y][x][z] = c_air +-- end end end end + local size = {}; size.y = #scm; size.x = #scm[1]; diff --git a/build_chest.lua b/build_chest.lua index 227bf35..68402c8 100644 --- a/build_chest.lua +++ b/build_chest.lua @@ -78,7 +78,9 @@ build_chest.count_nodes = function( data ) else id = a; end - statistic[ id ] = { id, statistic[ id ][ 2 ]+1 }; + if( statistic[ id ] and statistic[ id ][ 2 ] ) then + statistic[ id ] = { id, statistic[ id ][ 2 ]+1 }; + end end end end @@ -93,7 +95,10 @@ build_chest.read_building = function( building_name ) -- read data local res = handle_schematics.analyze_mts_file( building_name ); if( not( res )) then - return; + res = mg_villages.analyze_we_file( building_name, nil ); + if( not( res )) then + return; + end end build_chest.building[ building_name ].size = res.size; build_chest.building[ building_name ].nodenames = res.nodenames;