public static void Patch() { darktest = AssetBundle.LoadFromFile(Environment.CurrentDirectory + "/QMods/techpistol/Assets"); Atlas.Sprite Icon = new Atlas.Sprite(darktest.LoadAsset <Sprite>("Icon")); var gun = TechTypeHandler.AddTechType("techpistol", "tech pistol", "tech pistol", true); SpriteHandler.RegisterSprite(gun, Icon); GunPrefab gunper = new GunPrefab("techpistol", "WorldEntities/Tools/techpistol", gun); PrefabHandler.RegisterPrefab(gunper); CraftDataHandler.SetEquipmentType(gun, EquipmentType.Hand); var techData = new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.SeaTreaderPoop, 1), new Ingredient(TechType.TitaniumIngot, 2), new Ingredient(TechType.Lubricant, 1), new Ingredient(TechType.EnameledGlass, 3), } }; CraftDataHandler.SetTechData(gun, techData); CraftDataHandler.SetCraftingTime(gun, 5f); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, gun, "Personal", "Tools", "techpistol"); CraftDataHandler.SetItemSize(gun, 2, 2); }
public void Patch() { if (this.IsPatched) { return; } this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, this.UnlocksAtStart); if (!this.UnlocksAtStart) { KnownTechHandler.SetAnalysisTechEntry(this.RequiredForUnlock, new TechType[] { this.TechType }); } if (this.Sprite == null) { this.Sprite = ImageUtils.LoadSpriteFromFile(IOUtilities.Combine(ExecutingFolder, this.PluginFolder, this.IconFileName)); } SpriteHandler.RegisterSprite(this.TechType, this.Sprite); CraftDataHandler.SetTechData(this.TechType, GetBlueprintRecipe()); CraftDataHandler.AddToGroup(TechGroup.Resources, TechCategory.Electronics, this.TechType); CraftDataHandler.SetEquipmentType(this.TechType, this.ChargerType); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, this.TechType, this.StepsToFabricatorTab); PrefabHandler.RegisterPrefab(this); AddToList(); this.IsPatched = true; }
public ExteriorPlantPotPrefab(string plantPotId, string displayName, string tooltip, string basePotPath, TechType basePotTechType) : base(plantPotId, $"Submarine/Build/{plantPotId}") { this.basePlantPotPath = basePotPath; // Register the TechType TechType = TechTypeHandler.AddTechType(plantPotId, displayName, tooltip, false); // Register the Sprite(icon) of the new TechType with the icon of the base plant pot. SpriteHandler.RegisterSprite(TechType, SpriteManager.Get(basePotTechType)); // Set the recipe of the TechType. CraftDataHandler.SetTechData(TechType, new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.Titanium, 2) } }); // Add it as a buildable. CraftDataHandler.AddBuildable(TechType); // Add it to the group in the PDA. CraftDataHandler.AddToGroup(TechGroup.ExteriorModules, TechCategory.ExteriorOther, TechType); // Set it to unlock after the base TechType is unlocked. KnownTechHandler.SetAnalysisTechEntry(basePotTechType, new List <TechType>() { TechType }); // Register this prefab. PrefabHandler.RegisterPrefab(this); }
public static void Patch() { bundle = AssetBundle.LoadFromFile("QMods/AlienRifle2/alienrifle"); rifleTech = TechTypeHandler.AddTechType("AlienRifleWeapon", "Alien Rifle", "An ancient weapon found in an alien facility", ImageUtils.LoadSpriteFromFile("QMods/AlienRifle2/Assets/alienrifle.png"), false); PrefabHandler.RegisterPrefab(new RiflePrefab("AlienRifleWeapon", "WorldEntities/Tools/AlienRifle", rifleTech)); CraftDataHandler.SetEquipmentType(rifleTech, EquipmentType.Hand); TechData data = new TechData(); data.Ingredients = new List <Ingredient>() { new Ingredient(TechType.StasisRifle, 1), new Ingredient(TechType.Magnetite, 3), new Ingredient(TechType.PlasteelIngot, 2), new Ingredient(TechType.PrecursorIonCrystal, 1) }; data.craftAmount = 1; CraftDataHandler.SetTechData(rifleTech, data); CraftDataHandler.SetItemSize(rifleTech, 2, 2); CraftTreeHandler.AddTabNode(CraftTree.Type.Workbench, "StasisRifleMods", "Stasis Rifle Upgrades", ImageUtils.LoadSpriteFromFile("QMods/AlienRifle2/Assets/stasisrifleupgrades.png")); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Workbench, rifleTech, "StasisRifleMods", "Alien Rifle"); HarmonyInstance inst = HarmonyInstance.Create("Kylinator25.AlienRifle.V2"); inst.PatchAll(typeof(MainPatch).Assembly); }
public void Patch() { TechType = TechTypeHandler.AddTechType(ID, DisplayName, Tooltip, RequiredForUnlock == TechType.None); if (RequiredForUnlock != TechType.None) { KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[] { TechType }); } if (Sprite == null) { SpriteHandler.RegisterSprite(TechType, $"./QMods/SeamothClawArm/Assets/{ID}.png"); } else { SpriteHandler.RegisterSprite(TechType, Sprite); } switch (Fabricator) { case CraftTree.Type.Workbench: CraftDataHandler.AddToGroup(TechGroup.Workbench, TechCategory.Workbench, TechType, AddAfter); break; case CraftTree.Type.SeamothUpgrades: CraftDataHandler.AddToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, TechType, AddAfter); break; } CraftDataHandler.SetEquipmentType(TechType, EquipmentType.SeamothModule); CraftDataHandler.SetTechData(TechType, GetTechData()); CraftTreeHandler.AddCraftingNode(Fabricator, TechType, StepsToTab); }
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()); }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 public void PrePatch() { AssetBundle.LoadFromFile(Path.Combine("Qmods" + "EggMod" + "eggs.assets")); TechTypeHandler.AddTechType("GhostRayBlueEgg", "Ghost Ray Egg", "this is the egg from the ghostRay"); TechTypeHandler.AddTechType("GhostRayBlueEggUndiscovered", "GhostRayBlueEggUndiscovered", "ghostrayegg"); TechTypeHandler.AddTechType("GhostRayRedEgg", "GhostRayRedEgg", "ghost Ray Red Egg"); TechTypeHandler.AddTechType("GhostRayRedEggUndiscovered", "GhostRayRedEggUndiscovered", "GhostRayRedEggUndiscovered"); Dictionary <TechType, float> dictionary = typeof(BaseBioReactor).GetField("charge", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) as Dictionary <TechType, float>; WaterParkCreature.waterParkCreatureParameters[TechType.GhostRayBlue] = new WaterParkCreatureParameters(0.05f, 0.2f, 0.5f, 1f, false); WaterParkCreature.waterParkCreatureParameters[TechType.GhostRayRed] = new WaterParkCreatureParameters(0.05f, 0.2f, 0.5f, 1f, false); WaterParkCreature.waterParkCreatureParameters[TechType.ReaperLeviathan] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false); WaterParkCreature.waterParkCreatureParameters[TechType.GhostLeviathan] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false); WaterParkCreature.waterParkCreatureParameters[TechType.GhostLeviathanJuvenile] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false); WaterParkCreature.waterParkCreatureParameters[TechType.SeaDragon] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false); WaterParkCreature.creatureEggs[TechType.GhostRayBlue] = (TechType)9999; WaterParkCreature.creatureEggs[TechType.GhostRayRed] = (TechType)6969; CraftDataHandler.SetItemSize(TechType.GhostRayBlue, 3, 3); CraftDataHandler.SetItemSize(TechType.GhostRayRed, 3, 3); GhostRayBlueEggPrefab ghostRayBlueEggPrefab = new GhostRayBlueEggPrefab("WorldEntities/Eggs/GhostRayBlueEgg", "GhostRayBlueEggID"); ghostRayBlueEggPrefab.LoadResource(); PrefabHandler.RegisterPrefab(this); GhostRayRedEggPrefab ghostRayRedEggPrefab = new GhostRayRedEggPrefab("WorldEntities/Eggs/GhostRayRedEgg", "GhostRayRedEggID"); ghostRayRedEggPrefab.LoadResource(); CustomResourceManager.customResources.Add(ghostRayRedEggPrefab); }
public void Patch() { TechType = TechTypeHandler.AddTechType(ID, DisplayName, Tooltip, RequiredForUnlock == TechType.Seaglide); if (RequiredForUnlock != TechType.None) { KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[] { TechType.PowerGlide }); } if (Sprite == null) { SpriteHandler.RegisterSprite(TechType, $"./QMods/BetterSeaglide/Assets/powerglide.png"); } else { SpriteHandler.RegisterSprite(TechType, Sprite); } /*switch (Fabricator) * { * case CraftTree.Type.Fabricator: * CraftDataHandler.AddToGroup(TechGroup.Machines, TechCategory.Machines, TechType, AddAfter); * break; * * }*/ //CraftDataHandler.AddToGroup(TechGroup.Machines, TechCategory.Machines, TechType, AddAfter); CraftDataHandler.SetEquipmentType(TechType, EquipmentType.Hand); CraftDataHandler.SetTechData(TechType, GetTechData()); CraftDataHandler.SetQuickSlotType(TechType, QuickSlotType.Selectable); //CraftTreeHandler.AddTabNode(Fabricator, "Deployables", "Better Seaglide", SpriteManager.Get(BetterSeaglide)); CraftTreeHandler.AddCraftingNode(Fabricator, TechType, StepsToTab); }
protected virtual void Patch() { this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, RequiredForUnlock == TechType.None); if (!ModulesEnabled) // Even if the options have this be disabled, { return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched } if (RequiredForUnlock == TechType.None) { KnownTechHandler.UnlockOnStart(this.TechType); } else { KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { this.TechType }, $"{FriendlyName} blueprint discovered!"); } PrefabHandler.RegisterPrefab(this); SpriteHandler.RegisterSprite(this.TechType, $"./QMods/MoreCyclopsUpgrades/Assets/{NameID}.png"); CraftDataHandler.SetTechData(this.TechType, GetRecipe()); if (AddToCraftTree) { CraftTreeHandler.AddCraftingNode(Fabricator, this.TechType, FabricatorTabs); } CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.CyclopsModule); CraftDataHandler.AddToGroup(TechGroup.Cyclops, TechCategory.CyclopsUpgrades, this.TechType); SetStaticTechTypeID(this.TechType); }
public virtual void Patch() { Atlas.Sprite sprite; if (NameUsingForFiles != null) { sprite = ImageUtils.LoadSpriteFromFile($"./QMods/{NameUsingForFiles}/Assets/{NameUsingForFiles}.png"); } else { sprite = GetResourceIcon(PrefabTemplate); } 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); KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { TechType }, $"{FriendlyName} blueprint discovered!"); PrefabHandler.RegisterPrefab(this); }
public BuildableHelper(string id, string displayname, string tooltip, TechGroup group, TechCategory category, TechType after = TechType.None, bool unlockonstart = true, Atlas.Sprite atlasSprite = null, Sprite unitySprite = null) { if (atlasSprite != null && unitySprite != null) { throw new ArgumentException("Neither atlasSprite nor unitySprite are null!"); } if (atlasSprite != null) { techType = TechTypeHandler.AddTechType(id, displayname, tooltip, atlasSprite, unlockonstart); } else if (unitySprite != null) { techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unitySprite, unlockonstart); } else { techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unlockonstart); } CraftDataHandler.AddBuildable(techType); if (after == TechType.None) { CraftDataHandler.AddToGroup(group, category, techType); } else { CraftDataHandler.AddToGroup(group, category, techType, after); } }
public void Patch(bool auxConsolesEnabled) { this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, false); if (!auxConsolesEnabled) // Even if the options have this be disabled, { return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched } LanguageHandler.SetLanguageLine(HandOverText, "Access Auxiliary Cyclops Upgrade Console"); CraftDataHandler.AddBuildable(this.TechType); CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType); PrefabHandler.RegisterPrefab(this); var recipe = new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>(new Ingredient[3] { new Ingredient(TechType.AdvancedWiringKit, 1), new Ingredient(TechType.Titanium, 2), new Ingredient(TechType.Lead, 1), }) }; CraftDataHandler.SetTechData(this.TechType, recipe); SpriteHandler.RegisterSprite(this.TechType, @"./QMods/MoreCyclopsUpgrades/Assets/AuxCyUpgradeConsole.png"); KnownTechHandler.SetAnalysisTechEntry(TechType.CyclopsHullModule1, new TechType[1] { this.TechType }, $"{FriendlyName} blueprint discovered!"); }
protected override void Patch() { DepletedNuclearModuleID = TechTypeHandler.AddTechType(DepletedNameID, FriendlyName, Description, false); RefillNuclearModuleID = TechTypeHandler.AddTechType(RefillNameID, "Reload Cyclops Nuclear Module", "Reload a Depleted Cyclops Nuclear Module with a Reactor Rod", false); if (CyclopsModule.ModulesEnabled) // Even if the options have this be disabled, { // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched SpriteHandler.RegisterSprite(DepletedNuclearModuleID, $"./QMods/MoreCyclopsUpgrades/Assets/DepletedCyclopsNuclearModule.png"); SpriteHandler.RegisterSprite(RefillNuclearModuleID, $"./QMods/MoreCyclopsUpgrades/Assets/CyclopsNuclearModule.png"); CraftDataHandler.SetTechData(RefillNuclearModuleID, GetRecipe()); KnownTechHandler.SetAnalysisTechEntry(TechType.BaseNuclearReactor, new TechType[1] { RefillNuclearModuleID }, "Reload of cyclops nuclear module available."); PrefabHandler.RegisterPrefab(this); PrefabHandler.RegisterPrefab(new RefillNuclearModule(RefillNuclearModuleID)); LanguageHandler.SetLanguageLine(DepletedEventKey, "Nuclear Reactor Module depleted"); } this.NukFabricator.Patch(CyclopsModule.ModulesEnabled); }
protected TechType register(string name, string description, Atlas.Sprite sprite) { TechType = TechTypeHandler.AddTechType(ClassID, name, description, sprite, false); registerPrefabAndTechData(); return(TechType); }
internal Fabricator_Decorations() : base("", "") { this.ClassID = DecorationsFabID; this.PrefabFileName = $"Submarine/Build/{DecorationsFabID}"; this.TechType = TechTypeHandler.AddTechType(DecorationsFabID, LanguageHelper.GetFriendlyWord("DecorationsFabricatorName"), LanguageHelper.GetFriendlyWord("DecorationsFabricatorDescription"), true); }
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); }
private void Patch(bool auxConsolesEnabled) { if (!auxConsolesEnabled) // Even if the options have this be disabled, { this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, false); return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched } Patch(); }
// for using already existing fragments (will be used for this tech if fragment own tech is unlocked) protected void setFragmentToUnlock(TechType fragTechType, int fragCount, float scanTime = 1f) { string fragTechID = ClassID + "_Fragment"; TechType substFragTechType = TechTypeHandler.AddTechType(fragTechID, "", ""); LanguageHelper.substituteString(fragTechID, fragTechType.AsString()); // use name from original fragment UnlockTechHelper.setFragmentTypeToUnlock(TechType, fragTechType, substFragTechType, fragCount, scanTime); }
internal void Patch(bool auxConsolesEnabled) { if (!auxConsolesEnabled) // Even if the options have this be disabled, { QuickLogger.Info("Auxiliary Upgrade Console disabled by config settings"); this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, false); return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched } QuickLogger.Debug("Patching Auxiliary Upgrade Console"); base.Patch(); }
public static void AddTechTypes() { _1_Previous = TechTypeHandler.AddTechType("MP3Player_Controls_Previous", "Previous", "Previous song"); _2_1_Play = TechTypeHandler.AddTechType("MP3Player_Controls_Play", "Play/Pause", "Current status: <color=#C21807FF>paused</color>"); _2_2_Pause = TechTypeHandler.AddTechType("MP3Player_Controls_Pause", "Pause/Pause", "Current status: <color=#4CBB17FF>playing</color>"); _3_Next = TechTypeHandler.AddTechType("MP3Player_Controls_Next", "Next", "Next song"); _4_1_EnableRepeat = TechTypeHandler.AddTechType("MP3Player_Controls_EnableRepeat", "Repeat", "Current status: <color=#C21807FF>disabled</color>"); _4_2_DisableRepeat = TechTypeHandler.AddTechType("MP3Player_Controls_DisableRepeat", "Repeat", "Current status: <color=#4CBB17FF>enabled</color>"); _5_1_EnableShuffle = TechTypeHandler.AddTechType("MP3Player_Controls_EnableShuffle", "Shuffle", "Current status: <color=#C21807FF>disabled</color>"); _5_2_DisableShuffle = TechTypeHandler.AddTechType("MP3Player_Controls_DisableShuffle", "Shuffle", "Current status: <color=#4CBB17FF>enabled</color>"); _6_ExitInterface = TechTypeHandler.AddTechType("MP3Player_Controls_ExitInterface", "Exit", "Close the interface"); }
protected override void Patch() { if (!ModulesEnabled || !ModConfig.Settings.EnableBioReactors) // Even if the options have this be disabled, { this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, RequiredForUnlock == TechType.None); return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched } base.Patch(); LanguageHandler.SetLanguageLine(MaxBoostKey, "Maximum boost to cyclops bioreactors achieved"); LanguageHandler.SetLanguageLine(CannotRemoveKey, "Cannot remove BioReactor Booster while bioreactor is too full"); }
public static void Patch() { TechType techType = TechTypeHandler.AddTechType("CyclopsInceptionModule", "Cyclops Inception Module", "Uses precursor technology to shrink any other cyclops near the docking hatch, allowing them to dock."); CraftDataHandler.SetEquipmentType(techType, EquipmentType.CyclopsModule); CraftDataHandler.AddToGroup(TechGroup.Cyclops, TechCategory.CyclopsUpgrades, techType); UpgradeManager.RegisterReusableHandlerCreator(() => new InceptionUpgrade(techType)); Hooks.Update += InceptionManager.UpdateUndockTime; HarmonyHelper.Patch(); }
public void Patch() { ModdedItems.Initialize(); // Create new Craft Tree Type CreateCustomTree(out CraftTree.Type craftType); this.TreeTypeID = craftType; // Create a new TechType for new fabricator this.TechType = TechTypeHandler.AddTechType( internalName: NameID, displayName: FriendlyName, tooltip: "Construct vehicle upgrade modules from the comfort of your favorite habitat or cyclops.", sprite: ImageUtils.LoadSpriteFromFile(@"./QMods/VModFabricator/Assets/VModFabIcon.png"), unlockAtStart: false); // Create a Recipie for the new TechType var customFabRecipe = new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>(new Ingredient[4] { new Ingredient(TechType.Titanium, 2), new Ingredient(TechType.ComputerChip, 1), new Ingredient(TechType.Diamond, 1), new Ingredient(TechType.Lead, 1), }) }; // Add the new TechType to the buildables CraftDataHandler.AddBuildable(this.TechType); // Add the new TechType to the group of Interior Module buildables CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType); LanguageHandler.SetLanguageLine(HandOverText, "Use Vehicle Module Fabricator"); // Set the buildable prefab PrefabHandler.RegisterPrefab(this); // Associate the recipie to the new TechType CraftDataHandler.SetTechData(this.TechType, customFabRecipe); // Set which blueprints unlock the VMod Fabricator string unlockMessage = $"{FriendlyName} blueprint discovered!"; var unlockThis = new TechType[1] { this.TechType }; KnownTechHandler.SetAnalysisTechEntry(TechType.Workbench, unlockThis, unlockMessage); KnownTechHandler.SetAnalysisTechEntry(TechType.BaseUpgradeConsole, unlockThis, unlockMessage); KnownTechHandler.SetAnalysisTechEntry(TechType.Cyclops, unlockThis, unlockMessage); }
/// <summary> /// Loads item sizes for plasteel ingot /// </summary> public static void PlasteelIngot() { var _x = 1; var _y = 1; var _e = true; var languageName = "Plasteel Ingot"; try { Log.Debug(languageName, Status.Start); if (ConfigCheck(languageName)) { var Config = MI.Config.cfgfile; Config.TryGet(ref _x, languageName, "Size", "x"); Config.TryGet(ref _y, languageName, "Size", "y"); Config.TryGet(ref _e, languageName, "Enabled"); } Log.Debug(languageName, "Adding TechType..."); var sprite = SpriteManager.Get(TechType.Lithium); var techType = TechTypeHandler.AddTechType("MIPlasteel", languageName, "Turn one plasteel ingot into 1 titanium ingot and 2 lithium", sprite); Log.Debug(languageName, "Adding TechData..."); var techDataB = new TechData() { craftAmount = 0, Ingredients = new List <Ingredient>() { new Ingredient(TechType.PlasteelIngot, 1) }, LinkedItems = new List <TechType>() { TechType.TitaniumIngot, TechType.Lithium, TechType.Lithium } }; Log.Debug(languageName, "Linking TechData with TechType..."); CraftDataHandler.SetTechData(techType, techDataB); Log.Debug(languageName, "TechData linked with TechType"); Log.Debug(languageName, "Adding Fabricator node..."); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, techType, "Resources", "Unpack"); Log.Debug(languageName, "Fabricator node added"); Log.Debug(languageName, "Applying item size..."); CraftDataHandler.SetItemSize(TechType.PlasteelIngot, new Vector2int(_x, _y)); Log.Debug(languageName, "Item size applied"); Log.Debug(languageName, Status.Stop); } catch (Exception e) { Log.e(e); } }
private void Patch(bool fullPatch) { if (fullPatch) { base.Patch(); } else { this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, false); } TechTypeID = this.TechType; }
public void Patch() { // Register this Prefab with SMLHelper PrefabHandler.RegisterPrefab(this); // Create a new TechType for new Buildable this.TechType = TechTypeHandler.AddTechType ( NameID, FriendlyName, "This machine gathers resources from underground veins and pulls them to the surface.", ImageUtils.LoadSpriteFromFile(@"./BaseDrillMod/BaseDrillIcon.png"), true ); // Add the new TechType to the buildables CraftDataHandler.AddBuildable(this.TechType); // Add the new TechType to the group of Interior Module buildables CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType); LanguageHandler.SetLanguageLine(HandOverText, "Resource Drill"); // Create new instance of TechData and apply the recipie to it TechData techData = new TechData { craftAmount = 1, Ingredients = new List <Ingredient>(new Ingredient[] { new Ingredient(TechType.TitaniumIngot, 2), new Ingredient(TechType.Diamond, 2), new Ingredient(TechType.Lithium, 4), new Ingredient(TechType.AdvancedWiringKit, 1), new Ingredient(TechType.Lubricant, 1) }) }; // Associate TechType and TechData CraftDataHandler.SetTechData(base.TechType, techData); // Set which blueprints unlock the Item string unlockMessage = $"{FriendlyName} blueprint discovered!"; var unlockThis = new TechType[1] { this.TechType }; KnownTechHandler.SetAnalysisTechEntry(TechType.BaseMapRoom, unlockThis, unlockMessage); BaseDrillModule instance = new BaseDrillModule(); instance.GetGameObject(); }
public static void Load() { try { assetBundle = AssetBundle.LoadFromFile("./QMods/AncientSword/Assets/ancient_sword"); if (assetBundle == null) { Debug.Log("[AncientSword] AssetBundle is NULL!"); } else { Debug.Log($"[AncientSword] AssetBundle loaded, name: {assetBundle.name}"); } Atlas.Sprite swordIcon = null; swordIcon = ImageUtils.LoadSpriteFromFile($"./QMods/AncientSword/Assets/AncientSword.png"); SwordTechType = TechTypeHandler.AddTechType("AncientSword", "Ancient Sword", "An ancient sword from Earth.\nFound in an ancient Precursor facility."); SpriteHandler.RegisterSprite(SwordTechType, swordIcon); SwordPrefab swordPrefab = new SwordPrefab("AncientSword", "WorldEntities/Tools/AncientSword", SwordTechType); PrefabHandler.RegisterPrefab(swordPrefab); var techData = new TechData { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.Titanium, 2), new Ingredient(TechType.Copper, 2) }, }; CraftDataHandler.SetTechData(SwordTechType, techData); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, SwordTechType, new string[] { "Personal", "Tools", "AncientSword" }); CraftDataHandler.SetItemSize(SwordTechType, new Vector2int(2, 2)); CraftDataHandler.SetEquipmentType(SwordTechType, EquipmentType.Hand); //HarmonyInstance.Create("Subnautica.AncientSword.mod").PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception ex) { Debug.LogException(ex); } }
public static void Patch() { try { bund = AssetBundle.LoadFromFile(Environment.CurrentDirectory + "/QMods/AlienRifle/alienrifle"); Atlas.Sprite rifleIcon = null; try { rifleIcon = ImageUtils.LoadSpriteFromFile("./QMods/AlienRifle/RifleIcon.PNG", TextureFormat.BC7); } catch { Console.WriteLine("[AlienRifle] Couldn't convert rifle sprite to Atlas.Sprite "); } ARtech = TechTypeHandler.AddTechType("AlienRifle", "Alien Rifle", "A strange weapon found in an ancient facility"); if (rifleIcon != null) { SpriteHandler.RegisterSprite(ARtech, rifleIcon); } RiflePrefab prefab = new RiflePrefab("AlienRifle", "WorldEntities/Tools/AlienRifle", ARtech); PrefabHandler.RegisterPrefab(prefab); var techData = new TechData { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.PlasteelIngot, 2), new Ingredient(TechType.Nickel, 5), new Ingredient(TechType.AdvancedWiringKit, 1), new Ingredient(TechType.Glass, 5) }, }; CraftDataHandler.SetTechData(ARtech, techData); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, ARtech, new string[] { "Personal", "Tools", "AlienRifle" }); CraftDataHandler.SetItemSize(ARtech, new Vector2int(2, 2)); CraftDataHandler.SetEquipmentType(ARtech, EquipmentType.Hand); HarmonyInstance inst = HarmonyInstance.Create("com.kylinator.alienrifle"); inst.PatchAll(Assembly.GetExecutingAssembly()); Debug.Log("[AlienRifle] Loading Alien Rifle finished!"); } catch (Exception e) { Debug.Log("[AlienRifle] Failed to load Alien Rifle: " + e.Message + e.StackTrace); } }
public virtual void Patch() { TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, ImageUtils.LoadSpriteFromFile($"./QMods/LaserCannon/Assets/{NameID}.png"), false); CraftTreeHandler.AddCraftingNode(FabricatorType, TechType, FabricatorTab); CraftDataHandler.SetTechData(TechType, GetRecipe()); PrefabHandler.RegisterPrefab(this); KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { TechType }, $"{FriendlyName} blueprint discovered!"); CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType); }
public virtual void Patch_B() { Atlas.Sprite sprite = null; if (IconFilename != null) { try { sprite = ImageUtils.LoadSpriteFromFile($"./QMods/{IconFilename}/Assets/{IconFilename}.png"); } catch { SNLogger.Log($"[{_ClassID}] ***ERROR! File [{IconFilename}.png] not Found! "); } } else if (IconTechType != TechType.None) { try { sprite = GetResourceIcon(IconTechType); } catch { SNLogger.Log($"[{_ClassID}] ***ERROR! Resource TechType icon [{IconTechType.ToString()}] not Found! "); } } else { try { sprite = GetResourceIcon(PrefabTemplate); } catch { SNLogger.Log($"[{_ClassID}] ***ERROR! Resource template icon [{PrefabTemplate.ToString()}] not Found! "); } } TechType = TechTypeHandler.AddTechType(_ClassID, _FriendlyName, _Description, sprite, false); SpriteHandler.RegisterSprite(TechType, sprite); CraftDataHandler.SetTechData(TechType, GetRecipe()); CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType); KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { TechType }, $"{_FriendlyName} blueprint discovered!"); PrefabHandler.RegisterPrefab(this); }