Advertisement
guitarplayer616

Turtle Simulate

Dec 21st, 2016
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.57 KB | None | 0 0
  1. --fs.open("simulate","w").write(http.post("http://pastebin.com/raw/Th40FmCz").readAll())
  2. --estimation needs rework
  3.  
  4. turtle = {}
  5. gRuntime = 0
  6. selectTime = 0
  7.  
  8. runtimeHistory = {}
  9. select = 1
  10. inventory = {
  11.     [1] = {name = "minecraft:wool",damage = 4,count = 32},
  12.     [2] = {name = "minecraft:fence",damage = 0,count = 6},
  13.     [3] = {name = "minecraft:wool",damage = 0,count = 64},
  14.     [4] = {name = "minecraft:wool",damage = 0,count = 64},
  15.     [5] = {name = "minecraft:wool",damage = 0,count = 64},
  16.     [6] = {name = "minecraft:wool",damage = 0,count = 64},
  17.     [7] = {name = "minecraft:wool",damage = 0,count = 64},
  18.     [8] = {name = "minecraft:wool",damage = 0,count = 1},
  19.     [9] = {name = "minecraft:wooden_slab",damage = 0,count = 2},
  20.     [10] = {name = "minecraft:torch",damage = 0,count = 4},
  21.     [11] = {name = "minecraft:wool",damage = 14,count = 14},
  22.     [12] = {name = "minecraft:planks",damage = 0,count = 48},
  23.     [13] = {name = "minecraft:snow_layer",damage = 0,count = 8},
  24.     [14] = {name = "minecraft:wool",damage = 15,count = 2},
  25.     [15] = nil,
  26.     [16] = nil,
  27. }
  28.  
  29. function getRuntime()
  30.     local estimatedRuntime = (gRuntime-1*.4) + .05 + (selectTime * .05)
  31.     return estimatedRuntime
  32. end
  33.  
  34. function turtle.getItemDetail(i)
  35.     if i then
  36.         return inventory[i]
  37.     else
  38.         return inventory[select]
  39.     end
  40. end
  41.  
  42. function turtle.inspect()
  43.     return true
  44. end
  45.  
  46. function turtle.inspectDown()
  47.     return true
  48. end
  49.  
  50. function turtle.getItemCount()
  51.     if inventory[select] then
  52.         return inventory[select].count
  53.     else
  54.         return 0
  55.     end
  56. end
  57.  
  58. function turtle.digDown()
  59.     gRuntime = gRuntime + 1
  60.     return true
  61. end
  62.  
  63. function turtle.dig()
  64.     gRuntime = gRuntime + 1
  65.     return true
  66. end
  67.  
  68.  
  69. function turtle.forward()
  70.     gRuntime = gRuntime + 1
  71.     return true
  72. end
  73.  
  74. function turtle.back()
  75.     gRuntime = gRuntime + 1
  76.     return true
  77. end
  78.  
  79. function turtle.up()
  80.     gRuntime = gRuntime + 1
  81.     return true
  82. end
  83.  
  84. function turtle.down()
  85.     gRuntime = gRuntime + 1
  86.     return true
  87. end
  88.  
  89. function turtle.turnLeft()
  90.     gRuntime = gRuntime + 1
  91.     return true
  92. end
  93.  
  94. function turtle.turnRight()
  95.     gRuntime = gRuntime + 1
  96.     return true
  97. end
  98.  
  99. function turtle.placeDown()
  100.     gRuntime = gRuntime + 1
  101.     return true
  102. end
  103.  
  104. function turtle.place()
  105.     gRuntime = gRuntime + 1
  106.     return true
  107. end
  108.  
  109. function turtle.refuel()
  110.     return true
  111. end
  112.  
  113. function turtle.transferTo()
  114.     return true
  115. end
  116.  
  117. function turtle.getFuelLevel()
  118.     return 15000
  119. end
  120.  
  121. function turtle.select(n)
  122.     select = n
  123.     selectTime = selectTime + 1
  124.     return select
  125. end
  126.  
  127. function turtle.getSelectedSlot()
  128.     return select
  129. end
  130.  
  131. function turtle.getRuntime()
  132.     return tostring(gRuntime).." seconds"
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement