Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IMyLandingGear magPlate;
- IMyLandingGear securingGear;
- IMyMotorStator hinge;
- List<IMyMotorSuspension> wheels;
- int state = 0;
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update1;
- //This makes the program automatically run every 1 ticks.
- }
- void Main(string argument)
- {
- if ( magPlate == null ) {
- Initilize();
- }
- if ( state == 0 && magPlate.isLocked ) {
- state = 1;
- hinge.ApplyAction("Reverse");
- foreach ( IMyMotorSuspension wheel in wheels ) {
- wheel.Height = -18.0f;
- }
- if ( state == 2 ) {
- state = 0
- securingGear.Unlock;
- hinge.ApplyAction("Reverse");
- foreach ( IMyMotorSuspension wheel in wheels ) {
- wheel.Height = 18.0f;
- }
- }
- if ( state == 1 && hinge.Angle >= 90.0f; )
- {
- state = 2
- magPlate.Unlock();
- }
- }
- void Initilize() {
- magPlate = GridTerminalSystem.GetBlockWithName("Front MagPlate") as IMyLandingGear;
- securingPlate = GridTerminalSystem.GetBlockWithName("Ground Plate") as IMyLandingGear;
- hinge = GridTerminalSystem.GetBlockWithName("Flipper Hinge") as IMyMotorStator;
- wheels = new List<IMyMotorSuspension>;
- GridTerminalSystem.GetBlocksOfType(wheels);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement