protected override void OnSpawn() { base.OnSpawn(); selectable = GetComponent <KSelectable>(); fabricator = GetComponent <ComplexFabricator>(); InitializeBalances(); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; ComplexFabricator complexFabricator = go.AddOrGet <ComplexFabricator>(); complexFabricator.resultState = ComplexFabricator.ResultState.Heated; complexFabricator.heatedTemperature = OUTPUT_TEMPERATURE; 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_supermaterial_refinery_kanim") }; Prioritizable.AddRef(go); AddRecipes(); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <LoreBearer>(); go.AddOrGet <Telepad>(); Light2D light2D = go.AddOrGet <Light2D>(); light2D.Color = LIGHT2D.HEADQUARTERS_COLOR; light2D.Range = 5f; light2D.Offset = LIGHT2D.HEADQUARTERS_OFFSET; light2D.overlayColour = LIGHT2D.HEADQUARTERS_OVERLAYCOLOR; light2D.shape = LightShape.Circle; light2D.drawOverlay = true; go.AddOrGet <DropAllWorkable>(); Prioritizable.AddRef(go); go.AddOrGet <BuildingComplete>().isManuallyOperated = false; ComplexFabricator fabricator = go.AddOrGet <ComplexFabricator>(); BuildingTemplates.CreateComplexFabricatorStorage(go, fabricator); Storage storage = go.AddOrGet <Storage>(); storage.showInUI = true; storage.allowItemRemoval = false; storage.showDescriptor = false; storage.storageFilters = STORAGEFILTERS.NOT_EDIBLE_SOLIDS; storage.storageFullMargin = STORAGE.STORAGE_LOCKER_FILLED_MARGIN; storage.fetchCategory = Storage.FetchCategory.GeneralStorage; // todo storage.Serialize }
private void RefreshQueueCountDisplay(GameObject entryGO, ComplexFabricator fabricator) { HierarchyReferences component = entryGO.GetComponent <HierarchyReferences>(); bool flag = fabricator.GetRecipeQueueCount(recipeMap[entryGO]) == ComplexFabricator.QUEUE_INFINITE; component.GetReference <LocText>("CountLabel").text = ((!flag) ? fabricator.GetRecipeQueueCount(recipeMap[entryGO]).ToString() : string.Empty); component.GetReference <RectTransform>("InfiniteIcon").gameObject.SetActive(flag); }
public void RefreshQueueCountDisplayForRecipe(ComplexRecipe recipe, ComplexFabricator fabricator) { GameObject gameObject = recipeToggles.Find((GameObject match) => recipeMap[match] == recipe); if ((Object)gameObject != (Object)null) { RefreshQueueCountDisplay(gameObject, fabricator); } }
private static void Postfix(ComplexFabricator __instance, List <GameObject> __result) { if (fabricators.Contains(__instance.PrefabID().Name)) { foreach (GameObject gameObject in __result) { if (gameObject?.GetComponent <PrimaryElement>().Element.IsGas ?? false) { gameObject.GetComponent <Dumpable>()?.Dump(); } } } }
public void SetRecipe(ComplexFabricatorSideScreen owner, ComplexFabricator target, ComplexRecipe recipe) { ownerScreen = owner; this.target = target; selectedRecipe = recipe; recipeName.text = recipe.GetUIName(); Tuple <Sprite, Color> uISprite = Def.GetUISprite((recipe.nameDisplay != 0) ? recipe.results[0].material : recipe.ingredients[0].material, "ui", false); recipeIcon.sprite = uISprite.first; recipeIcon.color = uISprite.second; RefreshIngredientDescriptors(); RefreshResultDescriptors(); RefreshQueueCountDisplay(); }
public static void CreateComplexFabricatorStorage(GameObject go, ComplexFabricator fabricator) { fabricator.inStorage = go.AddComponent <Storage>(); fabricator.inStorage.capacityKg = 20000f; fabricator.inStorage.showInUI = true; fabricator.inStorage.SetDefaultStoredItemModifiers(Storage.StandardFabricatorStorage); fabricator.buildStorage = go.AddComponent <Storage>(); fabricator.buildStorage.capacityKg = 20000f; fabricator.buildStorage.showInUI = true; fabricator.buildStorage.SetDefaultStoredItemModifiers(Storage.StandardFabricatorStorage); fabricator.outStorage = go.AddComponent <Storage>(); fabricator.outStorage.capacityKg = 20000f; fabricator.outStorage.showInUI = true; fabricator.outStorage.SetDefaultStoredItemModifiers(Storage.StandardFabricatorStorage); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false); go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = false; ComplexFabricator fabricator = go.AddOrGet <ComplexFabricator>(); fabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; fabricator.duplicantOperated = false; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); BuildingTemplates.CreateComplexFabricatorStorage(go, fabricator); ConfigureRecipes(); Prioritizable.AddRef(go); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; ComplexFabricator fabricator = go.AddOrGet <ComplexFabricator>(); fabricator.resultState = ComplexFabricator.ResultState.Heated; fabricator.heatedTemperature = 313.15f; fabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; fabricator.duplicantOperated = true; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); ComplexFabricatorWorkable fabricatorWorkable = go.AddOrGet <ComplexFabricatorWorkable>(); BuildingTemplates.CreateComplexFabricatorStorage(go, fabricator); fabricatorWorkable.overrideAnims = new KAnimFile[1] { //Assets.GetAnim((HashedString) "anim_interacts_supermaterial_refinery_kanim") Assets.GetAnim((HashedString)"anim_interacts_metalrefinery_kanim") }; Prioritizable.AddRef(go); //float num7 = 0.35f; ComplexRecipe.RecipeElement[] ingredients4 = new ComplexRecipe.RecipeElement[2] { new ComplexRecipe.RecipeElement((Tag)HatchConfig.EGG_ID, 1f), new ComplexRecipe.RecipeElement((Tag)RawEggConfig.ID, (float)(40 / 8)) }; ComplexRecipe.RecipeElement[] results4 = new ComplexRecipe.RecipeElement[1] { new ComplexRecipe.RecipeElement((Tag)HatchConfig.EGG_ID, 1f) }; var r = new ComplexRecipe(ComplexRecipeManager.MakeRecipeID(ID, (IList <ComplexRecipe.RecipeElement>)ingredients4, (IList <ComplexRecipe.RecipeElement>)results4), ingredients4, results4) { time = 80f / 8, description = RECOMBINATION_RECIPE_DESCRIPTION, nameDisplay = ComplexRecipe.RecipeNameDisplay.Result }; RECIPE_RECOMBINATION = r; r.fabricators = new List <Tag>() { TagManager.Create(ID) }; }
public static void SetAutomatic(GameObject go, object fabricatorObject) { BuildingComplete bc = go.GetComponent <BuildingComplete>(); ComplexFabricator fabricator = (ComplexFabricator)fabricatorObject; if (bc == null) { Debug.LogWarning("SetAutomatic bc was null"); return; } if (fabricator == null) { Debug.LogWarning("SetAutomatic fabricator was null"); return; } go.AddOrGet <BuildingComplete>().isManuallyOperated = false; fabricator.duplicantOperated = false; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); Prioritizable.AddRef(go); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; ComplexFabricator complexFabricator = go.AddOrGet <ComplexFabricator>(); complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); go.AddOrGet <ComplexFabricatorWorkable>().overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_fabricator_generic_kanim") }; go.AddOrGet <ComplexFabricatorWorkable>().AnimOffset = new Vector3(-1f, 0f, 0f); complexFabricator.fetchChoreTypeIdHash = Db.Get().ChoreTypes.FabricateFetch.IdHash; BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator); go.AddOrGet <LoopingSounds>(); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; go.AddOrGet <DropAllWorkable>(); Prioritizable.AddRef(go); ComplexFabricator complexFabricator = go.AddOrGet <ComplexFabricator>(); go.AddOrGet <ComplexFabricatorWorkable>().overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_clothingfactory_kanim") }; go.AddOrGet <ComplexFabricatorWorkable>().AnimOffset = new Vector3(-1f, 0f, 0f); complexFabricator.sideScreenStyle = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid; go.AddOrGet <FabricatorIngredientStatusManager>(); go.AddOrGet <CopyBuildingSettings>(); ConfigureRecipes(); BuildingTemplates.CreateComplexFabricatorStorage(go, complexFabricator); }
public override void SetTarget(GameObject target) { ComplexFabricator component = target.GetComponent <ComplexFabricator>(); if ((Object)component == (Object)null) { Debug.LogError("The object selected doesn't have a ComplexFabricator!"); } else { if (targetOrdersUpdatedSubHandle != -1) { Unsubscribe(targetOrdersUpdatedSubHandle); } Initialize(component); targetOrdersUpdatedSubHandle = targetFab.Subscribe(1721324763, UpdateQueueCountLabels); UpdateQueueCountLabels(null); } }
private void OnCopySettings(object data) { GameObject gameObject = (GameObject)data; if (!((UnityEngine.Object)gameObject == (UnityEngine.Object)null)) { ComplexFabricator component = gameObject.GetComponent <ComplexFabricator>(); if (!((UnityEngine.Object)component == (UnityEngine.Object)null)) { ComplexRecipe[] array = recipe_list; foreach (ComplexRecipe complexRecipe in array) { if (!component.recipeQueueCounts.TryGetValue(complexRecipe.id, out int value)) { value = 0; } SetRecipeQueueCountInternal(complexRecipe, value); } RefreshQueue(); } } }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <DropAllWorkable>(); go.AddOrGet <BuildingComplete>().isManuallyOperated = true; go.AddOrGet <KBatchedAnimController>().SetSymbolVisiblity("snapto_egg", false); ComplexFabricator complexFabricator = go.AddOrGet <ComplexFabricator>(); complexFabricator.labelByResult = false; 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_egg_cracker_kanim") }; complexFabricator.outputOffset = new Vector3(1f, 1f, 0f); Prioritizable.AddRef(go); go.AddOrGet <EggCracker>(); }
private static bool Prefix(RockCrusherConfig __instance, ref GameObject go) { Debug.Log("Refinement Plus - RockCrusherConfig Postfix: "); Prioritizable.AddRef(go); 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[] { Assets.GetAnim("anim_interacts_rockrefinery_kanim") }; complexFabricatorWorkable.workingPstComplete = "working_pst_complete"; Methods mtd = new Methods(); /* Clay To Slime */ mtd.clayToSlime(); //* Corpses To Meal And Lime */ mtd.corpseToMeal(); /* Eggs To Lime */ mtd.limeCrushing(); /* Fossils To Lime And Sand */ mtd.fossilCrushing(); /* Mafic Rock To Regolith */ mtd.maficToRegolith(); /* Minerals To Sand Overhaul */ mtd.mineralsCrushing(); /* Ores To Refined */ mtd.oresToRefined(); /* Organic To Fert */ mtd.organicToFert(); /* Refined To Ores */ mtd.refinedToOres(); /* Salt To Table Salt */ mtd.saltCrushing(); /* Crush Ice */ mtd.snowCone(); return(false); }
public void Initialize(ComplexFabricator target) { if ((Object)target == (Object)null) { Debug.LogError("ComplexFabricator provided was null."); } else { targetFab = target; base.gameObject.SetActive(true); recipeMap = new Dictionary <GameObject, ComplexRecipe>(); recipeToggles.ForEach(delegate(GameObject rbi) { Object.Destroy(rbi.gameObject); }); recipeToggles.Clear(); GridLayoutGroup component = recipeGrid.GetComponent <GridLayoutGroup>(); switch (targetFab.sideScreenStyle) { case StyleSetting.ListResult: case StyleSetting.ListInput: case StyleSetting.ListInputOutput: { component.constraintCount = 1; GridLayoutGroup gridLayoutGroup2 = component; Vector2 cellSize2 = component.cellSize; gridLayoutGroup2.cellSize = new Vector2(262f, cellSize2.y); break; } case StyleSetting.ClassicFabricator: component.constraintCount = 128; component.cellSize = new Vector2(78f, 96f); buttonScrollContainer.minHeight = 100f; break; case StyleSetting.ListQueueHybrid: component.constraintCount = 1; component.cellSize = new Vector2(264f, 64f); buttonScrollContainer.minHeight = 66f; break; default: { component.constraintCount = 3; GridLayoutGroup gridLayoutGroup = component; Vector2 cellSize = component.cellSize; gridLayoutGroup.cellSize = new Vector2(116f, cellSize.y); break; } } int num = 0; ComplexRecipe[] recipes = targetFab.GetRecipes(); ComplexRecipe[] array = recipes; foreach (ComplexRecipe recipe in array) { bool flag = false; if (DebugHandler.InstantBuildMode) { flag = true; } else if (recipe.RequiresTechUnlock() && recipe.IsRequiredTechUnlocked()) { flag = true; } else if (target.GetRecipeQueueCount(recipe) != 0) { flag = true; } else if (AnyRecipeRequirementsDiscovered(recipe)) { flag = true; } else if (HasAnyRecipeRequirements(recipe)) { flag = true; } if (flag) { num++; Tuple <Sprite, Color> uISprite = Def.GetUISprite(recipe.ingredients[0].material, "ui", false); Tuple <Sprite, Color> uISprite2 = Def.GetUISprite(recipe.results[0].material, "ui", false); KToggle newToggle = null; GameObject entryGO; switch (target.sideScreenStyle) { case StyleSetting.ListInputOutput: case StyleSetting.GridInputOutput: { newToggle = Util.KInstantiateUI <KToggle>(recipeButtonMultiple, recipeGrid, false); entryGO = newToggle.gameObject; HierarchyReferences component2 = newToggle.GetComponent <HierarchyReferences>(); ComplexRecipe.RecipeElement[] ingredients = recipe.ingredients; foreach (ComplexRecipe.RecipeElement recipeElement in ingredients) { GameObject gameObject = Util.KInstantiateUI(component2.GetReference("FromIconPrefab").gameObject, component2.GetReference("FromIcons").gameObject, true); gameObject.GetComponent <Image>().sprite = Def.GetUISprite(recipeElement.material, "ui", false).first; gameObject.GetComponent <Image>().color = Def.GetUISprite(recipeElement.material, "ui", false).second; gameObject.gameObject.name = recipeElement.material.Name; } ComplexRecipe.RecipeElement[] results = recipe.results; foreach (ComplexRecipe.RecipeElement recipeElement2 in results) { GameObject gameObject2 = Util.KInstantiateUI(component2.GetReference("ToIconPrefab").gameObject, component2.GetReference("ToIcons").gameObject, true); gameObject2.GetComponent <Image>().sprite = Def.GetUISprite(recipeElement2.material, "ui", false).first; gameObject2.GetComponent <Image>().color = Def.GetUISprite(recipeElement2.material, "ui", false).second; gameObject2.gameObject.name = recipeElement2.material.Name; } break; } case StyleSetting.ListQueueHybrid: { newToggle = Util.KInstantiateUI <KToggle>(recipeButtonQueueHybrid, recipeGrid, false); entryGO = newToggle.gameObject; recipeMap.Add(entryGO, recipe); Image image = entryGO.GetComponentsInChildrenOnly <Image>()[2]; if (recipe.nameDisplay == ComplexRecipe.RecipeNameDisplay.Ingredient) { image.sprite = uISprite.first; image.color = uISprite.second; } else { image.sprite = uISprite2.first; image.color = uISprite2.second; } entryGO.GetComponentInChildren <LocText>().text = recipe.GetUIName(); bool flag2 = HasAllRecipeRequirements(recipe); image.material = ((!flag2) ? Assets.UIPrefabs.TableScreenWidgets.DesaturatedUIMaterial : Assets.UIPrefabs.TableScreenWidgets.DefaultUIMaterial); RefreshQueueCountDisplay(entryGO, targetFab); entryGO.GetComponent <HierarchyReferences>().GetReference <MultiToggle>("DecrementButton").onClick = delegate { target.DecrementRecipeQueueCount(recipe, false); RefreshQueueCountDisplay(entryGO, target); }; entryGO.GetComponent <HierarchyReferences>().GetReference <MultiToggle>("IncrementButton").onClick = delegate { target.IncrementRecipeQueueCount(recipe); RefreshQueueCountDisplay(entryGO, target); }; entryGO.gameObject.SetActive(true); break; } default: { newToggle = Util.KInstantiateUI <KToggle>(recipeButton, recipeGrid, false); entryGO = newToggle.gameObject; Image componentInChildrenOnly = newToggle.gameObject.GetComponentInChildrenOnly <Image>(); if (target.sideScreenStyle == StyleSetting.GridInput || target.sideScreenStyle == StyleSetting.ListInput) { componentInChildrenOnly.sprite = uISprite.first; componentInChildrenOnly.color = uISprite.second; } else { componentInChildrenOnly.sprite = uISprite2.first; componentInChildrenOnly.color = uISprite2.second; } break; } } if (targetFab.sideScreenStyle == StyleSetting.ClassicFabricator) { newToggle.GetComponentInChildren <LocText>().text = recipe.results[0].material.ProperName(); } else if (targetFab.sideScreenStyle != StyleSetting.ListQueueHybrid) { newToggle.GetComponentInChildren <LocText>().text = string.Format(UI.UISIDESCREENS.REFINERYSIDESCREEN.RECIPE_FROM_TO_WITH_NEWLINES, recipe.ingredients[0].material.ProperName(), recipe.results[0].material.ProperName()); } ToolTip component3 = entryGO.GetComponent <ToolTip>(); component3.toolTipPosition = ToolTip.TooltipPosition.Custom; component3.parentPositionAnchor = new Vector2(0f, 0.5f); component3.tooltipPivot = new Vector2(1f, 1f); component3.tooltipPositionOffset = new Vector2(-24f, 20f); component3.ClearMultiStringTooltip(); component3.AddMultiStringTooltip(recipe.GetUIName(), styleTooltipHeader); component3.AddMultiStringTooltip(recipe.description, styleTooltipBody); newToggle.onClick += delegate { ToggleClicked(newToggle); }; entryGO.SetActive(true); recipeToggles.Add(entryGO); } } if (recipeToggles.Count > 0) { LayoutElement component4 = buttonScrollContainer.GetComponent <LayoutElement>(); float num2 = (float)num; Vector2 sizeDelta = recipeButtonQueueHybrid.rectTransform().sizeDelta; component4.minHeight = Mathf.Min(451f, 2f + num2 * sizeDelta.y); subtitleLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.SUBTITLE); noRecipesDiscoveredLabel.gameObject.SetActive(false); } else { subtitleLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.NORECIPEDISCOVERED); noRecipesDiscoveredLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.NORECIPEDISCOVERED_BODY); noRecipesDiscoveredLabel.gameObject.SetActive(true); LayoutElement component5 = buttonScrollContainer.GetComponent <LayoutElement>(); Vector2 sizeDelta2 = noRecipesDiscoveredLabel.rectTransform.sizeDelta; component5.minHeight = sizeDelta2.y + 10f; } RefreshIngredientAvailabilityVis(); } }
private static void Postfix(ref ComplexFabricator __instance) { __instance.keepAdditionalTags.SetTag(MachinePartsConfig.TAG); }
public static bool Prefix(ComplexFabricator __instance, ref ComplexRecipe recipe, ref List <GameObject> __result) { if (recipe == GeneticSamplerConfig.RECIPE_RECOMBINATION) { Debug.Log("Should recombinate"); var ingredient_0 = recipe.ingredients[0]; Debug.Log(ingredient_0); float amount = ingredient_0.amount; var tag = ingredient_0.material; Storage storage = __instance.buildStorage; Debug.Log(amount); Debug.Log(tag); Debug.Log(storage.items.Count); DebugHelper.LogForEach(storage.items); for (int index = 0; index < storage.items.Count && (double)amount > 0.0; ++index) { GameObject item_0 = storage.items[index]; Debug.Log(item_0); Debug.Log(item_0.HasTag(tag)); if (!((UnityEngine.Object)item_0 == (UnityEngine.Object)null) && item_0.HasTag(tag)) { Debug.Log("About to add traits to add"); var traitsToAdd = GeneticTraits.GeneticTraits.ChooseTraitsFromEggToEgg(item_0).Select(Db.Get().traits.Get); //to the result List <GameObject> gameObjectList = new List <GameObject>(); SimUtil.DiseaseInfo diseaseInfo; diseaseInfo.count = 0; diseaseInfo.idx = (byte)0; float num1 = 0.0f; float num2 = 0.0f; foreach (ComplexRecipe.RecipeElement ingredient in recipe.ingredients) { num2 += ingredient.amount; } foreach (ComplexRecipe.RecipeElement ingredient in recipe.ingredients) { float num3 = ingredient.amount / num2; SimUtil.DiseaseInfo disease_info; float aggregate_temperature; __instance.buildStorage.ConsumeAndGetDisease(ingredient.material, ingredient.amount, out disease_info, out aggregate_temperature); if (disease_info.count > diseaseInfo.count) { diseaseInfo = disease_info; } num1 += aggregate_temperature * num3; } foreach (ComplexRecipe.RecipeElement result in recipe.results) { GameObject first = __instance.buildStorage.FindFirst(result.material); if ((UnityEngine.Object)first != (UnityEngine.Object)null) { Edible component = first.GetComponent <Edible>(); if ((bool)((UnityEngine.Object)component)) { ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, -component.Calories, StringFormatter.Replace((string)UI.ENDOFDAYREPORT.NOTES.CRAFTED_USED, "{0}", component.GetProperName()), (string)UI.ENDOFDAYREPORT.NOTES.CRAFTED_CONTEXT); } } switch (__instance.resultState) { case ComplexFabricator.ResultState.PassTemperature: case ComplexFabricator.ResultState.Heated: GameObject go = GameUtil.KInstantiate(Assets.GetPrefab(result.material), Grid.SceneLayer.Ore, (string)null, 0); int cell = Grid.PosToCell((KMonoBehaviour)__instance); go.transform.SetPosition(Grid.CellToPosCCC(cell, Grid.SceneLayer.Ore) + __instance.outputOffset); PrimaryElement component1 = go.GetComponent <PrimaryElement>(); component1.Units = result.amount; component1.Temperature = __instance.resultState != ComplexFabricator.ResultState.PassTemperature ? __instance.heatedTemperature : num1; go.SetActive(true); float num3 = result.amount / recipe.TotalResultUnits(); component1.AddDisease(diseaseInfo.idx, Mathf.RoundToInt((float)diseaseInfo.count * num3), "ComplexFabricator.CompleteOrder"); go.GetComponent <KMonoBehaviour>().Trigger(748399584, (object)null); var gtc = go.AddOrGet <GeneticTraitComponent>(); gtc.addTraits(traitsToAdd, item_0); gameObjectList.Add(go); if (__instance.storeProduced) { __instance.outStorage.Store(go, false, false, true, false); break; } break; case ComplexFabricator.ResultState.Melted: if (__instance.storeProduced) { float temperature = ElementLoader.GetElement(result.material).lowTemp + (float)(((double)ElementLoader.GetElement(result.material).highTemp - (double)ElementLoader.GetElement(result.material).lowTemp) / 2.0); __instance.outStorage.AddLiquid(ElementLoader.GetElementID(result.material), result.amount, temperature, (byte)0, 0, false, true); break; } break; } if (gameObjectList.Count > 0) { SymbolOverrideController component2 = __instance.GetComponent <SymbolOverrideController>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { KAnim.Build build = gameObjectList[0].GetComponent <KBatchedAnimController>().AnimFiles[0].GetData().build; KAnim.Build.Symbol symbol = build.GetSymbol((KAnimHashedString)build.name); if (symbol != null) { component2.TryRemoveSymbolOverride((HashedString)"output_tracker", 0); component2.AddSymbolOverride((HashedString)"output_tracker", symbol, 0); } else { Debug.LogWarning((object)(component2.name + " is missing symbol " + build.name)); } } } } __result = gameObjectList; } } return(false); } else { Debug.Log("Should NO recombinate"); return(true); } }
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 bool Prefix(ComplexFabricator __instance, Operational ___operational) { (__instance as LiquidCooledFueledRefinery)?.CheckCoolantIsTooHot(); return(___operational.IsOperational); }