jille_Jr

CC: Cannon mail [Server] - inv.lua

Feb 22nd, 2016
55
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- inv.lua
  2.  
  3. --(( Settings ))--
  4.  
  5. --(( Variables ))--
  6.  
  7. local dropper = peripheral.wrap("dropper_0")
  8. or error("Unable to wrap dropper!")
  9.  
  10. --(( Functions ))--
  11.  
  12. -- get the side to eject from the dropper
  13. function getDirection(r)
  14.     r = r:lower()
  15.  
  16.     if r == "jag"
  17.     or r == "kalle"
  18.     or r == "akajag"
  19.     then
  20.         return "north"
  21.     end
  22.    
  23.     if r == "bejno"
  24.     or r == "fabian"
  25.     then
  26.         return "east"
  27.     end
  28.  
  29.     if r == "knut"
  30.     or r == "knaut"
  31.     then
  32.         return "south"
  33.     end
  34. end
  35.  
  36. function emptyDropper(dir)
  37.     if dir == nil then
  38.         dir = getDirection("jag")
  39.     end
  40.     for slot = 1,dropper.getInventorySize() do
  41.         dropper.pushItem(dir, slot)
  42.     end
  43. end
  44.  
  45. -- dir=direction we send the item in the drive to
  46. function emptyDrive(dir)
  47.     dropper.pullItem("up",1)
  48.     emptyDropper(dir)
  49. end
  50.  
  51. -- eof
RAW Paste Data