SofieBrink

TPKSP Test

Feb 2nd, 2023 (edited)
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. Function DoDeorbit {
  2. parameter targeted is false.
  3. parameter tar is latlng(0,0).
  4. parameter lngoffset is 175.
  5. local deorbitlng is tar:lng - lngoffset.
  6. if deorbitlng < -180 {
  7. set deorbitlng to deorbitlng + 360.
  8. }
  9.  
  10. if (targeted) {
  11. local warplng is 0.
  12. local wantedoffset is abs(ship:orbit:inclination).
  13. if (ship:longitude > deorbitlng - wantedoffset) {
  14. set warplng to 360 - ship:longitude + deorbitlng - wantedoffset.
  15. }
  16. else {
  17. set warplng to deorbitlng - wantedoffset - ship:longitude.
  18. }
  19. local warptime is time:seconds + warplng / (360 / ship:orbit:period - (360 / body:rotationperiod)).
  20. lock steering to -velocityat(ship, warptime):orbit.
  21.  
  22. print "Re-orienting...".
  23.  
  24. wait until vang(steering, ship:facing:vector) < 3.
  25.  
  26. print "Warping...".
  27.  
  28. warpto(warptime - 30).
  29.  
  30. lock steering to retrograde.
  31.  
  32. wait until time:seconds > warptime.
  33. }
  34. else {
  35. lock steering to retrograde.
  36. print "Re-orienting...".
  37.  
  38. wait until vang(steering, ship:facing:vector) < 3.
  39. }
  40.  
  41.  
  42. if ship:maxthrust = 0 {
  43. toggle ag3.
  44. }
  45.  
  46. lock throttle to 0.4.
  47. when (ship:periapsis < 42000) then {
  48. lock throttle to 0.
  49. toggle ag3.
  50. unlock steering.
  51. set PrintOut to false.
  52. }
  53.  
  54. }
  55.  
  56.  
  57. Function LogToDisk { parameter volume is 1. parameter compileksm is false. local filestring is "
  58. if (homeConnection:isconnected AND exists(" + char(34) + "0:/boot/StableBoot.ks" + char(34) + ")) {
  59. copyPath(" + char(34) + "0:/boot/StableBoot.ks" + char(34) + ", " + char(34) + "1:/boot/StableBoot.ks" + char(34) + ").
  60. set core:bootfilename to " + char(34) + "boot/StableBoot" + char(34) + ".
  61. }
  62. wait until abs(vang(up:vector, ship:facing:vector) - 90) < 0.5
  63. and vang(up:vector, ship:facing:topvector) < 0.5.
  64. set ship:loaddistance:splashed:unpack to 0.1.
  65. set ship:loaddistance:splashed:pack to 0.2.
  66. hudtext(" + char(34) + "Barge is Stable" + char(34) + ", 4, 2, 24, white, false).
  67. ". if exists(volume + ":/" + "tmp.ks") { print ".ks File already exists, Overwriting.". deletepath(volume + ":/" + "tmp.ks"). } log filestring to volume + ":/" + "tmp.ks". wait 0. if (compileksm) { if exists(volume + ":/" + "tmp.ksm") { print ".ksm File already exists, Overwriting.". deletepath(volume + ":/" + "tmp.ksm"). } compile (volume + ":/" + "tmp.ks") to (volume + ":/" + "tmp.ksm").} }
  68.  
Advertisement
Add Comment
Please, Sign In to add comment