Example #1
0
        private static void UpdateCollection(HashSet <TechType> compatibleTech, List <CbCore> toBeAdded)
        {
            if (toBeAdded.Count == 0)
            {
                return;
            }

            // Make sure all custom batteries are allowed in the battery charger
            for (int i = toBeAdded.Count - 1; i >= 0; i--)
            {
                CbCore cbCoreItem = toBeAdded[i];

                if (cbCoreItem.ExcludeFromChargers)
                {
                    continue;
                }

                TechType entry = cbCoreItem.TechType;

                if (compatibleTech.Contains(entry))
                {
                    continue;
                }

                compatibleTech.Add(entry);
            }
        }
Example #2
0
        public static void Patch()
        {
            QuickLogger.Info("Start patching. Version: " + QuickLogger.GetAssemblyVersion());

            try
            {
                CbCore.PatchCraftingTabs();
                PackReader.PatchTextPacks();

                // Packs from external mods are patched as they arrive.
                // They can still be patched in even after the harmony patches have completed.

                var harmony = HarmonyInstance.Create("com.custombatteries.mod");
                EnergyMixinPatcher.Patch(harmony);

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }