Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //author GreenPixel , BASIC COORDS and ultra precice speed controll butchered by Suicide_Jack
- //1 place programmable block name it Programmable
- //2 rename one thruster that thrusts forward "Forward Thruster"
- //3 setup timer block that triggers itself and this script
- //TODO Make this autopilot on off
- List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
- double x0,dx;
- double y0,dy;
- double z0,dz;
- double speed;
- double setSpeed=0.012;//0.016~1m/s (perfect speed for drilling 0.3m/s)
- double speedMultiplier=2400000;
- float Thrust;
- void Main()
- {
- GridTerminalSystem.SearchBlocksOfName("PDS-Controller",blocks);
- double x = Math.Round(blocks[0].GetPosition().GetDim(0),3);
- double y = Math.Round(blocks[0].GetPosition().GetDim(1),3);
- 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;
- speed=Math.Round(Math.Sqrt(dx*dx+dy*dy+dz*dz),5);
- blocks[0].SetCustomName("PDS-Controller"+speed );
- GridTerminalSystem.SearchBlocksOfName("PDS-Thruster",blocks);
- Thrust=(float)(setSpeed-speed)*(float)speedMultiplier;
- blocks[0].SetValueFloat("Override",Thrust);
- blocks[0].SetCustomName("PDS-Thruster 1 "+Thrust);
- blocks[1].SetValueFloat("Override",Thrust);
- blocks[1].SetCustomName("PDS-Thruster 2 "+Thrust);
- blocks[2].SetValueFloat("Override",Thrust);
- blocks[2].SetCustomName("PDS-Thruster 3 "+Thrust);
- blocks[3].SetValueFloat("Override",Thrust);
- blocks[3].SetCustomName("PDS-Thruster 4 "+Thrust);
- blocks[4].SetValueFloat("Override",Thrust);
- blocks[4].SetCustomName("PDS-Thruster 5 "+Thrust);
- blocks[5].SetValueFloat("Override",Thrust);
- blocks[5].SetCustomName("PDS-Thruster 6 "+Thrust);
- blocks[6].SetValueFloat("Override",Thrust);
- blocks[6].SetCustomName("PDS-Thruster 7 "+Thrust);
- blocks[7].SetValueFloat("Override",Thrust);
- blocks[7].SetCustomName("PDS-Thruster 8 "+Thrust);
- }
Advertisement
Add Comment
Please, Sign In to add comment