Advertisement
Selim_042

witherKiller

Apr 5th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. --Variables
  2. version = 0.1
  3. skullData = {name = "skull", dmg = 1, min = 3}
  4. soulSandData = {name = "soul_sand", dmg = 0, min = 4}
  5. attackDmg = 300
  6.  
  7. --Peripherals
  8. t = peripheral.find("tile_computercraft_turtle_name")
  9.  
  10. --Setup
  11. rs.setOutput("bottom", false)
  12.  
  13. --Functions
  14. function findItem(itemInfo)
  15.   slot = nil
  16.   done = false
  17.   i = 1
  18.   while i <= 16 do
  19.     slotInfo = turtle.getItemCount()
  20.     if (type(slotInfo) == "table") and (slotInfo.name == itemInfo.name) and (slotInfo.dmg == itemInfo.dmg) and (slotInfo.qty >= itemInfo.min) then
  21.       slot = i
  22.       i = 17
  23.     end
  24.     i = i + 1
  25.   end
  26.   if slot ~= nil then
  27.     return slot
  28.   end
  29. end
  30.  
  31. function placeWither(skullSlot, soulSandSlot)
  32.   turtle.select(soulSandSlot)
  33.   turtle.forward()
  34.   turtle.placeDown()
  35.   turtle.turnLeft()
  36.   turtle.place()
  37.   turtle.turnRight()
  38.   turtle.turnRight()
  39.   turtle.place()
  40.   turtle.turnLeft()
  41.   turtle.up()
  42.   turtle.placeDown()
  43.   turtle.select(skullSlot)
  44.   turtle.turnLeft()
  45.   turtle.place()
  46.   turtle.turnRight()
  47.   turtle.turnRight()
  48.   turtle.place()
  49.   turtle.turnLeft()
  50.   turtle.back()
  51.   turtle.place()
  52.   turtle.down()
  53. end
  54.  
  55. --Body
  56. while true do
  57.   --[[term.clear()
  58.   term.setCursorPos(1, 1)
  59.   ready = true
  60.   skullSlot = findItem(skullData)
  61. print(skullSlot)
  62.   soulSandSlot = findItem(soulSandData)
  63. print(soulSandSlot)
  64.   if skullSlot == false then
  65.     term.setCursorPos(1, 2)
  66.     print("Out of Wither Skulls")
  67.     sleep(10)
  68.     ready = false
  69.   end
  70.   if soulSandSlot == false then
  71.     term.setCursorPos(1, 3)
  72.     print("Out of Soul Sand")
  73.     sleep(10)
  74.     ready = false
  75.   end
  76.   if ready == false then
  77.     rs.setOutput("bottom", true)
  78.   else
  79.     rs.setOutput("bottom", false)
  80.     placeWither(skullSlot, soulSandSlot)
  81.     sleep(60)
  82.   end]]--
  83.   placeWither(1, 2)
  84.   sleep(60)
  85.   for i = 0, (attackDmg / 7) do
  86.     turtle.attack()
  87.   end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement