From 096b39518241e594d14e4c73063b766e47600968 Mon Sep 17 00:00:00 2001 From: Foz Date: Sun, 14 Feb 2016 23:13:53 -0500 Subject: [PATCH] Convert shared_door to the new door api --- shared_door.lua | 59 ++++++------------------------------- textures/shared_door.png | Bin 0 -> 335 bytes textures/shared_door_a.png | Bin 304 -> 0 bytes textures/shared_door_b.png | Bin 281 -> 0 bytes 4 files changed, 9 insertions(+), 50 deletions(-) create mode 100644 textures/shared_door.png delete mode 100644 textures/shared_door_a.png delete mode 100644 textures/shared_door_b.png diff --git a/shared_door.lua b/shared_door.lua index 8dc4abc..7f59272 100644 --- a/shared_door.lua +++ b/shared_door.lua @@ -1,31 +1,18 @@ -function landrush.on_rightclick(pos, dir, check_name, replace, replace_dir, params) - pos.y = pos.y+dir - if not minetest.get_node(pos).name == check_name then - return - end - local p2 = minetest.get_node(pos).param2 - p2 = params[p2+1] - - local meta = minetest.get_meta(pos):to_table() - minetest.set_node(pos, {name=replace_dir, param2=p2}) - minetest.get_meta(pos):from_table(meta) - - pos.y = pos.y-dir - meta = minetest.get_meta(pos):to_table() - minetest.set_node(pos, {name=replace, param2=p2}) - minetest.get_meta(pos):from_table(meta) - end - -doors.register_door("landrush:shared_door", { +doors.register("landrush_shared_door", { description = "Shared Door", inventory_image = "shared_door_inv.png", groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1}, - tiles_bottom = {"shared_door_b.png", "door_blue.png"}, - tiles_top = {"shared_door_a.png", "door_blue.png"}, + tiles = {{ name = "shared_door.png", backface_culling = true }}, + on_rightclick = function(pos, node, clicker) + if ( landrush.can_interact(pos,clicker:get_player_name()) ) then + local door = doors.get(pos) + door:toggle() + end + end }) minetest.register_craft({ - output = 'landrush:shared_door', + output = 'doors:landrush_shared_door', recipe = { {'default:steel_ingot','default:steel_ingot',''}, {'default:steel_ingot','landrush:landclaim',''}, @@ -33,31 +20,3 @@ minetest.register_craft({ } }) - - -minetest.registered_nodes['landrush:shared_door_b_1'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(pos,clicker:get_player_name()) ) then - landrush.on_rightclick(pos, 1, "landrush:shared_door_t_1", "landrush:shared_door_b_2", "landrush:shared_door_t_2", {1,2,3,0}) -end -end - -minetest.registered_nodes['landrush:shared_door_t_1'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(pos,clicker:get_player_name()) ) then - landrush.on_rightclick(pos, -1, "landrush:shared_door_b_1", "landrush:shared_door_t_2", "landrush:shared_door_b_2", {1,2,3,0}) -end -end - --- Fix for duplicating Bug! --- Bug was caused, because the reverse order of the on_rightclick was not taken into account - -minetest.registered_nodes['landrush:shared_door_b_2'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(pos,clicker:get_player_name()) ) then - landrush.on_rightclick(pos, 1, "landrush:shared_door_t_2", "landrush:shared_door_b_1", "landrush:shared_door_t_1", {3,0,1,2}) -end -end - -minetest.registered_nodes['landrush:shared_door_t_2'].on_rightclick = function(pos, node, clicker) -if ( landrush.can_interact(pos,clicker:get_player_name()) ) then - landrush.on_rightclick(pos, -1, "landrush:shared_door_b_2", "landrush:shared_door_t_1", "landrush:shared_door_b_1", {3,0,1,2}) -end -end diff --git a/textures/shared_door.png b/textures/shared_door.png new file mode 100644 index 0000000000000000000000000000000000000000..399820fd9d3ee2acf64e29baf919b31e823d8cf1 GIT binary patch literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^YCx>O!3HGjQn)q)DaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkQ1Fqbi(^Q{;p8u?W&%ptvkGeqH*P|}yjB@)cc%!k*0E$ul`v;WoC|M@Yy zdqU?lG8#|OxZ2M%LxN3HqEupK1FP{nL&lA+TuXlyTJeO>YzmEuZG2(W8S!`V&LWfW zzGq%3?T)Y3owq3Bf9N$U=&yyWn7BB*c+8dzLElB~BGzp6Qj0@16q$qGNJzakbm~e> zIO`j?h7+iAG3%QZhuvh&UTp|$zqs3$O>^Q&_9?H_*V?)T-Tgju7oYN0CO4qKaW)3! Xn6B#=#61LozGd)q^>bP0l+XkK3AcOA literal 0 HcmV?d00001 diff --git a/textures/shared_door_a.png b/textures/shared_door_a.png deleted file mode 100644 index da256766f6374e8ca38c014626c53720d4894757..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 304 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hTL^K@|xskoK&Wp&*D`Hf5r0uDL~N-lqmBWFclvrk~)P!LPu(_Eky!05xwBEY@r z!P(NSJtu1Z&*J@`AG5nBbWS7VqpSvoq@)D`3@idi*x+5hnzPT|16|DE>FVdQ&MBb@0JLvc82|tP diff --git a/textures/shared_door_b.png b/textures/shared_door_b.png deleted file mode 100644 index 84f7aebe67252f26854d0c2fda7dc002f6f1b37b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hVpd%8G=RNPAXvO4a+y~|%?=a?87W*(iWEgg*#7dHK4WOiWKIAIm1ECY)G_omDx z4YM3r4R{3{bZ)S4Hkz7OHa