AndrewofDoom

Untitled

Jun 27th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #Conditional Hooks
  2.  
  3. $State: GS_STATE_GAME_PLAY
  4.  
  5. $On Frame:
  6.  
  7. [
  8. --Rotational Compensation. For those ignorant evil things known as THENUMBERSANDRESULTSDONTMATCHUP
  9. if boolean_startRotation == true then
  10. if ship_to_rotate.Orientation["p"] > (pitch_desired+0.01) then --get it within +-.01 of the desire. An exact number may take forever...
  11. ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] - (ship_to_rotate.Orientation["p"]/pitch_desired))
  12. elseif ship_to_rotate.Orientation["p"] < (pitch_desired-0.01) then
  13. ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] + (ship_to_rotate.Orientation["p"]/pitch_desired))
  14. else --must be done
  15. boolean_startRotation = false
  16. end
  17. end
  18.  
  19.  
  20. --Triggers the force rotation algorithm. rotation in RADIENS
  21. function fpo(shipName, pitch_orientation)
  22. ship_to_rotate = mn.Ships[shipName]
  23. if pitch_orientation == 0 then --if it's 0 I'm not going to bother with it due to probable division by 0 errors.
  24. ship_to_rotate.Orientation["p"] = 0
  25. else
  26. pitch_desired = pitch_orientation
  27. boolean_startRotation = true
  28. end
  29. end
  30.  
  31. ]
  32.  
  33. $On Death:
  34.  
  35. [
  36. local dyingShip = hv.Self
  37. if dyingShip == hv.Player or dyingShip == ship_to_rotate then --Disable when either the player or the target ship blows up.
  38. boolean_startRotation = false
  39. end
  40.  
  41. ]
  42.  
  43. $On Mission End:
  44. [
  45.  
  46. boolean_startRotation = false --force it off when a mission ends.
  47.  
  48. ]
  49.  
  50. #End
Advertisement
Add Comment
Please, Sign In to add comment