コード例 #1
0
        // Token: 0x06000007 RID: 7 RVA: 0x0000212C File Offset: 0x0000032C
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(base.GetInspectString());
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();
            bool flag = comp != null;

            if (flag)
            {
                float num   = (float)typeof(CompTemperatureRuinable).GetField("ruinedPercent", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(comp);
                bool  flag2 = num > 0f;
                if (flag2)
                {
                    stringBuilder.AppendLine("(" + GenText.ToStringPercent(num) + ") " + (this.Extension.temperatureManagement.hasTemperatureManagement ? "AVInspect_BadTempManaged".AdvancedTranslate(this.Extension) : "AVInspect_BadTempUnmanaged".AdvancedTranslate(this.Extension)));
                }
            }
            stringBuilder.AppendLine(this.GetStringIngredients());
            bool flag3 = !GenCollection.Any <Building_AutomatedVat._ThingCountClass>(this.localRecord, (Building_AutomatedVat._ThingCountClass t) => t.count > 0);

            if (flag3)
            {
                stringBuilder.AppendLine(this.GetStringWorking());
            }
            return(GenText.TrimEndNewlines(stringBuilder.ToString()));
        }
コード例 #2
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (this.Fermented)
            {
                stringBuilder.AppendLine("ReadyToHatch".Translate());
            }
            else
            {
                stringBuilder.AppendLine("AntEggProgress".Translate(this.Progress.ToStringPercent(), this.EstimatedTicksLeft.ToStringTicksToPeriod()));
                if (this.CurrentTempProgressSpeedFactor != 1f)
                {
                    stringBuilder.AppendLine("AntEggOutOfIdealTemperature".Translate(this.CurrentTempProgressSpeedFactor.ToStringPercent()));
                }
            }

            stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0"));
            stringBuilder.AppendLine(string.Concat(new string[]
            {
                "AntEggIdealTemperature".Translate(),
                ": ",
                MinIdealTemperature.ToStringTemperature("F0"),
                " ~ ",
                comp.Props.maxSafeTemperature.ToStringTemperature("F0")
            }));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #3
0
        public override string GetProcessingString()
        {
            StringBuilder           stringBuilder = new StringBuilder();
            CompTemperatureRuinable tempRuinable  = GetComp <CompTemperatureRuinable>();

            if (!Empty && (tempRuinable == null || !tempRuinable.Ruined))
            {
                string contentsLabel = Completed ? CompFermenting.ProductDef.label : CompFermenting.IngredientLabel;
                stringBuilder.AppendLine("FermentingBuildingContainsSomething".Translate(new object[]
                {
                    contentsCount,
                    Capacity,
                    contentsLabel
                }));
            }
            if (!Empty)
            {
                if (Completed)
                {
                    stringBuilder.AppendLine(ProcessedLabel.Translate());
                }
                else
                {
                    stringBuilder.AppendLine("FermentationProgress".Translate(new object[]
                    {
                        Progress.ToStringPercent(),
                        EstimatedTicksLeft.ToStringTicksToPeriod()
                    }));
                    if (CurrentTempProgressSpeedFactor != 1f)
                    {
                        stringBuilder.Append(OutOfIdealTemperatureLabel);
                        stringBuilder.AppendLine(CurrentTempProgressSpeedFactor.ToStringPercent());
                    }
                }
            }
            stringBuilder.AppendLine("Temperature".Translate() + ": " + AmbientTemperature.ToStringTemperature("F0"));
            if (tempRuinable == null)
            {
                stringBuilder.AppendLine(string.Concat(new string[]
                {
                    CompFermenting.IdealTempLabel,
                    ": >",
                    MinIdealTemperature.ToStringTemperature("F0")
                }));
            }
            else
            {
                stringBuilder.AppendLine(string.Concat(new string[]
                {
                    CompFermenting.IdealTempLabel,
                    ": ",
                    MinIdealTemperature.ToStringTemperature("F0"),
                    " ~ ",
                    tempRuinable.Props.maxSafeTemperature.ToStringTemperature("F0")
                }));
            }
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #4
0
        public void AddInput(Thing input)
        {
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (comp.Ruined)
            {
                comp.Reset();
            }
            this.AddInput(input.stackCount);
            input.Destroy(DestroyMode.Vanish);
        }
        // Token: 0x06000010 RID: 16 RVA: 0x000023BC File Offset: 0x000013BC
        public void Addoil(Thing sd_luciprod_mechanite_oil)
        {
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (comp.Ruined)
            {
                comp.Reset();
            }
            this.Addoil(sd_luciprod_mechanite_oil.stackCount);
            sd_luciprod_mechanite_oil.Destroy(DestroyMode.Vanish);
        }
コード例 #6
0
        // Token: 0x0600000D RID: 13 RVA: 0x000024C4 File Offset: 0x000006C4
        public void ManageTemperature()
        {
            CompTemperatureRuinable comp  = base.GetComp <CompTemperatureRuinable>();
            CompPowerTrader         comp2 = base.GetComp <CompPowerTrader>();
            FieldInfo field = typeof(CompTemperatureRuinable).GetField("ruinedPercent", BindingFlags.Instance | BindingFlags.NonPublic);
            bool      flag  = comp != null && comp2 != null && (float)field.GetValue(comp) > 0f;

            if (flag)
            {
                comp2.powerOutputInt = -this.def.GetCompProperties <CompProperties_Power>().basePowerConsumption - this.Extension.temperatureManagement.powerConsumptionExtra;
                field.SetValue(comp, (float)field.GetValue(comp) - comp.Props.progressPerDegreePerTick * this.Extension.temperatureManagement.temperatureManagementStrength * (float)this.Extension.tickRateDivisor);
            }
        }
コード例 #7
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (!this.Empty && !comp.Ruined)
            {
                if (this.Fermented)
                {
                    stringBuilder.AppendLine("ContainsRxlvn".Translate(this.mashCount, 25));
                }
                else
                {
                    stringBuilder.AppendLine("ContainsMash".Translate(this.mashCount, 25));
                }
            }
            if (!this.Empty)
            {
                if (this.Fermented)
                {
                    stringBuilder.AppendLine("Fermented".Translate());
                }
                else
                {
                    stringBuilder.AppendLine("FermentationProgress".Translate(this.Progress.ToStringPercent(), this.EstimatedTicksLeft.ToStringTicksToPeriod()));
                    if (this.CurrentTempProgressSpeedFactor != 1f)
                    {
                        stringBuilder.AppendLine("FermentationBarrelOutOfIdealTemperature".Translate(this.CurrentTempProgressSpeedFactor.ToStringPercent()));
                    }
                }
            }
            stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0"));
            stringBuilder.AppendLine(string.Concat(new string[]
            {
                "IdealFermentingTemperature".Translate(),
                ": ",
                7f.ToStringTemperature("F0"),
                " ~ ",
                comp.Props.maxSafeTemperature.ToStringTemperature("F0")
            }));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #8
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            CompTemperatureRuinable comp = GetComp <CompTemperatureRuinable>();

            if (!Empty && !comp.Ruined)
            {
                if (Reacted)
                {
                    stringBuilder.AppendLine("ContainsGraphene".Translate(GrapheneCartridgeCount, 25));
                }
                else
                {
                    stringBuilder.AppendLine("ContainsGrapheneCartridge".Translate(GrapheneCartridgeCount, 25));
                }
            }
            if (!Empty)
            {
                if (Reacted)
                {
                    stringBuilder.AppendLine("Complete".Translate());
                }
                else
                {
                    stringBuilder.AppendLine("ReactionProgress".Translate(Progress.ToStringPercent(), EstimatedTicksLeft.ToStringTicksToPeriod()));
                    if (CurrentTempProgressSpeedFactor != 1f)
                    {
                        stringBuilder.AppendLine("GrapheneVatOutOfIdealTemperature".Translate(CurrentTempProgressSpeedFactor.ToStringPercent()));
                    }
                }
            }

            stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0"));
            stringBuilder.AppendLine("IdealReactingTemperature".Translate() + ": " + 7f.ToStringTemperature("F0") + " ~ " + comp.Props.maxSafeTemperature.ToStringTemperature("F0"));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (!this.Empty && !comp.Ruined)
            {
                if (this.Fermented)
                {
                    stringBuilder.AppendLine("VFEV_ContainsBeer".Translate(this.wortCount, MaxCapacity));
                }
                else
                {
                    stringBuilder.AppendLine("VFEV_ContainsWort".Translate(this.wortCount, MaxCapacity));
                }
            }
            if (!this.Empty)
            {
                if (this.Fermented)
                {
                    stringBuilder.AppendLine("VFEV_Fermented".Translate());
                }
                else
                {
                    stringBuilder.AppendLine("VFEV_FermentationProgress".Translate(this.Progress.ToStringPercent(), this.EstimatedTicksLeft.ToStringTicksToPeriod(true, false, true, true)));
                    if (this.CurrentTempProgressSpeedFactor != 1f)
                    {
                        stringBuilder.AppendLine("VFEV_FermentationBarrelOutOfIdealTemperature".Translate(this.CurrentTempProgressSpeedFactor.ToStringPercent()));
                    }
                }
            }
            stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0"));
            stringBuilder.AppendLine("IdealFermentingTemperature".Translate() + ": " + 5f.ToStringTemperature("F0") + " ~ " + comp.Props.maxSafeTemperature.ToStringTemperature("F0"));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #10
0
ファイル: RuinedEggs.cs プロジェクト: rheirman/RimworldMods
            static void Postfix(ref bool __state, ref CompTemperatureRuinable __instance)
            {
                if (Settings.convert_ruined_eggs && !__state && __instance.Ruined) // Thing is ruined after this tick
                {
                    ThingWithComps thing = __instance.parent;
                    Map            map   = thing.Map;
                    foreach (var item in thing.AllComps)
                    {
                        if (item.props.GetType() == typeof(CompProperties_Hatcher))
                        {
                            thing.DeSpawn();
                            thing.def = DefDatabase <ThingDef> .GetNamed("EggChickenUnfertilized");

                            thing.AllComps.Remove(__instance);
                            thing.AllComps.Remove(item);
                            thing.SpawnSetup(map, true);
                            break;
                        }
                    }
                }
            }
コード例 #11
0
        public void AddIngredient(int count)
        {
            CompTemperatureRuinable temperatureRuinable = GetComp <CompTemperatureRuinable>();

            if (temperatureRuinable != null)
            {
                temperatureRuinable.Reset();
            }
            if (Completed)
            {
                Log.Warning(string.Format("Tried to add {0} to a building full of {1}. Colonists should take the {1} first.", CompProcessing.IngredientLabel, CompProcessing.ProductDef.label));
                return;
            }
            int added = Mathf.Min(count, Capacity - contentsCount);

            if (added > 0)
            {
                Progress       = GenMath.WeightedAverage(0f, added, Progress, contentsCount);
                contentsCount += added;
            }
        }
コード例 #12
0
ファイル: Main.cs プロジェクト: silverjoy/rimworld-rimfridge
        static bool Prefix(CompTemperatureRuinable __instance, int ticks)
        {
            if (!__instance.Ruined)
            {
                IEnumerable <Thing> things = __instance.parent?.Map?.thingGrid.ThingsAt(__instance.parent.Position);
                if (things != null)
                {
                    foreach (Thing thing in things)
                    {
                        if (thing?.def.defName.StartsWith("RimFridge") == true)
                        {
                            Building_Refrigerator refridge = (Building_Refrigerator)thing;
                            float ruinedPercent            = (float)RuinedPercentFI.GetValue(__instance);
                            if (refridge.CurrentTemp > __instance.Props.maxSafeTemperature)
                            {
                                ruinedPercent += (refridge.CurrentTemp - __instance.Props.maxSafeTemperature) * __instance.Props.progressPerDegreePerTick * (float)ticks;
                            }
                            else if (refridge.CurrentTemp < __instance.Props.minSafeTemperature)
                            {
                                ruinedPercent -= (refridge.CurrentTemp - __instance.Props.minSafeTemperature) * __instance.Props.progressPerDegreePerTick * (float)ticks;
                            }

                            if (ruinedPercent >= 1f)
                            {
                                ruinedPercent = 1f;
                                __instance.parent.BroadcastCompSignal("RuinedByTemperature");
                            }
                            else if (ruinedPercent < 0f)
                            {
                                ruinedPercent = 0f;
                            }
                            RuinedPercentFI.SetValue(__instance, ruinedPercent);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
コード例 #13
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (!this.Empty && !comp.Ruined)
            {
                if (this.Fermented)
                {
                    ExtraThingDef extra_def = def as ExtraThingDef;
                    if (extra_def != null && extra_def.vatProperties != null)
                    {
                        stringBuilder.AppendLine(extra_def.vatProperties.containsOutputTranslation.Translate(new object[]
                        {
                            this.thingCount,
                            MaxCapacity
                        }));
                    }
                    else
                    {
                        stringBuilder.AppendLine("ContainsBerries".Translate(new object[]
                        {
                            this.thingCount,
                            MaxCapacity
                        }));
                    }
                }
                else
                {
                    ExtraThingDef extra_def = def as ExtraThingDef;
                    if (extra_def != null && extra_def.vatProperties != null)
                    {
                        stringBuilder.AppendLine(extra_def.vatProperties.containsInputTranslation.Translate(new object[]
                        {
                            this.thingCount,
                            MaxCapacity
                        }));
                    }
                    else
                    {
                        stringBuilder.AppendLine("ContainsCider".Translate(new object[]
                        {
                            this.thingCount,
                            MaxCapacity
                        }));
                    }
                }
            }
            if (!this.Empty)
            {
                if (this.Fermented)
                {
                    ExtraThingDef extra_def = def as ExtraThingDef;
                    if (extra_def != null && extra_def.vatProperties != null)
                    {
                        stringBuilder.AppendLine(extra_def.vatProperties.fermentedTranslation.Translate());
                    }
                    else
                    {
                        stringBuilder.AppendLine("Fermented".Translate());
                    }
                }
                else
                {
                    ExtraThingDef extra_def = def as ExtraThingDef;
                    if (extra_def != null && extra_def.vatProperties != null)
                    {
                        stringBuilder.AppendLine(extra_def.vatProperties.fermentationProgressTranslation.Translate(new object[]
                        {
                            this.Progress.ToStringPercent(),
                            this.EstimatedTicksLeft.ToStringTicksToPeriod()
                        }));
                    }
                    else
                    {
                        stringBuilder.AppendLine("FermentationProgress".Translate(new object[]
                        {
                            this.Progress.ToStringPercent(),
                            this.EstimatedTicksLeft.ToStringTicksToPeriod()
                        }));
                    }
                    if (this.CurrentTempProgressSpeedFactor != 1f)
                    {
                        if (extra_def != null && extra_def.vatProperties != null)
                        {
                            stringBuilder.AppendLine(extra_def.vatProperties.fermentationNonIdealTranslation.Translate(new object[]
                            {
                                this.CurrentTempProgressSpeedFactor.ToStringPercent()
                            }));
                        }
                        else
                        {
                            stringBuilder.AppendLine("FermentationBarrelOutOfIdealTemperature".Translate(new object[]
                            {
                                this.CurrentTempProgressSpeedFactor.ToStringPercent()
                            }));
                        }
                    }
                }
            }
            stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0"));
            stringBuilder.AppendLine(string.Concat(new string[]
            {
                "IdealFermentingTemperature".Translate(),
                ": ",
                7f.ToStringTemperature("F0"),
                " ~ ",
                comp.Props.maxSafeTemperature.ToStringTemperature("F0")
            }));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #14
0
ファイル: RuinedEggs.cs プロジェクト: rheirman/RimworldMods
 static bool Prefix(ref bool __state, ref CompTemperatureRuinable __instance)
 {
     __state = __instance.Ruined;
     return(true);
 }
        // Token: 0x06000011 RID: 17 RVA: 0x000023FC File Offset: 0x000013FC
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>();

            if (stringBuilder.Length != 0)
            {
                stringBuilder.AppendLine();
            }
            if (!this.Empty && !comp.Ruined)
            {
                if (this.Distilled)
                {
                    stringBuilder.AppendLine(string.Concat(new object[]
                    {
                        Translator.Translate("sd_luciprod_txtcontainsrawluci"),
                        ": ",
                        this.sd_luciprod_oilcount,
                        "/10"
                    }));
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new object[]
                    {
                        Translator.Translate("sd_luciprod_txtcontainsoil"),
                        ": ",
                        this.sd_luciprod_oilcount,
                        "/10"
                    }));
                }
            }
            if (!this.Empty)
            {
                if (this.Distilled)
                {
                    stringBuilder.AppendLine(Translator.Translate("sd_luciprod_txtdistilled"));
                }
                else
                {
                    stringBuilder.AppendLine(string.Concat(new string[]
                    {
                        Translator.Translate("sd_luciprod_txtdistillingprogress"),
                        ": ",
                        this.Progress.ToStringPercent(),
                        " ~ ",
                        GenDate.ToStringTicksToPeriod(this.EstimatedTicksLeft)
                    }));
                    if (this.CurrentTempProgressSpeedFactor != 1f)
                    {
                        stringBuilder.AppendLine(Translator.Translate("sd_luciprod_txtdistilleryoutofidealtemperature") + ": " + this.CurrentTempProgressSpeedFactor.ToStringPercent());
                    }
                }
            }
            if (base.MapHeld != null)
            {
                stringBuilder.AppendLine(Translator.Translate("sd_luciprod_txttemperature") + ": " + this.Temperature.ToStringTemperature("F0"));
            }
            stringBuilder.AppendLine(string.Concat(new string[]
            {
                Translator.Translate("sd_luciprod_txtidealdistillingtemperature"),
                ": ",
                7f.ToStringTemperature("F0"),
                " ~ ",
                comp.Props.maxSafeTemperature.ToStringTemperature("F0")
            }));
            return(stringBuilder.ToString().TrimEndNewlines());
        }
コード例 #16
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     temperatureComp = GetComp <CompTemperatureRuinable>();
 }