Example #1
0
    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);
    }
Example #2
0
        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);
            }
        }
Example #3
0
    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);
    }
Example #4
0
    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);
    }
    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);
    }
Example #6
0
        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 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);
    }
Example #8
0
            // 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);
                }
            }
Example #9
0
        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);
                }
            }
        }
Example #10
0
    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);
    }
    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);
    }
Example #12
0
        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);
            }
        }