Savage_Me55iah

nukesetup

Jun 4th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. inv = { [1] = 1, [2] = 2,  [3] = 1,  [4] = 2,  [5] = 2,  [6] = 3,  [7] = 2,  [8] = 3,  [9] = 2,
  2.              [10] = 3, [11] = 3, [12] = 2, [13] = 3, [14] = 1, [15] = 2, [16] = 4, [17] = 2, [18] = 1,
  3.              [19] = 1, [20] = 2, [21] = 4, [22] = 2, [23] = 2, [24] = 3, [25] = 4, [26] = 3, [27] = 2,
  4.              [28] = 2, [29] = 3, [30] = 4, [31] = 3, [32] = 2, [33] = 2, [34] = 4, [35] = 2, [36] = 1,
  5.              [37] = 1, [38] = 2, [39] = 4, [40] = 2, [41] = 1, [42] = 3, [43] = 2, [44] = 3, [45] = 3,
  6.              [46] = 2, [47] = 3, [48] = 2, [49] = 3, [50] = 2, [51] = 2, [52] = 1, [53] = 2, [54] = 1,}
  7.  
  8. fre = {[1] = 273, [2] = 546, [3] = 1092}
  9.  
  10. function find_peripheral(t, e)
  11.   e = e or nil
  12.   sides = {[1] = "front", [2] = "back", [3] = "left", [4] = "right", [5] = "top", [6] = "bottom"}
  13.   peripheral_found = false
  14.   for num=1, 6 do
  15.     type = peripheral.getType(sides[num])
  16.     if type == t then
  17.       if e == "wireless" then
  18.         if peripheral.call(sides[num], "isWireless") then
  19.           return sides[num]
  20.         end
  21.       elseif e == "remote" then
  22.         if not peripheral.call(sides[num], "isWireless") then
  23.           return sides[num]
  24.         end
  25.       elseif e == nil then
  26.         return sides[num]
  27.       end
  28.     end
  29.   end
  30.   error("No " .. t .. " attached to the computer", 0)
  31. end
  32.  
  33. ender = find_peripheral(ender_chest)
  34.  
  35. for num = 1,table.maxn(inv) do
  36.  
  37. x = inv[num]
  38.  
  39. if not fre[x] == nil then
  40.   ender.setFrequency(fre[x])
  41.   ender.condenseItems()
  42.   ender.pushItemIntoSlot("down", 1, 1, num)
  43. end
  44. end
  45.  
  46. print("complete")
Advertisement
Add Comment
Please, Sign In to add comment