diff options
author | Sokomine <wegwerf@anarres.dyndns.org> | 2018-07-26 19:07:23 +0200 |
---|---|---|
committer | Sokomine <wegwerf@anarres.dyndns.org> | 2018-07-26 19:07:23 +0200 |
commit | 61f1ab16f8f7c62fc28669bf2fc0b9759dc2580f (patch) | |
tree | 8fc26699584e579b2343161d921a105bd9484495 | |
parent | e3894514cc8575d66415af709fbba6c590b93c15 (diff) |
added handling for old steel doors
-rw-r--r-- | handle_schematics.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/handle_schematics.lua b/handle_schematics.lua index c98e573..4f0efda 100644 --- a/handle_schematics.lua +++ b/handle_schematics.lua @@ -183,11 +183,26 @@ handle_schematics.update_nodes = function( start_pos, end_pos, on_constr, after_ -- steel doors are annoying because the cannot be catched with the functions above local doornodes = minetest.find_nodes_in_area( start_pos, end_pos, {'doors:door_steel_b_1','doors:door_steel_b_2', - 'doors:door_steel_t_1','doors:door_steel_t_2'}); + 'doors:door_steel_t_1','doors:door_steel_t_2', + 'doors:door_steel_a', 'doors:door_steel_b'}); for _, p in ipairs( doornodes ) do + local node = minetest.get_node( p ); local meta = minetest.get_meta( p ); - meta:set_string("doors_owner", player_name ); - meta:set_string("infotext", "Owned by "..player_name) + if( not( node ) or not( node.name )) then + -- do nothing + elseif( node.name=='doors:door_steel_t_1' or node.name=='doors:door_steel_t_2') then + -- replace top of old steel doors with new node + minetest.swap_node( p, {name='doors:door_hidden', param2=node.param2} ); + else + -- set the new owner + meta:set_string("doors_owner", player_name ); + meta:set_string("infotext", "Owned by "..player_name) + if( node.name == 'doors:door_steel_b_1' ) then + minetest.swap_node( p, {name='doors:door_steel_a', param2=nod3.param2}); + elseif( node.name == 'doors:door_steel_b_2' ) then + minetest.swap_node( p, {name='doors:door_steel_b', param2=node.param2}); + end + end end |