public override void Generate(Map map, GenStepParams parms) { int num = 0; for (int i = (int)(GenLocalDate.Twelfth(map) - 2); i <= (int)GenLocalDate.Twelfth(map); i++) { int num2 = i; if (num2 < 0) { num2 += 12; } Twelfth twelfth = (Twelfth)num2; if (GenTemperature.AverageTemperatureAtTileForTwelfth(map.Tile, twelfth) < 0f) { num++; } } float num3 = 0f; switch (num) { case 0: return; case 1: num3 = 0.3f; break; case 2: num3 = 0.7f; break; case 3: num3 = 1f; break; } if (map.mapTemperature.SeasonalTemp > 0f) { num3 *= 0.4f; } if (!((double)num3 < 0.3)) { foreach (IntVec3 allCell in map.AllCells) { if (!allCell.Roofed(map)) { map.steadyEnvironmentEffects.AddFallenSnowAt(allCell, num3); } } } }
public override void CompTick() { base.CompTick(); this.UpdateDesiredPowerOutput(); Room room = this.parent.PositionHeld.GetRoom(this.parent.Map, RegionType.Set_All); if (room != null) { if ((room.OutdoorsForWork || (!this.parent.Map.roofGrid.Roofed(this.parent.PositionHeld))) || room.OpenRoofCount > 0) { noReactorRoom = true; } else { noReactorRoom = false; } } if (!noReactorRoom) { if (this.radiationRadius > 0) { if (Find.TickManager.TicksGame % tickRadiation == 0) { int num = GenRadial.NumCellsInRadius(this.radiationRadius); for (int i = 0; i < num; i++) { AffectCell(this.parent.Position + GenRadial.RadialPattern[i]); } } } float result; GenTemperature.TryGetTemperatureForCell(this.parent.Position, this.parent.Map, out result); temperatureRightNow = (int)Math.Round(result); if ((temperatureRightNow > criticalTemp) && !signalMeltdown) { signalMeltdown = true; this.parent.Map.weatherManager.curWeather = WeatherDef.Named("VPE_RadioactiveFog"); this.parent.Map.weatherManager.TransitionTo(WeatherDef.Named("VPE_RadioactiveFog")); this.breakdownableComp.DoBreakdown(); this.refuelableComp.ConsumeFuel(refuelableComp.Fuel); List <ThingDef> links = new List <ThingDef>(); links.Add(ThingDef.Named("VPE_NuclearGenerator")); Find.LetterStack.ReceiveLetter("VPE_MeltdownLetterLabel".Translate(), "VPE_MeltdownLetter".Translate(), LetterDefOf.NegativeEvent, this.parent, null, null, links, null); } } }
public override void CompTick() { base.CompTick(); if (parent.IsHashIntervalTick(1000)) { parent.TakeDamage(new DamageInfo(DamageDefOf.Crush, parent.MaxHitPoints * 0.01f)); } if (parent.IsHashIntervalTick(60) && ShouldPushHeatNow) { GenTemperature.PushHeat(parent.PositionHeld, parent.MapHeld, -8); } }
public static bool Applies(ThingDef tDef, Map map, IntVec3 c) { if (map == null) { return(false); } if (tDef.building == null || !tDef.building.workSpeedPenaltyTemperature) { return(false); } float temperatureForCell = GenTemperature.GetTemperatureForCell(c, map); return(temperatureForCell < 5f || temperatureForCell > 35f); }
public static string GrowingQuadrumsDescription(int tile) { List <Twelfth> list = GenTemperature.TwelfthsInAverageTemperatureRange(tile, 10f, 42f); if (list.NullOrEmpty <Twelfth>()) { return("NoGrowingPeriod".Translate()); } if (list.Count == 12) { return("GrowYearRound".Translate()); } return("PeriodDays".Translate(list.Count * 5 + "/" + 60) + " (" + QuadrumUtility.QuadrumsRangeLabel(list) + ")"); }
public static NeededWarmth CalculateNeededWarmth(Pawn pawn, int tile, Twelfth twelfth) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, twelfth); if (num < pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin) - 4f) { return(NeededWarmth.Warm); } if (num > pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin) + 4f) { return(NeededWarmth.Cool); } return(NeededWarmth.Any); }
private float CalculateOutdoorTemperatureAtTile(int absTick, bool includeDailyVariations) { if (absTick == 0) { absTick = 1; } float num = Find.WorldGrid[tile].temperature + GenTemperature.OffsetFromSeasonCycle(absTick, tile); if (includeDailyVariations) { num += OffsetFromDailyRandomVariation(absTick) + GenTemperature.OffsetFromSunCycle(absTick, tile); } return(num); }
protected virtual void DoFreezeCheck() { float temp = GenTemperature.GetTemperatureForCell(parent.Position); if (BeltPhase == Phase.Frozen && temp > FreezeTemperature && Rand.Range(0.0f, 1.0f) < 0.50f) { _beltPhase = Phase.Offline; } if (BeltPhase != Phase.Frozen && Rand.Range(0.0f, 1.0f) < this.FreezeChance(temp)) { Freeze(); } }
public CachedTileTemperatureData2(int tile) { this.tile = tile; int seed = Gen.HashCombineInt(tile, 199372327); dailyVariationPerlinCached = new Perlin(4.9999998736893758E-06, 2.0, 0.5, 3, seed, QualityMode.Medium); twelfthlyTempAverages = new float[12]; for (int i = 0; i < 12; i++) { twelfthlyTempAverages[i] = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)i); } CheckCache(); }
public override void TickRare() { if (this.compPowerTrader.PowerOn) { IntVec3 vecNorth = base.Position + IntVec3.North.RotatedBy(base.Rotation); bool hotIsHot = false; Room roomNorth = vecNorth.GetRoom(this.Map); if (!vecNorth.Impassable(base.Map) && (roomNorth != null)) { var temperature = roomNorth.Temperature; float energyMod; if (temperature < 20f) { energyMod = 1f; } else { energyMod = temperature > 120f ? 0f : Mathf.InverseLerp(120f, 20f, temperature); } var energyLimit = compTempControl.Props.energyPerSecond * energyMod * 4.16666651f; if (temperature > this.compTempControl.targetTemperature) { energyLimit *= -1; } var hotAir = GenTemperature.ControlTemperatureTempChange(vecNorth, this.Map, energyLimit, compTempControl.targetTemperature); hotIsHot = !Mathf.Approximately(hotAir, 0f); if (hotIsHot) { vecNorth.GetRoomGroup(base.Map).Temperature += hotAir; } } CompProperties_Power props = this.compPowerTrader.Props; if (hotIsHot) { this.compPowerTrader.PowerOutput = -props.basePowerConsumption; } else { this.compPowerTrader.PowerOutput = -props.basePowerConsumption * this.compTempControl.Props.lowPowerConsumptionFactor; } this.compTempControl.operatingAtHighPower = hotIsHot; } }
public static bool WillWinterEverAffectMovementDifficulty(int tile) { int ticksAbs = GenTicks.TicksAbs; for (int i = 0; i < 3600000; i += 60000) { int absTick = ticksAbs + i; float temperatureFromSeasonAtTile = GenTemperature.GetTemperatureFromSeasonAtTile(absTick, tile); if (temperatureFromSeasonAtTile < 5f) { return(true); } } return(false); }
protected override bool isPawnAffected(Pawn p) { float maxComfortTemp = p.ComfortableTemperatureRange().max; float curTemp = 999; GenTemperature.TryGetAirTemperatureAroundThing(p, out curTemp); if (curTemp > maxComfortTemp) { return(true); } else { return(false); } }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); this.compPowerTrader = base.GetComp <CompPowerTrader>(); this.compDTempControl = base.GetComp <CompDTempControl>(); this.compRefuelable = base.GetComp <CompRefuelable>(); if (unrefrigeratedRotRate < 0) { unrefrigeratedRotRate = GenTemperature.RotRateAtTemperature(999f); } if (slowRotRateAmount < 0) { slowRotRateAmount = unrefrigeratedRotRate - GenTemperature.RotRateAtTemperature(1f); } }
public void PushHeat(float amount) { if (Net) { compAir.SetNetTemperatureDirect(amount); } else { if (VecNorth.UsesOutdoorTemperature(this.Map)) { return; } GenTemperature.PushHeat(VecNorth, this.Map, amount); } }
public static IEnumerable <Rule> ExtraRules() { Pawn initiator = DialogManager.Initiator; if (initiator == null) { yield break; } //pawn parameters if (PawnCheck()) { Pawn recipient = DialogManager.Recipient; string initPrefix = "INITIATOR_", reciPrefix = "RECIPIENT_"; foreach (var rule in ExtraRulesForPawn(initPrefix, initiator, recipient)) { yield return(rule); } foreach (var rule in ExtraRulesForPawn(reciPrefix, recipient, initiator)) { yield return(rule); } } //climate yield return(new Rule_String("WEATHER", initiator.Map.weatherManager.CurWeatherPerceived.label)); //time yield return(new Rule_String("HOUR", GenLocalDate.HourInteger(initiator).ToString())); yield return(new Rule_String("DAYPERIOD", DayPeriod(initiator))); //temperature yield return(new Rule_String("TEMPERATURE", GenTemperature.GetTemperatureForCell(initiator.Position, initiator.Map).ToString())); //outdoor? yield return(new Rule_String("OUTDOORS", initiator.Position.UsesOutdoorTemperature(initiator.Map).ToStringYesNo())); //nearest things foreach (var group in subjects) { var thing = GenClosest.ClosestThing_Global(initiator.Position, initiator.Map.listerThings.ThingsInGroup(group), lookRadius); if (thing != null) { yield return(new Rule_String($"NEAREST_{group.ToString().ToLower()}", $"{thing.def.label}")); } } }
public override string CompInspectStringExtra() { if (!Active) { return(null); } var sb = new StringBuilder(); switch (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 progressUntilStartRot = PropsRot.TicksToRotStart - RotProgress; if (progressUntilStartRot > 0) { float cellTemp = parent.AmbientTemperature; cellTemp = Mathf.RoundToInt(cellTemp); //Rounding here reduces dithering float rotRate = GenTemperature.RotRateAtTemperature(cellTemp); int ticksUntilStartRot = TicksUntilRotAtCurrentTemp; sb.AppendLine(); if (rotRate < 0.001f) { // frozen sb.Append("CurrentlyFrozen".Translate() + "."); } else if (rotRate < 0.999f) { // refrigerated sb.Append("CurrentlyRefrigerated".Translate(ticksUntilStartRot.ToStringTicksToPeriod()) + "."); } else { // not refrigerated sb.Append("NotRefrigerated".Translate(ticksUntilStartRot.ToStringTicksToPeriod()) + "."); } } return(sb.ToString()); }
public override void Tick() { if (this.IsHashIntervalTick(250)) { if (compRefuelable.HasFuel) { float ambientTemperature = base.AmbientTemperature; float num = (ambientTemperature < 20f) ? 1f : ((!(ambientTemperature > 120f)) ? Mathf.InverseLerp(120f, 20f, ambientTemperature) : 0f); float energyLimit = compTempControl.Props.energyPerSecond * num * 4.16666651f; float num2 = GenTemperature.ControlTemperatureTempChange(base.Position, base.Map, energyLimit, compTempControl.targetTemperature); bool flag = !Mathf.Approximately(num2, 0f); compTempControl.operatingAtHighPower = flag; this.GetRoomGroup().Temperature += num2; } } }
public override void TickLong() { if (this.GetComp <CompPowerTrader>().PowerOn) { if (this.AmbientTemperature > 80f) { this.TryAttachFire(2f); } else { Find.World.GetComponent <WorldComp_RimCoin>().RimCoinAmount += Mathf.RoundToInt(this.parts.Select(t => t.def).OfType <PCMiningDef>().Sum(pcd => 1 * pcd.miningFactor)); GenTemperature.PushHeat(this, Mathf.Abs(this.GetComp <CompPowerTrader>().PowerOutput)); UpdatePowerDraw(); } } }
public static bool EnvironmentAllowsEatingVirtualPlantsAt(int tile, int ticksAbs) { BiomeDef biome = Find.WorldGrid[tile].biome; bool result; if (!biome.hasVirtualPlants) { result = false; } else { float temperatureFromSeasonAtTile = GenTemperature.GetTemperatureFromSeasonAtTile(ticksAbs, tile); result = (temperatureFromSeasonAtTile >= 0f); } return(result); }
private void DrawTileInfo() { DrawEntryHeader("PLTFWTW_TileSpecifications".Translate(), backgroundColor: Color.magenta); var vectorLongLat = Find.WorldGrid.LongLatOf(_tileId); var latitude = vectorLongLat.y; var longitude = vectorLongLat.x; ListingStandard.Label($"{"PLTFWTW_Date".Translate()}: {GenDate.DateReadoutStringAt(_dateTicks, vectorLongLat)}"); ListingStandard.Label($"{"PLTFWTW_TileId".Translate()}: {_tileId}"); ListingStandard.Label( $"{"PLTFWTW_LatLong".Translate()}: {latitude.ToStringLatitude()} - {longitude.ToStringLongitude()}"); ListingStandard.Label($"{"PLTFWTW_EquatorialDistance".Translate()}: {Find.WorldGrid.DistanceFromEquatorNormalized(_tileId)}"); ListingStandard.Label($"{"PLTFWTW_TileAvgTemp".Translate()}: {Find.World.grid[_tileId].temperature} °C"); ListingStandard.Label($"{"PLTFWTW_SeasonalShiftAmplitude".Translate()}: {GenTemperature.SeasonalShiftAmplitudeAt(_tileId)} °C"); }
public static bool EnvironmentAllowsEatingVirtualPlantsNowAt(int tile) { BiomeDef biome = Find.WorldGrid[tile].biome; if (!biome.hasVirtualPlants) { return(false); } float temperatureAtTile = GenTemperature.GetTemperatureAtTile(tile); if (temperatureAtTile < 0.0) { return(false); } return(true); }
public bool SatisfiesNeededWarmth(NeededWarmth warmth, bool mustBeSafe = false, float mapTemperature = 21f) { if (warmth == NeededWarmth.Any) { return(true); } if (mustBeSafe && !GenTemperature.SafeTemperatureRange(raceDef, aps).Includes(mapTemperature)) { return(false); } return(warmth switch { NeededWarmth.Cool => aps.Sum((ThingStuffPair a) => a.InsulationHeat) >= -2f, NeededWarmth.Warm => aps.Sum((ThingStuffPair a) => a.InsulationCold) >= 52f, _ => throw new NotImplementedException(), });
private void Tick(int interval) { if (!this.Active) { return; } float rotProgress = this.RotProgress; float num = GenTemperature.RotRateAtTemperature(this.parent.AmbientTemperature); this.RotProgress += num * (float)interval; if (this.Stage == RotStage.Rotting && this.PropsRot.rotDestroys) { //The first main change from the rotting code is here //If the item reaches it's rotting time, a new item with the same stackCount is spawned on its location, and this item is destroyed //The map check is done... just in case if (this.parent.Map != null) { int stackCount = this.parent.stackCount; ThingDef newThingDef = ThingDef.Named(PropsRot.thingToTransformTo); Thing newThing = GenSpawn.Spawn(newThingDef, this.parent.Position, this.parent.Map, WipeMode.Vanish); newThing.stackCount = stackCount; this.parent.Destroy(DestroyMode.Vanish); } else { this.parent.Destroy(DestroyMode.Vanish); } return; } if (Mathf.FloorToInt(rotProgress / 60000f) != Mathf.FloorToInt(this.RotProgress / 60000f) && this.ShouldTakeRotDamage()) { if (this.Stage == RotStage.Rotting && this.PropsRot.rotDamagePerDay > 0f) { this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, (float)GenMath.RoundRandom(this.PropsRot.rotDamagePerDay), 0f, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null)); return; } if (this.Stage == RotStage.Dessicated && this.PropsRot.dessicatedDamagePerDay > 0f) { this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, (float)GenMath.RoundRandom(this.PropsRot.dessicatedDamagePerDay), 0f, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null)); } } }
public override string CompInspectStringExtra() { if (!Active) { return(null); } StringBuilder stringBuilder = new StringBuilder(); switch (Stage) { case RotStage.Fresh: stringBuilder.Append("RotStateFresh".Translate() + "."); break; case RotStage.Rotting: stringBuilder.Append("RotStateRotting".Translate() + "."); break; case RotStage.Dessicated: stringBuilder.Append("RotStateDessicated".Translate() + "."); break; } float num = (float)PropsRot.TicksToRotStart - RotProgress; if (num > 0f) { float ambientTemperature = parent.AmbientTemperature; ambientTemperature = (float)Mathf.RoundToInt(ambientTemperature); float num2 = GenTemperature.RotRateAtTemperature(ambientTemperature); int ticksUntilRotAtCurrentTemp = TicksUntilRotAtCurrentTemp; stringBuilder.AppendLine(); if (num2 < 0.001f) { stringBuilder.Append("CurrentlyFrozen".Translate() + "."); } else if (num2 < 0.999f) { stringBuilder.Append("CurrentlyRefrigerated".Translate(ticksUntilRotAtCurrentTemp.ToStringTicksToPeriod()) + "."); } else { stringBuilder.Append("NotRefrigerated".Translate(ticksUntilRotAtCurrentTemp.ToStringTicksToPeriod()) + "."); } } return(stringBuilder.ToString()); }
private void TemperatureCheck() { nextTemperatureCheck--; if (nextTemperatureCheck > 0) { return; } const int delay = 20; nextTemperatureCheck += delay; // Develop heat var temperatureForCell = GenTemperature.GetTemperatureForCell(Position); if (HasPower) { innerHeat += compDef.innerHeatPerSecond / 60 * delay; } // Apply cooling innerHeat -= cooling; cooling = 0; if (innerHeat < temperatureForCell) { innerHeat = temperatureForCell; } if (heater != null && innerHeat > temperatureForCell) { // 5% heat loss heater.props.heatPerSecond = (innerHeat - temperatureForCell) * 0.05f; innerHeat -= heater.props.heatPerSecond / 60 * delay; } //Log.Message("Try burn " + Label + ": " + (innerHeat - compDef.criticalTemperature) + ", " + (compDef.ignitionChancePerTick *delay* innerHeat / compDef.criticalTemperature)); if (innerHeat > compDef.criticalTemperature && Rand.Value < compDef.ignitionChance * innerHeat / compDef.criticalTemperature) { if (!Position.ContainsStaticFire()) { innerHeat = 0; power.DesirePowerOn = false; GenExplosion.DoExplosion(Position, 0.5f, DamageDefOf.Flame, this); } } }
public override string GetInspectString() { float temperature = GenTemperature.GetTemperatureForCell(this.Position); if (temperature < CavePlant.minTempToGrow) { return("Cannot grow now: too cold."); } else if (temperature > CavePlant.maxTempToGrow) { return("Cannot grow now: too hot."); } else { return("Growing."); } }
private void DoTicks(int ticks) { if (this.parent.IsHashIntervalTick(60) && this.ShouldPushHeatNow) { CompProperties_AC_Fermenter props = this.Props; float ambientTemperature = this.parent.AmbientTemperature; if (ambientTemperature < props.heatPushMaxTemperature && ambientTemperature > props.heatPushMinTemperature) { GenTemperature.PushHeat(this.parent.Position, this.parent.Map, props.heatPerSecondPerFermenter * this.FermenterCount); } } if (!this.Ruined) { if (this.FermenterCount > 0) { if (this.fermentProgress < 1f) { float fermentPerTick = this.FermentProgressPerTickAtCurrentTemp; this.fermentProgress += fermentPerTick * ticks; } } if (this.fermentProgress >= 1f) { if (this.parent.GetType() != typeof(Building_AC_CompostBin)) { Thing thing = ThingMaker.MakeThing(this.Props.fermentedThing, null); thing.stackCount = this.parent.stackCount; GenSpawn.Spawn(thing, this.parent.Position, this.parent.Map); this.parent.Destroy(DestroyMode.Vanish); } } } else { if (this.parent.IsInAnyStorage() && this.parent.SpawnedOrAnyParentSpawned) { Messages.Message(TranslatorFormattedStringExtensions.Translate("AC.CompostRuined", parent.Label) .CapitalizeFirst(), new TargetInfo(this.parent.PositionHeld, this.parent.MapHeld, false), MessageTypeDefOf.NegativeEvent, true); } if (this.parent.GetType() != typeof(Building_AC_CompostBin)) { this.parent.Destroy(DestroyMode.Vanish); } } this.UpdateRuinedPercent(ticks); }
public override void CompTickRare() { if (this.parent.MapHeld != null && this.parent.Map != null) { float rotProgress = this.RotProgress; float num = 1f; float temperatureForCell = GenTemperature.GetTemperatureForCell(this.parent.PositionHeld, this.parent.MapHeld); List <Thing> list = this.parent.MapHeld.thingGrid.ThingsListAtFast(this.parent.PositionHeld); for (int i = 0; i < list.Count; i++) { if (list[i] is Building_Refrigerator) { var bf = list[i] as Building_Refrigerator; temperatureForCell = bf.CurrentTemp; break; } } num *= GenTemperature.RotRateAtTemperature(temperatureForCell); this.RotProgress += Mathf.Round(num * 250f); if (this.Stage == RotStage.Rotting && this.PropsRot.rotDestroys) { if (this.parent.IsInAnyStorage() && this.parent.SpawnedOrAnyParentSpawned) { Messages.Message("MessageRottedAwayInStorage".Translate(new object[] { this.parent.Label }).CapitalizeFirst(), MessageTypeDefOf.SilentInput); LessonAutoActivator.TeachOpportunity(ConceptDefOf.SpoilageAndFreezers, OpportunityType.GoodToKnow); } this.parent.Destroy(DestroyMode.Vanish); return; } if (Mathf.FloorToInt(rotProgress / 60000f) != Mathf.FloorToInt(this.RotProgress / 60000f)) { if (this.Stage == RotStage.Rotting && this.PropsRot.rotDamagePerDay > 0f) { this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.rotDamagePerDay))); } else if (this.Stage == RotStage.Dessicated && this.PropsRot.dessicatedDamagePerDay > 0f && this.ShouldTakeDessicateDamage()) { this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.dessicatedDamagePerDay))); } } } }
public TemperatureForecastForDay(int tileId, int ticks, int hour) { TileId = tileId; Ticks = ticks; Hour = hour; OutdoorTemperature = Find.World.tileTemperatures.OutdoorTemperatureAt(tileId, Ticks); OffsetFromSunCycle = GenTemperature.OffsetFromSunCycle(Ticks, TileId); OffsetFromDailyRandomVariation = Find.World.tileTemperatures.OffsetFromDailyRandomVariation(TileId, Ticks); OffsetFromSeasonCycle = GenTemperature.OffsetFromSeasonCycle(Ticks, tileId); var tile = Find.WorldGrid[TileId]; DailyRandomVariation = tile.temperature - (OffsetFromSeasonCycle + OffsetFromDailyRandomVariation + OffsetFromSunCycle); }
// Token: 0x06000038 RID: 56 RVA: 0x00003884 File Offset: 0x00001A84 private static void Ticky(CompRottable CR, int interval) { if (!CR.Active) { return; } interval = (int)(interval / 2f); var rotProgress = CR.RotProgress; var num = GenTemperature.RotRateAtTemperature(CR.parent.AmbientTemperature); CR.RotProgress += num * interval; if (CR.Stage == RotStage.Rotting && CR.PropsRot.rotDestroys) { if (CR.parent.IsInAnyStorage() && CR.parent.SpawnedOrAnyParentSpawned) { Messages.Message( "MessageRottedAwayInStorage".Translate(CR.parent.Label, CR.parent).CapitalizeFirst(), new TargetInfo(CR.parent.PositionHeld, CR.parent.MapHeld), MessageTypeDefOf.NegativeEvent); LessonAutoActivator.TeachOpportunity(ConceptDefOf.SpoilageAndFreezers, OpportunityType.GoodToKnow); } CR.parent.Destroy(); return; } if (Mathf.FloorToInt(rotProgress / 60000f) == Mathf.FloorToInt(CR.RotProgress / 60000f) || !ShouldTakeRotDamage(CR)) { return; } if (CR.Stage == RotStage.Rotting && CR.PropsRot.rotDamagePerDay > 0f) { CR.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(CR.PropsRot.rotDamagePerDay))); return; } if (CR.Stage == RotStage.Dessicated && CR.PropsRot.dessicatedDamagePerDay > 0f) { CR.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(CR.PropsRot.dessicatedDamagePerDay))); } }