Exemplo n.º 1
0
        public override void UpdateBeforeSimulation10()
        {
            base.UpdateBeforeSimulation10();

            if (GridResourceDistributor == null || GridGyroSystem == null || EntityThrustComponent == null)
            {
                return;
            }

            if (m_pilot != null)
            {
                m_pilot.SuitBattery.UpdateOnServer();
            }

            bool autopilotEnabled = false;
            var  thrustComp       = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComp != null)
            {
                autopilotEnabled = thrustComp.AutopilotEnabled;
            }

            bool shipControlled = CubeGrid.GridSystems.ControlSystem.IsControlled || autopilotEnabled;

            if (!shipControlled && m_aiPilot != null && Sync.IsServer)
            {
                m_aiPilot.Update();
            }
            else if (shipControlled && m_aiPilot != null && m_aiPilot.RemoveOnPlayerControl == true)
            {
                RemoveAutopilot();
            }

            if (m_pilot != null)
            {
                if (ControllerInfo.IsLocallyHumanControlled())
                {
                    m_pilot.RadioReceiver.UpdateHud();
                }
            }
        }
Exemplo n.º 2
0
        public override void UpdateBeforeSimulation10()
        {
            base.UpdateBeforeSimulation10();

            if (GridPowerDistributor == null)
            {
                return;
            }
            if (GridGyroSystem == null)
            {
                return;
            }
            if (GridThrustSystem == null)
            {
                return;
            }

            if (m_pilot != null)
            {
                m_pilot.SuitBattery.UpdateOnServer();
            }

            bool shipControlled = CubeGrid.GridSystems.ControlSystem.IsControlled;

            if (!shipControlled && m_aiPilot != null && Sync.IsServer)
            {
                m_aiPilot.Update();
            }
            else if (shipControlled && m_aiPilot != null && m_aiPilot.RemoveOnPlayerControl == true)
            {
                RemoveAutopilot();
            }

            if (m_pilot != null)
            {
                if (ControllerInfo.IsLocallyHumanControlled())
                {
                    m_pilot.RadioReceiver.UpdateHud();
                }
            }
        }
Exemplo n.º 3
0
        public Multiplayer.MyEntityCameraSettings GetCameraEntitySettings()
        {
            ulong playerId = 0;

            if (ControllerInfo.Controller != null && ControllerInfo.Controller.Player != null)
            {
                playerId = ControllerInfo.Controller.Player.Id.SteamId;
                if (!MySession.Static.Cameras.TryGetCameraSettings(ControllerInfo.Controller.Player.Id, EntityId, out m_cameraSettings))
                {
                    if (ControllerInfo.IsLocallyHumanControlled())
                    {
                        m_cameraSettings = new MyEntityCameraSettings()
                        {
                            Distance      = 0,
                            IsFirstPerson = true,
                            HeadAngle     = new Vector2(HeadLocalXAngle, HeadLocalYAngle)
                        };
                    }
                }
            }
            return(m_cameraSettings);
        }