Advertisement
Guest User

follow

a guest
Feb 9th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. local mods = peripheral.wrap "back"
  2. local targ = ...
  3.  
  4. local function yaw_and_pitch(e)
  5.     local x, y, z = e.x, e.y, e.z
  6.     local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
  7.     local yaw = math.atan2(-x, z)
  8.     return math.deg(yaw), math.deg(pitch)
  9. end
  10.  
  11. while true do
  12.     local t = mods.getMetaByName(targ)
  13.     if t then
  14.         local y, p = yaw_and_pitch(t)
  15.         --mods.fire(y, p, 0.5)
  16.         mods.launch(y, p, 1)
  17.     end
  18.     sleep(0.1)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement