Advertisement
Guest User

Untitled

a guest
Sep 5th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. minetest.register_abm( {
  2.     nodenames = { 'hopper:hopper' },
  3.     interval = 1.0,
  4.     chance = 1,
  5.     action = function ( pos, node )
  6.         local fromnode, tonode,
  7.         local frompos = { x = pos.x, y = pos.y, z = pos.z }
  8.         local topos = { x = pos.x, y = pos.y, z = pos.z }
  9.         local facedir = node.param2
  10.         if facedir == 0 then
  11.             frompos.y = frompos.y + 1
  12.             topos.y = topos.y - 1
  13.         elseif facedir == 1 then
  14.             frompos.y = frompos.y + 1
  15.             topos.y = topos.y - 1
  16.         elseif facedir == 2 then
  17.             frompos.y = frompos.y + 1
  18.             topos.y = topos.y - 1
  19.         elseif facedir == 3 then
  20.             frompos.y = frompos.y + 1
  21.             topos.y = topos.y - 1
  22.         end
  23.  
  24.         fromnode = minetest.get_node( frompos ).name
  25.         tonode = minetest.get_node( topos ).name
  26.  
  27.         if hopper_transactions[fromnode] and hopper_transactions[tonode] then
  28.             local wl = hopper_transactions[tonode].wishlist
  29.             if wl == nil and hopper_transactions[tonode].get_wishlist ~= nil then
  30.                 wl = hopper_transactions[tonode].get_wishlist( topos )
  31.             end
  32.             hopper_transactions[tonode].add(
  33.                 topos,
  34.                 hopper_transactions[fromnode].get( frompos, wl ),
  35.                 function ( thing )
  36.                     hopper_transactions[fromnode].add( frompos, thing )
  37.                 end
  38.             )
  39.         end
  40.     end
  41. } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement