Пример #1
0
        public void InitNet()
        {
            GenList.RemoveDuplicates(PipesThings);

            foreach (var thing in PipesThings)
            {
                Pipes.Add(thing.GetComp <CompPipe>());

                GasPlant gasPlant = thing.TryGetComp <GasPlant>();
                if (gasPlant != null)
                {
                    GasPlants.Add(gasPlant);
                }

                CompGasCooler compGasCooler = thing.TryGetComp <CompGasCooler>();
                if (compGasCooler != null)
                {
                    GasCoolers.Add(compGasCooler);
                }

                CompGasTank compGasTank = thing.TryGetComp <CompGasTank>();
                if (compGasTank != null)
                {
                    GasTankers.Add(compGasTank);
                }
            }

            if (GasCoolers.Count > 0)
            {
                CanPush = true;
            }

            PipesThings.ForEach(x => x.GetComp <CompPipe>().NetInit());
        }
Пример #2
0
        public void PushGas(GasPlant plant, float count)
        {
            if (Full)
            {
                return;
            }

            Storage += count;
            if (Storage > MaxStorage)
            {
                Storage = MaxStorage;
                count  -= Storage - MaxStorage;
            }

            plant.ParentGasWell.GasReserves -= count;
        }
Пример #3
0
        public void PushGasIntoNet(GasPlant plant, float count)
        {
            if (!CanPush)
            {
                return;
            }

            List <CompGasCooler> notFuel = GasCoolers.Where(x => !x.Full).ToList();
            float toPush = count / notFuel.Count;

            foreach (var cooler in notFuel)
            {
                cooler.PushGas(plant, toPush);
            }

            return;
        }