Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int One = 1;
- int seconds = 0;
- void Main(string argument) {
- if (seconds < 100)
- {
- //putShipIntoStorage();
- takeShipFromStorage();
- }
- }
- void takeShipFromStorage() {
- seconds++;
- IMyPistonBase pistonY = (IMyPistonBase)GridTerminalSystem.GetBlockWithName("Piston_Y");
- IMyMotorAdvancedStator rotorPad = (IMyMotorAdvancedStator)GridTerminalSystem.GetBlockWithName("Rotor_Pad");
- List<IMyTerminalBlock> pistonsX = new List<IMyTerminalBlock>();
- GridTerminalSystem.GetBlocksOfType<IMyPistonBase>(pistonsX, ShouldIncludePistons);
- if (seconds == One)
- {
- ApplyActionToAllBlocks(pistonsX, "Reverse");
- }
- if (seconds == One + 10)
- {
- ApplyActionToBlock(rotorPad, "Reverse");
- }
- if (seconds == One + 20 + 10)
- {
- ApplyActionToBlock(pistony, "Reverse");
- }
- }
- void putShipIntoStorage() {
- seconds++;
- IMyPistonBase pistonY = (IMyPistonBase)GridTerminalSystem.GetBlockWithName("Piston_Y");
- IMyMotorAdvancedStator rotorPad = (IMyMotorAdvancedStator)GridTerminalSystem.GetBlockWithName("Rotor_Pad");
- List<IMyTerminalBlock> pistonsX = new List<IMyTerminalBlock>();
- GridTerminalSystem.GetBlocksOfType<IMyPistonBase>(pistonsX, ShouldIncludePistons);
- if (seconds == One)
- {
- ApplyActionToBlock(pistonY, "Reverse");
- }
- if (seconds == One + 20)
- {
- ApplyActionToBlock(rotorPad, "Reverse");
- }
- if (seconds == One + 20 + 10)
- {
- ApplyActionToAllBlocks(pistonsX, "Reverse");
- }
- }
- void ApplyActionToBlock(IMyTerminalBlock block, string action)
- {
- block.GetActionWithName(action).Apply(block);
- }
- bool ShouldIncludePistons (IMyTerminalBlock block)
- {
- return (block.CustomName).Contains("Piston_X");
- }
- void ApplyActionToAllBlocks(List<IMyTerminalBlock> blocks, string action)
- {
- for (int i = 0; i < blocks.Count; i++)
- {
- blocks[i].GetActionWithName(action).Apply(blocks[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement