public static bool WindManagerTick(WindManager __instance) { __instance.cachedWindSpeed = __instance.BaseWindSpeedAt(Find.TickManager.TicksAbs) * __instance.map.weatherManager.CurWindSpeedFactor; float curWindSpeedOffset = __instance.map.weatherManager.CurWindSpeedOffset; if (curWindSpeedOffset > 0f) { FloatRange floatRange = WindManager.WindSpeedRange * __instance.map.weatherManager.CurWindSpeedFactor; float num = (__instance.cachedWindSpeed - floatRange.min) / (floatRange.max - floatRange.min) * (floatRange.max - curWindSpeedOffset); __instance.cachedWindSpeed = curWindSpeedOffset + num; } List <Thing> list = __instance.map.listerThings.ThingsInGroup(ThingRequestGroup.WindSource); for (int i = 0; i < list.Count; i++) { CompWindSource compWindSource = list[i].TryGetComp <CompWindSource>(); __instance.cachedWindSpeed = Mathf.Max(__instance.cachedWindSpeed, compWindSource.wind); } if (Prefs.PlantWindSway) { __instance.plantSwayHead += Mathf.Min(__instance.WindSpeed, 1f); } else { __instance.plantSwayHead = 0f; } if (Find.CurrentMap != __instance.map) { return(false); } plantSwayHead = __instance.plantSwayHead; plantMaterialsCount = WindManager.plantMaterials.Count; return(false); }
public static bool WindManagerTick(WindManager __instance) { cachedWindSpeed(__instance) = BaseWindSpeedAt2(__instance, Find.TickManager.TicksAbs) * map(__instance).weatherManager.CurWindSpeedFactor; float curWindSpeedOffset = map(__instance).weatherManager.CurWindSpeedOffset; if (curWindSpeedOffset > 0f) { FloatRange floatRange = WindSpeedRange * map(__instance).weatherManager.CurWindSpeedFactor; float num = (cachedWindSpeed(__instance) - floatRange.min) / (floatRange.max - floatRange.min) * (floatRange.max - curWindSpeedOffset); cachedWindSpeed(__instance) = curWindSpeedOffset + num; } List <Thing> list = map(__instance).listerThings.ThingsInGroup(ThingRequestGroup.WindSource); for (int i = 0; i < list.Count; i++) { CompWindSource compWindSource = list[i].TryGetComp <CompWindSource>(); cachedWindSpeed(__instance) = Mathf.Max(cachedWindSpeed(__instance), compWindSource.wind); } if (Prefs.PlantWindSway) { plantSwayHead(__instance) += Mathf.Min(__instance.WindSpeed, 1f); } else { plantSwayHead(__instance) = 0f; } if (Find.CurrentMap == map(__instance)) { RimThreaded.plantSwayHead = plantSwayHead(__instance); RimThreaded.plantMaterialsCount = plantMaterials.Count; } return(false); }