Advertisement
GauHelldragon

SE BattlebotScript

Sep 28th, 2022
1,133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1.  
  2. IMyLandingGear magPlate;
  3. IMyLandingGear securingGear;
  4. IMyMotorStator hinge;
  5. List<IMyMotorSuspension> wheels;
  6. int state = 0;
  7.  
  8. public Program()
  9. {
  10.     Runtime.UpdateFrequency = UpdateFrequency.Update1;
  11.     //This makes the program automatically run every 1 ticks.
  12. }
  13.  
  14.  
  15. void Main(string argument)
  16. {
  17.     if ( magPlate == null ) {
  18.         Initilize();
  19.     }
  20.     if ( state == 0 && magPlate.isLocked ) {
  21.         state = 1;
  22.         hinge.ApplyAction("Reverse");
  23.         foreach ( IMyMotorSuspension wheel in wheels ) {
  24.             wheel.Height = -18.0f;
  25.         }
  26.     if ( state == 2 ) {
  27.         state = 0
  28.         securingGear.Unlock;
  29.         hinge.ApplyAction("Reverse");
  30.         foreach ( IMyMotorSuspension wheel in wheels ) {
  31.             wheel.Height = 18.0f;
  32.         }
  33.        
  34.     }
  35.     if ( state == 1 && hinge.Angle >= 90.0f; )
  36.     {
  37.         state = 2
  38.         magPlate.Unlock();
  39.        
  40.     }
  41.    
  42. }
  43.  
  44. void Initilize() {
  45.     magPlate = GridTerminalSystem.GetBlockWithName("Front MagPlate") as IMyLandingGear;
  46.     securingPlate = GridTerminalSystem.GetBlockWithName("Ground Plate") as IMyLandingGear;
  47.     hinge = GridTerminalSystem.GetBlockWithName("Flipper Hinge") as IMyMotorStator;
  48.     wheels = new List<IMyMotorSuspension>;
  49.     GridTerminalSystem.GetBlocksOfType(wheels);
  50. }
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement