AndrewofDoom

Untitled

Jun 27th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. --Triggers the force rotation algorithm. rotation in RADIENS
  2. --if boolean_direction is true, rotate clockwise, if false it rotates counterclockwise.
  3. function fpo(shipName, rotate_amount, boolean_direction)
  4. ba.print("fpo called with parameters: " .. shipName .. " " .. tostring(rotate_amount) .. " " .. tostring(boolean_direction) .. "\n")
  5. ship_to_rotate = mn.Ships[shipName]
  6. if ship_to_rotate:isValid() then
  7. ba.print("Found valid ship\n")
  8. end
  9. local vect_rotVelMax = ship_to_rotate.Physics.RotationalVelocityMax
  10. ba.print("Rotational Velocity Max X: " .. tostring(vect_rotVelMax["x"]))
  11. local t = (rotate_amount/vect_rotVelMax["x"])*1000 --solve for the time.
  12. ba.print("Time Equals: " .. tostring(t))
  13. if boolean_direction == true then
  14. ba.print("Rotating in one direction\n")
  15. local bool = ship_to_rotate:doManeuver(t,0,100,0,true,0,0,0,false)
  16. ba.print("I am " .. tostring(bool))
  17. elseif boolean_direction == false then
  18. ba.print("Rotating in other direction\n")
  19. local bool = ship_to_rotate:doManeuver(t,0,-100,0,true,0,0,0,false)
  20. ba.print("I am " .. tostring(bool))
  21. else
  22. ba.print("Shit be fucked up yo\n")
  23. --nothing. If somehow this is nil then it'll go here.
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment