public static void IsAllowed_Postfix(ThingFilter __instance, ref bool __result, Thing t) { if (!__result) { return; } MyWorldComponent world = Find.World.GetComponent <MyWorldComponent>(); CompRottable rot = t.TryGetComp <CompRottable>(); if (rot != null && world.ShowSpoilTime(__instance)) { IntRange spoilTickRange = SpoilTimeCalc.convertToTicks(world.getSpoilTime(__instance)); int spoilTicks = rot.TicksUntilRotAtTemp(25.0f); if (spoilTickRange.min == -1 || spoilTicks < spoilTickRange.min) { __result = false; } else if (spoilTickRange.max != -1 && spoilTicks > spoilTickRange.max) { __result = false; } } }
public static void DrawSpoilTimeFilterConfig(ref float y, float width, ThingFilter filter) { MyWorldComponent world = Find.World.GetComponent <MyWorldComponent>(); if (!world.ShowSpoilTime(filter)) { return; } Rect rect = new Rect(20f, y, width - 20f, 28f); ref IntRange local = ref world.getSpoilTime(filter);