Пример #1
0
        public override string CompInspectStringExtra()
        {
            StringBuilder sb = new StringBuilder();

            switch (base.Stage)
            {
            case RotStage.Fresh:
                sb.Append("RotStateFresh".Translate());
                break;

            case RotStage.Rotting:
                sb.Append("RotStateRotting".Translate());
                break;

            case RotStage.Dessicated:
                sb.Append("RotStateDessicated".Translate());
                break;
            }
            float num = (float)this.PropsRot.TicksToRotStart - base.RotProgress;

            if (num > 0f)
            {
                float        num2      = GenTemperature.GetTemperatureForCell(this.parent.PositionHeld, this.parent.Map);
                List <Thing> thingList = GridsUtility.GetThingList(this.parent.PositionHeld, this.parent.Map);
                for (int i = 0; i < thingList.Count; i++)
                {
                    if (thingList[i] is Building_Refrigerator)
                    {
                        Building_Refrigerator building_Refrigerator = thingList[i] as Building_Refrigerator;
                        num2 = building_Refrigerator.CurrentTemp;
                        break;
                    }
                }
                num2 = (float)Mathf.RoundToInt(num2);
                float num3 = GenTemperature.RotRateAtTemperature(num2);
                int   ticksUntilRotAtCurrentTemp = base.TicksUntilRotAtCurrentTemp;
                if (num3 < 0.001f)
                {
                    sb.Append(Translator.Translate("CurrentlyFrozen") + ".");
                }
                else
                {
                    if (num3 < 0.999f)
                    {
                        sb.Append(Translator.Translate("CurrentlyRefrigerated", new object[]
                        {
                            GenDate.ToStringTicksToPeriodVague(ticksUntilRotAtCurrentTemp)
                        }) + ".");
                    }
                    else
                    {
                        sb.Append(Translator.Translate("NotRefrigerated", new object[]
                        {
                            GenDate.ToStringTicksToPeriodVague(ticksUntilRotAtCurrentTemp)
                        }) + ".");
                    }
                }
            }
            return(sb.ToString().TrimEndNewlines());
        }
Пример #2
0
        public override void CompTickRare()
        {
            base.CompTickRare();
            float num = 15f;

            if (this.parent.MapHeld != null)
            {
                num = GridsUtility.GetTemperature(this.parent.PositionHeld, this.parent.MapHeld);
            }
            CompEquippable comp = this.parent.GetComp <CompEquippable>();

            if (comp != null)
            {
                Pawn casterPawn = comp.PrimaryVerb.CasterPawn;
                if (casterPawn != null)
                {
                    num = GridsUtility.GetTemperature(casterPawn.PositionHeld, casterPawn.MapHeld);
                }
            }
            if (this.parent.Spawned)
            {
                List <Thing> thingList = GridsUtility.GetThingList(this.parent.PositionHeld, this.parent.MapHeld);
                for (int i = 0; i < thingList.Count; i++)
                {
                    bool flag4 = thingList[i] is Building_Refrigerator;
                    if (flag4)
                    {
                        Building_Refrigerator building_Refrigerator = thingList[i] as Building_Refrigerator;
                        num = building_Refrigerator.Temp;
                        break;
                    }
                }
            }
            this.Temp += (num - this.Temp) * 0.05f;
        }
Пример #3
0
 public Dialog_Rename(Building_Refrigerator fridge)
 {
     this.forcePause              = true;
     this.doCloseX                = true;
     this.closeOnEscapeKey        = true;
     this.absorbInputAroundWindow = true;
     this.closeOnClickedOutside   = true;
     this.fridge    = fridge;
     this.inputText = fridge.Label;
 }
Пример #4
0
        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);
        }