only schems that may actually be used will be imported at startup
This commit is contained in:
parent
7f9393caa9
commit
4d2819a6f0
@ -271,10 +271,7 @@ if( minetest.get_modpath( 'dryplants' )) then
|
|||||||
table.insert( mg_villages.village_types, 'grasshut' );
|
table.insert( mg_villages.village_types, 'grasshut' );
|
||||||
end
|
end
|
||||||
|
|
||||||
--mg_villages.village_types = {'lumberjack'};
|
|
||||||
--mg_villages.village_types = {'medieval'};
|
|
||||||
--mg_villages.village_types = {'claytrader'};
|
|
||||||
--mg_villages.village_types = {'grasshut'};
|
|
||||||
|
|
||||||
-- read the data files and fill in information like size and nodes that need on_construct to be called after placing
|
-- read the data files and fill in information like size and nodes that need on_construct to be called after placing
|
||||||
mg_villages.buildings_init = function()
|
mg_villages.buildings_init = function()
|
||||||
@ -283,16 +280,31 @@ mg_villages.buildings_init = function()
|
|||||||
-- determine the size of the given houses
|
-- determine the size of the given houses
|
||||||
for i,v in ipairs( mg_villages.BUILDINGS ) do
|
for i,v in ipairs( mg_villages.BUILDINGS ) do
|
||||||
|
|
||||||
|
local is_used = false;
|
||||||
-- read the size of the building
|
for _,t in ipairs( mg_villages.village_types ) do
|
||||||
local res = handle_schematics.analyze_mts_file( mts_path..mg_villages.BUILDINGS[ i ].scm );
|
if( t and v and v.weight and v.weight[ t ] ) then
|
||||||
-- alternatively, read the mts file
|
is_used = true;
|
||||||
if( not( res )) then
|
end
|
||||||
res = mg_villages.import_scm( mg_villages.BUILDINGS[ i ].scm );
|
end
|
||||||
|
if( v.weight and v.weight.fields ) then
|
||||||
|
is_used = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local res = nil;
|
||||||
|
if( is_used ) then
|
||||||
|
-- read the size of the building
|
||||||
|
res = handle_schematics.analyze_mts_file( mts_path..mg_villages.BUILDINGS[ i ].scm );
|
||||||
|
-- alternatively, read the mts file
|
||||||
|
if( not( res )) then
|
||||||
|
res = mg_villages.import_scm( mg_villages.BUILDINGS[ i ].scm );
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if( not( is_used )) then
|
||||||
|
-- do nothing; skip this file
|
||||||
|
print('SKIPPING '..tostring( mg_villages.BUILDINGS[ i ].scm )..' due to village type not supported.');
|
||||||
-- provided the file could be analyzed successfully
|
-- provided the file could be analyzed successfully
|
||||||
if( res and res.size and res.size.x ) then
|
elseif( res and res.size and res.size.x ) then
|
||||||
-- the file has to be placed with minetest.place_schematic(...)
|
-- the file has to be placed with minetest.place_schematic(...)
|
||||||
mg_villages.BUILDINGS[ i ].is_mts = 1;
|
mg_villages.BUILDINGS[ i ].is_mts = 1;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user