Guest User

goto.lua

a guest
Mar 23rd, 2024
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. args = {...}
  2. x = tonumber(args[1])
  3. y = tonumber(args[2])
  4. z = tonumber(args[3])
  5. target = vector.new(x, y, z)
  6.  
  7. rednet.open("left")
  8. mon = peripheral.wrap("top")
  9. fuel = turtle.getFuelLevel()
  10.  
  11. pos0 = vector.new(gps.locate())
  12. turtle.forward()
  13. pos1 = vector.new(gps.locate())
  14. dist = pos1 - pos0
  15. turtle.back()
  16. face = ""
  17. if dist.x > 0 then
  18.   face = "west"
  19. elseif dist.x < 0 then
  20.   face = "east"
  21. elseif dist.z > 0 then
  22.   face = "north"
  23. else
  24.   face = "south"
  25. end
  26.  
  27. if mon ~= nil then
  28.   mon.setTextScale(1.5)
  29.   mon.clear()
  30.   mon.setCursorPos(1, 1)
  31.   mon.write("id:"..os.getComputerID())
  32.   mon.setCursorPos(1, 2)
  33.   mon.write("fuel:"..fuel)
  34.   mon.setCursorPos(1, 3)
  35.   mon.write("pos:"..tostring(pos0))
  36.   mon.setCursorPos(1, 4)
  37.   mon.write("faceTo:"..face)
  38. end
  39. print("pos:"..tostring(pos0))
  40. print("faceTo:"..face)
  41. print("dist:"..tostring(target - pos0))
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment