示例#1
0
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            if (!Sync.IsServer || !IsWorking)
            {
                return;
            }

            if (FilledRatio > 0f && UseConveyorSystem && m_inventory.VolumeFillFactor < 0.6f)
            {
                MyGridConveyorSystem.PullAllRequest(this, m_inventory, OwnerId, m_inventory.Constraint);
            }

            if (m_autoRefill && CanRefill())
            {
                RefillBottles();
            }

            int sinkUpdateFrames   = (m_updateCounter - m_lastInputUpdateTime);
            int sourceUpdateFrames = (m_updateCounter - m_lastOutputUpdateTime);

            float gasInput      = GasInputPerUpdate * sinkUpdateFrames;
            float gasOutput     = GasOutputPerUpdate * sourceUpdateFrames;
            float totalTransfer = gasInput - gasOutput + m_nextGasTransfer;

            Transfer(totalTransfer);

            m_updateCounter        = 0;
            m_lastOutputUpdateTime = m_updateCounter;
            m_lastInputUpdateTime  = m_updateCounter;
            ResourceSink.Update();
        }
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            if (Sync.IsServer && IsWorking)
            {
                if (m_useConveyorSystem && m_inventory.VolumeFillFactor < 0.6f)
                {
                    if (HasIce())
                    {
                        MyGridConveyorSystem.PullAllRequest(this, m_inventory, OwnerId, m_inventory.Constraint);
                    }
                    else
                    {
                        MyGridConveyorSystem.PullAllRequest(this, m_inventory, OwnerId, m_oreConstraint);
                    }
                }

                if (m_autoRefill && CanRefill())
                {
                    RefillBottles();
                }
            }

            UpdateEmissivity();

            if (MyFakes.ENABLE_OXYGEN_SOUNDS)
            {
                UpdateSounds();
            }

            m_isProducing             = m_producedSinceLastUpdate;
            m_producedSinceLastUpdate = false;
        }
示例#3
0
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            if (!Sync.IsServer)
            {
                return;
            }

            if (!IsWorking)
            {
                if (m_nextGasTransfer != 0f)
                {
                    ExecuteGasTransfer();
                }
                return;
            }

            if (FilledRatio > 0f && UseConveyorSystem && this.GetInventory().VolumeFillFactor < 0.6f)
            {
                MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(), OwnerId, this.GetInventory().Constraint);
            }

            if (m_autoRefill && CanRefill())
            {
                RefillBottles();
            }

            ExecuteGasTransfer();
        }
示例#4
0
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            if (!Sync.IsServer)
            {
                return;
            }

            if (!IsWorking)
            {
                if (m_nextGasTransfer != 0f)
                {
                    ExecuteGasTransfer();
                }
                return;
            }

            if (FilledRatio > 0f && UseConveyorSystem && this.GetInventory().VolumeFillFactor < 0.6f)
            {
                MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(), OwnerId, this.GetInventory().Constraint);
            }

            if (m_autoRefill && CanRefill())
            {
                RefillBottles();
            }

            // this is performance unfriendly
            // its supposed to be in Sink_CurrentInputChanged, but it dont catch slider change correctly
            SourceComp.Enabled = CanStore;
            ExecuteGasTransfer();
        }
示例#5
0
 public override void UpdateBeforeSimulation100()
 {
     base.UpdateBeforeSimulation100();
     if (((Sync.IsServer && (this.DrainAll && (base.Enabled && base.IsFunctional))) && base.IsWorking) && !this.GetInventory(0).IsFull)
     {
         MyFixedPoint?maxAmount = null;
         MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(0), base.OwnerId, this.m_inventoryConstraint, maxAmount, true);
     }
 }
示例#6
0
        public override void UpdateBeforeSimulation100()
        {
            base.UpdateBeforeSimulation100();
            if (!Sync.IsServer || !DrainAll || !Enabled || !IsFunctional || !IsWorking || !ResourceSink.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
                return;

            if (!this.GetInventory().IsFull)
            {
                MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(), OwnerId, m_inventoryConstraint);
            }
        }
示例#7
0
        public override void UpdateBeforeSimulation100()
        {
            base.UpdateBeforeSimulation100();
            if (!Sync.IsServer || !DrainAll || !Enabled || !IsFunctional || !IsWorking || !ResourceSink.IsPowered)
            {
                return;
            }

            if (!m_inventory.IsFull)
            {
                MyGridConveyorSystem.PullAllRequest(this, m_inventory, OwnerId, m_inventoryConstraint);
            }
        }
示例#8
0
 public override void UpdateBeforeSimulation100()
 {
     base.UpdateBeforeSimulation100();
     if ((Sync.IsServer && base.IsWorking) && (base.m_useConveyorSystem != null))
     {
         if ((base.InputInventory.VolumeFillFactor < 0.6f) && MyGridConveyorSystem.PullAllRequest(this, base.InputInventory, base.OwnerId, base.InputInventory.Constraint, this.m_refineryDef.OreAmountPerPullRequest, true))
         {
             this.m_queueNeedsRebuild = true;
         }
         if (base.OutputInventory.VolumeFillFactor > 0.75f)
         {
             MyGridConveyorSystem.PushAnyRequest(this, base.OutputInventory, base.OwnerId);
         }
     }
 }
示例#9
0
 public override void UpdateBeforeSimulation100()
 {
     base.UpdateBeforeSimulation100();
     if (Sync.IsServer && IsWorking && m_useConveyorSystem)
     {
         if (InputInventory.VolumeFillFactor < 0.6f)
         {
             MyGridConveyorSystem.PullAllRequest(this, InputInventory, OwnerId, InputInventory.Constraint);
         }
         if (OutputInventory.VolumeFillFactor > 0.75f)
         {
             Debug.Assert(OutputInventory.GetItems().Count > 0);
             MyGridConveyorSystem.PushAnyRequest(this, OutputInventory, OwnerId);
         }
     }
 }
示例#10
0
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            if (Sync.IsServer && IsWorking)
            {
                if (FilledRatio > 0f && m_useConveyorSystem && m_inventory.VolumeFillFactor < 0.6f)
                {
                    MyGridConveyorSystem.PullAllRequest(this, m_inventory, OwnerId, m_inventory.Constraint);
                }

                if (m_autoRefill && CanRefill())
                {
                    RefillBottles();
                }
            }
        }
示例#11
0
 public override void UpdateAfterSimulation100()
 {
     if (Sync.IsServer && base.IsWorking)
     {
         if ((this.m_useConveyorSystem != null) && (this.GetInventory(0).VolumeFillFactor < 0.6f))
         {
             MyFixedPoint?maxAmount = null;
             MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(0), base.OwnerId, this.HasIce() ? this.GetInventory(0).Constraint : this.m_oreConstraint, maxAmount, false);
         }
         if (this.AutoRefill && this.CanRefill())
         {
             this.RefillBottles();
         }
     }
     this.m_isProducing = true;
     base.NeedsUpdate  |= MyEntityUpdateEnum.EACH_FRAME;
 }
示例#12
0
 public override void UpdateAfterSimulation()
 {
     base.UpdateAfterSimulation();
     if (Sync.IsServer)
     {
         if ((this.FilledRatio > 0.0) && this.UseConveyorSystem)
         {
             MyInventory destinationInventory = this.GetInventory(0);
             if (destinationInventory.VolumeFillFactor < 0.6f)
             {
                 MyFixedPoint?maxAmount = null;
                 MyGridConveyorSystem.PullAllRequest(this, destinationInventory, base.OwnerId, destinationInventory.Constraint, maxAmount, true);
             }
         }
         this.ExecuteGasTransfer();
     }
 }
示例#13
0
        public override void UpdateAfterSimulation100()
        {
            base.UpdateAfterSimulation100();

            ResourceSink.Update();

            int updatesSinceSourceUpdate = (MySession.Static.GameplayFrameCounter - m_lastSourceUpdate);

            foreach (var gasId in SourceComp.ResourceTypes)
            {
                var   tmpGasId  = gasId;
                float gasOutput = GasOutputPerUpdate(ref tmpGasId) * updatesSinceSourceUpdate;
                ProduceGas(ref tmpGasId, gasOutput);
            }

            if (Sync.IsServer && IsWorking)
            {
                if (m_useConveyorSystem && this.GetInventory().VolumeFillFactor < 0.6f)
                {
                    MyGridConveyorSystem.PullAllRequest(this, this.GetInventory(), OwnerId, HasIce() ? this.GetInventory().Constraint : m_oreConstraint);
                }

                if (AutoRefill && CanRefill())
                {
                    RefillBottles();
                }
            }

            UpdateEmissivity();

            if (MyFakes.ENABLE_OXYGEN_SOUNDS)
            {
                UpdateSounds();
            }

            m_isProducing             = m_producedSinceLastUpdate;
            m_producedSinceLastUpdate = false;
            foreach (var gasId in SourceComp.ResourceTypes)
            {
                m_producedSinceLastUpdate = m_producedSinceLastUpdate || (SourceComp.CurrentOutputByType(gasId) > 0);
            }

            m_lastSourceUpdate = MySession.Static.GameplayFrameCounter;
        }