Advertisement
DanchiZZ

TurtlePark Deployer

Oct 11th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.11 KB | None | 0 0
  1. -- TurtlePark deployer script
  2.  
  3.  
  4. do
  5.   local slots =
  6.   {
  7.     ["wood"] = 1, ["stone"] = 2, ["redstone"] = 3, ["ironingot"] = 4,
  8.     ["diamond"] = 5, ["glasspane"] = 6, ["chest1"] = 7, ["chest2"] = 8,
  9.     ["fuel"] = 9, ["planks"] = 15, ["sticks"] = 16
  10.   }
  11.  
  12.   local chestsNames =
  13.   {
  14.     "wood", "stone", "redstone",
  15.     "ironingot", "diamond", "glasspane",
  16.     "sticks", "planks", "fuel"
  17.   }
  18.  
  19.  
  20.   local chestsLocations =
  21.   {
  22.     ["wood"] = { 0, 0, 0 },
  23.     ["stone"] = { 1, 0, 0 },
  24.     ["redstone"] = { 2, 0, 0 },
  25.     ["ironingot"] = { 0, 0, 1 },
  26.     ["diamond"] = { 1, 0, 1 },
  27.     ["glasspane"] = { 2, 0, 1 },
  28.     ["sticks"] = { 0, 0, 2 },
  29.     ["planks"] = { 1, 0, 2 } ,
  30.     ["fuel"] = { 2, 0, 2 }
  31.   }
  32.  
  33.  
  34.   local recipes =
  35.   {
  36.     ["diskdrive"] =
  37.     {
  38.       required = 2,
  39.       map =
  40.       {
  41.         [1] = "stone", [2] = "stone", [3] = "stone",
  42.         [5] = "stone", [6] = "redstone", [7] = "stone",
  43.         [9] = "stone", [10] = "redstone", [11] = "stone"
  44.       }
  45.     }
  46.   }
  47.  
  48.   function waitForKeyPress()
  49.     while true do
  50.       print("Press E to do something.")
  51.      
  52.       local event, key = os.pullEvent("char") -- limit os.pullEvent to the 'key' event
  53.      
  54.       if key == keys.e then -- if the key pressed was 'e'
  55.         print("You pressed E. Exiting program...")
  56.         break
  57.       end
  58.     end
  59.   end
  60.  
  61.   -- Craft an "item" from "recipes" table
  62.   -- and put it to "outputSlot"
  63.   function craftItem(item, outputSlot)
  64.     for i = 1, 3 do
  65.       for j = 1, 3 do
  66.         --turtle.select(i + (j - 1) * j - 1)
  67.         --recipes[item].map[i][j]
  68.       end
  69.     end
  70.   end
  71.  
  72.  
  73.   -- Deploy chest from 7-8 slots in
  74.   -- 3x3 area
  75.   function deployChests()
  76.     while turtle.getFuelLevel() < 100 do
  77.       turtle.select(9)
  78.       turtle.refuel(1)
  79.     end
  80.     i = 1
  81.     for l = 1, #chestsNames do
  82.       location = chestsLocations[chestsNames[l]]
  83.       moving.safeMove(location[1], location[2], location[3])
  84.       turtle.select(7 + (i % 2))
  85.       turtle.placeDown()
  86.       turtle.select(slots[chestsNames[l]])
  87.       turtle.dropDown()
  88.       i = i + 1
  89.     end
  90.   end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement