Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Triggers the force rotation algorithm. rotation in RADIENS
- --if boolean_direction is true, rotate clockwise, if false it rotates counterclockwise.
- function fpo(shipName, rotate_amount, boolean_direction)
- ba.print("fpo called with parameters: " .. shipName .. " " .. tostring(rotate_amount) .. " " .. tostring(boolean_direction) .. "\n")
- ship_to_rotate = mn.Ships[shipName]
- if ship_to_rotate:isValid() then
- ba.print("Found valid ship\n")
- end
- local vect_rotVelMax = ship_to_rotate.Physics.RotationalVelocityMax
- ba.print("Rotational Velocity Max X: " .. tostring(vect_rotVelMax["x"]))
- local t = (rotate_amount/vect_rotVelMax["x"])*1000 --solve for the time.
- ba.print("Time Equals: " .. tostring(t))
- if boolean_direction == true then
- ba.print("Rotating in one direction\n")
- local bool = ship_to_rotate:doManeuver(t,0,100,0,true,0,0,0,false)
- ba.print("I am " .. tostring(bool))
- elseif boolean_direction == false then
- ba.print("Rotating in other direction\n")
- local bool = ship_to_rotate:doManeuver(t,0,-100,0,true,0,0,0,false)
- ba.print("I am " .. tostring(bool))
- else
- ba.print("Shit be fucked up yo\n")
- --nothing. If somehow this is nil then it'll go here.
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment