public static void Patch() { // Add the techtype tank = TechTypeHandler.AddTechType("SolarOxygenTank", "Solar-powered Oxygen Tank", "An solar-powered oxygen tank which replenishes in the daylight!"); // Apply prefab PrefabHandler.RegisterPrefab(new TankPrefab()); // Add recipe CraftDataHandler.SetTechData(tank, new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.AdvancedWiringKit, 1), new Ingredient(TechType.EnameledGlass, 1), new Ingredient(TechType.Copper, 2), new Ingredient(TechType.Quartz, 2), new Ingredient(TechType.Pipe, 3), new Ingredient(TechType.PlasteelTank, 1), } }); // Add it to the crafting tree CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, tank, "Personal", "Equipment"); // Make the background purple CraftDataHandler.SetBackgroundType(tank, CraftData.BackgroundType.ExosuitArm); // Double it's crafting time CraftDataHandler.SetCraftingTime(tank, 6f); // Make it equipable in the tank slot CraftDataHandler.SetEquipmentType(tank, EquipmentType.Tank); // Make it take a lot of inventory space CraftDataHandler.SetItemSize(tank, 3, 3); // Start patching HarmonyInstance.Create("alexejheroytb.subnauticamods.solaroxygentank").PatchAll(Assembly.GetExecutingAssembly()); }
public virtual void Patch() { Atlas.Sprite sprite = null; if (IconFilename != null) { string iconfilePath = $"./QMods/{IconFilename}/Assets/{IconFilename}.png"; try { sprite = ImageUtils.LoadSpriteFromFile(iconfilePath); } catch { SNLogger.Log($"[{NameID}] ***ERROR! File [{iconfilePath}] not Found! "); } } else if (IconTechType != TechType.None) { try { sprite = GetResourceIcon(IconTechType); } catch { SNLogger.Log($"[{NameID}] ***ERROR! Resource TechType icon [{IconTechType.ToString()}] not Found! "); } } else { try { sprite = GetResourceIcon(PrefabTemplate); } catch { SNLogger.Log($"[{NameID}] ***ERROR! Resource template icon [{PrefabTemplate.ToString()}] not Found! "); } } TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, sprite, false); SpriteHandler.RegisterSprite(TechType, sprite); CraftTreeHandler.AddCraftingNode(FabricatorType, TechType, FabricatorTab); CraftDataHandler.SetTechData(TechType, GetRecipe()); CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType); CraftDataHandler.SetEquipmentType(TechType, TypeForEquipment); CraftDataHandler.SetQuickSlotType(TechType, TypeForQuickslot); CraftDataHandler.SetItemSize(TechType, ItemSize); CraftDataHandler.SetBackgroundType(TechType, BackgroundType); KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { TechType }, $"{FriendlyName} blueprint discovered!"); PrefabHandler.RegisterPrefab(this); }
protected void setBackgroundType(CraftData.BackgroundType backgroundType) => CraftDataHandler.SetBackgroundType(TechType, backgroundType);