Example #1
0
        private static void Postfix()
        {
            if (typeof(Database.Techs).GetField("TECH_GROUPING") == null)
            {
                Tech tech = Db.Get().Techs.TryGet(TechID);
                if (tech == null)
                {
                    return;
                }
                ICollection <string> list = (ICollection <string>)tech.GetType().GetField("unlockedItemIDs")?.GetValue(tech);
                if (list == null)
                {
                    return;
                }

                list.Add(Building.Config.LiquidBottlerConfig.ID);
                list.Add(Building.Config.LiquidBottleEmptierConfig.ID);
            }
            else
            {
                System.Reflection.FieldInfo   info = typeof(Database.Techs).GetField("TECH_GROUPING");
                Dictionary <string, string[]> dict = (Dictionary <string, string[]>)info.GetValue(null);
                dict[TechID].Append(Building.Config.LiquidBottlerConfig.ID);
                dict[TechID].Append(Building.Config.LiquidBottleEmptierConfig.ID);
                typeof(Database.Techs).GetField("TECH_GROUPING").SetValue(null, dict);
            }
        }
Example #2
0
        private static void Postfix()
        {
            CaiLib.Utils.StringUtils.AddBuildingStrings(
                Building.Config.LiquidBottlerConfig.ID,
                "Liquid Bottle filler",
                "Allow Duplicants to fetch bottled liquids for delivery to buildings.",
                "Automatically stores piped <link=\"ELEMENTSLIQUID\">Liquid</link> into bottles for manual transport."
                );
            CaiLib.Utils.StringUtils.AddBuildingStrings(
                Building.Config.LiquidBottleEmptierConfig.ID,
                "Liquid bottle emptier",
                "Allows emptying bottles directly to the pipe system.",
                "Automatically empties <link=\"ELEMENTSLIQUID\">Liquid</link> from bottles for pipe transport."
                );


            if (typeof(Database.Techs).GetField("TECH_GROUPING") == null)
            {
                Tech tech = Db.Get().Techs.TryGet(TechID);
                if (tech == null)
                {
                    return;
                }
                ICollection <string> list = (ICollection <string>)tech.GetType().GetField("unlockedItemIDs")?.GetValue(tech);
                if (list == null)
                {
                    return;
                }

                list.Add(Building.Config.LiquidBottlerConfig.ID);
                list.Add(Building.Config.LiquidBottleEmptierConfig.ID);
            }
            else
            {
                System.Reflection.FieldInfo   info = typeof(Database.Techs).GetField("TECH_GROUPING");
                Dictionary <string, string[]> dict = (Dictionary <string, string[]>)info.GetValue(null);
                dict[TechID].Append(Building.Config.LiquidBottlerConfig.ID);
                dict[TechID].Append(Building.Config.LiquidBottleEmptierConfig.ID);
                typeof(Database.Techs).GetField("TECH_GROUPING").SetValue(null, dict);
            }
        }
Example #3
0
 private static WebTechAttribute GetWebTechAttribute(Tech x)
 {
     return(x.GetType().GetCustomAttribute(typeof(WebTechAttribute)) as WebTechAttribute);
 }