private void UpdateRelayedCameras() { var mutualGridsInfo = MyAntennaSystem.GetMutuallyConnectedGrids(m_grid).ToList(); //We need to sort to make sure that the list of relayed cameras is always the same, regardles of which grid system computes it. //This is so that cycling through the cameras will be the same. mutualGridsInfo.Sort(delegate(MyAntennaSystem.BroadcasterInfo b1, MyAntennaSystem.BroadcasterInfo b2) { return(b1.EntityId.CompareTo(b2.EntityId)); }); m_relayedCameras.Clear(); foreach (var gridInfo in mutualGridsInfo) { AddValidCamerasFromGridToRelayed(gridInfo.EntityId); } //We don't have an antenna connected if (m_relayedCameras.Count == 0) { AddValidCamerasFromGridToRelayed(m_grid); } }
public void SetAsCurrent(MyCameraBlock newCamera) { MyDebug.AssertDebug(newCamera != null); if (m_currentCamera == newCamera) { return; } if (newCamera.BlockDefinition.OverlayTexture != null) { MyHudCameraOverlay.TextureName = newCamera.BlockDefinition.OverlayTexture; MyHudCameraOverlay.Enabled = true; } else { MyHudCameraOverlay.Enabled = false; } string shipName = MyAntennaSystem.GetLogicalGroupRepresentative(m_grid).DisplayName ?? ""; string cameraName = newCamera.DisplayNameText; MyHud.CameraInfo.Enable(shipName, cameraName); m_currentCamera = newCamera; m_ignoreNextInput = true; MySessionComponentVoxelHand.Static.Enabled = false; MyCubeBuilder.Static.Deactivate(); }
public static bool CameraIsInRangeAndPlayerHasAccess(MyCameraBlock camera) { if (MySession.ControlledEntity != null) { MyIDModule module; if ((camera as IMyComponentOwner <MyIDModule>).GetComponent(out module)) { if (!(camera.HasPlayerAccess(MySession.LocalPlayerId) || module.Owner == 0)) { return(false); } } if (MySession.ControlledEntity is MyCharacter) { return(MyAntennaSystem.CheckConnection(MySession.LocalCharacter, camera.CubeGrid, MySession.LocalHumanPlayer)); } else if (MySession.ControlledEntity is MyShipController) { return(MyAntennaSystem.CheckConnection((MySession.ControlledEntity as MyShipController).CubeGrid, camera.CubeGrid, MySession.LocalHumanPlayer)); } } return(false); }
private static bool CheckConnection(MyEntity interactedEntityRepresentative, MyCubeGrid grid, MyPlayer player) { var connectedGrids = MyAntennaSystem.GetMutuallyConnectedGrids(interactedEntityRepresentative, player); var gridRepresentative = MyAntennaSystem.GetLogicalGroupRepresentative(grid); foreach (var connectedGrid in connectedGrids) { if (connectedGrid.EntityId == gridRepresentative.EntityId) { return(true); } } return(false); }
protected override void UnloadData() { base.UnloadData(); m_addedItems.Clear(); m_addedItems = null; m_output.Clear(); m_output = null; m_tempGridBroadcastersFromPlayer.Clear(); m_tempGridBroadcastersFromPlayer = null; m_tempPlayerRelayedBroadcasters.Clear(); m_tempPlayerRelayedBroadcasters = null; m_tempPlayerReceivers.Clear(); m_tempPlayerReceivers = null; Static = null; }
public override void BeforeStart() { Static = this; }
public static bool CheckConnection(MyCubeGrid interactedGrid, MyCubeGrid grid, MyPlayer player) { return(CheckConnection((MyEntity)MyAntennaSystem.GetLogicalGroupRepresentative(interactedGrid), grid, player)); }