sumguytwitches

SG Dynamic Display

Apr 8th, 2022 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set sgp to 0.
  2. set sggo to true.
  3. set sgf to 8.
  4. set sgpr to 4.
  5. set displayItems to list().
  6. function sgd {
  7. parameter l.
  8. parameter d.
  9. If l:length > sgpr set sgpr to l:length.
  10. print (l:padleft(sgpr) + ": " +round(d(),2)):padright(terminal:width) at (0, sgp).
  11. set sgp to sgp + 1.
  12. }.
  13.  
  14. function addLine {
  15. parameter l.
  16. parameter d.
  17. local func to sgd(l,d).
  18. displayItems:add(func@).
  19. }
  20. lock twr to ship:availablethrust/ship:mass/body:mu*body:position:sqrmagnitude.
  21. list engines in es.
  22. function fueltime {
  23. set total to 0.
  24. for e in es set total to choose total+e:consumedresources["liquid fuel"]:fuelflow if e:consumedresources:haskey("liquid fuel") else 0.
  25. return choose ship:liquidfuel/total if total > 0 else -1.
  26. }
  27.  
  28. addLine("alt radar",{return alt:radar.}).
  29. //addLine("terrain alt",ship:geoposition:terrainheight).
  30. //addLine("groundspeed",groundspeed).
  31. //addLine("twr",twr).
  32. //addLine("oxidizer", ship:oxidizer).
  33. //addLine("liquidfuel", ship:liquidfuel).
  34. //addLine("Fuel Time", fueltime()/60).
  35. //addLine("eta minutes", alt:radar / -ship:verticalspeed / 60).
  36. //addLine("Vertical Speed", ship:verticalspeed).
  37.  
  38. //displayItems:add(sgd("bottom alt radar:", ship:bounds:bottomaltradar)).
  39.  
  40.  
  41. set sggo to false. wait 0. set sggo to true.
  42. On round(kuniverse:realtime * sgf) {
  43. set sgp to 0.
  44.  
  45. foreach line in displayItems {
  46. line().
  47. }
  48.  
  49.  
  50. Print "":padright(terminal:width) at (0,sgp).
  51. Set sgp to sgp + 1.
  52. Print "":padright(terminal:width) at (0,sgp).
  53. return sggo.
  54. }
  55.  
Add Comment
Please, Sign In to add comment