public static bool SteadyEnvironmentEffectsTick(SteadyEnvironmentEffects __instance) { Map map2 = __instance.map; if (Find.TickManager.TicksGame % 97f == 0f && Rand.Chance(0.02f)) { __instance.RollForRainFire(); } __instance.outdoorMeltAmount = __instance.MeltAmountAt(map2.mapTemperature.OutdoorTemp); __instance.snowRate = map2.weatherManager.SnowRate; __instance.rainRate = map2.weatherManager.RainRate; __instance.deteriorationRate = Mathf.Lerp(1f, 5f, __instance.rainRate); int area = map2.Area; int ticks = Mathf.CeilToInt(area * 0.0006f); int index = steadyEnvironmentEffectsCount; steadyEnvironmentEffectsStructures[index].steadyEnvironmentEffects = __instance; steadyEnvironmentEffectsStructures[index].steadyEnvironmentEffectsCellsInRandomOrder = map2.cellsInRandomOrder; //int num = Mathf.CeilToInt((float)map2.Area * 0.0006f); steadyEnvironmentEffectsStructures[index].steadyEnvironmentEffectsArea = area; //RimThreaded.steadyEnvironmentEffectsInstance = __instance; steadyEnvironmentEffectsStructures[index].steadyEnvironmentEffectsCycleIndexOffset = ticks + __instance.cycleIndex; int ticks2 = Interlocked.Add(ref totalSteadyEnvironmentEffectsTicks, ticks); steadyEnvironmentEffectsStructures[index].steadyEnvironmentEffectsTicks = ticks2; Interlocked.Increment(ref steadyEnvironmentEffectsCount); __instance.cycleIndex = (__instance.cycleIndex + ticks) % area; return(false); }
static bool Prefix(ref SteadyEnvironmentEffects __instance) { if ((double)Find.TickManager.TicksGame % 97.0 < RefcellRespeedConfig.currentTimeMultiplier && Rand.Chance(0.02f)) { __instance.RollForRainFire(); } __instance.outdoorMeltAmount = __instance.MeltAmountAt(__instance.map.mapTemperature.OutdoorTemp); __instance.snowRate = __instance.map.weatherManager.SnowRate; __instance.rainRate = __instance.map.weatherManager.RainRate; __instance.deteriorationRate = Mathf.Lerp(1f, 5f, __instance.rainRate); int num = Mathf.CeilToInt((float)__instance.map.Area * 0.0006f); int area = __instance.map.Area; for (int index = 0; index < num; ++index) { if (__instance.cycleIndex >= area) { __instance.cycleIndex = 0; } __instance.DoCellSteadyEffects(__instance.map.cellsInRandomOrder.Get(__instance.cycleIndex)); ++__instance.cycleIndex; } return(false); }