示例#1
0
        private MyCueId SelectCue(MySoundPair sound)
        {
            if (m_useRealisticByDefault)
            {
                if (m_lastSoundData == null)
                {
                    m_lastSoundData = MyAudio.Static.GetCue(sound.Realistic);
                }

                if (m_lastSoundData != null && m_lastSoundData.AlwaysUseOneMode)
                {
                    m_realistic = true;
                    return(sound.Realistic);
                }

                MyCockpit cockpit = MySession.Static.LocalCharacter != null ? MySession.Static.LocalCharacter.Parent as MyCockpit : null;
                bool      isLargePressurizedCockpit = (cockpit != null && cockpit.CubeGrid.GridSizeEnum == VRage.Game.MyCubeSize.Large && cockpit.BlockDefinition.IsPressurized);
                if (IsThereAir() || isLargePressurizedCockpit)
                {
                    m_realistic = false;
                    return(sound.Arcade);
                }
                else
                {
                    m_realistic = true;
                    return(sound.Realistic);
                }
            }
            else
            {
                m_realistic = false;
                return(sound.Arcade);
            }
        }
示例#2
0
 public static void GetLinearVelocity(this IMyControllableEntity controlledEntity, ref Vector3 velocityVector, bool useRemoteControlVelocity = true)
 {
     if (controlledEntity.Entity.Physics != null)
     {
         velocityVector = (controlledEntity.Entity.Physics != null) ? controlledEntity.Entity.Physics.LinearVelocity : Vector3.Zero;
     }
     else
     {
         MyCockpit cockpit = controlledEntity as MyCockpit;
         if (cockpit != null)
         {
             velocityVector = (cockpit.CubeGrid.Physics != null) ? cockpit.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
         }
         else
         {
             MyRemoteControl control = controlledEntity as MyRemoteControl;
             if ((control != null) & useRemoteControlVelocity)
             {
                 velocityVector = (control.CubeGrid.Physics != null) ? control.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
             }
             else
             {
                 MyLargeTurretBase base2 = controlledEntity as MyLargeTurretBase;
                 if (base2 != null)
                 {
                     velocityVector = (base2.CubeGrid.Physics != null) ? base2.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
                 }
             }
         }
     }
 }
示例#3
0
        private MyStringHash SelectEffect()
        {
            int isPressurized;

            if ((this.m_lastSoundData != null) && !this.m_lastSoundData.ModifiableByHelmetFilters)
            {
                return(MyStringHash.NullOrEmpty);
            }
            if (((MySession.Static == null) || ((MySession.Static.LocalCharacter == null) || ((MySession.Static.LocalCharacter.OxygenComponent == null) || !MyFakes.ENABLE_NEW_SOUNDS))) || !MySession.Static.Settings.RealisticSound)
            {
                return(MyStringHash.NullOrEmpty);
            }
            bool      flag   = this.IsThereAir();
            MyCockpit parent = MySession.Static.LocalCharacter.Parent as MyCockpit;

            if ((parent == null) || (parent.BlockDefinition == null))
            {
                isPressurized = 0;
            }
            else
            {
                isPressurized = (int)parent.BlockDefinition.IsPressurized;
            }
            bool flag2 = (bool)isPressurized;

            if (flag & flag2)
            {
                return(m_effectEnclosedCockpitInAir);
            }
            if (((!flag & flag2) && (parent.CubeGrid != null)) && (parent.CubeGrid.GridSizeEnum == MyCubeSize.Large))
            {
                return(m_effectEnclosedCockpitInSpace);
            }
            if (MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled & flag)
            {
                return(m_effectHasHelmetInOxygen);
            }
            if (((this.m_lastSoundData == null) || !MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled) || flag)
            {
                if ((!MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled && !flag) && (((parent == null) || (parent.BlockDefinition == null)) || !parent.BlockDefinition.IsPressurized))
                {
                    return(m_effectNoHelmetNoOxygen);
                }
                if (((this.m_lastSoundData == null) || ((parent == null) || ((parent.BlockDefinition == null) || (!parent.BlockDefinition.IsPressurized || (parent.CubeGrid == null))))) || (parent.CubeGrid.GridSizeEnum != MyCubeSize.Small))
                {
                    return(MyStringHash.NullOrEmpty);
                }
            }
            return(this.m_lastSoundData.RealisticFilter);
        }
示例#4
0
        public static MyPhysicsComponentBase Physics(this IMyControllableEntity entity)
        {
            if (entity.Entity == null)
            {
                return(null);
            }
            if (entity.Entity.Physics != null)
            {
                return(entity.Entity.Physics);
            }
            MyCockpit cockpit = entity.Entity as MyCockpit;

            if (((cockpit == null) || (cockpit.CubeGrid == null)) || (cockpit.CubeGrid.Physics == null))
            {
                return(null);
            }
            return(cockpit.CubeGrid.Physics);
        }
示例#5
0
        private MyStringHash SelectEffect()
        {
            if (m_lastSoundData != null && m_lastSoundData.ModifiableByHelmetFilters == false)
            {
                return(MyStringHash.NullOrEmpty);
            }
            if (MySession.Static == null || MySession.Static.LocalCharacter == null || MySession.Static.LocalCharacter.OxygenComponent == null || MyFakes.ENABLE_NEW_SOUNDS == false || MySession.Static.Settings.RealisticSound == false)
            {
                return(MyStringHash.NullOrEmpty);
            }
            bool      air     = IsThereAir();
            MyCockpit cockpit = MySession.Static.LocalCharacter.Parent as MyCockpit;
            bool      isPressurizedCockpit = (cockpit != null && cockpit.BlockDefinition != null && cockpit.BlockDefinition.IsPressurized);

            if (air && isPressurizedCockpit)
            {
                return(m_effectEnclosedCockpitInAir);//in enclosed cockpit in oxygen
            }
            if (air == false && isPressurizedCockpit && cockpit.CubeGrid != null && cockpit.CubeGrid.GridSizeEnum == VRage.Game.MyCubeSize.Large)
            {
                return(m_effectEnclosedCockpitInSpace);//in enclosed large cockpit in space
            }
            if (MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled && air)
            {
                return(m_effectHasHelmetInOxygen);//helmet in oxygen
            }
            if (m_lastSoundData != null && MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled && air == false)
            {
                return(m_lastSoundData.RealisticFilter);//helmet in space
            }
            if (MySession.Static.LocalCharacter.OxygenComponent.HelmetEnabled == false && air == false && (cockpit == null || cockpit.BlockDefinition == null || cockpit.BlockDefinition.IsPressurized == false))
            {
                return(m_effectNoHelmetNoOxygen);//no helmet in space
            }
            if (m_lastSoundData != null && cockpit != null && cockpit.BlockDefinition != null && cockpit.BlockDefinition.IsPressurized && cockpit.CubeGrid != null && cockpit.CubeGrid.GridSizeEnum == VRage.Game.MyCubeSize.Small)
            {
                return(m_lastSoundData.RealisticFilter); //no helmet in small ship in space
            }
            return(MyStringHash.NullOrEmpty);            //no helmet in oxygen
        }
示例#6
0
        private MyCueId SelectCue(MySoundPair sound)
        {
            int isPressurized;

            if (!this.m_useRealisticByDefault)
            {
                this.m_realistic = false;
                return(sound.Arcade);
            }
            if (this.m_lastSoundData == null)
            {
                this.m_lastSoundData = MyAudio.Static.GetCue(sound.Realistic);
            }
            if ((this.m_lastSoundData != null) && this.m_lastSoundData.AlwaysUseOneMode)
            {
                this.m_realistic = true;
                return(sound.Realistic);
            }
            MyCockpit cockpit = (MySession.Static.LocalCharacter != null) ? (MySession.Static.LocalCharacter.Parent as MyCockpit) : null;

            if ((cockpit == null) || (cockpit.CubeGrid.GridSizeEnum != MyCubeSize.Large))
            {
                isPressurized = 0;
            }
            else
            {
                isPressurized = (int)cockpit.BlockDefinition.IsPressurized;
            }
            bool flag = (bool)isPressurized;

            if (this.IsThereAir() | flag)
            {
                this.m_realistic = false;
                return(sound.Arcade);
            }
            this.m_realistic = true;
            return(sound.Realistic);
        }
 public MyDebugRenderComponentCockpit(MyCockpit cockpit)
     : base(cockpit)
 {
     m_cockpit = cockpit;
 }
示例#8
0
        public MySyncCockpit(MyCockpit cockpit):
            base(cockpit)
        {

        }
示例#9
0
 public static void SendCharacterAttachToCockpit(long character, MyCockpit cockpit)
 {
     AttachToCockpitMsg msg = new AttachToCockpitMsg();
     msg.CharacterEntityId = character;
     msg.CockpitEntityId = cockpit.EntityId;
     Sync.Layer.SendMessageToAll(ref msg);
 }
示例#10
0
        public static void SendCharacterCreated(MyObjectBuilder_Character character, MyCockpit cockpit)
        {
            MySyncCreate.SendEntityCreated(character);

            AttachToCockpitMsg msg = new AttachToCockpitMsg();
            msg.CharacterEntityId = character.EntityId;
            msg.CockpitEntityId = cockpit.EntityId;

            Sync.Layer.SendMessageToAll(ref msg);
        }
        private static void UseCockpit(MyCockpit cockpit)
        {
            if (MySession.Static.LocalHumanPlayer == null) return;

            // Leave current cockpit if controlling any
            if (MySession.Static.ControlledEntity is MyCockpit)
            {
                MySession.Static.ControlledEntity.Use();
            }
            cockpit.RequestUse(UseActionEnum.Manipulate, MySession.Static.LocalHumanPlayer.Identity.Character);
            cockpit.RemoveOriginalPilotPosition();
        }