Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Conditional Hooks
- $State: GS_STATE_GAME_PLAY
- $On Frame:
- [
- --Rotational Compensation. For those ignorant evil things known as THENUMBERSANDRESULTSDONTMATCHUP
- if boolean_startRotation == true then
- if boolean_firstFRot == true then --This is your first time starting? He he he...
- float_interval_amount = (rotation_desired/time_to_rotate)
- boolean_firstFRot = false
- end
- rotation_added = 0
- rotation_added = (rotation_added + (float_interval_amount*ba.getFrametime(false)))
- if rotation_desired < float_interval_amount then --this is likely the last interval
- local float_interval_amount = float_interval_amount - rotation_desired --Get what little's left and feed it to the ship.
- end
- local original_ship_orientation = ship_to_rotate.Orientation
- if boolean_rotDirection == true then
- new_ship_orientation = ba.createOrientation(0,original_ship_orientation["b"],original_ship_orientation["h"])
- new_ship_orientation["p"] = (original_ship_orientation["p"] + rotation_added)
- elseif boolean_rotDirection == false then
- new_ship_orientation = ba.createOrientation(0,original_ship_orientation["b"],original_ship_orientation["h"])
- new_ship_orientation["p"] = (original_ship_orientation["p"] - rotation_added)
- else
- ba.error("boolean_rotDirection is nil, fix this asshole!")
- end
- ship_to_rotate.Orientation = new_ship_orientation
- rotation_desired = (rotation_desired - (float_interval_amount*ba.getFrametime(false)))
- if rotation_desired <= 0.0 then
- boolean_startRotation = false
- end
- end
- --Triggers the force rotation algorithm. rotation in RADIENS
- --Time should be in ms.
- --When boolean_direction is true, it goes clockwise, and counterclockwise if false.
- function fpo(shipName, rotation_amount, time, boolean_direction)
- if boolean_startRotation ~= true then
- ship_to_rotate = mn.Ships[shipName]
- rotation_desired = rotation_amount
- time_to_rotate = time
- boolean_rotDirection = boolean_direction
- boolean_startRotation = true
- boolean_firstFRot = true
- end
- end
- ]
- $On Death:
- [
- local dyingShip = hv.Self
- if dyingShip == hv.Player or dyingShip == ship_to_rotate then --Disable when either the player or the target ship blows up.
- boolean_startRotation = false
- boolean_firstFRot = false
- end
- ]
- $On Mission End:
- [
- boolean_startRotation = false --force it off when a mission ends.
- boolean_firstFRot = false
- ]
- #End
Advertisement
Add Comment
Please, Sign In to add comment