示例#1
0
 public void TogglePanel(IMyTextPanel Block)
 {
     if (Block != null && Block.Enabled)
     {
         var off = Block.GetActionWithName("OnOff_Off");
         var on  = Block.GetActionWithName("OnOff_On");
         if (off != null && on != null)
         {
             off.Apply(Block);
             on.Apply(Block);
         }
     }
 }
示例#2
0
        /// <summary>
        /// Sends entity IDs to a text panel for display. To display GPS or Entity ID on the text panel,
        /// the appropriate command should be enabled on the text panel.
        /// </summary>
        /// <param name="panelName">The name of the text panel</param>
        /// <param name="entityIds">List of entity IDs to display. Order of the list does not affect
        /// the order they will be displayed in.</param>
        void DisplayEntitiesOnPanel(string panelName, List <TerminalActionParameter> entityIds)
        {
            IMyTerminalBlock term = GridTerminalSystem.GetBlockWithName(panelName);

            if (term == null)
            {
                Terminate(panelName + " does not exist or is not accessible");
                return;
            }
            IMyTextPanel panel = term as IMyTextPanel;

            if (panel == null)
            {
                Terminate(panelName + " is not a text panel");
                return;
            }
            ITerminalAction act = panel.GetActionWithName(displayAction);

            if (act == null)
            {
                Terminate("ARMS is not loaded. ARMS is a prerequisite for this script.");
                return;
            }
            panel.ApplyAction(displayAction, entityIds);
        }