Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- global function closest {
- parameter sgt is time:seconds.
- parameter sgstep to 1.
- set sgmindist to 9e9.
- lock sgdist to (positionat(ship, sgt) - positionat(target, sgt)):mag.
- until sgt - time:seconds > orbit:period {
- if sgdist < sgmindist {
- set sgmindist to sgdist.
- set sgmint to sgt.
- }
- set sgt to sgt + sgstep.
- }
- print sgmint. print sgmindist.
- return sgmint.
- }
- set rt to closest().
- set st to (positionat(target, rt) - positionat(ship, rt)).
- lock steering to st. wait 0.
- wait until abs(steeringmanager:angleerror) < 1.
- print "steering adjusted".
- lock dist to (positionat(ship, rt) - positionat(target, rt)):mag.
- until dist > 5000 { set rt to rt - 1.}
- when target:loaded then {
- set portacontrol to target:partsdubbedpattern("porta")[0].
- lock tgt to portacontrol:position + portacontrol:facing:vector*12.5.
- lock steering to tgt.
- lock relvel to ship:velocity:orbit - target:velocity:orbit.
- lock tarVel to tgt:normalized * relvel:mag.
- lock errvel to tarvel-relvel.
- rcs on.
- set adjust to true.
- when adjust then {
- set ship:control:translation to errvel * ship:facing:inverse.
- return adjust.
- }
- when not adjust then {
- set ship:Control:translation to v(0,0,0).
- set ship:Control:neutralize to true.
- }
- on body adjust off.
- set m to target:modulesnamed("wbijumpgate")[0].
- set m:destination to vessel("marauder plus").
- }
- set warp to 1.
- when kuniverse:timewarp:issettled then warpto(rt).
- //camera
- mapview off.
- set cam to addons:camera:flightcamera.
- set cam:mode to "orbital".
- wait 1.
- set cx to 0.
- set cy to -25.
- Set cz to 0.
- set cd to cam:distance.
- on time:seconds {
- set cam:position to (-target:position:normalized*cd)*r(cx,cy,cz).
- return target:distance > 200.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement