SHOW:
|
|
- or go back to the newest paste.
| 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 |
| 8 | + | |
| 9 | if ship_to_rotate.Orientation["p"] > (pitch_desired+0.01) then --get it within +-.01 of the desire. An exact number may take forever... | |
| 10 | ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] - (ship_to_rotate.Orientation["p"]/pitch_desired)) | |
| 11 | elseif ship_to_rotate.Orientation["p"] < (pitch_desired-0.01) then | |
| 12 | ship_to_rotate.Orientation["p"] = (ship_to_rotate.Orientation["p"] + (ship_to_rotate.Orientation["p"]/pitch_desired)) | |
| 13 | else --must be done | |
| 14 | boolean_startRotation = false | |
| 15 | end | |
| 16 | end | |
| 17 | function fpo(shipName, rotate_amount, boolean_direction) | |
| 18 | ba.print("fpo called with parameters: " + shipname + " " + rotate_amount + " " + boolean_direction + "\n")
| |
| 19 | ship_to_rotate = mn.Ships[shipName] | |
| 20 | - | --Triggers the force rotation algorithm. rotation in RADIENS |
| 20 | + | |
| 21 | - | --function fpo(shipName, pitch_orientation) |
| 21 | + | |
| 22 | - | -- ship_to_rotate = mn.Ships[shipName] |
| 22 | + | |
| 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. |
| 23 | + | |
| 24 | - | -- ship_to_rotate.Orientation["p"] = 0 |
| 24 | + | |
| 25 | - | -- else |
| 25 | + | |
| 26 | - | -- pitch_desired = pitch_orientation |
| 26 | + | |
| 27 | - | -- boolean_startRotation = true |
| 27 | + | |
| 28 | - | --end |
| 28 | + | |
| 29 | - | --end |
| 29 | + | |
| 30 | ship_to_rotate:doManeuver(t,0,-100,0,true,0,0,0,false) | |
| 31 | - | --Triggers the force rotation algorithm. rotation in RADIENS |
| 31 | + | |
| 32 | - | --if boolean_direction is true, rotate clockwise, if false it rotates counterclockwise. |
| 32 | + | |
| 33 | --nothing. If somehow this is nil then it'll go here. | |
| 34 | end | |
| 35 | end | |
| 36 | ||
| 37 | ] |