Exemplo n.º 1
0
        protected override bool OnWorkTick(Worker worker, float dt)
        {
            base.OnWorkTick(worker, dt);
            OreScrubber    component     = GetComponent <OreScrubber>();
            Storage        component2    = GetComponent <Storage>();
            PrimaryElement firstInfected = GetFirstInfected(worker.GetComponent <Storage>());
            int            num           = 0;

            SimUtil.DiseaseInfo invalid = SimUtil.DiseaseInfo.Invalid;
            if ((UnityEngine.Object)firstInfected != (UnityEngine.Object)null)
            {
                num             = Math.Min((int)(dt / workTime * (float)component.diseaseRemovalCount), firstInfected.DiseaseCount);
                diseaseRemoved += num;
                invalid.idx     = firstInfected.DiseaseIdx;
                invalid.count   = num;
                firstInfected.ModifyDiseaseCount(-num, "OreScrubber.OnWorkTick");
            }
            component.maxPossiblyRemoved += num;
            float num2 = component.massConsumedPerUse * dt / workTime;

            SimUtil.DiseaseInfo disease_info = SimUtil.DiseaseInfo.Invalid;
            component2.ConsumeAndGetDisease(ElementLoader.FindElementByHash(component.consumedElement).tag, num2, out disease_info, out float aggregate_temperature);
            if (component.outputElement != SimHashes.Vacuum)
            {
                disease_info = SimUtil.CalculateFinalDiseaseInfo(invalid, disease_info);
                component2.AddLiquid(component.outputElement, num2, aggregate_temperature, disease_info.idx, disease_info.count, false, true);
            }
            return(diseaseRemoved > component.diseaseRemovalCount);
        }
        protected override bool OnWorkTick(Worker worker, float dt)
        {
            base.OnWorkTick(worker, dt);
            HandSanitizer component     = GetComponent <HandSanitizer>();
            Storage       component2    = GetComponent <Storage>();
            float         massAvailable = component2.GetMassAvailable(component.consumedElement);

            if (massAvailable == 0f)
            {
                return(true);
            }
            PrimaryElement component3 = worker.GetComponent <PrimaryElement>();
            float          a          = component.massConsumedPerUse * dt / workTime;
            float          num        = Mathf.Min(a, massAvailable);
            int            num2       = Math.Min((int)(dt / workTime * (float)component.diseaseRemovalCount), component3.DiseaseCount);

            diseaseRemoved += num2;
            SimUtil.DiseaseInfo invalid = SimUtil.DiseaseInfo.Invalid;
            invalid.idx   = component3.DiseaseIdx;
            invalid.count = num2;
            component3.ModifyDiseaseCount(-num2, "HandSanitizer.OnWorkTick");
            component.maxPossiblyRemoved += num2;
            SimUtil.DiseaseInfo disease_info = SimUtil.DiseaseInfo.Invalid;
            component2.ConsumeAndGetDisease(ElementLoader.FindElementByHash(component.consumedElement).tag, num, out disease_info, out float aggregate_temperature);
            if (component.outputElement != SimHashes.Vacuum)
            {
                disease_info = SimUtil.CalculateFinalDiseaseInfo(invalid, disease_info);
                component2.AddLiquid(component.outputElement, num, aggregate_temperature, disease_info.idx, disease_info.count, false, true);
            }
            return(diseaseRemoved > component.diseaseRemovalCount);
        }
    public void AddDisease(HandleVector <int> .Handle h, byte disease_idx, int disease_count)
    {
        Data data = GetData(h);

        SimUtil.DiseaseInfo diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(disease_idx, disease_count, data.diseaseIdx, data.diseaseCount);
        data.diseaseIdx   = diseaseInfo.idx;
        data.diseaseCount = diseaseInfo.count;
        SetData(h, data);
    }
Exemplo n.º 4
0
        private void ConduitUpdate(float dt)
        {
            var flowManager = Conduit.GetFlowManager(Type);

            if (flowManager == null)
            {
                return;
            }

            var inputContents = flowManager.GetContents(inputCell);

            if (!TeleStorageData.Instance.storedElementsMap.ContainsKey(inputContents.element))
            {
                TeleStorageData.Instance.storedElementsMap[inputContents.element] = new StoredItem();
            }
            StoredItem inputStored = TeleStorageData.Instance.storedElementsMap[inputContents.element];

            if (inputContents.mass > 0.0f && !float.IsNaN(inputStored.temperature) && !float.IsNaN(inputContents.temperature))
            {
                inputStored.temperature = GameUtil.GetFinalTemperature(inputStored.temperature, inputStored.mass, inputContents.temperature, inputContents.mass);
                inputStored.mass       += inputContents.mass;
                SimUtil.DiseaseInfo diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(inputContents.diseaseIdx, inputContents.diseaseCount, inputStored.diseaseIdx, inputStored.diseaseCount);
                inputStored.diseaseIdx   = diseaseInfo.idx;
                inputStored.diseaseCount = diseaseInfo.count;
                TeleStorageData.Instance.FireRefresh();
                flowManager.RemoveElement(inputCell, inputContents.mass);
            }

            if (!IsOperational || !TeleStorageData.Instance.storedElementsMap.ContainsKey(FilteredElement))
            {
                return;
            }
            StoredItem outputStored   = TeleStorageData.Instance.storedElementsMap[FilteredElement];
            var        possibleOutput = Math.Min(outputStored.mass, Flow / TeleStorageFlowControl.GramsPerKilogram);

            if (possibleOutput > 0.0f)
            {
                var delta = flowManager.AddElement(outputCell, FilteredElement, possibleOutput, outputStored.temperature, 0, 0);
                outputStored.mass -= delta;
                TeleStorageData.Instance.FireRefresh();
            }
        }
Exemplo n.º 5
0
 private void OnSimConsume(Sim.MassConsumedCallback mass_cb_info)
 {
     if (consumedAmount == 0f)
     {
         temperature = mass_cb_info.temperature;
     }
     else
     {
         temperature = GameUtil.GetFinalTemperature(temperature, consumedAmount, mass_cb_info.temperature, mass_cb_info.mass);
     }
     consumedAmount += mass_cb_info.mass;
     lastTickAmount  = mass_cb_info.mass;
     diseaseInfo     = SimUtil.CalculateFinalDiseaseInfo(diseaseInfo.idx, diseaseInfo.count, mass_cb_info.diseaseIdx, mass_cb_info.diseaseCount);
     if (consumedAmount >= amountToPickup)
     {
         amountPerTick  = 0f;
         lastTickAmount = 0f;
     }
     ConsumeMass();
 }
Exemplo n.º 6
0
 private void OnSimConsume(Sim.MassConsumedCallback mass_cb_info)
 {
     if (mass_cb_info.mass > 0f)
     {
         this.storedTemperature = SimUtil.CalculateFinalTemperature(this.storedMass, this.storedTemperature, mass_cb_info.mass, mass_cb_info.temperature);
         this.storedMass       += mass_cb_info.mass;
         SimUtil.DiseaseInfo diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(this.diseaseIdx, this.diseaseCount, mass_cb_info.diseaseIdx, mass_cb_info.diseaseCount);
         this.diseaseIdx   = diseaseInfo.idx;
         this.diseaseCount = diseaseInfo.count;
         if (this.storedMass > this.minConvertMass && this.simEmitCBHandle.IsValid())
         {
             Game.Instance.massEmitCallbackManager.GetItem(this.simEmitCBHandle);
             this.gasStorage.AddGasChunk(this.srcElem, this.storedMass, this.storedTemperature, this.diseaseIdx, this.diseaseCount, true, true);
             this.storedMass        = 0f;
             this.storedTemperature = 0f;
             this.diseaseIdx        = 255;
             this.diseaseCount      = 0;
         }
     }
 }
Exemplo n.º 7
0
    protected override bool OnWorkTick(Worker worker, float dt)
    {
        PrimaryElement component = worker.GetComponent <PrimaryElement>();

        if (component.DiseaseCount > 0)
        {
            SimUtil.DiseaseInfo diseaseInfo = default(SimUtil.DiseaseInfo);
            diseaseInfo.idx   = component.DiseaseIdx;
            diseaseInfo.count = Mathf.CeilToInt((float)component.DiseaseCount * (1f - Mathf.Pow(fractionalDiseaseRemoval, dt)) - (float)absoluteDiseaseRemoval);
            SimUtil.DiseaseInfo b = diseaseInfo;
            component.ModifyDiseaseCount(-b.count, "Shower.RemoveDisease");
            accumulatedDisease = SimUtil.CalculateFinalDiseaseInfo(accumulatedDisease, b);
            Storage        component2     = GetComponent <Storage>();
            PrimaryElement primaryElement = component2.FindPrimaryElement(outputTargetElement);
            if ((Object)primaryElement != (Object)null)
            {
                PrimaryElement component3 = primaryElement.GetComponent <PrimaryElement>();
                component3.AddDisease(accumulatedDisease.idx, accumulatedDisease.count, "Shower.RemoveDisease");
                accumulatedDisease = SimUtil.DiseaseInfo.Invalid;
            }
        }
        return(false);
    }
Exemplo n.º 8
0
    public int AddDisease(HandleVector <int> .Handle h, byte disease_idx, int disease_count)
    {
        GetData(h, out DiseaseHeader header, out DiseaseContainer payload);
        SimUtil.DiseaseInfo diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(disease_idx, disease_count, header.diseaseIdx, header.diseaseCount);
        bool flag = header.diseaseIdx != diseaseInfo.idx;

        header.diseaseIdx   = diseaseInfo.idx;
        header.diseaseCount = diseaseInfo.count;
        if (flag && diseaseInfo.idx != 255)
        {
            EvaluateGrowthConstants(header, ref payload);
            SetData(h, header, ref payload);
        }
        else
        {
            SetHeader(h, header);
        }
        if (flag)
        {
            header.primaryElement.Trigger(-283306403, null);
        }
        return(header.diseaseCount);
    }
Exemplo n.º 9
0
 private void OnSimEmitted(Sim.MassEmittedCallback info)
 {
     if (info.suceeded != 1)
     {
         this.storedTemperature = SimUtil.CalculateFinalTemperature(this.storedMass, this.storedTemperature, info.mass, info.temperature);
         this.storedMass       += info.mass;
         if (info.diseaseIdx != 255)
         {
             SimUtil.DiseaseInfo a = new SimUtil.DiseaseInfo
             {
                 idx   = this.diseaseIdx,
                 count = this.diseaseCount
             };
             SimUtil.DiseaseInfo b = new SimUtil.DiseaseInfo
             {
                 idx   = info.diseaseIdx,
                 count = info.diseaseCount
             };
             SimUtil.DiseaseInfo diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(a, b);
             this.diseaseIdx   = diseaseInfo.idx;
             this.diseaseCount = diseaseInfo.count;
         }
     }
 }
    private void ConvertMass()
    {
        float speedMultiplier = GetSpeedMultiplier();
        float num             = 1f * speedMultiplier;
        float num2            = 1f;

        for (int i = 0; i < consumedElements.Length; i++)
        {
            ConsumedElement consumedElement = consumedElements[i];
            float           num3            = consumedElement.massConsumptionRate * num * num2;
            if (num3 <= 0f)
            {
                num2 = 0f;
                break;
            }
            float num4 = 0f;
            for (int j = 0; j < storage.items.Count; j++)
            {
                GameObject gameObject = storage.items[j];
                if (!((UnityEngine.Object)gameObject == (UnityEngine.Object)null) && gameObject.HasTag(consumedElement.tag))
                {
                    PrimaryElement component = gameObject.GetComponent <PrimaryElement>();
                    float          num5      = Mathf.Min(num3, component.Mass);
                    num4 += num5 / num3;
                }
            }
            num2 = Mathf.Min(num2, num4);
        }
        if (!(num2 <= 0f))
        {
            SimUtil.DiseaseInfo diseaseInfo = SimUtil.DiseaseInfo.Invalid;
            diseaseInfo.idx   = byte.MaxValue;
            diseaseInfo.count = 0;
            float num6 = 0f;
            float num7 = 0f;
            float num8 = 0f;
            for (int k = 0; k < consumedElements.Length; k++)
            {
                ConsumedElement consumedElement2 = consumedElements[k];
                float           num9             = consumedElement2.massConsumptionRate * num * num2;
                Game.Instance.accumulators.Accumulate(consumedElement2.accumulator, num9);
                for (int l = 0; l < storage.items.Count; l++)
                {
                    GameObject gameObject2 = storage.items[l];
                    if (!((UnityEngine.Object)gameObject2 == (UnityEngine.Object)null))
                    {
                        if (gameObject2.HasTag(consumedElement2.tag))
                        {
                            PrimaryElement component2 = gameObject2.GetComponent <PrimaryElement>();
                            component2.KeepZeroMassObject = true;
                            float num10 = Mathf.Min(num9, component2.Mass);
                            float num11 = num10 / component2.Mass;
                            int   num12 = (int)(num11 * (float)component2.DiseaseCount);
                            float num13 = num10 * component2.Element.specificHeatCapacity;
                            num8            += num13;
                            num7            += num13 * component2.Temperature;
                            component2.Mass -= num10;
                            component2.ModifyDiseaseCount(-num12, "ElementConverter.ConvertMass");
                            num6       += num10;
                            diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(diseaseInfo.idx, diseaseInfo.count, component2.DiseaseIdx, num12);
                            num9       -= num10;
                            if (num9 <= 0f)
                            {
                                break;
                            }
                        }
                        if (num9 <= 0f)
                        {
                            Debug.Assert(num9 <= 0f);
                        }
                    }
                }
            }
            float num14 = (!(num8 > 0f)) ? 0f : (num7 / num8);
            if (onConvertMass != null && num6 > 0f)
            {
                onConvertMass(num6);
            }
            if (outputElements != null && outputElements.Length > 0)
            {
                for (int m = 0; m < outputElements.Length; m++)
                {
                    OutputElement       outputElement = outputElements[m];
                    SimUtil.DiseaseInfo a             = diseaseInfo;
                    if (totalDiseaseWeight <= 0f)
                    {
                        a.idx   = byte.MaxValue;
                        a.count = 0;
                    }
                    else
                    {
                        float num15 = outputElement.diseaseWeight / totalDiseaseWeight;
                        a.count = (int)((float)a.count * num15);
                    }
                    if (outputElement.addedDiseaseIdx != 255)
                    {
                        a = SimUtil.CalculateFinalDiseaseInfo(a, new SimUtil.DiseaseInfo
                        {
                            idx   = outputElement.addedDiseaseIdx,
                            count = outputElement.addedDiseaseCount
                        });
                    }
                    float num16 = outputElement.massGenerationRate * OutputMultiplier * num * num2;
                    Game.Instance.accumulators.Accumulate(outputElement.accumulator, num16);
                    float num17 = 0f;
                    num17 = ((!outputElement.useEntityTemperature && (num14 != 0f || outputElement.minOutputTemperature != 0f)) ? Mathf.Max(outputElement.minOutputTemperature, num14) : GetComponent <PrimaryElement>().Temperature);
                    Element element = ElementLoader.FindElementByHash(outputElement.elementHash);
                    if (outputElement.storeOutput)
                    {
                        PrimaryElement primaryElement = storage.AddToPrimaryElement(outputElement.elementHash, num16, num17);
                        if ((UnityEngine.Object)primaryElement == (UnityEngine.Object)null)
                        {
                            if (element.IsGas)
                            {
                                storage.AddGasChunk(outputElement.elementHash, num16, num17, a.idx, a.count, true, true);
                            }
                            else if (element.IsLiquid)
                            {
                                storage.AddLiquid(outputElement.elementHash, num16, num17, a.idx, a.count, true, true);
                            }
                            else
                            {
                                GameObject go = element.substance.SpawnResource(base.transform.GetPosition(), num16, num17, a.idx, a.count, true, false, false);
                                storage.Store(go, true, false, true, false);
                            }
                        }
                        else
                        {
                            primaryElement.AddDisease(a.idx, a.count, "ElementConverter.ConvertMass");
                        }
                    }
                    else
                    {
                        Vector3 position  = base.transform.GetPosition();
                        float   x         = position.x + outputElement.outputElementOffset.x;
                        Vector3 position2 = base.transform.GetPosition();
                        Vector3 vector    = new Vector3(x, position2.y + outputElement.outputElementOffset.y, 0f);
                        int     num18     = Grid.PosToCell(vector);
                        if (element.IsLiquid)
                        {
                            int idx = element.idx;
                            FallingWater.instance.AddParticle(num18, (byte)idx, num16, num17, a.idx, a.count, true, false, false, false);
                        }
                        else if (element.IsSolid)
                        {
                            element.substance.SpawnResource(vector, num16, num17, a.idx, a.count, false, false, false);
                        }
                        else
                        {
                            SimMessages.AddRemoveSubstance(num18, outputElement.elementHash, CellEventLogger.Instance.OxygenModifierSimUpdate, num16, num17, a.idx, a.count, true, -1);
                        }
                    }
                    if (outputElement.elementHash == SimHashes.Oxygen)
                    {
                        ReportManager.Instance.ReportValue(ReportManager.ReportType.OxygenCreated, num16, base.gameObject.GetProperName(), null);
                    }
                }
            }
            storage.Trigger(-1697596308, base.gameObject);
        }
    }
Exemplo n.º 11
0
    private GameObject CraftRecipe(Storage resource_storage, Ingredient[] ingredientTags)
    {
        SimUtil.DiseaseInfo a = SimUtil.DiseaseInfo.Invalid;
        float num             = 0f;
        float num2            = 0f;

        foreach (Ingredient ingredient in ingredientTags)
        {
            GameObject gameObject = resource_storage.FindFirst(ingredient.tag);
            if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null)
            {
                Edible component = gameObject.GetComponent <Edible>();
                if ((bool)component)
                {
                    ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, 0f - component.Calories, StringFormatter.Replace(UI.ENDOFDAYREPORT.NOTES.CRAFTED_USED, "{0}", component.GetProperName()), UI.ENDOFDAYREPORT.NOTES.CRAFTED_CONTEXT);
                }
            }
            resource_storage.ConsumeAndGetDisease(ingredient, out SimUtil.DiseaseInfo disease_info, out float temperature);
            a     = SimUtil.CalculateFinalDiseaseInfo(a, disease_info);
            num   = SimUtil.CalculateFinalTemperature(num2, num, ingredient.amount, temperature);
            num2 += ingredient.amount;
        }
        GameObject prefab      = Assets.GetPrefab(Result);
        GameObject gameObject2 = null;

        if ((UnityEngine.Object)prefab != (UnityEngine.Object)null)
        {
            gameObject2 = GameUtil.KInstantiate(prefab, Grid.SceneLayer.Ore, null, 0);
            PrimaryElement component2 = gameObject2.GetComponent <PrimaryElement>();
            gameObject2.GetComponent <KSelectable>().entityName = Name;
            if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
            {
                gameObject2.GetComponent <KPrefabID>().RemoveTag(TagManager.Create("Vacuum"));
                if (ResultElementOverride != 0)
                {
                    if ((UnityEngine.Object)component2.GetComponent <ElementChunk>() != (UnityEngine.Object)null)
                    {
                        component2.SetElement(ResultElementOverride);
                    }
                    else
                    {
                        component2.ElementID = ResultElementOverride;
                    }
                }
                component2.Temperature = num;
                component2.Units       = OutputUnits;
            }
            Edible component3 = gameObject2.GetComponent <Edible>();
            if ((bool)component3)
            {
                ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, component3.Calories, StringFormatter.Replace(UI.ENDOFDAYREPORT.NOTES.CRAFTED, "{0}", component3.GetProperName()), UI.ENDOFDAYREPORT.NOTES.CRAFTED_CONTEXT);
            }
            gameObject2.SetActive(true);
            if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
            {
                component2.AddDisease(a.idx, a.count, "Recipe.CraftRecipe");
            }
            gameObject2.GetComponent <KMonoBehaviour>().Trigger(748399584, null);
        }
        return(gameObject2);
    }
Exemplo n.º 12
0
        private void ConvertMass()
        {
            SimUtil.DiseaseInfo diseaseInfo = SimUtil.DiseaseInfo.Invalid;
            diseaseInfo.idx   = byte.MaxValue;
            diseaseInfo.count = 0;

            float speedMultiplier = GetSpeedMultiplier();

            // Accumulators
            float oxygenMass      = 0f;
            float hydrogenMass    = 0f;
            float bleachStoneMass = 0f;

            float totalConsumedAmount  = 0f;
            float waterConsumptionRate = Config.waterConsumptionRate * speedMultiplier;

            Tag dirtyWaterTag = SimHashes.DirtyWater.CreateTag();
            Tag saltWaterTag  = SimHashes.SaltWater.CreateTag();
            Tag brineTag      = SimHashes.Brine.CreateTag();

            bool isDirty = false;

            for (int i = 0; i < storage.items.Count; i++)
            {
                GameObject storageItem = storage.items[i];
                if (storageItem != null && storageItem.HasTag(GameTags.AnyWater))
                {
                    PrimaryElement element = storageItem.GetComponent <PrimaryElement>();

                    //element.KeepZeroMassObject = true;
                    float consumedAmount     = Mathf.Min(waterConsumptionRate, element.Mass);
                    float consumedPercentage = consumedAmount / element.Mass;

                    int diseaseCount = (int)(consumedPercentage * element.DiseaseCount);

                    element.Mass -= consumedAmount;
                    element.ModifyDiseaseCount(-diseaseCount, "IndustrialElectrolyzer.ConvertMass");

                    if (storageItem.HasTag(saltWaterTag))
                    {
                        // 93% H2O
                        oxygenMass   += consumedAmount * Config.saltWater2WaterRatio * Config.water2OxygenRatio;
                        hydrogenMass += consumedAmount * Config.saltWater2WaterRatio * Config.water2HydrogenRatio;
                        // 7% NaCl
                        bleachStoneMass += consumedAmount * Config.saltWater2SaltRatio * Config.salt2BleachStoneRatio;
                    }
                    else if (storageItem.HasTag(brineTag))
                    {
                        // 70% H2O
                        oxygenMass   += consumedAmount * Config.brine2WaterRatio * Config.water2OxygenRatio;
                        hydrogenMass += consumedAmount * Config.brine2WaterRatio * Config.water2HydrogenRatio;
                        // 30% NaCl
                        bleachStoneMass += consumedAmount * Config.brine2SaltRatio * Config.salt2BleachStoneRatio;
                    }
                    else
                    {
                        oxygenMass   += consumedAmount * Config.water2OxygenRatio;
                        hydrogenMass += consumedAmount * Config.water2HydrogenRatio;
                    }

                    totalConsumedAmount += consumedAmount;

                    if (storageItem.HasTag(dirtyWaterTag) && consumedAmount > EPSILON)
                    {
                        isDirty = true;
                    }

                    diseaseInfo = SimUtil.CalculateFinalDiseaseInfo(diseaseInfo.idx, diseaseInfo.count, element.DiseaseIdx, element.DiseaseCount);

                    waterConsumptionRate -= consumedAmount;
                    if (waterConsumptionRate <= 0f)
                    {
                        Debug.Assert(waterConsumptionRate <= 0f);
                        break;
                    }
                }
            }

            float temperature = GetComponent <PrimaryElement>().Temperature;

            if (onConvertMass != null && totalConsumedAmount > EPSILON)
            {
                onConvertMass(totalConsumedAmount);
            }

            ConduitFlow gasFlowManager = Conduit.GetFlowManager(portInfo.conduitType);

            SimHashes oxygenHash      = isDirty ? SimHashes.ContaminatedOxygen : SimHashes.Oxygen;
            float     oxygenGenerated = gasFlowManager.AddElement(oxygenOutputCell, oxygenHash, oxygenMass * speedMultiplier, Mathf.Max(Config.oxygenTemperature, temperature), diseaseInfo.idx, diseaseInfo.count / 2);

            ReportManager.Instance.ReportValue(ReportManager.ReportType.OxygenCreated, oxygenGenerated, gameObject.GetProperName());
            Game.Instance.accumulators.Accumulate(OxygenAccumulator, oxygenGenerated);

            float hydrogenGenerated = gasFlowManager.AddElement(hydrogenOutputCell, SimHashes.Hydrogen, hydrogenMass * speedMultiplier, Mathf.Max(Config.hydrogenTemperature, temperature), diseaseInfo.idx, diseaseInfo.count / 2);

            Game.Instance.accumulators.Accumulate(HydrogenAccumulator, hydrogenGenerated);

            if (bleachStoneMass > EPSILON)
            {
                Element bleachStone = ElementLoader.FindElementByHash(SimHashes.BleachStone);

                Vector3 position = building.GetRotatedOffset(new CellOffset(1, 0)).ToVector3() + new Vector3(.5f, .5f, .0f) + transform.position;
                UnityEngine.Debug.Log("[AE] transform is at " + transform.position);
                UnityEngine.Debug.Log("[AE] exit is at " + position);

                bleachStone.substance.SpawnResource(position, bleachStoneMass, temperature, diseaseInfo.idx, diseaseInfo.count);
            }

            storage.Trigger((int)GameHashes.OnStorageChange, gameObject);
        }