From 84656e079d834ab3289d7ba071ee010812948436 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Fri, 9 Mar 2012 22:49:37 -0500 Subject: [PATCH] Vertical mesecon plugs and sockets! Plugs will now affect sockets on a level two below or two above, as long as there is air between them. --- mesecons_temperest/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mesecons_temperest/init.lua b/mesecons_temperest/init.lua index 308f7b6..fb0ec8d 100644 --- a/mesecons_temperest/init.lua +++ b/mesecons_temperest/init.lua @@ -72,6 +72,12 @@ local plug_on = function(pos, node) local lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away if lnode.name=="air" then set_node_on({x=pos.x+2, y=pos.y, z=pos.z}) end + lnode = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y-2, z=pos.z}) end + + lnode = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y+2, z=pos.z}) end + local lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z-2}) end @@ -88,6 +94,12 @@ local plug_off = function(pos, node) lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away if lnode.name=="air" then set_node_off({x=pos.x+2, y=pos.y, z=pos.z}) end + lnode = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y-2, z=pos.z}) end + + lnode = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}) --a node between this node and the one two nodes away + if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y+2, z=pos.z}) end + lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z-2}) end