public void CompleteWorkingOrder() { if (!HasWorkingOrder) { Debug.LogWarning("CompleteWorkingOrder called with no working order.", base.gameObject); } else { ComplexRecipe recipe = recipe_list[workingOrderIdx]; SpawnOrderProduct(recipe); float num = buildStorage.MassStored(); if (num != 0f) { Debug.LogWarningFormat(base.gameObject, "{0} build storage contains mass {1} after order completion.", base.gameObject, num); buildStorage.Transfer(inStorage, true, true); } DecrementRecipeQueueCountInternal(recipe, true); workingOrderIdx = -1; orderProgress = 0f; CancelChore(); if (!cancelling) { RefreshAndStartNextOrder(); } } }
private void InitializeEntries() { if (recipe == null) { recipe = new ComplexRecipe(); recipe.AddNewDetail(); recipe.AddNewAdditionalDetail(); recipe.UserId = BusinessDomain.LoggedUser.Id; recipe.LoggedUserId = BusinessDomain.LoggedUser.Id; OperationTotalHide(); editMode = false; } else { txtName.Text = recipe.Name; SetOperationTotal(); OperationTotalShow(); editMode = true; } txtName.ButtonPressEvent += txtName_ButtonPressEvent; txtName.Focused += txtName_Focused; txtName.KeyPressEvent += txtName_KeyPressEvent; InitializeMaterialsGrid(); InitializeProductsGrid(); }
private void DropExcessIngredients(Storage storage) { TagBits search_tags = default(TagBits); search_tags.Or(ref keepAdditionalTags); for (int i = 0; i < recipe_list.Length; i++) { ComplexRecipe complexRecipe = recipe_list[i]; if (IsRecipeQueued(complexRecipe)) { ComplexRecipe.RecipeElement[] ingredients = complexRecipe.ingredients; foreach (ComplexRecipe.RecipeElement recipeElement in ingredients) { search_tags.SetTag(recipeElement.material); } } } for (int num = storage.items.Count - 1; num >= 0; num--) { GameObject gameObject = storage.items[num]; if (!((UnityEngine.Object)gameObject == (UnityEngine.Object)null)) { PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); if (!((UnityEngine.Object)component == (UnityEngine.Object)null) && (!keepExcessLiquids || !component.Element.IsLiquid)) { KPrefabID component2 = gameObject.GetComponent <KPrefabID>(); if ((bool)component2 && !component2.HasAnyTags(ref search_tags)) { storage.Drop(gameObject, true); } } } } }
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); } }
public void fossilCrushing() { Tag fossil = SimHashes.Fossil.CreateTag(); Tag lime = SimHashes.Lime.CreateTag(); Tag sand = SimHashes.Sand.CreateTag(); string desc = "Crushes {0} into {1} and {2}"; ComplexRecipe.RecipeElement[] input = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(fossil, 100) }; ComplexRecipe.RecipeElement[] output = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(lime, 5), new ComplexRecipe.RecipeElement(sand, 95) }; ComplexRecipe recipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", input, output), input, output); recipe.time = 40f; recipe.description = string.Format(desc, fossil, lime, sand); recipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; recipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; recipesIDs.Add(recipe.id); }
private void OnWorkableEvent(Workable.WorkableEvent e) { switch (e) { case Workable.WorkableEvent.WorkStarted: { ComplexRecipe currentWorkingOrder = refinery.CurrentWorkingOrder; if (currentWorkingOrder != null) { ComplexRecipe.RecipeElement[] ingredients = currentWorkingOrder.ingredients; if (ingredients.Length > 0) { ComplexRecipe.RecipeElement recipeElement = ingredients[0]; display_egg = refinery.buildStorage.FindFirst(recipeElement.material); PositionActiveEgg(); } } break; } case Workable.WorkableEvent.WorkCompleted: if ((bool)display_egg) { KBatchedAnimController component = display_egg.GetComponent <KBatchedAnimController>(); component.Play("hatching_pst", KAnim.PlayMode.Once, 1f, 0f); } break; case Workable.WorkableEvent.WorkStopped: UnityEngine.Object.Destroy(tracker); tracker = null; display_egg = null; break; } }
public int GetRecipePrefetchCount(ComplexRecipe recipe) { int remainingQueueCount = GetRemainingQueueCount(recipe); Debug.Assert(remainingQueueCount >= 0); return(Mathf.Min(2, remainingQueueCount)); }
public void burnCloth() { Dictionary <string, string> vests = new Dictionary <string, string> { { "Cool_Vest", EQUIPMENT.PREFABS.COOL_VEST.NAME }, { "Funky_Vest", EQUIPMENT.PREFABS.FUNKY_VEST.NAME }, { "Warm_Vest", EQUIPMENT.PREFABS.WARM_VEST.NAME } }; Tag coal = SimHashes.Carbon.CreateTag(); string descBurn = "Burn old {0}"; foreach (KeyValuePair <string, string> vest in vests) { ComplexRecipe.RecipeElement[] input = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(vest.Key, 1) }; ComplexRecipe.RecipeElement[] output = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(coal, 3) }; ComplexRecipe recipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("Kiln", input, output), input, output); recipe.time = 55f; recipe.description = string.Format(descBurn, vest.Value); recipe.fabricators = new List <Tag> { TagManager.Create("Kiln") }; recipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; recipesIDs.Add(recipe.id); } }
public GameObject CreatePrefab() { Db.Get().effects.Add(CreateEffect()); GameObject gameObject = EntityTemplates.CreateLooseEntity("Stimulant", "Stimulant", "Temporarily increases physical ability at the cost of increased metabolism.", 1f, unitMass: true, Assets.GetAnim("pill_2_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, isPickupable: true); EntityTemplates.ExtendEntityToMedicine(gameObject, medicineInfo); ComplexRecipe.RecipeElement[] inputs = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(SimHashes.RefinedCarbon.CreateTag(), 10f), new ComplexRecipe.RecipeElement(SpiceNutConfig.ID, 1f), new ComplexRecipe.RecipeElement("LightBugEgg", 1f) }; ComplexRecipe.RecipeElement[] outputs = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("Stimulant", 10f) }; string id = ComplexRecipeManager.MakeRecipeID("Apothecary", inputs, outputs); recipe = new ComplexRecipe(id, inputs, outputs) { time = 75f, description = "Temporarily increases physical ability at the cost of increased metabolism.", nameDisplay = ComplexRecipe.RecipeNameDisplay.Result, fabricators = new List <Tag> { "Apothecary" }, sortOrder = 1 }; return(gameObject); }
public static void ConfigureRecipes(string fabricator) { var inputs = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement("BasicFabric".ToTag(),3f), }; var outputs = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(ID.ToTag(),1f), }; var id = ComplexRecipeManager.MakeRecipeID(fabricator,inputs,outputs); recipe = new ComplexRecipe(id,inputs,outputs) { time = FABTIME, description = RECIPE_DESC, nameDisplay = ComplexRecipe.RecipeNameDisplay.Result, fabricators = new List <Tag> { fabricator }, sortOrder = 1, requiredTech = Db.Get().TechItems.suitsOverlay.parentTech.Id }; }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateLooseEntity("Antihistamine", ITEMS.PILLS.ANTIHISTAMINE.NAME, ITEMS.PILLS.ANTIHISTAMINE.DESC, 1f, true, Assets.GetAnim("pill_allergies_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, true, 0, SimHashes.Creature, null); EntityTemplates.ExtendEntityToMedicine(gameObject, MEDICINE.ANTIHISTAMINE); ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement("PrickleFlowerSeed", 1f), new ComplexRecipe.RecipeElement(SimHashes.Dirt.CreateTag(), 1f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("Antihistamine", 10f) }; string id = ComplexRecipeManager.MakeRecipeID("Apothecary", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(id, array, array2); complexRecipe.time = 100f; complexRecipe.description = ITEMS.PILLS.ANTIHISTAMINE.RECIPEDESC; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; complexRecipe.fabricators = new List <Tag> { "Apothecary" }; complexRecipe.sortOrder = 10; recipe = complexRecipe; return(gameObject); }
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 GameObject CreatePrefab() { ComplexRecipe.RecipeElement[] ingredients = new ComplexRecipe.RecipeElement[4] { new ComplexRecipe.RecipeElement((Tag)PuftConfig.EGG_ID, 2f), new ComplexRecipe.RecipeElement((Tag)PuftBleachstoneConfig.EGG_ID, 1f), new ComplexRecipe.RecipeElement((Tag)PuftOxyliteConfig.EGG_ID, 1f), new ComplexRecipe.RecipeElement(SimHashes.SourGas.CreateTag(), 10f), }; ComplexRecipe.RecipeElement[] results = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement((Tag)DevilPuftConfig.EGG_ID, 1f) }; var r = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID(ID, (IList <ComplexRecipe.RecipeElement>)ingredients, (IList <ComplexRecipe.RecipeElement>)results), ingredients, results, 0) { time = 80f / 8, description = BabyDescription, nameDisplay = ComplexRecipe.RecipeNameDisplay.Result }; r.fabricators = new List <Tag>() { TagManager.Create(SupermaterialRefineryConfig.ID) }; return(EntityTemplates.ExtendEntityToFertileCreature(DevilPuftConfig.CreatePuft(ID, Name, Description, "devil_puft_adult_kanim", false), EGG_ID, EggName, Description, "devil_puft_egg_kanim", PuftTuning.EGG_MASS, BABY_ID, 45f, 15f, EggChances, DevilPuftConfig.EGG_SORT_ORDER, true, false, true, 1f)); }
public static void Postfix() { ComplexRecipe.RecipeElement[] ingredients2 = new ComplexRecipe.RecipeElement[4] { 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), new ComplexRecipe.RecipeElement(ElementLoader.FindElementByHash(SimHashes.SuperCoolant).tag, 50f), }; ComplexRecipe.RecipeElement[] results2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.SolidMercury.CreateTag(), 100f) }; ComplexRecipe complexRecipe3 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", (IList <ComplexRecipe.RecipeElement>)ingredients2, (IList <ComplexRecipe.RecipeElement>)results2), ingredients2, results2); complexRecipe3.time = 80f; complexRecipe3.description = (string)STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.SUPERCOOLANT_RECIPE_DESCRIPTION; complexRecipe3.useResultAsDescription = true; ComplexRecipe complexRecipe4 = complexRecipe3; List <Tag> tagList3 = new List <Tag>(); tagList3.Add(TagManager.Create("SupermaterialRefinery")); List <Tag> tagList4 = tagList3; complexRecipe4.fabricators = tagList4; }
// формулы расчета тепла и прироста температуры для порции хладагента массой minCoolantMass // для правильности расчета должны быть аналогичны формулам внутри LiquidCooledRefinery.SpawnOrderProduct public static float CalculateEnergyDelta(this LiquidCooledRefinery @this, ComplexRecipe recipe) { var firstresult = recipe.results[0]; var element = ElementLoader.GetElement(firstresult.material); return(GameUtil.CalculateEnergyDeltaForElementChange(firstresult.amount, element.specificHeatCapacity, element.highTemp, @this.outputTemperature) * @this.thermalFudge); }
public void saltCrushing() { Tag salt = SimHashes.Salt.CreateTag(); Tag tableSalt = TableSaltConfig.ID.ToTag(); Tag sand = SimHashes.Sand.CreateTag(); float num = 5E-05f; string desc = "Crushes {0} into {1} and some {2}"; ComplexRecipe.RecipeElement[] input = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(salt, 100) }; ComplexRecipe.RecipeElement[] output = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(tableSalt, 100 * num), new ComplexRecipe.RecipeElement(sand, 100 * (1 - num)) }; ComplexRecipe recipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", input, output), input, output); recipe.time = 120f; recipe.description = string.Format(desc, salt, tableSalt, sand); recipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; recipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; recipesIDs.Add(recipe.id); }
public static void Postfix() { float num1 = 0.01f; ComplexRecipe.RecipeElement[] ingredients2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.Steel.CreateTag(), 100f) }; ComplexRecipe.RecipeElement[] results2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.Lime.CreateTag(), 20f) }; ComplexRecipe complexRecipe3 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", (IList <ComplexRecipe.RecipeElement>)ingredients2, (IList <ComplexRecipe.RecipeElement>)results2), ingredients2, results2); complexRecipe3.time = 80f; complexRecipe3.description = (string)STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.SUPERCOOLANT_RECIPE_DESCRIPTION; complexRecipe3.useResultAsDescription = true; ComplexRecipe complexRecipe4 = complexRecipe3; List <Tag> tagList3 = new List <Tag>(); tagList3.Add(TagManager.Create("SupermaterialRefinery")); List <Tag> tagList4 = tagList3; complexRecipe4.fabricators = tagList4; }
public void add_recipe_Dirt() { ComplexRecipe.RecipeElement[] ingredients = new ComplexRecipe.RecipeElement[4] { new ComplexRecipe.RecipeElement(SimHashes.Granite.CreateTag(), 1000f), new ComplexRecipe.RecipeElement(SimHashes.Water.CreateTag(), 1000f), new ComplexRecipe.RecipeElement(SimHashes.DirtyWater.CreateTag(), 1000f), new ComplexRecipe.RecipeElement(SimHashes.Obsidian.CreateTag(), 1000f), }; ComplexRecipe.RecipeElement[] results = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement(SimHashes.Dirt.CreateTag(), 4000f) }; var r = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID(ID, (IList <ComplexRecipe.RecipeElement>)ingredients, (IList <ComplexRecipe.RecipeElement>)results), ingredients, results) { time = 80f / 8, description = "Pulverize minerals until an organic paste is made", nameDisplay = ComplexRecipe.RecipeNameDisplay.Result }; r.fabricators = new List <Tag>() { TagManager.Create(SupermaterialRefineryConfig.ID) }; }
public async Task <List <ComplexRecipe> > GetPriceAsync(string productName, int limit, int offset) { string getRecipesPrice = "SELECT * FROM biksbudgetdb.recipes WHERE recipename like @ProductName AND recipe_totalprice > 0 " + "ORDER BY recipe_totalprice LIMIT @Limit OFFSET @Offset"; List <ComplexRecipe> complexRecipes = new List <ComplexRecipe>(); MySqlCommand msc = new MySqlCommand(getRecipesPrice); msc.Parameters.AddWithValue("@ProductName", "%" + productName + "%"); msc.Parameters.AddWithValue("@Limit", limit); msc.Parameters.AddWithValue("@Offset", offset); DataSet ds = await new SQLConnect().DynamicSimpleListSQL(msc); if (ds.Tables.Count != 0) { foreach (DataRow r in ds.Tables[0].Rows) { ComplexRecipe recipe = new ComplexRecipe((int)r[0], (string)r[1], (string)r[3], await GetIngredients((int)r[0]), Convert.ToSingle(r[2]), new ComplexRecipeComponent(Convert.ToDouble(r[4]))); complexRecipes.Add(recipe); } } return(complexRecipes); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateLooseEntity("BasicBooster", ITEMS.PILLS.BASICBOOSTER.NAME, ITEMS.PILLS.BASICBOOSTER.DESC, 1f, true, Assets.GetAnim("pill_2_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, true, 0, SimHashes.Creature, null); EntityTemplates.ExtendEntityToMedicine(gameObject, MEDICINE.BASICBOOSTER); ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("Carbon", 1f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("BasicBooster".ToTag(), 1f) }; string id = ComplexRecipeManager.MakeRecipeID("Apothecary", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(id, array, array2); complexRecipe.time = 50f; complexRecipe.description = ITEMS.PILLS.BASICBOOSTER.RECIPEDESC; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; complexRecipe.fabricators = new List <Tag> { "Apothecary" }; complexRecipe.sortOrder = 1; recipe = complexRecipe; return(gameObject); }
private void ToggleClicked(KToggle toggle) { if (!recipeMap.ContainsKey(toggle.gameObject)) { Debug.LogError("Recipe not found on recipe list."); } else { if ((Object)selectedToggle == (Object)toggle) { selectedToggle.isOn = false; selectedToggle = null; selectedRecipe = null; } else { selectedToggle = toggle; selectedToggle.isOn = true; selectedRecipe = recipeMap[toggle.gameObject]; selectedRecipeFabricatorMap[targetFab] = recipeToggles.IndexOf(toggle.gameObject); } RefreshIngredientAvailabilityVis(); if (toggle.isOn) { recipeScreen = (SelectedRecipeQueueScreen)DetailsScreen.Instance.SetSecondarySideScreen(recipeScreenPrefab, UI.UISIDESCREENS.FABRICATORSIDESCREEN.RECIPE_DETAILS); recipeScreen.SetRecipe(this, targetFab, selectedRecipe); } else { DetailsScreen.Instance.ClearSecondarySideScreen(); } } }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateLooseEntity("IntermediateCure", ITEMS.PILLS.INTERMEDIATECURE.NAME, ITEMS.PILLS.INTERMEDIATECURE.DESC, 1f, true, Assets.GetAnim("iv_slimelung_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, true, 0, SimHashes.Creature, null); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.MedicalSupplies, false); ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(SwampLilyFlowerConfig.ID, 1f), new ComplexRecipe.RecipeElement(SimHashes.Phosphorite.CreateTag(), 1f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("IntermediateCure", 1f) }; string id = ComplexRecipeManager.MakeRecipeID("Apothecary", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(id, array, array2); complexRecipe.time = 100f; complexRecipe.description = ITEMS.PILLS.INTERMEDIATECURE.RECIPEDESC; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; complexRecipe.fabricators = new List <Tag> { "Apothecary" }; complexRecipe.sortOrder = 10; complexRecipe.requiredTech = "MedicineII"; recipe = complexRecipe; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateLooseEntity("AdvancedCure", ITEMS.PILLS.ADVANCEDCURE.NAME, ITEMS.PILLS.ADVANCEDCURE.DESC, 1f, true, Assets.GetAnim("vial_spore_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.4f, true, 0, SimHashes.Creature, null); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.MedicalSupplies, false); ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(SimHashes.Steel.CreateTag(), 1f), new ComplexRecipe.RecipeElement("LightBugOrangeEgg", 1f) }; ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement("AdvancedCure", 1f) }; string id = ComplexRecipeManager.MakeRecipeID("Apothecary", array, array2); ComplexRecipe complexRecipe = new ComplexRecipe(id, array, array2); complexRecipe.time = 200f; complexRecipe.description = ITEMS.PILLS.ADVANCEDCURE.RECIPEDESC; complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result; complexRecipe.fabricators = new List <Tag> { "Apothecary" }; complexRecipe.sortOrder = 20; complexRecipe.requiredTech = "MedicineIV"; recipe = complexRecipe; return(gameObject); }
public void clayToSlime() { Tag clay = SimHashes.Clay.CreateTag(); Tag dirt = SimHashes.ToxicSand.CreateTag(); Tag slime = SimHashes.SlimeMold.CreateTag(); string desc = "Mixes {0} with {1} to create {2}"; ComplexRecipe.RecipeElement[] input = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(clay, 200), new ComplexRecipe.RecipeElement(dirt, 200) }; ComplexRecipe.RecipeElement[] output = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(slime, 400) }; ComplexRecipe recipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", input, output), input, output); recipe.time = 100f; recipe.description = string.Format(desc, clay, dirt, slime); recipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; recipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; recipesIDs.Add(recipe.id); }
public static void Postfix() { ComplexRecipe.RecipeElement[] ingredients2 = new ComplexRecipe.RecipeElement[3] { new ComplexRecipe.RecipeElement(SimHashes.MaficRock.CreateTag(), 70f), new ComplexRecipe.RecipeElement(SimHashes.Sulfur.CreateTag(), 10f), new ComplexRecipe.RecipeElement(SimHashes.IgneousRock.CreateTag(), 20f) }; ComplexRecipe.RecipeElement[] results2 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement(SimHashes.Wolframite.CreateTag(), 50f), new ComplexRecipe.RecipeElement(SimHashes.Sand.CreateTag(), 50f) }; ComplexRecipe complexRecipe3 = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("SupermaterialRefinery", (IList <ComplexRecipe.RecipeElement>)ingredients2, (IList <ComplexRecipe.RecipeElement>)results2), ingredients2, results2); complexRecipe3.time = 80f; complexRecipe3.description = (string)STRINGS.BUILDINGS.PREFABS.SUPERMATERIALREFINERY.SUPERCOOLANT_RECIPE_DESCRIPTION; complexRecipe3.useResultAsDescription = true; ComplexRecipe complexRecipe4 = complexRecipe3; List <Tag> tagList3 = new List <Tag>(); tagList3.Add(TagManager.Create("SupermaterialRefinery")); List <Tag> tagList4 = tagList3; complexRecipe4.fabricators = tagList4; }
public bool IsRecipeQueued(ComplexRecipe recipe) { int num = recipeQueueCounts[recipe.id]; Debug.Assert(num >= 0 || num == QUEUE_INFINITE); return(num != 0); }
public List <Descriptor> GetResultDescriptions(ComplexRecipe recipe) { List <Descriptor> list = new List <Descriptor>(); ComplexRecipe.RecipeElement[] results = recipe.results; foreach (ComplexRecipe.RecipeElement recipeElement in results) { GameObject prefab = Assets.GetPrefab(recipeElement.material); string formattedByTag = GameUtil.GetFormattedByTag(recipeElement.material, recipeElement.amount, GameUtil.TimeSlice.None); list.Add(new Descriptor(string.Format(UI.UISIDESCREENS.FABRICATORSIDESCREEN.RECIPEPRODUCT, prefab.GetProperName(), formattedByTag), string.Format(UI.UISIDESCREENS.FABRICATORSIDESCREEN.TOOLTIPS.RECIPEPRODUCT, prefab.GetProperName(), formattedByTag), Descriptor.DescriptorType.Requirement, false)); Element element = ElementLoader.GetElement(recipeElement.material); if (element != null) { List <Descriptor> materialDescriptors = GameUtil.GetMaterialDescriptors(element); GameUtil.IndentListOfDescriptors(materialDescriptors, 1); list.AddRange(materialDescriptors); } else { List <Descriptor> effectDescriptors = GameUtil.GetEffectDescriptors(GameUtil.GetAllDescriptors(prefab, false)); GameUtil.IndentListOfDescriptors(effectDescriptors, 1); list.AddRange(effectDescriptors); } } return(list); }
public void limeCrushing() { Dictionary <string[], float[]> organics = new Dictionary <string[], float[]> { { new string[] { "EggShell", MISC.TAGS.EGGSHELL }, new float[] { 5, 5 } }, { new string[] { "BabyCrabShell", ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME }, new float[] { 1, 5 } }, { new string[] { "CrabShell", ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME }, new float[] { 1, 10 } } }; Tag lime = SimHashes.Lime.CreateTag(); string desc = "Crushes {0} into {1}"; foreach (KeyValuePair <string[], float[]> organic in organics) { ComplexRecipe.RecipeElement[] input = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(organic.Key[0], organic.Value[0]), }; ComplexRecipe.RecipeElement[] output = new ComplexRecipe.RecipeElement[] { new ComplexRecipe.RecipeElement(lime, organic.Value[1]) }; ComplexRecipe recipe = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID("RockCrusher", input, output), input, output); recipe.time = 40f; recipe.description = string.Format(desc, organic.Key[1], lime); recipe.fabricators = new List <Tag> { TagManager.Create("RockCrusher") }; recipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult; recipesIDs.Add(recipe.id); } }
private int CompareRecipe(ComplexRecipe a, ComplexRecipe b) { if (a.sortOrder != b.sortOrder) { return(a.sortOrder - b.sortOrder); } return(StringComparer.InvariantCulture.Compare(a.id, b.id)); }
private bool IsCurrentRecipe(ComplexRecipe recipe) { if (workingOrderIdx < 0) { return(false); } return(recipe_list[workingOrderIdx].id == recipe.id); }