Suicide_Jack

Untitled

Feb 16th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. //author GreenPixel , BASIC COORDS and ultra precice speed controll butchered by Suicide_Jack
  2. //1 place programmable block name it Programmable
  3. //2 rename one thruster that thrusts forward "Forward Thruster"
  4. //3 setup timer block that triggers itself and this script
  5. //TODO Make this autopilot on off
  6. List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
  7. double x0,dx;
  8. double y0,dy;
  9. double z0,dz;
  10. double speed;
  11. double setSpeed=0.012;//0.016~1m/s (perfect speed for drilling 0.3m/s)
  12. double speedMultiplier=2400000;
  13. float Thrust;
  14. void Main()
  15.  
  16.  
  17. {
  18. GridTerminalSystem.SearchBlocksOfName("PDS-Controller",blocks);
  19. double x = Math.Round(blocks[0].GetPosition().GetDim(0),3);
  20. double y = Math.Round(blocks[0].GetPosition().GetDim(1),3);
  21. double z = Math.Round(blocks[0].GetPosition().GetDim(2),3); dx=x-x0;dy=y-y0;dz=z-z0;x0=x;y0=y;z0=z;
  22. speed=Math.Round(Math.Sqrt(dx*dx+dy*dy+dz*dz),5);
  23. blocks[0].SetCustomName("PDS-Controller"+speed );
  24. GridTerminalSystem.SearchBlocksOfName("PDS-Thruster",blocks);
  25.  
  26. Thrust=(float)(setSpeed-speed)*(float)speedMultiplier;
  27.  
  28. blocks[0].SetValueFloat("Override",Thrust);
  29. blocks[0].SetCustomName("PDS-Thruster 1 "+Thrust);
  30.  
  31. blocks[1].SetValueFloat("Override",Thrust);
  32. blocks[1].SetCustomName("PDS-Thruster 2 "+Thrust);
  33.  
  34. blocks[2].SetValueFloat("Override",Thrust);
  35. blocks[2].SetCustomName("PDS-Thruster 3 "+Thrust);
  36.  
  37. blocks[3].SetValueFloat("Override",Thrust);
  38. blocks[3].SetCustomName("PDS-Thruster 4 "+Thrust);
  39.  
  40. blocks[4].SetValueFloat("Override",Thrust);
  41. blocks[4].SetCustomName("PDS-Thruster 5 "+Thrust);
  42.  
  43. blocks[5].SetValueFloat("Override",Thrust);
  44. blocks[5].SetCustomName("PDS-Thruster 6 "+Thrust);
  45.  
  46. blocks[6].SetValueFloat("Override",Thrust);
  47. blocks[6].SetCustomName("PDS-Thruster 7 "+Thrust);
  48.  
  49. blocks[7].SetValueFloat("Override",Thrust);
  50. blocks[7].SetCustomName("PDS-Thruster 8 "+Thrust);
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment