Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Program()
- {
- // The constructor, called only once every session and
- // always before any other method is called. Use it to
- // initialize your script.
- //
- // The constructor is optional and can be removed if not
- // needed.
- //
- // It's recommended to set RuntimeInfo.UpdateFrequency
- // here, which will allow your script to run itself without a
- // timer block.
- }
- public void Save()
- {
- // Called when the program needs to save its state. Use
- // this method to save your state to the Storage field
- // or some other means.
- //
- // This method is optional and can be removed if not
- // needed.
- }
- // Method for finding blocks by names
- List<IMyTerminalBlock> SearchBlocksByName(string blockName) {
- var blocks = new List<IMyTerminalBlock>();
- GridTerminalSystem.SearchBlocksOfName(blockName, blocks);
- return blocks;
- }
- public void Main(string argument, UpdateType updateSource)
- {
- List<IMyTerminalBlock> doors = new List<IMyTerminalBlock>();
- GridTerminalSystem.GetBlocksOfType<IMyDoor>(doors);
- List<IMyDoor> hangarDoors = new List<IMyDoor>();
- for (int i = 0; i < doors.Count; i++)
- {
- if (doors[i].CustomName.Contains("Airtight"))
- {
- hangarDoors.Add(doors[i] as IMyDoor);
- }
- }
- for (int i = 0; i < hangarDoors.Count; i++)
- {
- hangarDoors[i].ApplyAction("Open_Off");
- }
- IMyTimerBlock time = GridTerminalSystem.GetBlockWithName("Timer Block") as IMyTimerBlock;
- time.ApplyAction("OnOff_On");
- time.ApplyAction("Stop");
- var vents = SearchBlocksByName("AirHangar");
- List<IMyAirVent> airVents = new List<IMyAirVent>();
- for (int i = 0; i < vents.Count; i++)
- {
- airVents.Add(vents[i] as IMyAirVent);
- }
- for (int i = 0; i < airVents.Count(); i++)
- {
- airVents[i].ApplyAction("Depressurize_Off");
- }
- }
Add Comment
Please, Sign In to add comment