Advertisement
abobich

get_angles.lua

Apr 16th, 2024
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | Gaming | 0 0
  1. local input = peripheral.wrap('blockReader_1')
  2.  
  3. function get_angles()
  4.  
  5. local cannon_data = input.getBlockData()
  6. local arr =
  7. {
  8. ['horizontal']=cannon_data['CannonYaw'],
  9. ['vertical']=cannon_data['CannonPitch']
  10. }
  11.  
  12. if arr['horizontal'] > 180 then
  13.     arr['horizontal'] = arr['horizontal'] - 360
  14. end
  15. if arr['horizontal'] < -180 then
  16.     arr['horizontal'] = arr['horizontal'] + 360
  17. end
  18.  
  19. return arr
  20.  
  21. end
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement