internal static void PatchAll() { // Create a new crafting tree tab for batteries and power cells var tabIcon = ImageUtils.LoadSpriteFromFile(@"./Qmods/" + MgBatteryAssets + @"/CraftingTabIcon.png"); CraftTreeHandler.AddTabNode(CraftTree.Type.Fabricator, BatteryPowerCraftingTab, "Batteries and Power Cells", tabIcon, ResourcesCraftingTab, ElectronicsCraftingTab); // Remove the original batteries from the Electronics tab CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.Battery.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PowerCell.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonBattery.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonPowerCell.ToString()); // And add them back in on the new Batteries and PowerCells tab CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Battery, PathToNewTab); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PowerCell, PathToNewTab); var config = new DeepConfig(); config.ReadConfigFile(); var lithiumBattery = new DeepBattery(config.BatteryCapacity); lithiumBattery.Patch(); var lithiumPowerCell = new DeepPowerCell(lithiumBattery); lithiumPowerCell.Patch(); // Add the Ion Batteries after the Deep Batteries CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonBattery, PathToNewTab); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonPowerCell, PathToNewTab); }
private static void PatchCraftables() { var config = new DeepConfig(); config.ReadConfigFile(); var lithiumBattery = new DeepBattery(config.BatteryCapacity); lithiumBattery.Patch(); var lithiumPowerCell = new DeepPowerCell(lithiumBattery); lithiumPowerCell.Patch(); }
public DeepPowerCell(DeepBattery lithiumBattery) : base(classId: "DeepPowerCell", friendlyName: "Deep Power Cell", description: "A longer lasting power cell created from rare materials and stronger chemicals.") { // Because the DeepLithiumPowerCell is dependent on the DeepLithiumBattery regarding its blueprint, // we'll go ahead and add this little safety check here if (!lithiumBattery.IsPatched) { lithiumBattery.Patch(); } // This event will be invoked after all patching done by the Craftable class is complete OnFinishedPatching += SetStaticTechType; }
internal static void PatchAll() { string mainDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // Create a new crafting tree tab for batteries and power cells string assetsFolder = Path.Combine(mainDirectory, "Assets"); string pathToIcon = Path.Combine(assetsFolder, @"CraftingTabIcon.png"); Atlas.Sprite tabIcon = ImageUtils.LoadSpriteFromFile(pathToIcon); CraftTreeHandler.AddTabNode(CraftTree.Type.Fabricator, BatteryPowerCraftingTab, "Batteries and Power Cells", tabIcon, ResourcesCraftingTab, ElectronicsCraftingTab); // Remove the original batteries from the Electronics tab CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.Battery.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PowerCell.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonBattery.ToString()); CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResourcesCraftingTab, ElectronicsCraftingTab, TechType.PrecursorIonPowerCell.ToString()); // And add them back in on the new Batteries and PowerCells tab CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Battery, PathToNewTab); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PowerCell, PathToNewTab); var config = new DeepConfig(); config.ReadConfigFile(mainDirectory); QuickLogger.Info($"Selected PowerStyle in config: {config.SelectedPowerStyle} - (Battery Capacity:{Mathf.RoundToInt(config.BatteryCapacity)})"); QuickLogger.Info("Patching DeepBattery"); var lithiumBattery = new DeepBattery(config.BatteryCapacity); lithiumBattery.Patch(); QuickLogger.Info("Patching DeepPowerCell"); var lithiumPowerCell = new DeepPowerCell(lithiumBattery); lithiumPowerCell.Patch(); // Add the Ion Batteries after the Deep Batteries CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonBattery, PathToNewTab); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonPowerCell, PathToNewTab); }