private static void UpdateSolidDigAmount(TextureRegion region, int x0, int y0, int x1, int y1)
    {
        int elementIndex = ElementLoader.GetElementIndex(SimHashes.Void);

        for (int i = y0; i <= y1; i++)
        {
            int num  = Grid.XYToCell(x0, i);
            int num2 = Grid.XYToCell(x1, i);
            int num3 = num;
            int num4 = x0;
            while (num3 <= num2)
            {
                byte b  = 0;
                byte b2 = 0;
                byte b3 = 0;
                if (Grid.ElementIdx[num3] != elementIndex)
                {
                    b3 = byte.MaxValue;
                }
                if (Grid.Solid[num3])
                {
                    b  = byte.MaxValue;
                    b2 = (byte)(255f * Grid.Damage[num3]);
                }
                region.SetBytes(num4, i, b, b2, b3);
                num3++;
                num4++;
            }
        }
    }
    public HandleVector <int> .Handle Allocate(HandleVector <int> .Handle temperature_handle, ref ConduitFlow.ConduitContents contents)
    {
        byte elem_idx     = (byte)ElementLoader.GetElementIndex(contents.element);
        Data initial_data = new Data(temperature_handle, elem_idx, contents.mass, contents.diseaseIdx, contents.diseaseCount);

        return(Allocate(initial_data));
    }
Exemple #3
0
        protected void InitializeElemGrowthArray(ref ElemGrowthInfo[] infoArray, ElemGrowthInfo default_value)
        {
            List <Element> elements = ElementLoader.elements;

            infoArray = new ElemGrowthInfo[elements.Count];
            for (int i = 0; i < elements.Count; i++)
            {
                infoArray[i] = default_value;
            }
            infoArray[ElementLoader.GetElementIndex(SimHashes.Polypropylene)] = new ElemGrowthInfo
            {
                underPopulationDeathRate         = 2.66666675f,
                populationHalfLife               = 10f,
                overPopulationHalfLife           = 10f,
                minCountPerKG                    = 0f,
                maxCountPerKG                    = float.PositiveInfinity,
                minDiffusionCount                = 2147483647,
                diffusionScale                   = 1f,
                minDiffusionInfestationTickCount = 255
            };
            infoArray[ElementLoader.GetElementIndex(SimHashes.Vacuum)] = new ElemGrowthInfo
            {
                underPopulationDeathRate         = 0f,
                populationHalfLife               = 0f,
                overPopulationHalfLife           = 0f,
                minCountPerKG                    = 0f,
                maxCountPerKG                    = float.PositiveInfinity,
                diffusionScale                   = 0f,
                minDiffusionInfestationTickCount = 255
            };
        }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = idle;
     idle.PlayAnim("grounded", KAnim.PlayMode.Loop).EventTransition(GameHashes.IgniteEngine, burning, null);
     burning.EventTransition(GameHashes.LandRocket, burnComplete, null).PlayAnim("launch_pre").QueueAnim("launch_loop", true, null)
     .Update(delegate(StatesInstance smi, float dt)
     {
         Vector3 pos = smi.master.gameObject.transform.GetPosition() + smi.master.GetComponent <KBatchedAnimController>().Offset;
         int num     = Grid.PosToCell(pos);
         if (Grid.IsValidCell(num))
         {
             SimMessages.EmitMass(num, (byte)ElementLoader.GetElementIndex(smi.master.exhaustElement), dt * smi.master.exhaustEmitRate, smi.master.exhaustTemperature, 0, 0, -1);
         }
         int num2 = 10;
         for (int i = 1; i < num2; i++)
         {
             int num3 = Grid.OffsetCell(num, -1, -i);
             int num4 = Grid.OffsetCell(num, 0, -i);
             int num5 = Grid.OffsetCell(num, 1, -i);
             if (Grid.IsValidCell(num3))
             {
                 SimMessages.ModifyEnergy(num3, smi.master.exhaustTemperature / (float)(i + 1), 3200f, SimMessages.EnergySourceID.Burner);
             }
             if (Grid.IsValidCell(num4))
             {
                 SimMessages.ModifyEnergy(num4, smi.master.exhaustTemperature / (float)i, 3200f, SimMessages.EnergySourceID.Burner);
             }
             if (Grid.IsValidCell(num5))
             {
                 SimMessages.ModifyEnergy(num5, smi.master.exhaustTemperature / (float)(i + 1), 3200f, SimMessages.EnergySourceID.Burner);
             }
         }
     }, UpdateRate.SIM_200ms, false);
     burnComplete.PlayAnim("grounded", KAnim.PlayMode.Loop).EventTransition(GameHashes.IgniteEngine, burning, null);
 }
Exemple #5
0
        public void Process(WorldGen worldGen, Chunk world, SeededRandom rnd)
        {
            SetValuesFunction setValues = delegate(int index, object elem, Sim.PhysicsData pd, Sim.DiseaseCell dc)
            {
                SimMessages.ModifyCell(index, ElementLoader.GetElementIndex((elem as Element).id), pd.temperature, pd.mass, dc.diseaseIdx, dc.elementCount, SimMessages.ReplaceType.Replace, false, -1);
            };

            DoProcess(worldGen, world, setValues, rnd);
        }
        public static SimHashes ToSimHash(this string str, SimHashes fallback = SimHashes.Vacuum)
        {
            SimHashes result = (SimHashes)Hash.SDBMLower(str);

            if (ElementLoader.GetElementIndex(result) < 0)
            {
                return(fallback);
            }

            return(result);
        }
    public void SetData(HandleVector <int> .Handle handle, ref ConduitFlow.ConduitContents contents)
    {
        Data data = GetData(handle);

        data.diseaseCount = contents.diseaseCount;
        if (contents.diseaseIdx != data.diseaseIdx)
        {
            data.diseaseIdx = contents.diseaseIdx;
            byte elem_idx = (byte)ElementLoader.GetElementIndex(contents.element);
            data.growthInfo = GetGrowthInfo(contents.diseaseIdx, elem_idx);
        }
        SetData(handle, data);
    }
 private void OnElementSelected(Tag element_tag)
 {
     if (element_tag.IsValid)
     {
         Element element = ElementLoader.GetElement(element_tag);
         bool    on      = true;
         if (element != null)
         {
             desiredElementIdx = (byte)ElementLoader.GetElementIndex(element.id);
             on = (element.id == SimHashes.Void || element.id == SimHashes.Vacuum);
         }
         GetComponent <KSelectable>().ToggleStatusItem(Db.Get().BuildingStatusItems.NoFilterElementSelected, on, null);
     }
 }
Exemple #9
0
 public unsafe static void ConsumeMass(int gameCell, SimHashes element, float mass, byte radius, int callbackIdx = -1)
 {
     if (Grid.IsValidCell(gameCell))
     {
         int elementIndex            = ElementLoader.GetElementIndex(element);
         MassConsumptionMessage *ptr = stackalloc MassConsumptionMessage[1];
         ptr->cellIdx     = gameCell;
         ptr->callbackIdx = callbackIdx;
         ptr->mass        = mass;
         ptr->elementIdx  = (byte)elementIndex;
         ptr->radius      = radius;
         Sim.SIM_HandleMessage(1727657959, sizeof(MassConsumptionMessage), (byte *)ptr);
     }
 }
Exemple #10
0
 public unsafe static void AddElementConsumer(int gameCell, ElementConsumer.Configuration configuration, SimHashes element, byte radius, int cb_handle)
 {
     Debug.Assert(Grid.IsValidCell(gameCell));
     if (Grid.IsValidCell(gameCell))
     {
         int elementIndex = ElementLoader.GetElementIndex(element);
         AddElementConsumerMessage *ptr = stackalloc AddElementConsumerMessage[1];
         ptr->cellIdx       = gameCell;
         ptr->configuration = (byte)configuration;
         ptr->elementIdx    = (byte)elementIndex;
         ptr->radius        = radius;
         ptr->callbackIdx   = cb_handle;
         Sim.SIM_HandleMessage(2024405073, sizeof(AddElementConsumerMessage), (byte *)ptr);
     }
 }
Exemple #11
0
 public unsafe static void AddElementChunk(int gameCell, SimHashes element, float mass, float temperature, float surface_area, float thickness, float ground_transfer_scale, int cb_handle)
 {
     Debug.Assert(Grid.IsValidCell(gameCell));
     if (Grid.IsValidCell(gameCell) && mass * temperature > 0f)
     {
         int elementIndex            = ElementLoader.GetElementIndex(element);
         AddElementChunkMessage *ptr = stackalloc AddElementChunkMessage[1];
         ptr->gameCell            = gameCell;
         ptr->callbackIdx         = cb_handle;
         ptr->mass                = mass;
         ptr->temperature         = temperature;
         ptr->surfaceArea         = surface_area;
         ptr->thickness           = thickness;
         ptr->groundTransferScale = ground_transfer_scale;
         ptr->elementIdx          = (byte)elementIndex;
         Sim.SIM_HandleMessage(1445724082, sizeof(AddElementChunkMessage), (byte *)ptr);
     }
 }
Exemple #12
0
        public void Sim200ms(float dt)
        {
            GameObject     storedObject = this.storage.FindFirst(elementTag);
            PrimaryElement component    = null;
            float          stored       = 0f;

            if (storedObject != null)
            {
                component = storedObject.GetComponent <PrimaryElement>();
                stored    = component.Mass;
            }

            if (stored > 0f && dispenser != null)
            {
                if (!dispenser.IsConnected)
                {
                    Element element     = component.Element;
                    float   temperature = component.Temperature;
                    int     disease     = component.DiseaseCount;

                    int outputCell = dispenser.UtilityCell;

                    if (element.IsGas)
                    {
                        Console.WriteLine("Outputing " + stored.ToString() + " of " + elementHash.CreateTag() + " at " + outputCell.ToString());
                        SimMessages.ModifyMass(outputCell, stored, 255, disease, CellEventLogger.Instance.EnergyGeneratorModifyMass, temperature, elementHash);
                    }
                    else if (element.IsLiquid)
                    {
                        int elementIndex = ElementLoader.GetElementIndex(elementHash);
                        FallingWater.instance.AddParticle(outputCell, (byte)elementIndex, stored, temperature, 255, disease, true, false, false, false);
                    }
                    else
                    {
                        element.substance.SpawnResource(Grid.CellToPosCCC(outputCell, Grid.SceneLayer.Front), stored, temperature, 255, disease, true, false, false);
                    }
                    storage.ConsumeIgnoringDisease(storedObject);
                    stored = 0f;
                }
            }
            bool overfilled = stored >= capacity;

            this.operational.SetFlag(outputFlag, !overfilled);
        }
Exemple #13
0
    public void ReleaseGasPressure(float dt)
    {
        PrimaryElement primaryElement = storage.FindPrimaryElement(gasElement);

        if ((Object)primaryElement != (Object)null && primaryElement.Mass > 0f)
        {
            float num = releaseGasRate * dt;
            if ((Object)base.worker != (Object)null)
            {
                num *= GetEfficiencyMultiplier(base.worker);
            }
            num = Mathf.Min(num, primaryElement.Mass);
            SimUtil.DiseaseInfo percentOfDisease = SimUtil.GetPercentOfDisease(primaryElement, num / primaryElement.Mass);
            primaryElement.Mass -= num;
            Game.Instance.accumulators.Accumulate(accumulator, num);
            SimMessages.AddRemoveSubstance(Grid.PosToCell(this), ElementLoader.GetElementIndex(gasElement), null, num, primaryElement.Temperature, percentOfDisease.idx, percentOfDisease.count, true, -1);
        }
        UpdatePressurePercent();
    }
Exemple #14
0
 public unsafe static void ModifyElementEmitter(int sim_handle, int game_cell, int max_depth, SimHashes element, float emit_interval, float emit_mass, float emit_temperature, float max_pressure, byte disease_idx, int disease_count)
 {
     Debug.Assert(Grid.IsValidCell(game_cell));
     if (Grid.IsValidCell(game_cell))
     {
         int elementIndex = ElementLoader.GetElementIndex(element);
         ModifyElementEmitterMessage *ptr = stackalloc ModifyElementEmitterMessage[1];
         ptr->handle          = sim_handle;
         ptr->cellIdx         = game_cell;
         ptr->emitInterval    = emit_interval;
         ptr->emitMass        = emit_mass;
         ptr->emitTemperature = emit_temperature;
         ptr->maxPressure     = max_pressure;
         ptr->elementIdx      = (byte)elementIndex;
         ptr->maxDepth        = (byte)max_depth;
         ptr->diseaseIdx      = disease_idx;
         ptr->diseaseCount    = disease_count;
         Sim.SIM_HandleMessage(403589164, sizeof(ModifyElementEmitterMessage), (byte *)ptr);
     }
 }
        private void Emit(EnergyGenerator.OutputItem output, float dt, PrimaryElement root_pe)
        {
            Element element = ElementLoader.FindElementByHash(output.element);
            float   num     = output.creationRate * dt;

            if (output.store)
            {
                if (element.IsGas)
                {
                    this.storage.AddGasChunk(output.element, num, root_pe.Temperature, 255, 0, true, true);
                }
                else if (element.IsLiquid)
                {
                    this.storage.AddLiquid(output.element, num, root_pe.Temperature, 255, 0, true, true);
                }
                else
                {
                    GameObject go = element.substance.SpawnResource(base.transform.GetPosition(), num, root_pe.Temperature, 255, 0, false, false, false);
                    this.storage.Store(go, true, false, true, false);
                }
            }
            else
            {
                int   cell        = Grid.PosToCell(base.transform.GetPosition());
                int   num2        = Grid.OffsetCell(cell, output.emitOffset);
                float temperature = Mathf.Max(root_pe.Temperature, output.minTemperature);
                if (element.IsGas)
                {
                    SimMessages.ModifyMass(num2, num, 255, 0, CellEventLogger.Instance.EnergyGeneratorModifyMass, temperature, output.element);
                }
                else if (element.IsLiquid)
                {
                    int elementIndex = ElementLoader.GetElementIndex(output.element);
                    FallingWater.instance.AddParticle(num2, (byte)elementIndex, num, temperature, 255, 0, true, false, false, false);
                }
                else
                {
                    element.substance.SpawnResource(Grid.CellToPosCCC(num2, Grid.SceneLayer.Front), num, temperature, 255, 0, true, false, false);
                }
            }
        }
Exemple #16
0
 private void OnDeserialized()
 {
     if (serializedParticleProperties != null)
     {
         Diseases diseases = Db.Get().Diseases;
         particleProperties.Clear();
         foreach (SerializedParticleProperties serializedParticleProperty in serializedParticleProperties)
         {
             SerializedParticleProperties current = serializedParticleProperty;
             ParticleProperties           item    = default(ParticleProperties);
             item.elementIdx   = (byte)ElementLoader.GetElementIndex(current.elementID);
             item.diseaseIdx   = (byte)((!(current.diseaseID != HashedString.Invalid)) ? 255 : diseases.GetIndex(current.diseaseID));
             item.mass         = current.mass;
             item.temperature  = current.temperature;
             item.diseaseCount = current.diseaseCount;
             particleProperties.Add(item);
         }
     }
     else
     {
         particleProperties = properties;
     }
     properties = null;
 }
Exemple #17
0
        protected override void PopulateElemGrowthInfo()
        {
            InitializeElemGrowthArray(ref elemGrowthInfo, RADIATION_GROWTH_INFO);
            elemGrowthInfo[ElementLoader.GetElementIndex(SimHashes.Polypropylene)] = RADIATION_GROWTH_INFO;
            elemGrowthInfo[ElementLoader.GetElementIndex(SimHashes.Vacuum)]        = RADIATION_GROWTH_INFO;

            elemGrowthInfo[ElementLoader.GetElementIndex(SimHashes.Vacuum)].populationHalfLife = 5 * 600;
            elemGrowthInfo[ElementLoader.GetElementIndex(SimHashes.Vacuum)].diffusionScale     = 1;

            AddGrowthRule(new GrowthRule
            {
                underPopulationDeathRate         = new float?(RADIATION_GROWTH_INFO.underPopulationDeathRate),
                populationHalfLife               = new float?(RADIATION_GROWTH_INFO.populationHalfLife),
                overPopulationHalfLife           = new float?(RADIATION_GROWTH_INFO.overPopulationHalfLife),
                minCountPerKG                    = new float?(RADIATION_GROWTH_INFO.minCountPerKG),
                maxCountPerKG                    = new float?(RADIATION_GROWTH_INFO.maxCountPerKG),
                minDiffusionCount                = new int?(RADIATION_GROWTH_INFO.minDiffusionCount),
                diffusionScale                   = new float?(RADIATION_GROWTH_INFO.diffusionScale),
                minDiffusionInfestationTickCount = new byte?(RADIATION_GROWTH_INFO.minDiffusionInfestationTickCount)
            });

            AddGrowthRule(new StateGrowthRule(Element.State.Solid)
            {
                populationHalfLife = 500 * 600,
                diffusionScale     = 0.0001f,
            });

            AddGrowthRule(new StateGrowthRule(Element.State.Liquid)
            {
                populationHalfLife = 50 * 600,
                diffusionScale     = 0.01f,
            });

            AddGrowthRule(new StateGrowthRule(Element.State.Gas)
            {
                populationHalfLife = 5 * 600,
                diffusionScale     = 1f,
            });

            AddGrowthRule(new ElementGrowthRule(SimHashes.Katairite)
            {
                diffusionScale = 0.0000001f,
            });

            AddGrowthRule(new ElementGrowthRule(SimHashes.Lead)
            {
                diffusionScale = 0.0000001f,
            });

            AddGrowthRule(new ElementGrowthRule(SimHashes.MoltenLead)
            {
                diffusionScale = 0.0000001f,
            });

            AddGrowthRule(new ElementGrowthRule(SimHashes.MoltenLead)
            {
                diffusionScale = 0.0000001f,
            });

            AddGrowthRule(new ElementGrowthRule(SimHashes.LeadGas)
            {
                diffusionScale = 0.0000001f,
            });

            AddGrowthRule(new TagGrowthRule(Radioactive.RadioactiveTag)
            {
                populationHalfLife = float.PositiveInfinity,
                diffusionScale     = 1f,
            });

            InitializeElemExposureArray(ref elemExposureInfo, RADIATION_EXPOSURE_INFO);

            AddExposureRule(new ExposureRule
            {
                populationHalfLife = RADIATION_EXPOSURE_INFO.populationHalfLife,
            });
        }
Exemple #18
0
        public unsafe static bool DoSettleSim(WorldGenSettings settings, Sim.Cell[] cells, float[] bgTemp, Sim.DiseaseCell[] dcs, WorldGen.OfflineCallbackFunction updateProgressFn, Data data, List <KeyValuePair <Vector2I, TemplateContainer> > templateSpawnTargets, Action <OfflineWorldGen.ErrorInfo> error_cb, Action <Sim.Cell[], float[], Sim.DiseaseCell[]> onSettleComplete)
        {
            Sim.SIM_Initialize(Sim.DLL_MessageHandler);
            SimMessages.CreateSimElementsTable(ElementLoader.elements);
            SimMessages.CreateWorldGenHACKDiseaseTable(WorldGen.diseaseIds);
            Sim.DiseaseCell[] dc = new Sim.DiseaseCell[dcs.Length];
            SimMessages.SimDataInitializeFromCells(Grid.WidthInCells, Grid.HeightInCells, cells, bgTemp, dc);
            int num = 500;

            updateProgressFn(UI.WORLDGEN.SETTLESIM.key, 0f, WorldGenProgressStages.Stages.SettleSim);
            Vector2I min = new Vector2I(0, 0);
            Vector2I max = new Vector2I(Grid.WidthInCells, Grid.HeightInCells);

            byte[] bytes = null;
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(memoryStream))
                {
                    try
                    {
                        Sim.Save(writer);
                    }
                    catch (Exception ex)
                    {
                        string message    = ex.Message;
                        string stackTrace = ex.StackTrace;
                        WorldGenLogger.LogException(message, stackTrace);
                        return(updateProgressFn(new StringKey("Exception in Sim Save"), -1f, WorldGenProgressStages.Stages.Failure));
                    }
                }
                bytes = memoryStream.ToArray();
            }
            FastReader reader = new FastReader(bytes);

            if (Sim.Load(reader) != 0)
            {
                updateProgressFn(UI.WORLDGEN.FAILED.key, -1f, WorldGenProgressStages.Stages.Failure);
                return(true);
            }
            byte[] array = new byte[Grid.CellCount];
            for (int i = 0; i < Grid.CellCount; i++)
            {
                array[i] = byte.MaxValue;
            }
            for (int j = 0; j < num; j++)
            {
                SimMessages.NewGameFrame(0.2f, min, max);
                IntPtr intPtr = Sim.HandleMessage(SimMessageHashes.PrepareGameData, array.Length, array);
                updateProgressFn(UI.WORLDGEN.SETTLESIM.key, (float)j / (float)num * 100f, WorldGenProgressStages.Stages.SettleSim);
                if (!(intPtr == IntPtr.Zero))
                {
                    Sim.GameDataUpdate *ptr = (Sim.GameDataUpdate *)(void *) intPtr;
                    for (int k = 0; k < ptr->numSubstanceChangeInfo; k++)
                    {
                        Sim.SubstanceChangeInfo substanceChangeInfo = ptr->substanceChangeInfo[k];
                        int cellIdx = substanceChangeInfo.cellIdx;
                        cells[cellIdx].elementIdx   = ptr->elementIdx[cellIdx];
                        cells[cellIdx].insulation   = ptr->insulation[cellIdx];
                        cells[cellIdx].properties   = ptr->properties[cellIdx];
                        cells[cellIdx].temperature  = ptr->temperature[cellIdx];
                        cells[cellIdx].mass         = ptr->mass[cellIdx];
                        cells[cellIdx].strengthInfo = ptr->strengthInfo[cellIdx];
                    }
                    foreach (KeyValuePair <Vector2I, TemplateContainer> templateSpawnTarget in templateSpawnTargets)
                    {
                        Cell templateCellData;
                        for (int l = 0; l < templateSpawnTarget.Value.cells.Count; l++)
                        {
                            templateCellData = templateSpawnTarget.Value.cells[l];
                            Vector2I key  = templateSpawnTarget.Key;
                            int      x    = key.x;
                            Vector2I key2 = templateSpawnTarget.Key;
                            int      num2 = Grid.OffsetCell(Grid.XYToCell(x, key2.y), templateCellData.location_x, templateCellData.location_y);
                            if (Grid.IsValidCell(num2))
                            {
                                cells[num2].elementIdx  = (byte)ElementLoader.GetElementIndex(templateCellData.element);
                                cells[num2].temperature = templateCellData.temperature;
                                cells[num2].mass        = templateCellData.mass;
                                dcs[num2].diseaseIdx    = (byte)WorldGen.diseaseIds.FindIndex((string name) => name == templateCellData.diseaseName);
                                dcs[num2].elementCount  = templateCellData.diseaseCount;
                            }
                        }
                    }
                }
            }
            for (int m = 0; m < Grid.CellCount; m++)
            {
                int callbackIdx = (m != Grid.CellCount - 1) ? (-1) : 2147481337;
                SimMessages.ModifyCell(m, cells[m].elementIdx, cells[m].temperature, cells[m].mass, dcs[m].diseaseIdx, dcs[m].elementCount, SimMessages.ReplaceType.Replace, false, callbackIdx);
            }
            bool flag = false;

            while (!flag)
            {
                SimMessages.NewGameFrame(0.2f, min, max);
                IntPtr intPtr2 = Sim.HandleMessage(SimMessageHashes.PrepareGameData, array.Length, array);
                if (!(intPtr2 == IntPtr.Zero))
                {
                    Sim.GameDataUpdate *ptr2 = (Sim.GameDataUpdate *)(void *) intPtr2;
                    for (int n = 0; n < ptr2->numCallbackInfo; n++)
                    {
                        Sim.CallbackInfo callbackInfo = ptr2->callbackInfo[n];
                        if (callbackInfo.callbackIdx == 2147481337)
                        {
                            flag = true;
                            break;
                        }
                    }
                }
            }
            Sim.HandleMessage(SimMessageHashes.SettleWorldGen, 0, null);
            bool result = SaveSim(settings, data, error_cb);

            onSettleComplete(cells, bgTemp, dcs);
            Sim.Shutdown();
            return(result);
        }
 private void EmitContents()
 {
     if (gasStorage.items.Count != 0)
     {
         float          num            = 0.1f;
         float          num2           = num;
         PrimaryElement primaryElement = null;
         for (int i = 0; i < gasStorage.items.Count; i++)
         {
             PrimaryElement component = gasStorage.items[i].GetComponent <PrimaryElement>();
             if (component.Mass > num2 && component.Element.IsGas)
             {
                 primaryElement = component;
                 num2           = primaryElement.Mass;
             }
         }
         if ((Object)primaryElement != (Object)null)
         {
             SimMessages.AddRemoveSubstance(Grid.CellRight(Grid.CellAbove(Grid.PosToCell(base.gameObject))), ElementLoader.GetElementIndex(primaryElement.ElementID), CellEventLogger.Instance.ExhaustSimUpdate, primaryElement.Mass, primaryElement.Temperature, primaryElement.DiseaseIdx, primaryElement.DiseaseCount, true, -1);
             gasStorage.ConsumeIgnoringDisease(primaryElement.gameObject);
         }
     }
 }