private bool OpenPropertiesByEntityId(long entityId) { MyEntity openTerminalEntity; MyEntities.TryGetEntityById(entityId, out openTerminalEntity); //rule: When you want to open character terminal you pass null as interactedEntity if (openTerminalEntity is MyCharacter) { MyGuiScreenTerminal.ChangeInteractedEntity(null); return(true); } //grid = null -> has been destroyed or something like that if (openTerminalEntity != null && openTerminalEntity is MyCubeGrid) { var grid = openTerminalEntity as MyCubeGrid; m_tempSendingToGrid.Clear(); m_tempReceivingFromGrid.Clear(); GridBroadcastersFromPlayer(grid, m_tempSendingToGrid); PlayerBroadcastersFromGrid(grid, m_tempReceivingFromGrid); if ((m_tempSendingToGrid.Count > 0 && m_tempReceivingFromGrid.Count > 0) || m_openInventoryInteractedEntityRepresentative == grid) { //This will only happen when you have a grid with no radio connection, in which case the entity itself is the only available option if (m_tempReceivingFromGrid.Count <= 0) { MyGuiScreenTerminal.ChangeInteractedEntity(MyGuiScreenTerminal.InteractedEntity); } //pick the first antenna from cube grid to switch (could've been any one anyways) else { MyGuiScreenTerminal.ChangeInteractedEntity(m_tempReceivingFromGrid.ElementAt(0).Entity as MyTerminalBlock); } return(true); } } //Else throw an alert to the user saying "ship has been disconnected" or something? return(false); }