better support for citybuilder

This commit is contained in:
Sokomine 2018-07-30 23:25:58 +02:00
parent 173890d4e2
commit 30c505a16e
2 changed files with 16 additions and 3 deletions

View File

@ -86,9 +86,14 @@ handle_schematics.analyze_file = function( file_name, origin_offset, store_as_mt
-- print error message only if all import methods failed -- print error message only if all import methods failed
if( not( res )) then if( not( res )) then
print('[handle_schematics] ERROR: Failed to import file \"'..tostring( file_name )..'\"[.mts|.we|.wem|.schematic]'); print('[handle_schematics] ERROR: Failed to import file \"'..tostring( file_name )..'\"[.mts|.we|.wem|.schematic]');
return;
-- convert to .mts for later usage -- convert to .mts for later usage
elseif( store_as_mts ) then elseif( store_as_mts ) then
handle_schematics.store_mts_file( store_as_mts, res ); handle_schematics.store_mts_file( store_as_mts, res );
res = handle_schematics.analyze_mts_file( file_name );
if( not( res )) then
return;
end
end end
-- .we and .schematic do not provide on_construct/after_palce_node -- .we and .schematic do not provide on_construct/after_palce_node

View File

@ -57,12 +57,19 @@ build_chest.end_pos_list = {};
build_chest.read_building = function( building_name ) build_chest.read_building = function( building_name, building_data )
if( not( building_data )) then
building_data = {};
end
if( not( build_chest.building[ building_name ] )) then
build_chest.building[ building_name ] = building_data;
end
-- read data -- read data
local res = handle_schematics.analyze_file( building_name, nil, nil ); local res = handle_schematics.analyze_file( building_name, nil, nil, build_chest.building[ building_name ]);
if( not( res )) then if( not( res )) then
return; return;
end end
--[[
build_chest.building[ building_name ].size = res.size; build_chest.building[ building_name ].size = res.size;
build_chest.building[ building_name ].nodenames = res.nodenames; build_chest.building[ building_name ].nodenames = res.nodenames;
build_chest.building[ building_name ].rotated = res.rotated; build_chest.building[ building_name ].rotated = res.rotated;
@ -73,7 +80,8 @@ build_chest.read_building = function( building_name )
build_chest.building[ building_name ].bed_list = res.bed_list; build_chest.building[ building_name ].bed_list = res.bed_list;
-- scm_data_cache is not stored as that would take up too much storage space -- scm_data_cache is not stored as that would take up too much storage space
--build_chest.building[ building_name ].scm_data_cache = res.scm_data_cache; --build_chest.building[ building_name ].scm_data_cache = res.scm_data_cache;
--]]
build_chest.building[ building_name ] = res;
-- create a statistic about how often each node occours -- create a statistic about how often each node occours
build_chest.building[ building_name ].statistic = handle_schematics.count_nodes( res ); build_chest.building[ building_name ].statistic = handle_schematics.count_nodes( res );