uepyon

curpos.lua

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