Implement align_with-function so as to not repeat ourselves too much.
This commit is contained in:
parent
3a1a120ba9
commit
694eeac86f
1 changed files with 18 additions and 0 deletions
|
@ -67,6 +67,24 @@ function extend_antennas {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function align_with {
|
||||||
|
//
|
||||||
|
// Aligns the rocket with the given vector or node.
|
||||||
|
//
|
||||||
|
parameter direction. // Vector or Node
|
||||||
|
parameter tolerance is 0.5.
|
||||||
|
|
||||||
|
local alignment_vector is direction.
|
||||||
|
if direction:istype("Node") {
|
||||||
|
lock alignment_vector to direction:burnvector. // locking allows steering to dynamically update when the node does
|
||||||
|
}
|
||||||
|
|
||||||
|
SAS off.
|
||||||
|
lock STEERING to alignment_vector.
|
||||||
|
wait until vang(SHIP:facing:vector, alignment_vector) <= tolerance.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function unlock_control {
|
function unlock_control {
|
||||||
//
|
//
|
||||||
// Ensure that the throttle is 0 and that the player is not locked out of control.
|
// Ensure that the throttle is 0 and that the player is not locked out of control.
|
||||||
|
|
Loading…
Reference in a new issue