public static List <RecipeDef> Postfix(List <RecipeDef> __result, ref List <RecipeDef> ___allRecipesCached,
                                               bool __state)
        {
            if (!__state)
            {
                return(__result);
            }

            var res = new List <RecipeDef>();

            foreach (var r in __result)
            {
                if (Ad2.IsNewRecipe(r))
                {
                    continue;
                }

                res.Add(r);
                var newRList = Ad2.GetNewRecipesList(r);
                if (newRList == null)
                {
                    continue;
                }

                foreach (var nr in newRList)
                {
                    res.Add(nr);
                }
            }

            ___allRecipesCached = res;
            //Log.Message("___allRecipesCached = res");

            return(res);
        }
Exemple #2
0
        public static void Postfix(ref bool __result, FloatMenuOption __instance)
        {
            if (!Ad2Mod.settings.useRightClickMenu || !PatchFloatMenu.IsTracked(__instance))
            {
                return;
            }

            if (!__result || Event.current.button != 1)
            {
                return;
            }

            __result = false;
            var recipe = Ad2.GetRecipeByLabel(__instance.Label);

            if (recipe == null || !Ad2.IsSrcRecipe(recipe))
            {
                return;
            }

            var nlst = Ad2.GetNewRecipesList(recipe);

            if (nlst == null)
            {
                return;
            }

            Find.WindowStack.Add(new FloatMenu(RecipeOptionsMaker(nlst)));
        }
Exemple #3
0
        public static bool Postfix(bool __result, RecipeDef __instance)
        {
            if (Ad2Mod.settings.useRightClickMenu)
            {
                return(__result);
            }

            if (__result == false)
            {
                return(false);
            }

            var srcRecipe = Ad2.GetSrcRecipe(__instance);

            if (srcRecipe == null)
            {
                return(true);
            }

            if (Ad2Mod.settings.limitToX5 && __instance != Ad2.GetNewRecipesList(srcRecipe)[0])
            {
                return(false);
            }

            if (__instance.workAmount > 1.5 * Ad2Mod.settings.defaultThreshold * 60)
            {
                //Log.Message(__instance.label + " hidden with src workAmount " + __instance.WorkAmountTotal(null)/60);
                return(false);
            }

            return(true);
        }