tuekats

floorLights

Nov 15th, 2015
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local param = ...
  2. if param~=nil then
  3.     local step = param
  4.     os.loadAPI("tillapi")
  5.  
  6.     local offsetX = 54
  7.     local offsetY = 66
  8.     local offsetZ = 1933
  9.  
  10.     function goToOffset(x3,y3,z3,facing3)
  11.         tillapi.goTo(x3+offsetX,y3+offsetY,z3+offsetZ,facing3)
  12.     end
  13.  
  14.     for i=1,12 do
  15.         turtle.select(i)
  16.             turtle.drop()
  17.     end
  18.  
  19.     north = -1 * ( (10-step) * 10 + 2 )
  20.     south =  (10-step) * 10 + 2
  21.     east =   (10-step) * 10 + 2
  22.     west = -1 * ( (10-step) * 10 + 2 )
  23.     alt = step*10
  24.  
  25.     local light= (math.floor((south-3)/6))*6+3
  26.     --print(light)
  27.    
  28.     local count = 0
  29.     local zCount = 0
  30.     local positions = {}
  31.     for z = -1*light,light,6 do
  32.         zCount=zCount+1
  33.         if zCount -(math.floor(zCount/2))*2 > 0 then
  34.             for x = -1*light,light,6 do
  35.                 count = count + 1
  36.                 positions[count]={}
  37.                 positions[count]["Y"]=alt-9
  38.                 positions[count]["X"]=x
  39.                 positions[count]["Z"]=z
  40.                 positions[count]["facing"]=2
  41.             end
  42.         else
  43.             for x = light,-1*light,-6 do
  44.                 count = count + 1
  45.                 positions[count]={}
  46.                 positions[count]["Y"]=alt-9
  47.                 positions[count]["X"]=x
  48.                 positions[count]["Z"]=z
  49.                 positions[count]["facing"]=4
  50.             end
  51.         end
  52.     end
  53. --print(textutils.serialize(positions))
  54.  
  55.     for i=1,3 do
  56.         local x1=positions[i]["X"]
  57.         local y1=positions[i]["Y"]
  58.         local z1=positions[i]["Z"]
  59.         local facing1=positions[i]["facing"]
  60.         goToOffset( x1 , y1 , z1 , facing1 )
  61.         turtle.digDown()
  62.             turtle.select(1)
  63.             tillapi.itemCheck()
  64.             turtle.placeDown()
  65.     end
  66. else
  67.     print("use lights [stepnumber]")
  68. end
Advertisement
Add Comment
Please, Sign In to add comment