/// <summary>
        /// Logs an exception with a detailed breakdown. This overload is used in building
        /// patches.
        /// </summary>
        /// <param name="e">The exception to log.</param>
        /// <param name="config">The building config that failed to load.</param>
        internal static void LogBuildingException(Exception e, IBuildingConfig config)
        {
            var cause = e.InnerException ?? e;

            try {
                var message = new StringBuilder(256);
                if (config != null)
                {
                    var type = config.GetType();
                    message.Append("Error when creating building ");
                    message.Append(type.Name);
                    // Name and shame!
                    var mod = ModDebugRegistry.Instance.OwnerOfType(type);
                    if (mod != null)
                    {
                        message.Append(" from mod ");
                        message.Append(mod.ModName);
                        ModLoadHandler.CrashingMod = mod;
                    }
                    message.AppendLine(":");
                }
                message.Append(GetExceptionLog(cause, new HarmonyMethodCache()));
                LogError(message.ToString());
            } catch {
                // Ensure it gets logged at all costs
                BaseLogException(cause, null);
                throw;
            }
        }
Esempio n. 2
0
            public static void Postfix(IBuildingConfig __instance, GameObject go)
            {
                var T = __instance.GetType();

                if (T == typeof(OilWellCapConfig))
                {
                    AddOilWell(go);
                }
            }
Esempio n. 3
0
            public static void Postfix(IBuildingConfig __instance, GameObject go)
            {
                var T = __instance.GetType();

                if (T == typeof(GourmetCookingStationConfig))
                {
                    AddGourmetCooking(go);
                }
            }
            public static void Postfix(IBuildingConfig __instance, GameObject go)
            {
                var T = __instance.GetType();

                if (T == typeof(OilRefineryConfig))
                {
                    AddOilRefinery(go);
                }
                else if (T == typeof(FertilizerMakerConfig))
                {
                    AddFertilizerMaker(go);
                }
                //else if (T == typeof(EthanolDistilleryConfig))
                //    AddEthanolDistillery(go);
                else if (T == typeof(PolymerizerConfig))
                {
                    AddPolymer(go);
                }
            }
Esempio n. 5
0
            public static void Postfix(IBuildingConfig __instance, GameObject go)
            {
                var T = __instance.GetType();

                if (T == typeof(GeneratorConfig))
                {
                    AddCoalGenerator(go);
                }
                else if (T == typeof(WoodGasGeneratorConfig))
                {
                    AddWoodGenerator(go);
                }
                else if (T == typeof(PetroleumGeneratorConfig))
                {
                    AddOilGenerator(go);
                }
                else if (T == typeof(MethaneGeneratorConfig))
                {
                    AddGasGenerator(go);
                }
            }
Esempio n. 6
0
            public static void Postfix(IBuildingConfig __instance, GameObject go)
            {
                var T = __instance.GetType();

                if (T == typeof(AlgaeHabitatConfig))
                {
                    AddAlgaeHabitat(go);
                }
                else if (T == typeof(ElectrolyzerConfig))
                {
                    AddElectrolyzer(go);
                }
                else if (T == typeof(MineralDeoxidizerConfig))
                {
                    AddMineralDeoxidizer(go);
                }
                else if (T == typeof(RustDeoxidizerConfig))
                {
                    AddRust(go);
                }
            }