Advertisement
King0fGamesYami

Patriotism

May 30th, 2016
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. os.loadAPI( "partTerm" )
  2.  
  3. commands.kill( "@e[type=ArmorStand,CustomName=coordfinder]" )
  4.  
  5. --make an armor stand for us
  6. commands.summon( "ArmorStand ~ ~ ~ {Invisible:1b,CustomName:coordfinder,NoGravity:1}" )
  7.  
  8. local function getPosition()
  9.         commands.execAsync( "tp @e[type=ArmorStand,CustomName=coordfinder] @p" )
  10.         local ok, result = commands.tp( "@e[type=ArmorStand,CustomName=coordfinder] ~ ~ ~" )
  11.         local x, y, z = result[ 1 ]:match( "to (%S+), (%S+), (%S+)" )
  12.         return tonumber( x ), tonumber( y ), tonumber( z )
  13. end
  14.  
  15. local x, y, z = getPosition()
  16. local oldX, oldZ = x, z
  17. local win = partTerm.createWindow( x, y + 3.5, z, 15, 7)
  18. win.center(false)
  19.  
  20. local oldTerm = term.redirect( win )
  21. paintutils.drawImage(paintutils.loadImage( "flag" ), 1,1 )
  22. term.redirect(oldTerm)
  23.  
  24. parallel.waitForAny(
  25.         function()
  26.                 while true do
  27.                         local newX, newY, newZ = getPosition()
  28.                        
  29.                         if newX ~= x or newZ ~= z then
  30.                                 oldX, oldY, oldZ = x, y, z
  31.                                 x, y, z = newX, newY, newZ
  32.                                 win.setAngles(partTerm.getHorizontalAngle(oldX, oldZ, x, z))
  33.                                 win.reposition( x, y + 3.5, z )
  34.                         elseif newY ~= y then
  35.                                 y = newY
  36.                                 win.reposition( x, y + 3.5, z )
  37.                         end
  38.                        
  39.                         sleep( 0.5 )
  40.                 end
  41.         end,
  42.        
  43.         partTerm.render )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement