Beispiel #1
0
 private void OnMassConsumed(Sim.MassConsumedCallback mcd)
 {
     if (IsRunning())
     {
         if (mcd.mass > 0f)
         {
             massUnavailableFrameCount = 0;
             Diet.Info dietInfo = base.def.diet.GetDietInfo(targetElement.tag);
             if (dietInfo != null)
             {
                 float calories = dietInfo.ConvertConsumptionMassToCalories(mcd.mass);
                 CreatureCalorieMonitor.CaloriesConsumedEvent caloriesConsumedEvent = default(CreatureCalorieMonitor.CaloriesConsumedEvent);
                 caloriesConsumedEvent.tag      = targetElement.tag;
                 caloriesConsumedEvent.calories = calories;
                 CreatureCalorieMonitor.CaloriesConsumedEvent caloriesConsumedEvent2 = caloriesConsumedEvent;
                 Trigger(-2038961714, caloriesConsumedEvent2);
             }
         }
         else
         {
             massUnavailableFrameCount++;
             if (massUnavailableFrameCount >= 2)
             {
                 Trigger(801383139, null);
             }
         }
     }
 }
 public void Consume(Sim.MassConsumedCallback mass_consumed)
 {
     if (onSimConsume != null)
     {
         onSimConsume(mass_consumed);
     }
 }
Beispiel #3
0
 public void OnAirConsumed(Sim.MassConsumedCallback mass_cb_info)
 {
     if (mass_cb_info.diseaseIdx != 255)
     {
         Disease disease = Db.Get().Diseases[mass_cb_info.diseaseIdx];
         InjectDisease(disease, mass_cb_info.diseaseCount, ElementLoader.elements[mass_cb_info.elemIdx].tag, Sickness.InfectionVector.Inhalation);
     }
 }
    private static void OnSimConsumeCallback(Sim.MassConsumedCallback mass_cb_info, object data)
    {
        EntityElementExchanger entityElementExchanger = (EntityElementExchanger)data;

        if ((UnityEngine.Object)entityElementExchanger != (UnityEngine.Object)null)
        {
            entityElementExchanger.OnSimConsume(mass_cb_info);
        }
    }
 private void OnSimConsume(Sim.MassConsumedCallback mass_cb_info)
 {
     if (!((UnityEngine.Object)oxygenBreather == (UnityEngine.Object)null) && !oxygenBreather.GetComponent <KPrefabID>().HasTag(GameTags.Dead))
     {
         Game.Instance.accumulators.Accumulate(oxygenBreather.O2Accumulator, mass_cb_info.mass);
         float value = 0f - mass_cb_info.mass;
         ReportManager.Instance.ReportValue(ReportManager.ReportType.OxygenCreated, value, oxygenBreather.GetProperName(), null);
         oxygenBreather.Consume(mass_cb_info);
     }
 }
 private void OnCellMopped(Sim.MassConsumedCallback mass_cb_info, object data)
 {
     if (!((UnityEngine.Object) this == (UnityEngine.Object)null) && mass_cb_info.mass > 0f)
     {
         amountMopped += mass_cb_info.mass;
         int            cell           = Grid.PosToCell(this);
         SubstanceChunk substanceChunk = LiquidSourceManager.Instance.CreateChunk(ElementLoader.elements[mass_cb_info.elemIdx], mass_cb_info.mass, mass_cb_info.temperature, mass_cb_info.diseaseIdx, mass_cb_info.diseaseCount, Grid.CellToPosCCC(cell, Grid.SceneLayer.Ore));
         substanceChunk.transform.SetPosition(substanceChunk.transform.GetPosition() + new Vector3((UnityEngine.Random.value - 0.5f) * 0.5f, 0f, 0f));
     }
 }
    private void OnSimConsume(Sim.MassConsumedCallback mass_cb_info)
    {
        float num = mass_cb_info.mass * base.smi.master.exchangeRatio;

        if (reportExchange && base.smi.master.emittedElement == SimHashes.Oxygen)
        {
            string            text      = base.gameObject.GetProperName();
            ReceptacleMonitor component = GetComponent <ReceptacleMonitor>();
            if ((UnityEngine.Object)component != (UnityEngine.Object)null && (UnityEngine.Object)component.GetReceptacle() != (UnityEngine.Object)null)
            {
                text = text + " (" + component.GetReceptacle().gameObject.GetProperName() + ")";
            }
            ReportManager.Instance.ReportValue(ReportManager.ReportType.OxygenCreated, num, text, null);
        }
        SimMessages.EmitMass(Grid.PosToCell(base.smi.master.transform.GetPosition() + outputOffset), ElementLoader.FindElementByHash(base.smi.master.emittedElement).idx, num, ElementLoader.FindElementByHash(base.smi.master.emittedElement).defaultValues.temperature, byte.MaxValue, 0, -1);
    }
Beispiel #8
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();
 }
Beispiel #9
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;
         }
     }
 }
Beispiel #10
0
            private static void Prefix(GasAndLiquidConsumerMonitor.Instance __instance, Sim.MassConsumedCallback mcd)
            {
                LivingCrystal livingCrystal = __instance.GetComponent <LivingCrystal>();

                if (livingCrystal == null)
                {
                    return;
                }

                if (mcd.mass > 0.0f)
                {
                    livingCrystal.AccumulateMass(mcd.mass, mcd.temperature);
                }
            }
Beispiel #11
0
 private void OnSimConsumeCallback(Sim.MassConsumedCallback mass_cb_info, object data)
 {
     ((WorkSession)data).OnSimConsume(mass_cb_info);
 }
Beispiel #12
0
 private static void OnSimConsumeCallback(Sim.MassConsumedCallback mass_cb_info, object data)
 {
     ((SteamTurbine)data).OnSimConsume(mass_cb_info);
 }
Beispiel #13
0
 private static void OnMassConsumedCallback(Sim.MassConsumedCallback mcd, object data)
 {
     ((Instance)data).OnMassConsumed(mcd);
 }
 private static void OnSimConsumeCallback(Sim.MassConsumedCallback mass_cb_info, object data)
 {
     ((GasBreatherFromWorldProvider)data).OnSimConsume(mass_cb_info);
 }