From e32df3095f06f23fba9bfa12e9d6a0aa43192435 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Mon, 11 Nov 2019 19:10:16 +0100 Subject: [PATCH] be aware of aliases when placing nodes --- place_buildings.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/place_buildings.lua b/place_buildings.lua index c4fa08a..be902df 100644 --- a/place_buildings.lua +++ b/place_buildings.lua @@ -1,13 +1,20 @@ --- TODO: this function also occours in replacements.lua handle_schematics.get_content_id_replaced = function( node_name, replacements ) if( not( node_name )) then return minetest.get_content_id( 'ignore' ); end + local new_name = node_name if( replacements and replacements.table and replacements.table[ node_name ]) then - return minetest.get_content_id( replacements.table[ node_name ] ); - else - return minetest.get_content_id( node_name ); + new_name = replacements.table[ node_name ]; end + if(minetest.registered_aliases[ new_name ]) then + new_name = minetest.registered_aliases[ new_name ] + end + -- try the original name if the new one doesn't exist + if(not(minetest.registered_nodes[ new_name ]) + and minetest.registered_nodes[ node_name ]) then + new_name = node_name + end + return minetest.get_content_id( new_name ); end -- either uses get_node_or_nil(..) or the data from voxelmanip