Advertisement
Guest User

map

a guest
May 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. term.clear()
  2. w, h = term.getSize()
  3. coord = {}
  4. for x = -100, 100 do
  5.   for z = -100, 100 do
  6.     if 47 <= (math.abs(x+z)+math.abs(x-z))/2 and (math.abs(x+z)+math.abs(x-z))/2 <= 73  then
  7.       coord[#coord+1] = {x,z}
  8.     end
  9.     if math.max(math.abs(x),math.abs(math.abs(z)-60)) <= 27 then
  10.       coord[#coord+1] = {x,z}
  11.     end
  12.   end
  13. end
  14. while true do
  15. -- Current Position
  16. term.setCursorPos((w+math.fmod(w,2))/2, (h+math.fmod(h,2))/2)
  17. term.setBackgroundColor(colors.red)
  18. term.write(" ")
  19.  
  20. -- Mapping
  21. x1 = 1
  22. y1 = 1
  23. xloc, yloc, zloc = gps.locate()
  24. for x = math.floor(xloc) - w/2, math.floor(xloc) + w/2 do
  25.   for z = math.floor(zloc) - w/2, math.floor(zloc) + w/2 do
  26.     for t = 1, #coord do
  27.       if coord[t][1] == x and coord[t][2] == z then
  28.         shade = true
  29.       end
  30.     end
  31.     if shade then
  32.       term.setCursorPos(x1,y1)
  33.       term.setBackgroundColor(colors.gray)
  34.       term.write(" ")
  35.       shade = false
  36.     end
  37.     y1 = y1 + 1
  38.   end
  39.   x1 = x1 + 1
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement