コード例 #1
0
        public override void OnPrefabInit()
        {
            base.OnPrefabInit();
            achievementsRun.Clear();
            targetFoods.Clear();
            var foodList      = new HashSet <string>();
            var foodProducers = new List <Tag>(4);
            // Use the default "It's Not Raw" achievement
            var achieve = Db.Get().ColonyAchievements.EatCookedFood;

            if (achieve != null)
            {
                foreach (var requirement in achieve.requirementChecklist)
                {
                    if (requirement is EatXKCalProducedByY eatIt)
                    {
                        foodProducers.AddRange(eatIt.foodProducers);
                    }
                }
            }
            foreach (var recipe in ComplexRecipeManager.Get().recipes)
            {
                foreach (var fabricator in recipe.fabricators)
                {
                    // Only 2 elements!
                    if (foodProducers.Contains(fabricator))
                    {
                        foodList.Add(recipe.FirstResult.ToString());
                    }
                }
            }
            targetFoods.AddRange(foodList);
            foodList.Clear();
#if DEBUG
            PUtil.LogDebug("Foods allowed for It's Not Raw: " + targetFoods.Join(", "));
#endif
            Instance = this;
        }
コード例 #2
0
 internal static bool Prepare() => AchievementPatches.ShouldRun();
コード例 #3
0
 /// <summary>
 /// Drops the pointer to the singleton instance if it exists.
 /// </summary>
 internal static void DestroyInstance()
 {
     Instance = null;
 }