public ComplexRecipe(string id, RecipeElement[] ingredients, RecipeElement[] results) { this.id = id; this.ingredients = ingredients; this.results = results; ComplexRecipeManager.Get().Add(this); }
public static void Postfix() { ComplexRecipe.RecipeElement[] ingredients = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Steel).tag, 25f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Glass).tag, 25f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.SolidNaphtha).tag, 100f) }; ComplexRecipe.RecipeElement[] results = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.LiquidPropane).tag, 100f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("GlassForge", ingredients[0].material); string str = ComplexRecipeManager.MakeRecipeID("GlassForge", (IList <ComplexRecipe.RecipeElement>)ingredients, (IList <ComplexRecipe.RecipeElement>)results); new ComplexRecipe(str, ingredients, results) { time = 40f, useResultAsDescription = true, description = string.Format((string)STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, (object)ElementLoader.GetElement(results[0].material).name, (object)ElementLoader.GetElement(ingredients[0].material).name) }.fabricators = new List <Tag>() { TagManager.Create("GlassForge") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, str); }
public static void RemoveInsulator() { float num3 = 0.15f; float num4 = 0.05f; float num5 = 1f - num4 - num3; ComplexRecipe.RecipeElement[] ingredients2 = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(SimHashes.Isoresin.CreateTag(), 100f * num3), new ComplexRecipe.RecipeElement(SimHashes.Katairite.CreateTag(), 100f * num5), new ComplexRecipe.RecipeElement(BasicFabricConfig.ID.ToTag(), 100f * num4) }; ComplexRecipe.RecipeElement[] results2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.SuperInsulator.CreateTag(), 100f) }; string recipeId = ComplexRecipeManager.MakeRecipeID(Id, ingredients2, results2); ComplexRecipe recipe = ComplexRecipeManager.Get().GetRecipe(recipeId); if (recipe != null) { ComplexRecipeManager.Get().recipes.Remove(recipe); } else { Debug.Log(nameof(ComplexRecipeManager) + " failed to add the new recipe."); } }
public static void Postfix() { ElementLoader.FindElementByHash(SimHashes.SolidMercury).highTemp = 1000f; ElementLoader.FindElementByHash(SimHashes.Mercury).lowTemp = 50f; ElementLoader.FindElementByHash(SimHashes.Mercury).highTemp = 1200f; ElementLoader.FindElementByHash(SimHashes.Granite).highTempTransitionTarget = SimHashes.Mercury; ComplexRecipe.RecipeElement[] ingredients = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Tungsten).tag, 50f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.MaficRock).tag, 50f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Obsidian).tag, 100f) }; ComplexRecipe.RecipeElement[] results = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Mercury).tag, 200f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("GlassForge", ingredients[0].material); string str = ComplexRecipeManager.MakeRecipeID("GlassForge", (IList <ComplexRecipe.RecipeElement>)ingredients, (IList <ComplexRecipe.RecipeElement>)results); new ComplexRecipe(str, ingredients, results) { time = 40f, useResultAsDescription = true, description = string.Format((string)STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, (object)ElementLoader.GetElement(results[0].material).name, (object)ElementLoader.GetElement(ingredients[0].material).name) }.fabricators = new List <Tag>() { TagManager.Create("GlassForge") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, str); }
private static void Postfix(Game __instance, GameObject go) { if (CustomizeBuildingsState.StateManager.State.NewRecipeRockCrusher) { string workstation = "RockCrusher"; // "Kiln" Tag ingredient1 = SimHashes.Regolith.CreateTag(); float amountIn1 = 100f; Tag result1 = SimHashes.Sand.CreateTag(); float amountOut1 = 99f; ComplexRecipe.RecipeElement[] ingredients1 = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(ingredient1, amountIn1) }; ComplexRecipe.RecipeElement[] results1 = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(result1, amountOut1) }; string obsolete_id1 = ComplexRecipeManager.MakeObsoleteRecipeID(workstation, result1); string str1 = ComplexRecipeManager.MakeRecipeID(workstation, (IList <ComplexRecipe.RecipeElement>)ingredients1, (IList <ComplexRecipe.RecipeElement>)results1); ComplexRecipe complexRecipe1 = new ComplexRecipe(str1, ingredients1, results1) { time = 40f, description = "Turns Regolith into Sand and Dirt.", fabricators = new List <Tag>() { TagManager.Create(workstation) }, nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id1, str1); } }
/// <summary> /// Recursively iterates the recipe list looking for foods that can be made with this /// item. /// </summary> /// <param name="item">The item to search.</param> /// <param name="found">The foods found so far.</param> /// <param name="seen">The items already seen, to prevent recipe loops from crashing.</param> /// <param name="quantity">The quantity of the base item.</param> private void SearchForRecipe(Tag item, IList <FoodResult> found, ICollection <Tag> seen, float quantity) { var prefab = Assets.GetPrefab(item); if (prefab != null && quantity > 0.0f && !seen.Contains(item)) { var edible = prefab.GetComponent <Edible>(); float kcal; seen.Add(item); // Item itself is usable as food if (edible != null && (kcal = edible.FoodInfo.CaloriesPerUnit) > 0.0f) { found.Add(new FoodResult(kcal, quantity, item)); } // Search for recipes using this item foreach (var recipe in RecipeManager.Get().recipes) { float amount = 0.0f; foreach (var ingredient in recipe.Ingredients) { // Search for this item in the recipe if (ingredient.tag == item) { amount = ingredient.amount; break; } } if (amount > 0.0f) { SearchForRecipe(recipe.Result, found, seen, recipe.OutputUnits * quantity / amount); } } // And complex ones too foreach (var recipe in ComplexRecipeManager.Get().recipes) { float amount = 0.0f; foreach (var ingredient in recipe.ingredients) { // Search for this item in the recipe if (ingredient.material == item) { amount = ingredient.amount; break; } } if (amount > 0.0f) { // Check all results of the recipe foreach (var result in recipe.results) { SearchForRecipe(result.material, found, seen, result.amount * quantity / amount); } } } } }
public GameObject CreatePrefab() { GameObject template = EntityTemplates.CreateLooseEntity("FruitCake", ITEMS.FOOD.FRUITCAKE.NAME, ITEMS.FOOD.FRUITCAKE.DESC, 1f, false, Assets.GetAnim("fruitcake_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, true, 0, SimHashes.Creature, null); template = EntityTemplates.ExtendEntityToFood(template, FOOD.FOOD_TYPES.FRUITCAKE); ComplexRecipeManager.Get().GetRecipe(recipe.id).FabricationVisualizer = MushBarConfig.CreateFabricationVisualizer(template); return(template); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; GlassForge glassForge = go.AddOrGet <GlassForge>(); glassForge.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); ComplexFabricatorWorkable complexFabricatorWorkable = go.AddOrGet <ComplexFabricatorWorkable>(); glassForge.duplicantOperated = true; BuildingTemplates.CreateComplexFabricatorStorage(go, glassForge); glassForge.outStorage.capacityKg = 2000f; glassForge.storeProduced = true; glassForge.inStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); glassForge.buildStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); glassForge.outStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); glassForge.outputOffset = new Vector3(1f, 0.5f); complexFabricatorWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_metalrefinery_kanim") }; glassForge.resultState = ComplexFabricator.ResultState.Melted; ConduitDispenser conduitDispenser = go.AddOrGet <ConduitDispenser>(); conduitDispenser.storage = glassForge.outStorage; conduitDispenser.conduitType = ConduitType.Liquid; conduitDispenser.elementFilter = null; conduitDispenser.alwaysDispense = true; ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Sand).tag, 100f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.MoltenGlass).tag, 25f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("GlassForge", array[0].material); string text = ComplexRecipeManager.MakeRecipeID("GlassForge", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(text, array, array2); complexRecipe.time = 40f; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.GetElement(array2[0].material).name, ElementLoader.GetElement(array[0].material).name); complexRecipe.fabricators = new List <Tag> { TagManager.Create("GlassForge") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); Prioritizable.AddRef(go); }
private void ConfgiureRecipes() { Tag tag = SimHashes.Ceramic.CreateTag(); Tag material = SimHashes.Clay.CreateTag(); Tag material2 = SimHashes.Carbon.CreateTag(); float num = 100f; float num2 = 25f; ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(material, num), new ComplexRecipe.RecipeElement(material2, num2) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(tag, num) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("Kiln", tag); string text = ComplexRecipeManager.MakeRecipeID("Kiln", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(text, array, array2); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.Clay).name, ElementLoader.FindElementByHash(SimHashes.Ceramic).name); complexRecipe.fabricators = new List <Tag> { TagManager.Create("Kiln") }; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); Tag tag2 = SimHashes.RefinedCarbon.CreateTag(); ComplexRecipe.RecipeElement[] array3 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(material2, num + num2) }; ComplexRecipe.RecipeElement[] array4 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(tag2, num) }; string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID("Kiln", tag2); string text2 = ComplexRecipeManager.MakeRecipeID("Kiln", array3, array4); complexRecipe = new ComplexRecipe(text2, array3, array4); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.Carbon).name, ElementLoader.FindElementByHash(SimHashes.RefinedCarbon).name); complexRecipe.fabricators = new List <Tag> { TagManager.Create("Kiln") }; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, text2); }
private static void Postfix(RockCrusherConfig __instance) { Debug.Log("RockCrusherConfig.ConfigureBuildingTemplate postfix loaded"); ComplexRecipe complexRecipe; Tag regolith_tag = SimHashes.Regolith.CreateTag(); Tag sand_tag = SimHashes.Sand.CreateTag(); List <Element> list = new List <Element>() { ElementLoader.GetElement(SimHashes.Cuprite.CreateTag()), ElementLoader.GetElement(SimHashes.AluminumOre.CreateTag()), ElementLoader.GetElement(SimHashes.GoldAmalgam.CreateTag()), ElementLoader.GetElement(SimHashes.IronOre.CreateTag()), ElementLoader.GetElement(SimHashes.Wolframite.CreateTag()), }; foreach (Element element in list) { Element highTempTransition = element.highTempTransition; Element lowTempTransition = highTempTransition.lowTempTransition; if (lowTempTransition != element) { ComplexRecipe.RecipeElement[] inputs = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(lowTempTransition.tag, 100f), new ComplexRecipe.RecipeElement(regolith_tag, 50f), }; ComplexRecipe.RecipeElement[] outputs = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(element.tag, 100f), new ComplexRecipe.RecipeElement(sand_tag, 50f), }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", element.tag); string text = ComplexRecipeManager.MakeRecipeID("RockCrusher", inputs, outputs); complexRecipe = new ComplexRecipe(text, inputs, outputs); complexRecipe.time = 40f; complexRecipe.description = string.Format("Grind up {0} to create {1}.", lowTempTransition.name, element.name); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); } } }
public static void Postfix() { if (_inited) { return; } var recipeIdList = new List <string>(); foreach (var recipe in ComplexRecipeManager.Get().recipes) { if (!recipe.fabricators.First().Equals(new Tag(GenericFabricatorConfig.ID))) { recipeIdList.Add(recipe.id); } } foreach (var recipeId in recipeIdList) { var recipe = ComplexRecipeManager.Get().GetRecipe(recipeId); var fabricator = recipe.id.Substring(0, recipe.id.IndexOf('_')); var index = fabricatorList.IndexOf(fabricator); if (index >= 0) { var recipeObj = new ComplexRecipe( ComplexRecipeManager.MakeRecipeID(GenericFabricatorConfig.ID, recipe.ingredients, recipe.results) , recipe.ingredients, recipe.results) { time = recipe.time, FabricationVisualizer = recipe.FabricationVisualizer, nameDisplay = recipe.nameDisplay, description = recipe.description, fabricators = new List <Tag> { new Tag(GenericFabricatorConfig.ID) }, sortOrder = (index + 1) * 1000 + recipe.sortOrder, }; } } _inited = true; }
public static GameObject CreateEgg(string id, string name, string desc, Tag creature_id, string anim, float mass, int egg_sort_order, float base_incubation_rate) { GameObject gameObject = EntityTemplates.CreateLooseEntity(id, name, desc, mass, true, Assets.GetAnim(anim), "idle", Grid.SceneLayer.Ore, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.8f, true, 0, SimHashes.Creature, null); gameObject.AddOrGet <KBoxCollider2D>().offset = new Vector2f(0f, 0.36f); Pickupable pickupable = gameObject.AddOrGet <Pickupable>(); pickupable.sortOrder = SORTORDER.EGGS + egg_sort_order; gameObject.AddOrGet <Effects>(); KPrefabID kPrefabID = gameObject.AddOrGet <KPrefabID>(); kPrefabID.AddTag(GameTags.Egg, false); kPrefabID.AddTag(GameTags.IncubatableEgg, false); kPrefabID.AddTag(GameTags.PedestalDisplayable, false); IncubationMonitor.Def def = gameObject.AddOrGetDef <IncubationMonitor.Def>(); def.spawnedCreature = creature_id; def.baseIncubationRate = base_incubation_rate; OvercrowdingMonitor.Def def2 = gameObject.AddOrGetDef <OvercrowdingMonitor.Def>(); def2.spaceRequiredPerCreature = 0; Object.Destroy(gameObject.GetComponent <EntitySplitter>()); Assets.AddPrefab(gameObject.GetComponent <KPrefabID>()); string arg = string.Format(STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RESULT_DESCRIPTION, name); ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(id, 1f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement("RawEgg", 0.5f * mass), new ComplexRecipe.RecipeElement("EggShell", 0.5f * mass) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(id, "RawEgg"); string text = ComplexRecipeManager.MakeRecipeID(id, array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(text, array, array2); complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION, name, arg); complexRecipe.fabricators = new List <Tag> { "EggCracker" }; complexRecipe.time = 5f; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); return(gameObject); }
protected virtual void OnDeserializedMethod() { List <string> list = new List <string>(); foreach (string key in recipeQueueCounts.Keys) { ComplexRecipe recipe = ComplexRecipeManager.Get().GetRecipe(key); if (recipe == null) { list.Add(key); } } foreach (string item in list) { Debug.LogWarningFormat("{1} removing missing recipe from queue: {0}", item, base.name); recipeQueueCounts.Remove(item); } }
// add a recipe in the kiln to make charcoal/ash from wood public static void Postfix() { var charcoalInput1 = Mod.Tags.Log; var charcoalOutput1 = TagManager.Create("Charcoal"); var charcoalOutput2 = TagManager.Create("Ash"); var amountIn = 100f; var amountOutMost = 90f; var amountOutLeast = 10f; foreach (var element in ElementLoader.elements.FindAll(e => e.IsSolid && e.HasTag(charcoalInput1))) { var charcoalInputs = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(element.tag, amountIn) }; var charcoalOutputs = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(charcoalOutput1, amountOutMost), new ComplexRecipe.RecipeElement(charcoalOutput2, amountOutLeast) }; var idObsolete = ComplexRecipeManager.MakeObsoleteRecipeID(KilnConfig.ID, charcoalOutput1); var id = ComplexRecipeManager.MakeRecipeID(KilnConfig.ID, charcoalInputs, charcoalOutputs); var charcoalRecipe = new ComplexRecipe(id, charcoalInputs, charcoalOutputs) { time = TUNING.BUILDINGS.FABRICATION_TIME_SECONDS.SHORT, description = string.Format( STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_BYPRODUCT, element.name, ElementLoader.FindElementByName(charcoalOutput1.Name).name, ElementLoader.FindElementByName(charcoalOutput2.Name).name), fabricators = new List <Tag>() { TagManager.Create(KilnConfig.ID) }, nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult }; ComplexRecipeManager.Get().AddObsoleteIDMapping(idObsolete, id); } }
public override bool Success() { List <string> list = new List <string>(); List <ComplexRecipe> recipes = ComplexRecipeManager.Get().recipes; foreach (ComplexRecipe item in recipes) { foreach (Tag foodProducer in foodProducers) { foreach (Tag fabricator in item.fabricators) { if (fabricator == foodProducer) { list.Add(item.FirstResult.ToString()); } } } } float caloiresConsumedByFood = RationTracker.Get().GetCaloiresConsumedByFood(list.Distinct().ToList()); return(caloiresConsumedByFood / 1000f > (float)numCalories); }
private void ConfigureRecipes() { List <Element> list = ElementLoader.elements.FindAll((Element e) => e.IsSolid && e.HasTag(GameTags.Metal)); ComplexRecipe complexRecipe; foreach (Element current in list) { Element highTempTransition = current.highTempTransition; Element lowTempTransition = highTempTransition.lowTempTransition; if (lowTempTransition != current) { ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(current.tag, 100f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(highTempTransition.tag, 100f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("Inductinator", current.tag); string text = ComplexRecipeManager.MakeRecipeID("Inductinator", array, array2); complexRecipe = new ComplexRecipe(text, array, array2) { time = (current.highTemp / 10) / 4, description = string.Format(RECIPE_DESCRIPTION, highTempTransition.name, current.name), nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult, fabricators = new List <Tag> { TagManager.Create("Inductinator") } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); } } }
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; }
public ComplexRecipe[] GetRecipes() { if (recipe_list == null) { KPrefabID component = GetComponent <KPrefabID>(); Tag prefabTag = component.PrefabTag; List <ComplexRecipe> recipes = ComplexRecipeManager.Get().recipes; List <ComplexRecipe> list = new List <ComplexRecipe>(); foreach (ComplexRecipe item in recipes) { foreach (Tag fabricator in item.fabricators) { if (fabricator == prefabTag) { list.Add(item); } } } recipe_list = list.ToArray(); Array.Sort(recipe_list, CompareRecipe); } return(recipe_list); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; ComplexFabricator complexFabricator = go.AddOrGet <ComplexFabricator>(); complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; complexFabricator.duplicantOperated = true; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); ComplexFabricatorWorkable complexFabricatorWorkable = go.AddOrGet <ComplexFabricatorWorkable>(); BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator); complexFabricatorWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_rockrefinery_kanim") }; complexFabricatorWorkable.workingPstComplete = "working_pst_complete"; Tag tag = SimHashes.Sand.CreateTag(); List <Element> list = ElementLoader.elements.FindAll((Element e) => e.HasTag(GameTags.Crushable)); ComplexRecipe complexRecipe; foreach (Element item in list) { ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(item.tag, 100f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(tag, 100f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", item.tag); string text = ComplexRecipeManager.MakeRecipeID("RockCrusher", array, array2); complexRecipe = new ComplexRecipe(text, array, array2); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.RECIPE_DESCRIPTION, item.name, tag.ProperName()); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); } List <Element> list2 = ElementLoader.elements.FindAll((Element e) => e.IsSolid && e.HasTag(GameTags.Metal)); foreach (Element item2 in list2) { Element highTempTransition = item2.highTempTransition; Element lowTempTransition = highTempTransition.lowTempTransition; if (lowTempTransition != item2) { ComplexRecipe.RecipeElement[] array3 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(item2.tag, 100f) }; ComplexRecipe.RecipeElement[] array4 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(lowTempTransition.tag, 50f), new ComplexRecipe.RecipeElement(tag, 50f) }; string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", lowTempTransition.tag); string text2 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array3, array4); complexRecipe = new ComplexRecipe(text2, array3, array4); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.METAL_RECIPE_DESCRIPTION, lowTempTransition.name, item2.name); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, text2); } } Element element = ElementLoader.FindElementByHash(SimHashes.Lime); ComplexRecipe.RecipeElement[] array5 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("EggShell", 5f) }; ComplexRecipe.RecipeElement[] array6 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Lime).tag, 5f) }; string obsolete_id3 = ComplexRecipeManager.MakeObsoleteRecipeID("RockCrusher", element.tag); string text3 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array5, array6); complexRecipe = new ComplexRecipe(text3, array5, array6); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), MISC.TAGS.EGGSHELL); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id3, text3); Element element2 = ElementLoader.FindElementByHash(SimHashes.Lime); ComplexRecipe.RecipeElement[] array7 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("BabyCrabShell", 1f) }; ComplexRecipe.RecipeElement[] array8 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(element2.tag, 5f) }; string id = ComplexRecipeManager.MakeRecipeID("RockCrusher", array7, array8); complexRecipe = new ComplexRecipe(id, array7, array8); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; Element element3 = ElementLoader.FindElementByHash(SimHashes.Lime); ComplexRecipe.RecipeElement[] array9 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("CrabShell", 1f) }; ComplexRecipe.RecipeElement[] array10 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(element3.tag, 10f) }; string id2 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array9, array10); complexRecipe = new ComplexRecipe(id2, array9, array10); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_RECIPE_DESCRIPTION, SimHashes.Lime.CreateTag().ProperName(), ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; ComplexRecipe.RecipeElement[] array11 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Fossil).tag, 100f) }; ComplexRecipe.RecipeElement[] array12 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Lime).tag, 5f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.SedimentaryRock).tag, 95f) }; string id3 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array11, array12); complexRecipe = new ComplexRecipe(id3, array11, array12); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.LIME_FROM_LIMESTONE_RECIPE_DESCRIPTION, SimHashes.Fossil.CreateTag().ProperName(), SimHashes.SedimentaryRock.CreateTag().ProperName(), SimHashes.Lime.CreateTag().ProperName()); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; float num = 5E-05f; ComplexRecipe.RecipeElement[] array13 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.Salt.CreateTag(), 100f) }; ComplexRecipe.RecipeElement[] array14 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(TableSaltConfig.ID.ToTag(), 100f * num), new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 100f * (1f - num)) }; string id4 = ComplexRecipeManager.MakeRecipeID("RockCrusher", array13, array14); complexRecipe = new ComplexRecipe(id4, array13, array14); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.ROCKCRUSHER.RECIPE_DESCRIPTION, SimHashes.Salt.CreateTag().ProperName(), ITEMS.INDUSTRIAL_PRODUCTS.TABLE_SALT.NAME); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; Prioritizable.AddRef(go); }
private static List <ComplexRecipe> FindRecipes(Predicate <ComplexRecipe> predicate) { return(ComplexRecipeManager.Get().recipes.FindAll(predicate)); }
private static ComplexRecipe FindRecipe(Predicate <ComplexRecipe> predicate) { return(ComplexRecipeManager.Get().recipes.Find(predicate)); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; LiquidCooledRefinery liquidCooledRefinery = go.AddOrGet <LiquidCooledRefinery>(); liquidCooledRefinery.duplicantOperated = true; liquidCooledRefinery.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; liquidCooledRefinery.keepExcessLiquids = true; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); ComplexFabricatorWorkable complexFabricatorWorkable = go.AddOrGet <ComplexFabricatorWorkable>(); BuildingTemplates.CreateComplexFabricatorStorage(go, liquidCooledRefinery); liquidCooledRefinery.coolantTag = COOLANT_TAG; liquidCooledRefinery.minCoolantMass = 400f; liquidCooledRefinery.outStorage.capacityKg = 2000f; liquidCooledRefinery.thermalFudge = 0.8f; liquidCooledRefinery.inStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); liquidCooledRefinery.buildStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); liquidCooledRefinery.outStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers); liquidCooledRefinery.outputOffset = new Vector3(1f, 0.5f); complexFabricatorWorkable.overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_metalrefinery_kanim") }; RequireOutputs requireOutputs = go.AddOrGet <RequireOutputs>(); requireOutputs.ignoreFullPipe = true; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.capacityTag = GameTags.Liquid; conduitConsumer.capacityKG = 800f; conduitConsumer.storage = liquidCooledRefinery.inStorage; conduitConsumer.alwaysConsume = true; conduitConsumer.forceAlwaysSatisfied = true; ConduitDispenser conduitDispenser = go.AddOrGet <ConduitDispenser>(); conduitDispenser.storage = liquidCooledRefinery.outStorage; conduitDispenser.conduitType = ConduitType.Liquid; conduitDispenser.elementFilter = null; conduitDispenser.alwaysDispense = true; List <Element> list = ElementLoader.elements.FindAll((Element e) => e.IsSolid && e.HasTag(GameTags.Metal)); ComplexRecipe complexRecipe; foreach (Element item in list) { Element highTempTransition = item.highTempTransition; Element lowTempTransition = highTempTransition.lowTempTransition; if (lowTempTransition != item) { ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(item.tag, 100f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(lowTempTransition.tag, 100f) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID("MetalRefinery", item.tag); string text = ComplexRecipeManager.MakeRecipeID("MetalRefinery", array, array2); complexRecipe = new ComplexRecipe(text, array, array2); complexRecipe.time = 40f; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_DESCRIPTION, lowTempTransition.name, item.name); complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.fabricators = new List <Tag> { TagManager.Create("MetalRefinery") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, text); } } Element element = ElementLoader.FindElementByHash(SimHashes.Steel); ComplexRecipe.RecipeElement[] array3 = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Iron).tag, 70f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.RefinedCarbon).tag, 20f), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Lime).tag, 10f) }; ComplexRecipe.RecipeElement[] array4 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.Steel).tag, 100f) }; string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID("MetalRefinery", element.tag); string text2 = ComplexRecipeManager.MakeRecipeID("MetalRefinery", array3, array4); complexRecipe = new ComplexRecipe(text2, array3, array4); complexRecipe.time = 40f; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; complexRecipe.description = string.Format(STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.Steel).name, ElementLoader.FindElementByHash(SimHashes.Iron).name); complexRecipe.fabricators = new List <Tag> { TagManager.Create("MetalRefinery") }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, text2); Prioritizable.AddRef(go); }
static public void Recipe(string ID, ComplexRecipe.RecipeElement[] ingredients, ComplexRecipe.RecipeElement[] results, float recipetime = 40, string description = null, string ingredientsstr = null, string resultsstr = null) { /*Tag ingredientsstri; Tag resultsstri; * try { * ingredientsstri = ingredients[0].material; * resultsstri = results[0].material; * } * catch { * ingredientsstri = ingredientsstr.ToTag(); * resultsstri = resultsstr.ToTag(); * } * * string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, ingredientsstri);*/ string str = ComplexRecipeManager.MakeRecipeID(ID, (IList <ComplexRecipe.RecipeElement>)ingredients, (IList <ComplexRecipe.RecipeElement>)results); string recipename = ""; foreach (var i in ingredients) { recipename += i.material.Name + " "; break; } recipename += " to "; foreach (var i in results) { recipename += i.material.Name + " "; break; } ComplexRecipeManager.Get().AddObsoleteIDMapping(recipename, str); ComplexRecipe complexRecipe1 = new ComplexRecipe(str, ingredients, results); complexRecipe1.time = recipetime; //complexRecipe1.useResultAsDescription = true; if (description == null) { complexRecipe1.description = "Combine "; int counter = 1; foreach (var i in ingredients) { if (ingredients.Length > counter++) { complexRecipe1.description += i.material.Name + " and "; } else { complexRecipe1.description += i.material.Name; } } complexRecipe1.description += " to get "; counter = 1; foreach (var i in results) { if (results.Length > counter++) { complexRecipe1.description += i.material.Name + " and "; } else { complexRecipe1.description += i.material.Name; } } ; } else { complexRecipe1.description = description; } complexRecipe1.nameDisplay = ComplexRecipe.RecipeNameDisplay.ResultWithIngredient; complexRecipe1.fabricators = new List <Tag>() { TagManager.Create(ID) }; }
internal static void ConfigureRecipes() { const float INPUT_KG = 100f; // добавляем переплавку абиссалития в электроплавильню if (SmelterOptions.Instance.RecipeKatairiteToTungsten) { const float PHOSPHORUS = 10f; const float SALT = 20f; const float TUNGSTEN = INPUT_KG - PHOSPHORUS - SALT; const float SALT_TO_CHLORINE_RATIO = 1f / 3f; const float CHLORINEGAS = SALT * SALT_TO_CHLORINE_RATIO; const float MAGMA = INPUT_KG - TUNGSTEN - CHLORINEGAS; var ingredients = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.Katairite.CreateTag(), TUNGSTEN), new ComplexRecipe.RecipeElement(SimHashes.Salt.CreateTag(), SALT), new ComplexRecipe.RecipeElement(SimHashes.Phosphorus.CreateTag(), PHOSPHORUS) }; var results = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.Tungsten.CreateTag(), TUNGSTEN), new ComplexRecipe.RecipeElement(SimHashes.IgneousRock.CreateTag(), MAGMA), new ComplexRecipe.RecipeElement(SimHashes.ChlorineGas.CreateTag(), CHLORINEGAS) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(MetalRefineryConfig.ID, SimHashes.Katairite.CreateTag()); string id = ComplexRecipeManager.MakeRecipeID(MetalRefineryConfig.ID, ingredients, results); new ComplexRecipe(id, ingredients, results) { time = BUILDINGS.FABRICATION_TIME_SECONDS.MODERATE, description = string.Format( global::STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.Tungsten).name, ElementLoader.FindElementByHash(SimHashes.Katairite).name), nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult, fabricators = new List <Tag> { TagManager.Create(MetalRefineryConfig.ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); } // добавляем переплавку фосфора в стеклоплавильню if (SmelterOptions.Instance.RecipePhosphoriteToPhosphorus) { var ingredients = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.Phosphorite.CreateTag(), INPUT_KG) }; var results = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.LiquidPhosphorus.CreateTag(), INPUT_KG) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(GlassForgeConfig.ID, SimHashes.Phosphorite.CreateTag()); string id = ComplexRecipeManager.MakeRecipeID(GlassForgeConfig.ID, ingredients, results); new ComplexRecipe(id, ingredients, results) { time = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT / 2, description = string.Format( global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.LiquidPhosphorus).name, ElementLoader.FindElementByHash(SimHashes.Phosphorite).name), nameDisplay = ComplexRecipe.RecipeNameDisplay.Result, fabricators = new List <Tag> { TagManager.Create(GlassForgeConfig.ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); } // добавляем копию рецептов из электроплавильни. кроме стали и наёбия var metalrefinery_recipes = ComplexRecipeManager.Get().recipes .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(MetalRefineryConfig.ID))) .ToList(); metalrefinery_recipes .DoIf( condition: (ComplexRecipe recipe) => !recipe.id.Contains(SimHashes.Steel.ToString()) && !recipe.id.Contains(SimHashes.Niobium.ToString()), action: (ComplexRecipe recipe) => recipe.fabricators.Add(TagManager.Create(ID)) ); // добавляем сталь с увеличенным временем фабрикации const float fabricationTimeMultiplier = 1.3f; metalrefinery_recipes .Where((ComplexRecipe recipe) => recipe.id.Contains(SimHashes.Steel.ToString())) .ToList() .Do((ComplexRecipe recipe) => { string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material); string id = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, recipe.results); new ComplexRecipe(id, recipe.ingredients, recipe.results) { time = recipe.time * fabricationTimeMultiplier, description = recipe.description, nameDisplay = recipe.nameDisplay, fabricators = new List <Tag> { TagManager.Create(ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); }); // добавляем копию рецептов из стеклоплавильни с увеличенным временем фабрикации var glassforge_recipes = ComplexRecipeManager.Get().recipes .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(GlassForgeConfig.ID))) .ToList(); glassforge_recipes .Do((ComplexRecipe recipe) => { var results = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(ElementLoader.GetElement(recipe.results[0].material).lowTempTransition.tag, recipe.results[0].amount) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material); string id = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, results); new ComplexRecipe(id, recipe.ingredients, results) { time = recipe.time * fabricationTimeMultiplier, description = string.Format(global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.GetElement(results[0].material).name, ElementLoader.GetElement(recipe.ingredients[0].material).name), nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult, fabricators = new List <Tag> { TagManager.Create(ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); }); // добавляем переплавку пластика if (SmelterOptions.Instance.RecipePlasticToNaphtha) { var ingredients = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.Polypropylene.CreateTag(), INPUT_KG) }; var results = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.Naphtha.CreateTag(), INPUT_KG) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, SimHashes.Polypropylene.CreateTag()); string id = ComplexRecipeManager.MakeRecipeID(ID, ingredients, results); new ComplexRecipe(id, ingredients, results) { time = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT, description = string.Format( global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.FindElementByHash(SimHashes.Naphtha).name, ElementLoader.FindElementByHash(SimHashes.Polypropylene).name), nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult, fabricators = new List <Tag> { TagManager.Create(ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); } // добавляем древесный уголь в печку if (SmelterOptions.Instance.RecipeWoodToCarbon) { const float WOOD = 200f; const float CARBON = 100f; const float CO2 = 60f; var ingredients = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(WoodLogConfig.TAG, WOOD) }; var results = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(SimHashes.RefinedCarbon.CreateTag(), CARBON), new ComplexRecipe.RecipeElement(SimHashes.CarbonDioxide.CreateTag(), CO2) }; string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(KilnConfig.ID, WoodLogConfig.TAG); string id = ComplexRecipeManager.MakeRecipeID(KilnConfig.ID, ingredients, results); new ComplexRecipe(id, ingredients, results) { time = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT, description = string.Format( global::STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION, global::STRINGS.UI.FormatAsLink(global::STRINGS.ITEMS.INDUSTRIAL_PRODUCTS.WOOD.NAME, ForestTreeConfig.ID.ToUpperInvariant()), ElementLoader.FindElementByHash(SimHashes.RefinedCarbon).name), nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult, fabricators = new List <Tag> { TagManager.Create(KilnConfig.ID) } }; ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id); } }