public virtual void GetObjectBuilder(MyObjectBuilder_CubeGrid ob)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            ob.DampenersEnabled = thrustComp == null || thrustComp.DampenersEnabled;

            ConveyorSystem.SerializeLines(ob.ConveyorLines);
            if (ob.ConveyorLines.Count == 0)
            {
                ob.ConveyorLines = null;
            }

            if (WheelSystem != null)
            {
                ob.Handbrake = WheelSystem.HandBrake;
            }

            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization)
            {
                ob.OxygenAmount = GasSystem.GetOxygenAmount();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ob.JumpDriveDirection = JumpSystem.GetJumpDriveDirection();
                ob.JumpRemainingTime  = JumpSystem.GetRemainingJumpTime();
            }
        }
Beispiel #2
0
 public virtual void UpdateBeforeSimulation100()
 {
     if (MySession.Static.Settings.EnableOxygen)
     {
         GasSystem.UpdateBeforeSimulation100();
     }
 }
        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComp != null)
            {
                thrustComp.DampenersEnabled = builder.DampenersEnabled;
            }

            if (WheelSystem != null)
            {
                m_cubeGrid.SetHandbrakeRequest(builder.Handbrake);
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                GasSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpRemainingTime);
            }

            var thrustComponent = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComponent != null)
            {
                thrustComponent.MergeAllGroupsDirty();
            }
        }
        public void UpdateBeforeSimulation()
        {
            ProfilerShort.Begin("Thrusters");
            MyEntityThrustComponent thrustComp;

            if (CubeGrid.Components.TryGet(out thrustComp))
            {
                thrustComp.UpdateBeforeSimulation(false, Sync.IsServer || CubeGrid.GridSystems.ControlSystem.IsLocallyControlled);
            }
            ProfilerShort.End();

            // Only update gyros if there are gyros in the system
            if (GyroSystem.GyroCount > 0)
            {
                ProfilerShort.Begin("Gyros");
                GyroSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
            {
                ProfilerShort.Begin("Wheels");
                WheelSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            /*ProfilerShort.Begin("Conveyors");
             * ConveyorSystem.UpdateBeforeSimulation();
             * ProfilerShort.End();*/

            ProfilerShort.Begin("Control");
            ControlSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Cameras");
            CameraSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization)
            {
                ProfilerShort.Begin("Oxygen");
                GasSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ProfilerShort.Begin("Jump");
                JumpSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            ProfilerShort.Begin("Ship sounds");
            if (ShipSoundComponent != null)
            {
                ShipSoundComponent.Update();
            }
            ProfilerShort.End();
        }
        public virtual void UpdateBeforeSimulation100()
        {
            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization)
            {
                GasSystem.UpdateBeforeSimulation100();
            }

            if (ShipSoundComponent != null)
            {
                ShipSoundComponent.Update100();
            }
        }
        public virtual void BeforeGridClose()
        {
            ConveyorSystem.IsClosing       = true;
            ReflectorLightSystem.IsClosing = true;

            if (ShipSoundComponent != null)
            {
                ShipSoundComponent.DestroyComponent();
                ShipSoundComponent = null;
            }

            // Inform gas system we are going down
            if (GasSystem != null)
            {
                GasSystem.OnGridClosing();
            }
        }
Beispiel #7
0
        public virtual void UpdateBeforeSimulation()
        {
            ProfilerShort.Begin("Thrusters and Gyro");
            MyEntityThrustComponent thrustComp;

            if (CubeGrid.Components.TryGet(out thrustComp))
            {
                thrustComp.UpdateBeforeSimulation();
            }

            GyroSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
            {
                ProfilerShort.Begin("Wheels");
                WheelSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            ProfilerShort.Begin("Conveyors");
            ConveyorSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Control");
            ControlSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            ProfilerShort.Begin("Cameras");
            CameraSystem.UpdateBeforeSimulation();
            ProfilerShort.End();

            if (MySession.Static.Settings.EnableOxygen)
            {
                ProfilerShort.Begin("Oxygen");
                GasSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                ProfilerShort.Begin("Jump");
                JumpSystem.UpdateBeforeSimulation();
                ProfilerShort.End();
            }
        }
        public virtual void DebugDraw()
        {
            if (MyDebugDrawSettings.DEBUG_DRAW_GRID_TERMINAL_SYSTEMS)
            {
                MyRenderProxy.DebugDrawText3D(m_cubeGrid.WorldMatrix.Translation, TerminalSystem.GetHashCode().ToString(), Color.NavajoWhite, 1.0f, false);
            }

            if (MyDebugDrawSettings.DEBUG_DRAW_CONVEYORS)
            {
                ConveyorSystem.DebugDraw(m_cubeGrid);
                ConveyorSystem.DebugDrawLinePackets();
            }

            if (MySession.Static.Settings.EnableOxygen && MySession.Static.Settings.EnableOxygenPressurization && MyDebugDrawSettings.DEBUG_DRAW_OXYGEN)
            {
                GasSystem.DebugDraw();
            }
        }
Beispiel #9
0
        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
            var thrustComp = CubeGrid.Components.Get <MyEntityThrustComponent>();

            if (thrustComp != null)
            {
                thrustComp.DampenersEnabled = builder.DampenersEnabled;
            }

            if (WheelSystem != null)
            {
                WheelSystem.HandBrake = builder.Handbrake;
            }

            if (MySession.Static.Settings.EnableOxygen)
            {
                GasSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpElapsedTicks);
            }
        }
Beispiel #10
0
 // Start is called before the first frame update
 void Start()
 {
     FuelScript = Player.GetComponent <GasSystem>();
 }