AndrewofDoom

Spinny spinny script.

Jun 27th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 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 boolean_firstFRot == true then --This is your first time starting? He he he...
  11. float_interval_amount = (rotation_desired/time_to_rotate)
  12. boolean_firstFRot = false
  13. end
  14.  
  15. if rotation_desired < float_interval_amount then --this is likely the last interval
  16. local float_interval_amount = float_interval_amount - rotation_desired --Get what little's left and feed it to the ship.
  17. end
  18.  
  19. local current_ship_orientation = ship_to_rotate.Orientation
  20. if boolean_rotDirection == true then
  21. current_ship_orientation["p"] = (current_ship_orientation["p"] + (float_interval_amount*ba.getFrametime(false)))
  22. elseif boolean_rotDirection == false then
  23. current_ship_orientation["p"] = (current_ship_orientation["p"] - (float_interval_amount*ba.getFrametime(false)))
  24.  
  25. else
  26. ba.error("boolean_rotDirection is nil, fix this asshole!")
  27. end
  28. ship_to_rotate.Orientation = current_ship_orientation
  29. rotation_desired = rotation_desired - float_interval_amount
  30. if rotation_desired <= 0.0 then
  31. boolean_startRotation = false
  32. end
  33. end
  34.  
  35.  
  36. --Triggers the force rotation algorithm. rotation in RADIENS
  37. --Time should be in ms.
  38. --When boolean_direction is true, it goes clockwise, and counterclockwise if false.
  39. function fpo(shipName, rotation_amount, time, boolean_direction)
  40. if boolean_startRotation ~= true then
  41. ship_to_rotate = mn.Ships[shipName]
  42. rotation_desired = rotation_amount
  43. time_to_rotate = time
  44. boolean_rotDirection = boolean_direction
  45. boolean_startRotation = true
  46. boolean_firstFRot = true
  47. end
  48. end
  49.  
  50. ]
  51.  
  52. $On Death:
  53.  
  54. [
  55. local dyingShip = hv.Self
  56. if dyingShip == hv.Player or dyingShip == ship_to_rotate then --Disable when either the player or the target ship blows up.
  57. boolean_startRotation = false
  58. boolean_firstFRot = false
  59. end
  60.  
  61. ]
  62.  
  63. $On Mission End:
  64. [
  65.  
  66. boolean_startRotation = false --force it off when a mission ends.
  67. boolean_firstFRot = false
  68.  
  69. ]
  70.  
  71. #End
Advertisement
Add Comment
Please, Sign In to add comment