Exemplo n.º 1
0
        public static IMySourceVoice PlaySound(MyGuiSounds sound)
        {
            if (MyFakes.ENABLE_NEW_SOUNDS && MySession.Static != null && MySession.Static.Settings.RealisticSound && MySession.Static.LocalCharacter != null &&
                MySession.Static.LocalCharacter.OxygenComponent != null && MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled == false)
            {
                MySoundData soundData = MyAudio.Static.GetCue(m_sounds[sound].SoundId);
                if (soundData != null && soundData.CanBeSilencedByVoid)
                {
                    MyCockpit cockpit = MySession.Static.LocalCharacter.Parent as MyCockpit;
                    if ((cockpit == null || !cockpit.BlockDefinition.IsPressurized) && MySession.Static.LocalCharacter.EnvironmentOxygenLevel <= 0)
                    {
                        return(null);//disables hud sound when in realistic mode in space without helmet
                    }
                }
            }

            if (CheckForSynchronizedSounds(sound))
            {
                return(MyAudio.Static.PlaySound(m_sounds[sound].SoundId));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 private static bool EnergyNoWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue  = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if (!IsEnergyUnderTreshold(0f))
     {
         return(false);
     }
     if (MySession.Static.ControlledEntity.Entity is MyCharacter)
     {
         cue  = MyGuiSounds.HudVocEnergyNo;
         text = MySpaceTexts.NotificationEnergyNo;
     }
     else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.Static.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
         {
             cue = MyGuiSounds.HudVocStationFuelNo;
         }
         else
         {
             cue = MyGuiSounds.HudVocShipFuelNo;
         }
         text = MySpaceTexts.NotificationFuelNo;
     }
     else
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        private static bool CheckForSynchronizedSounds(MyGuiSounds sound)
        {
            MySoundData soundData = MyAudio.Static.GetCue(m_sounds[sound].SoundId);

            if (soundData != null && soundData.PreventSynchronization >= 0)
            {
                int lastTime;
                int now = MyFpsManager.GetSessionTotalFrames();
                if (m_lastTimePlaying.TryGetValue(sound, out lastTime))
                {
                    if (Math.Abs(now - lastTime) <= soundData.PreventSynchronization)
                    {
                        return(false);
                    }
                    else
                    {
                        m_lastTimePlaying[sound] = now;
                    }
                }
                else
                {
                    m_lastTimePlaying.Add(sound, now);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
 public static void RemoveSound(MyGuiSounds cueEnum)
 {
     if (m_sound != null && m_sound.CueEnum == MyGuiAudio.GetCue(cueEnum))
     {
         m_sound.Stop();
     }
     m_soundQueue.RemoveAll(new System.Predicate <MyGuiSounds>((cue) => { return(cue == cueEnum); }));
 }
Exemplo n.º 5
0
        private static bool EnergyNoWarningMethod(out MyGuiSounds cue, out MyStringId text)
        {
            cue  = MyGuiSounds.None;
            text = MySpaceTexts.Blank;
            if (!IsEnergyUnderTreshold(0f))
            {
                return(false);
            }
            if (MySession.Static.ControlledEntity.Entity is MyCharacter)
            {
                cue  = MyGuiSounds.HudVocEnergyNo;
                text = MySpaceTexts.NotificationEnergyNo;
            }
            else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
            {
                MyCockpit         cockpit         = (MyCockpit)MySession.Static.ControlledEntity.Entity;
                bool              hasReactor      = false;
                List <MyCubeGrid> connectedGroups = MyCubeGridGroups.Static.Logical.GetGroupNodes(cockpit.CubeGrid);
                if (connectedGroups == null || connectedGroups.Count == 0)
                {
                    return(false);
                }

                foreach (var grid in connectedGroups)
                {
                    if (grid.NumberOfReactors > 0)
                    {
                        hasReactor = true;
                        break;
                    }
                }

                if (hasReactor)
                {
                    if (cockpit.CubeGrid.IsStatic)
                    {
                        cue = MyGuiSounds.HudVocStationFuelNo;
                    }
                    else
                    {
                        cue = MyGuiSounds.HudVocShipFuelNo;
                    }

                    text = MySpaceTexts.NotificationFuelNo;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 6
0
        public void PlaySound(GuiSounds sound)
        {
            if (sound == GuiSounds.None)
            {
                return;
            }
            MyGuiSounds hudSound = GetSound(sound);

            PlaySound(hudSound);
        }
Exemplo n.º 7
0
 private static bool MeteorInboundWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue  = MyGuiSounds.HudVocMeteorInbound;
     text = MySpaceTexts.NotificationMeteorInbound;
     if (MyMeteorShower.CurrentTarget.HasValue && MySession.Static.ControlledEntity != null)
     {
         var dist = Vector3.Distance(MyMeteorShower.CurrentTarget.Value.Center, MySession.Static.ControlledEntity.Entity.PositionComp.GetPosition());
         return(dist < (2 * MyMeteorShower.CurrentTarget.Value.Radius) + 500);
     }
     return(false);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Call it in each update
        /// </summary>
        /// <param name="isWarnedHigherPriority">Indicated if warning with greater priority was signalized</param>
        /// <returns>Returns true if warning detected. Else returns false</returns>
        public bool Update(bool isWarnedHigherPriority)
        {
            MyGuiSounds cue  = MyGuiSounds.None;
            MyStringId  text = MySpaceTexts.Blank;

            m_warningDetected = false;
            if (!isWarnedHigherPriority)
            {
                m_warningDetected = m_warningDetectionMethod(out cue, out text);
            }

            m_msSinceLastStateChange += VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS * MyHudWarnings.FRAMES_BETWEEN_UPDATE;
            if (m_warningDetected)
            {
                switch (m_warningState)
                {
                case WarningState.NOT_STARTED:
                    Text = text;
                    MyHud.Notifications.Add(this);
                    m_msSinceLastStateChange = 0;
                    m_warningState           = WarningState.STARTED;
                    break;

                case WarningState.STARTED:
                    if (m_msSinceLastStateChange >= m_soundDelay && CanPlay())
                    {
                        MyHudWarnings.EnqueueSound(cue);
                        m_warningState = WarningState.PLAYED;
                        Played();
                    }
                    break;

                case WarningState.PLAYED:
                    if (RepeatInterval > 0)
                    {
                        if (CanPlay())
                        {
                            MyHud.Notifications.Remove(this);
                            MyHud.Notifications.Add(this);
                            MyHudWarnings.EnqueueSound(cue);
                            Played();
                        }
                    }
                    break;
                }
            }
            else
            {
                MyHud.Notifications.Remove(this);
                MyHudWarnings.RemoveSound(cue);
                m_warningState = WarningState.NOT_STARTED;
            }
            return(m_warningDetected);
        }
Exemplo n.º 9
0
 private static bool EnergyLowWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue  = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if (!IsEnergyUnderTreshold(MyBattery.EnergyLowThreshold))
     {
         return(false);
     }
     if (MySession.Static.ControlledEntity.Entity is MyCharacter)
     {
         cue = MyGuiSounds.HudVocEnergyLow;
         if (MySession.Static.LocalCharacter != null &&
             MySession.Static.LocalCharacter.OxygenComponent != null &&
             MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyLowNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyLow;
         }
     }
     else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.Static.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
         {
             cue = MyGuiSounds.HudVocStationFuelLow;
         }
         else
         {
             cue = MyGuiSounds.HudVocShipFuelLow;
         }
         if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null &&
             MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationShipEnergyLowNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationShipEnergyLow;
         }
     }
     else
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 10
0
 public static void EnqueueSound(MyGuiSounds sound)
 {
     if (!MyGuiAudio.HudWarnings)
     {
         return;
     }
     if ((m_sound == null || !m_sound.IsPlaying) && MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastSoundPlayed > 5000)
     {
         m_sound           = MyGuiAudio.PlaySound(sound);
         m_lastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     }
     else
     {
         m_soundQueue.Add(sound);
     }
 }
Exemplo n.º 11
0
 public static void EnqueueSound(MyGuiSounds sound)
 {
     if (!MyGuiAudio.HudWarnings)
     {
         return;
     }
     if ((_mSound == null || !_mSound.IsPlaying) &&
         MySandboxGame.TotalGamePlayTimeInMilliseconds - _mLastSoundPlayed > 5000)
     {
         _mSound           = MyGuiAudio.PlaySound(sound);
         _mLastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     }
     else
     {
         M_SOUND_QUEUE.Add(sound);
     }
 }
Exemplo n.º 12
0
 private static bool EnergyCritWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue  = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if (!IsEnergyUnderTreshold(1))
     {
         return(false);
     }
     if (MySession.ControlledEntity.Entity is MyCharacter || MySession.ControlledEntity == null)
     {
         cue = MyGuiSounds.HudVocEnergyCrit;
         if (MySession.LocalCharacter != null && MySession.LocalCharacter.Definition.NeedsOxygen && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyCritical;
         }
     }
     else if (MySession.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
         {
             cue = MyGuiSounds.HudVocStationFuelCrit;
         }
         else
         {
             cue = MyGuiSounds.HudVocShipFuelCrit;
         }
         if (MySession.LocalCharacter != null && MySession.LocalCharacter.Definition.NeedsOxygen && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyCritical;
         }
     }
     else
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 13
0
        public static IMySourceVoice PlaySound(MyGuiSounds sound)
        {
            if (MyFakes.ENABLE_NEW_SOUNDS && MySession.Static != null && MySession.Static.Settings.RealisticSound && MySession.Static.LocalCharacter != null
                && MySession.Static.LocalCharacter.OxygenComponent != null && MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled == false)
            {
                MySoundData soundData = MyAudio.Static.GetCue(m_sounds[sound].SoundId);
                if (soundData != null && soundData.CanBeSilencedByVoid)
                {
                    MyCockpit cockpit = MySession.Static.LocalCharacter.Parent as MyCockpit;
                    if ((cockpit == null || !cockpit.BlockDefinition.IsPressurized) && MySession.Static.LocalCharacter.EnvironmentOxygenLevel <= 0)
                        return null;//disables hud sound when in realistic mode in space without helmet
                }
            }

            if (CheckForSynchronizedSounds(sound))
                return MyAudio.Static.PlaySound(m_sounds[sound].SoundId);
            else
                return null;
        }
Exemplo n.º 14
0
 private static bool CheckForSynchronizedSounds(MyGuiSounds sound)
 {
     MySoundData soundData = MyAudio.Static.GetCue(m_sounds[sound].SoundId);
     if (soundData != null && soundData.PreventSynchronization >= 0)
     {
         int lastTime;
         int now = MyFpsManager.GetSessionTotalFrames();
         if (m_lastTimePlaying.TryGetValue(sound, out lastTime))
         {
             if (Math.Abs(now - lastTime) <= soundData.PreventSynchronization)
             {
                 return false;
             }
             else
                 m_lastTimePlaying[sound] = now;
         }
         else
         {
             m_lastTimePlaying.Add(sound, now);
         }
     }
     return true;
 }
Exemplo n.º 15
0
 private static bool EnergyCritWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if (!IsEnergyUnderTreshold(1))
         return false;
     if (MySession.ControlledEntity.Entity is MyCharacter || MySession.ControlledEntity == null)
     {
         cue = MyGuiSounds.HudVocEnergyCrit;
         if (MySession.LocalCharacter != null && MySession.LocalCharacter.Definition.NeedsOxygen && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyCritical;
         }
     }
     else if (MySession.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
             cue = MyGuiSounds.HudVocStationFuelCrit;
         else
             cue = MyGuiSounds.HudVocShipFuelCrit;
         if (MySession.LocalCharacter != null && MySession.LocalCharacter.Definition.NeedsOxygen && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyCritical;
         }
     }
     else
         return false;
     return true;
 }
Exemplo n.º 16
0
 internal static MyCueId GetCue(MyGuiSounds sound)
 {
     return(m_sounds[sound].SoundId);
 }
Exemplo n.º 17
0
 public static IMySourceVoice PlaySound(MyGuiSounds sound)
 {
     return(MyAudio.Static.PlaySound(m_sounds[sound].SoundId));
 }
Exemplo n.º 18
0
 private static bool MeteorInboundWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue = MyGuiSounds.HudVocMeteorInbound;
     text = MySpaceTexts.NotificationMeteorInbound;
     if (MyMeteorShower.CurrentTarget.HasValue && MySession.Static.ControlledEntity != null)
     {
         var dist = Vector3.Distance(MyMeteorShower.CurrentTarget.Value.Center, MySession.Static.ControlledEntity.Entity.PositionComp.GetPosition());
         return dist < (2 * MyMeteorShower.CurrentTarget.Value.Radius) + 500;
     }
     return false;
 }
Exemplo n.º 19
0
 private static bool EnergyNoWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if (!IsEnergyUnderTreshold(0f))
         return false;
     if (MySession.Static.ControlledEntity.Entity is MyCharacter)
     {
         cue = MyGuiSounds.HudVocEnergyNo;
         text = MySpaceTexts.NotificationEnergyNo;
     }
     else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.Static.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
             cue = MyGuiSounds.HudVocStationFuelNo;
         else
             cue = MyGuiSounds.HudVocShipFuelNo;
         text = MySpaceTexts.NotificationFuelNo;
     }
     else
         return false;
     return true;
 }
Exemplo n.º 20
0
 private static bool EnergyLowWarningMethod(out MyGuiSounds cue, out MyStringId text)
 {
     cue = MyGuiSounds.None;
     text = MySpaceTexts.Blank;
     if(!IsEnergyUnderTreshold(MyBattery.EnergyLowThreshold))
         return false;
     if (MySession.Static.ControlledEntity.Entity is MyCharacter)
     {
         cue = MyGuiSounds.HudVocEnergyLow;
         if (MySession.Static.LocalCharacter != null
             && MySession.Static.LocalCharacter.OxygenComponent != null
             && MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationSuitEnergyLowNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationSuitEnergyLow;
         }
     }
     else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
     {
         if ((MySession.Static.ControlledEntity.Entity as MyCockpit).CubeGrid.IsStatic)
             cue = MyGuiSounds.HudVocStationFuelLow;
         else
             cue = MyGuiSounds.HudVocShipFuelLow;
         if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null
             && MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
         {
             text = MySpaceTexts.NotificationShipEnergyLowNoDamage;
         }
         else
         {
             text = MySpaceTexts.NotificationShipEnergyLow;
         }
     }
     else
         return false;
     return true;
 }
Exemplo n.º 21
0
 public static void RemoveSound(MyGuiSounds cueEnum)
 {
     if (m_sound != null && m_sound.CueEnum == MyGuiAudio.GetCue(cueEnum) && m_sound.IsPlaying == false)
     {
         m_sound.Stop();
         m_sound = null;
     }
     m_soundQueue.RemoveAll(new System.Predicate<MyGuiSounds>((cue) => { return cue == cueEnum; }));
 }
Exemplo n.º 22
0
 public static void EnqueueSound(MyGuiSounds sound)
 {
     if (!MyGuiAudio.HudWarnings)
         return;
     if ((m_sound == null || !m_sound.IsPlaying) && MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastSoundPlayed > 5000)
     {
         m_sound = MyGuiAudio.PlaySound(sound);
         m_lastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
     }
     else
         m_soundQueue.Add(sound);
 }
Exemplo n.º 23
0
        private static bool EnergyNoWarningMethod(out MyGuiSounds cue, out MyStringId text)
        {
            cue = MyGuiSounds.None;
            text = MySpaceTexts.Blank;
            if (!IsEnergyUnderTreshold(0f))
                return false;
            if (MySession.Static.ControlledEntity.Entity is MyCharacter)
            {
                cue = MyGuiSounds.HudVocEnergyNo;
                text = MySpaceTexts.NotificationEnergyNo;
            }
            else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
            {
                MyCockpit cockpit = (MyCockpit)MySession.Static.ControlledEntity.Entity;
                bool hasReactor = false;
                List<MyCubeGrid> connectedGroups = MyCubeGridGroups.Static.Logical.GetGroupNodes(cockpit.CubeGrid);
                if (connectedGroups == null || connectedGroups.Count == 0)
                    return false;

                foreach (var grid in connectedGroups)
                {
                    if (grid.NumberOfReactors > 0)
                    {
                        hasReactor = true;
                        break;
                    }
                }
                
                if (hasReactor)
                {
                    if (cockpit.CubeGrid.IsStatic)
                        cue = MyGuiSounds.HudVocStationFuelNo;
                    else
                        cue = MyGuiSounds.HudVocShipFuelNo;

                    text = MySpaceTexts.NotificationFuelNo;
                }
                else
                    return false;
            }
            else
                return false;
            return true;
        }
 public static void PlayHudSound(MyGuiSounds sound = MyGuiSounds.HudClick, long playerId = 0)
 {
     if (MyAudio.Static == null)
         return;
     MyGuiAudio.PlaySound(sound);
 }
Exemplo n.º 25
0
        private static bool EnergyCritWarningMethod(out MyGuiSounds cue, out MyStringId text)
        {
            cue  = MyGuiSounds.None;
            text = MySpaceTexts.Blank;
            if (!IsEnergyUnderTreshold(MyBattery.EnergyCriticalThreshold))
            {
                return(false);
            }
            if (MySession.Static.ControlledEntity.Entity is MyCharacter || MySession.Static.ControlledEntity == null)
            {
                cue = MyGuiSounds.HudVocEnergyCrit;
                if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null &&
                    MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
                {
                    text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
                }
                else
                {
                    text = MySpaceTexts.NotificationSuitEnergyCritical;
                }
            }
            else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
            {
                MyCockpit         cockpit         = (MyCockpit)MySession.Static.ControlledEntity.Entity;
                bool              hasReactor      = false;
                List <MyCubeGrid> connectedGroups = MyCubeGridGroups.Static.Logical.GetGroupNodes(cockpit.CubeGrid);
                if (connectedGroups == null || connectedGroups.Count == 0)
                {
                    return(false);
                }

                foreach (var grid in connectedGroups)
                {
                    if (grid.NumberOfReactors > 0)
                    {
                        hasReactor = true;
                        break;
                    }
                }

                if (hasReactor)
                {
                    if (cockpit.CubeGrid.IsStatic)
                    {
                        cue = MyGuiSounds.HudVocStationFuelCrit;
                    }
                    else
                    {
                        cue = MyGuiSounds.HudVocShipFuelCrit;
                    }
                }
                else
                {
                    return(false);
                }

                if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null &&
                    MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
                {
                    text = MySpaceTexts.NotificationShipEnergyCriticalNoDamage;
                }
                else
                {
                    text = MySpaceTexts.NotificationShipEnergyCritical;
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 26
0
 public static IMySourceVoice PlaySound(MyGuiSounds sound)
 {
     return MyAudio.Static.PlaySound(m_sounds[sound].SoundId);
 }
Exemplo n.º 27
0
 internal static MyCueId GetCue(MyGuiSounds sound)
 {
     return m_sounds[sound].SoundId;
 }
Exemplo n.º 28
0
        private static bool EnergyCritWarningMethod(out MyGuiSounds cue, out MyStringId text)
        {
            cue = MyGuiSounds.None;
            text = MySpaceTexts.Blank;
            if (!IsEnergyUnderTreshold(MyBattery.EnergyCriticalThreshold))
                return false;
            if (MySession.Static.ControlledEntity.Entity is MyCharacter || MySession.Static.ControlledEntity == null)
            {
                cue = MyGuiSounds.HudVocEnergyCrit;
                if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null
                    && MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
                {
                    text = MySpaceTexts.NotificationSuitEnergyCriticalNoDamage;
                }
                else
                {
                    text = MySpaceTexts.NotificationSuitEnergyCritical;
                }
            }
            else if (MySession.Static.ControlledEntity.Entity is MyCockpit)
            {
                MyCockpit cockpit = (MyCockpit)MySession.Static.ControlledEntity.Entity;
                bool hasReactor = false;
                List<MyCubeGrid> connectedGroups = MyCubeGridGroups.Static.Logical.GetGroupNodes(cockpit.CubeGrid);
                if (connectedGroups == null || connectedGroups.Count == 0)
                    return false;

                foreach (var grid in connectedGroups)
                {
                    if (grid.NumberOfReactors > 0)
                    {
                        hasReactor = true;
                        break;
                    }
                }

                if (hasReactor)
                {
                    if (cockpit.CubeGrid.IsStatic)
                        cue = MyGuiSounds.HudVocStationFuelCrit;
                    else
                        cue = MyGuiSounds.HudVocShipFuelCrit;
                }
                else
                    return false;

                if (MySession.Static.LocalCharacter != null && MySession.Static.LocalCharacter.OxygenComponent != null
                    && MySession.Static.LocalCharacter.OxygenComponent.NeedsOxygenFromSuit && MySession.Static.Settings.EnableOxygen)
                {
                    text = MySpaceTexts.NotificationShipEnergyCriticalNoDamage;
                }
                else
                {
                    text = MySpaceTexts.NotificationShipEnergyCritical;
                }
            }
            else
                return false;
            return true;
        }