Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Conditional Hooks
- $State: GS_STATE_GAME_PLAY
- $On Frame:
- [
- if boolean_startRotation == true then
- if ship_to_rotate.Orientation["p"] > (pitch_desired+0.01) then --get it within +-.01 of the desire. An exact number may take forever...
- ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] - (ship_to_rotate.Orientation["p"]/pitch_desired))
- elseif ship_to_rotate.Orientation["p"] < (pitch_desired-0.01) then
- ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] + (ship_to_rotate.Orientation["p"]/pitch_desired))
- else --must be done
- boolean_startRotation = false
- end
- end
- function fpo(shipName, rotate_amount, boolean_direction)
- ba.print("fpo called with parameters: " + shipname + " " + rotate_amount + " " + 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
- local t = rotate_amount/vect_rotVelMax["x"] --solve for the time.
- if boolean_direction == true then
- ba.print("Rotating in one direction\n")
- ship_to_rotate:doManeuver(t,0,100,0,true,0,0,0,false)
- elseif boolean_direction == false then
- ba.print("Rotating in other direction\n")
- ship_to_rotate:doManeuver(t,0,-100,0,true,0,0,0,false)
- 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