Advertisement
Guest User

endertank

a guest
Oct 8th, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. for a,b in pairs(rs.getSides()) do
  2.   if peripheral.getType(b) == "ender_tank" then
  3.     p_tank = peripheral.wrap(b)
  4.     print("Ender Tank an "..b.." gefunden")
  5.     break
  6.   end
  7. end
  8.  
  9. local t_args = { ... }
  10. if #t_args ~= 0 and t_args[1] == "r" then
  11.   p_tank.setColors(1, 1, 1)
  12. end
  13.  
  14. local c3, c2, c1 = p_tank.getColors()
  15. local initial_i = math.log(c1) / math.log(2)
  16. local initial_j = math.log(c2) / math.log(2)
  17. local initial_k = math.log(c3) / math.log(2)
  18. local i, j, k
  19. local skip = true
  20.  
  21. for i = initial_i, 15 do
  22.   c3 = 2^i
  23.   for j = initial_j, 15 do
  24.     c2 = 2^j
  25.     for k = initial_k, 15 do
  26.       c1 = 2^k
  27.       p_tank.setColors(c1, c2, c3)
  28.       local t = p_tank.getTankInfo()
  29.       if skip == true then skip = false
  30.       else if t[1].contents.amount ~= 0 then
  31.              do return end
  32.            end --if
  33.       end --if
  34.       sleep(1.1)
  35.     end --for k
  36.     initial_k = 0
  37.   end --for j
  38.   initial_j = 0
  39. end --for i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement