old two-node-high-doors now work again in newer mt versions

This commit is contained in:
Sokomine 2016-03-20 23:59:24 +01:00
parent a719d81e51
commit 18056fb463
3 changed files with 31 additions and 0 deletions

View File

@ -330,6 +330,8 @@ mg_villages.add_building = function( building_data )
building_data.nodenames = res.nodenames;
building_data.on_constr = res.on_constr;
building_data.after_place_node = res.after_place_node;
building_data.door_a = res.door_a;
building_data.door_b = res.door_b;
if( res.scm_data_cache ) then
building_data.scm_data_cache = res.scm_data_cache;

View File

@ -1104,6 +1104,27 @@ mg_villages.place_villages_via_voxelmanip = function( villages, minp, maxp, vm,
end
end
-- the doors need to be adjusted as well
for _, village in ipairs(villages) do
for k, v in pairs( village.to_add_data.extra_calls.door_b ) do
local meta = minetest.get_meta( v );
local l = 2 -- b
local h = meta:get_int("right") + 1
local replace = {
{ { type = "a", state = 0 }, { type = "a", state = 3 } },
{ { type = "b", state = 1 }, { type = "b", state = 2 } }
}
local new = replace[l][h]
-- minetest.swap_node(v, {name = name .. "_" .. new.type, param2 = v.p2})
meta:set_int("state", new.state)
-- wipe meta on top node as it's unused
minetest.set_node({x = v.x, y = v.y + 1, z = v.z}, { name = "doors:hidden" })
end
end
local pr = PseudoRandom(mg_villages.get_bseed(minp));
for _, village in ipairs(villages) do
for _,v in ipairs( village.to_add_data.extra_calls.chests ) do

View File

@ -354,6 +354,14 @@ mg_villages.get_replacement_list = function( housetype, pr )
table.insert( replacements, {'default:apple', 'air' });
table.insert( replacements, {'default:cobble', 'default:stone_macadam' });
table.insert( replacements, {'default:obsidian_glass', 'default:glass' });
-- the default doors from minetest game have been changed since the schematics where built
-- TODO: the door replacement function needs to be more complex; doesn't really work this way
else
table.insert( replacements, {'doors:door_wood_t_1', 'doors:hidden'});
table.insert( replacements, {'doors:door_wood_b_1', 'doors:door_wood_a'});
table.insert( replacements, {'doors:door_wood_t_2', 'doors:hidden'});
table.insert( replacements, {'doors:door_wood_b_2', 'doors:door_wood_b'});
end
if( housetype and mg_villages.village_type_data[ housetype ] and mg_villages.village_type_data[ housetype ].replacement_function ) then