Advertisement
drNovikov

EnableAntennas

May 5th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. //  Enables antennas and sets their radius to maximum. Need to find a way to ensure broadcasting is on.
  2. void EnableAntennas()  
  3. {  
  4.     List<IMyTerminalBlock> antennas = new List<IMyTerminalBlock>();    
  5.         GridTerminalSystem.GetBlocksOfType<IMyRadioAntenna>(antennas);  
  6.     for (int i=0; i < antennas.Count; i++)
  7.     {
  8.             antennas[i].GetActionWithName("OnOff_On").Apply(antennas[i]);
  9.         antennas[i].SetValueFloat("Radius", 50000.0f);
  10.         }        
  11. }  
  12.  
  13.  
  14.  
  15. // Checks is a ship is piloted. For example, if a pilot accidentally exits a ship, this could be used to engage emergency stop.
  16. bool ShipIsPiloted()
  17. {
  18.         List<IMyTerminalBlock> controlStations = new List<IMyTerminalBlock>();
  19.     GridTerminalSystem.GetBlocksOfType<IMyCockpit>(controlStations);  
  20.         for (int i = 0; i < controlStations.Count; i++)
  21.         {
  22.                 if ((controlStations[i] as IMyCockpit).IsUnderControl)
  23.                 {
  24.                         return true;
  25.                 }
  26.         }
  27.     return false;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement