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; }
/// <summary> /// Initializes a new <see cref="Spawnable"/>, the basic class needed for any item that can be spawned into the Subnautica game world. /// </summary> /// <param name="classId">The main internal identifier for this item. Your item's <see cref="TechType"/> will be created using this name.</param> /// <param name="friendlyName">The name displayed in-game for this item whether in the open world or in the inventory.</param> /// <param name="description">The description for this item; Typically seen in the PDA, inventory, or crafting screens.</param> protected Spawnable(string classId, string friendlyName, string description) : base(classId, $"{classId}Prefab") { if (string.IsNullOrEmpty(classId)) { Logger.Log($"ClassID for Spawnables must be a non-empty value.", LogLevel.Error); throw new ArgumentException($"Error patching Spawnable"); } FriendlyName = friendlyName; Description = description; CorePatchEvents += () => { PrefabHandler.RegisterPrefab(this); SpriteHandler.RegisterSprite(TechType, GetItemSprite()); if (!SizeInInventory.Equals(defaultSize)) { CraftDataHandler.SetItemSize(TechType, SizeInInventory); } if (EntityInfo != null && BiomesToSpawnIn != null) { LootDistributionHandler.AddLootDistributionData(this, BiomesToSpawnIn, EntityInfo); } else if (EntityInfo != null) { WorldEntityDatabaseHandler.AddCustomInfo(ClassID, EntityInfo); } }; }
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!"); }
public void RegisterFloraFabricator(List <IDecorationItem> decorationItems) { if (this.IsRegistered == false) { // Create new Craft Tree Type CreateCustomTree(out CraftTree.Type craftType, decorationItems); this.TreeTypeID = craftType; // 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, TechType.Fabricator); // Register handover text LanguageHandler.SetLanguageLine(HandOverText, LanguageHelper.GetFriendlyWord(HandOverText)); // Unlock at start KnownTechHandler.UnlockOnStart(this.TechType); // Set the buildable prefab PrefabHandler.RegisterPrefab(this); // Register sprite SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset <Sprite>("fabricator_icon_green")); // Load texture this.ColoredTexture = AssetsHelper.Assets.LoadAsset <Texture2D>("submarine_fabricator_green"); // Associate the recipie to the new TechType CraftDataHandler.SetTechData(this.TechType, this.Recipe); this.IsRegistered = true; } }
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); }
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); }
// for adding group node public static void addNode(CraftTree.Type treeType, string id, string displayName, string path, string idAfter, TechType spriteTechType) { getNodeList(treeType).Add(new CraftNode(id, path, idAfter)); LanguageHandler.SetLanguageLine($"{treeType.ToString()}Menu_{id}", displayName); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, $"{treeType.ToString()}_{id}", SpriteManager.Get(spriteTechType)); }
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 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 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() { 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 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 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 IEnumerator RegisterSpriteAsync() { while (!SpriteManager.hasInitialized) { yield return(new WaitForSecondsRealtime(1)); } SpriteHandler.RegisterSprite(TechType, GetItemSprite()); yield break; }
public new void OnFinishedPatching() { CraftDataHandler.RemoveFromGroup(TechGroup.Workbench, TechCategory.Workbench, this.TechType); CraftDataHandler.AddToGroup(TechGroup.Workbench, TechCategory.Workbench, this.TechType, TechType.HighCapacityTank); SpriteHandler.RegisterSprite(this.TechType, SpriteManager.Get(TechType.HighCapacityTank)); CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Tank); CraftDataHandler.SetItemSize(this.TechType, 3, 4); CraftDataHandler.SetCraftingTime(this.TechType, 5); }
public new void OnFinishedPatching() { CraftDataHandler.RemoveFromGroup(TechGroup.Workbench, TechCategory.Workbench, this.TechType); CraftDataHandler.AddToGroup(TechGroup.Workbench, TechCategory.Workbench, this.TechType, TechType.SwimChargeFins); SpriteHandler.RegisterSprite(this.TechType, SpriteManager.Get(TechType.SwimChargeFins)); CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Foots); CraftDataHandler.SetItemSize(this.TechType, 2, 3); CraftDataHandler.SetCraftingTime(this.TechType, 5); techType = TechType; }
private static void InventorySetup() { LanguageHandler.SetTechTypeName(TechType.SpineEel, "River Prowler"); LanguageHandler.SetTechTypeTooltip(TechType.SpineEel, "A fast, agile predator discovered at great depths"); Sprite spineEel = ImageUtils.LoadSpriteFromFile(Path.Combine(Main.AssetsFolder, "SpineEel.png")); if (spineEel != null) { SpriteHandler.RegisterSprite(TechType.SpineEel, spineEel); } CraftDataHandler.SetItemSize(TechType.SpineEel, new Vector2int(3, 3)); }
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 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); } }
private void AdditionalPatching() { TechTypeID = this.TechType; LanguageHandler.SetLanguageLine(StorageLabelKey, "Cyclops Nuclear Reactor Rods"); LanguageHandler.SetLanguageLine(DepletedMessageKey, "A nuclear reactor rod has depleted in the Cyclops"); LanguageHandler.SetLanguageLine(OnHoverPoweredKey, "Cyclops Nuclear Reactor\n {0} ({1}/{2})"); LanguageHandler.SetLanguageLine(OnHoverNoPowerKey, "Cyclops Nuclear Reactor\nNo Power"); LanguageHandler.SetLanguageLine(OverLimitKey, "Too many active nuclear reactors"); LanguageHandler.SetLanguageLine(NoPowerKey, "No Power"); LanguageHandler.SetLanguageLine(UpgradedMsgKey, "Cyclops nuclear reactor has been enhanced"); LanguageHandler.SetLanguageLine(CannotRemoveKey, "Too many active rods in nuclear reactor to remove enhancement"); LanguageHandler.SetLanguageLine(InactiveRodKey, "Inactive"); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, PowerIndicatorIconID, DirectoryHelper.GrabFromAssetsDirectory("CyclopsNuclearReactor", "CyNukReactorHUD.png")); }
private void RegisterBasics() { PrefabHandler.RegisterPrefab(this); string assetsFolder = this.AssetsFolder; if (string.IsNullOrEmpty(assetsFolder)) { Logger.Log($"AssetsFolder property for Spawnable instance of {this.ClassID} must have a non-empty value.", LogLevel.Error); throw new Exception($"Error patching Spawnable:{this.ClassID}"); } SpriteHandler.RegisterSprite(this.TechType, $"./QMods/{assetsFolder.Trim('/')}/{this.IconFileName}"); }
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); }
// This patch is handled by the Nuclear Charger internal void Patch(bool nukFabricatorEnabled) { // Create new Craft Tree Type CreateCustomTree(out CraftTree.Type craftType); TreeTypeID = craftType; // Create a new TechType for new fabricator this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, "A specialized fabricator for safe handling of radioactive energy sources.", false); if (!nukFabricatorEnabled) // 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 } // 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.Magnetite, 1), new Ingredient(TechType.Lead, 2), }) }; // 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); // Set the buildable prefab PrefabHandler.RegisterPrefab(this); LanguageHandler.SetLanguageLine(HandOverText, "Use Nuclear Fabricator"); // Set the custom sprite for the Habitat Builder Tool menu SpriteHandler.RegisterSprite(this.TechType, @"./QMods/MoreCyclopsUpgrades/Assets/NuclearFabricatorI.png"); // Associate the recipie to the new TechType CraftDataHandler.SetTechData(this.TechType, customFabRecipe); KnownTechHandler.SetAnalysisTechEntry(TechType.BaseNuclearReactor, new TechType[1] { this.TechType }, $"{FriendlyName} blueprint discovered!"); }
//public static TechType RepulsionKnifeID; public static void Patch() { RoseLogger.PatchStart(modName, "1.0.0"); try { Atlas.Sprite obsidianKnifeIcon = null; obsidianKnifeIcon = ImageUtils.LoadSpriteFromFile($"./QMods/MoreKnives/Assets/ObsidianKnife.png"); ObsidianKnifeID = TechTypeHandler.AddTechType("obsidianknife", "Obsidian Knife", "An enhanced knife that exudes a rapidly cooling magma, forming a sharp obsidian edge."); SpriteHandler.RegisterSprite(ObsidianKnifeID, obsidianKnifeIcon); KnifePrefab obsidianKnifePrefab = new KnifePrefab("obsidianknife", "WorldEntities/Tools/ObsidianKnife", ObsidianKnifeID); DropItems.PatchDropItems(); var techDataObsidian = new TechData { craftAmount = 1, Ingredients = new List <Ingredient>() { new Ingredient(TechType.Knife, 1), new Ingredient(DropItems.ObsidianFlakeID, 1), }, }; CraftDataHandler.SetTechData(ObsidianKnifeID, techDataObsidian); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Workbench, ObsidianKnifeID, new string[] { "Survival Knife", "obsidianknife" }); CraftDataHandler.SetItemSize(ObsidianKnifeID, new Vector2int(1, 1)); CraftDataHandler.SetEquipmentType(ObsidianKnifeID, EquipmentType.Hand); PrefabHandler.RegisterPrefab(obsidianKnifePrefab); var harmony = HarmonyInstance.Create("rose.moreknives.mod"); harmony.PatchAll(Assembly.GetExecutingAssembly()); RoseLogger.PatchComplete(modName); } catch (Exception ex) { RoseLogger.PatchFailed(modName, ex); } }
/// <summary> /// Initializes a new <see cref="Spawnable"/>, the basic class needed for any item that can be spawned into the Subnautica game world. /// </summary> /// <param name="classId">The main internal identifier for this item. Your item's <see cref="TechType"/> will be created using this name.</param> /// <param name="friendlyName">The name displayed in-game for this item whether in the open world or in the inventory.</param> /// <param name="description">The description for this item; Typically seen in the PDA, inventory, or crafting screens.</param> protected Spawnable(string classId, string friendlyName, string description) : base(classId, $"{classId}Prefab") { if (string.IsNullOrEmpty(classId)) { Logger.Log($"ClassID for Spawnables must be a non-empty value.", LogLevel.Error); throw new ArgumentException($"Error patching Spawnable"); } FriendlyName = friendlyName; Description = description; CorePatchEvents += () => { PrefabHandler.RegisterPrefab(this); #if SUBNAUTICA SpriteHandler.RegisterSprite(TechType, GetItemSprite()); #elif BELOWZERO CoroutineHost.StartCoroutine(RegisterSpriteAsync()); #endif if (!SizeInInventory.Equals(defaultSize)) { CraftDataHandler.SetItemSize(TechType, SizeInInventory); } if (EntityInfo != null) { if (BiomesToSpawnIn != null) { LootDistributionHandler.AddLootDistributionData(this, BiomesToSpawnIn, EntityInfo); } else { WorldEntityDatabaseHandler.AddCustomInfo(ClassID, EntityInfo); } } if (CoordinatedSpawns != null) { foreach (var(position, eulerAngles) in CoordinatedSpawns) { CoordinatedSpawnsHandler.RegisterCoordinatedSpawn(new SpawnInfo(TechType, position, eulerAngles)); } } }; }
private static void InventoryAndWaterParkSetup() { LanguageHandler.SetTechTypeName(TechType.Rockgrub, "RockGrub"); LanguageHandler.SetTechTypeTooltip(TechType.Rockgrub, "A small, luminescent scavenger"); Sprite rockgrub = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "RockGrub.png")); if (rockgrub != null) { SpriteHandler.RegisterSprite(TechType.Rockgrub, rockgrub); } CraftDataHandler.SetItemSize(TechType.Rockgrub, new Vector2int(1, 1)); WaterParkCreature.waterParkCreatureParameters[TechType.Rockgrub] = new WaterParkCreatureParameters(0.03f, 0.7f, 1f, 1f, true); CraftData.IsAllowed(TechType.Rockgrub); BioReactorHandler.SetBioReactorCharge(TechType.Rockgrub, 350f); }
public static void Patch() { try { // Hook up with harmony var harmony = HarmonyInstance.Create("com.standpeter.seamothhabitatbuilder"); harmony.PatchAll(Assembly.GetExecutingAssembly()); // Create TechType and register its inventory icon SeamothBuilderModule = TechTypeHandler.AddTechType("SeamothBuilderModule", "Seamoth habitat builder", "Allows the Seamoth to perform habitat construction tasks."); SpriteHandler.RegisterSprite(SeamothBuilderModule, "QMods/SeamothHabitatBuilder/Assets/SeamothBuilderModule.png"); // Create blueprint TechData blueprint = new TechData { craftAmount = 1, Ingredients = new List <Ingredient>(2) { new Ingredient(TechType.Builder, 1), new Ingredient(TechType.AdvancedWiringKit, 1) } }; CraftDataHandler.SetTechData(SeamothBuilderModule, blueprint); // Make the item craftable const string subTree = "Seamoth modules"; CraftTreeHandler.AddCraftingNode(CraftTree.Type.SeamothUpgrades, SeamothBuilderModule, subTree); KnownTechHandler.UnlockOnStart(SeamothBuilderModule); // Set how the new item gets used CraftDataHandler.AddToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, SeamothBuilderModule); CraftDataHandler.SetQuickSlotType(SeamothBuilderModule, QuickSlotType.Selectable); CraftDataHandler.SetEquipmentType(SeamothBuilderModule, EquipmentType.SeamothModule); // Register the prefab for the item ModPrefab prefab = new SeamothBuilderPrefab("SeamothBuilder", "WorldEntities/Tools/SeamothBuilderModule", SeamothBuilderModule); PrefabHandler.RegisterPrefab(prefab); Console.WriteLine("[SeamothHabitatBuilder] Succesfully patched!"); } catch (Exception e) { Console.WriteLine("[SeamothHabitatBuilder] Caught exception! " + e.InnerException.Message); Console.WriteLine(e.InnerException.StackTrace); } }
private void AdditionalPatching() { TechTypeID = this.TechType; LanguageHandler.SetLanguageLine(StorageLabelKey, "Cyclops Nuclear Reactor Rods"); LanguageHandler.SetLanguageLine(DepletedMessageKey, "A nuclear reactor rod has depleted in the Cyclops"); LanguageHandler.SetLanguageLine(OnHoverPoweredKey, "Cyclops Nuclear Reactor\n {0} ({1}/{2})"); LanguageHandler.SetLanguageLine(OnHoverNoPowerKey, "Cyclops Nuclear Reactor\nNo Power"); LanguageHandler.SetLanguageLine(OverLimitKey, "Too many active nuclear reactors"); LanguageHandler.SetLanguageLine(NoPowerKey, "No Power"); LanguageHandler.SetLanguageLine(UpgradedMsgKey, "Cyclops nuclear reactor has been enhanced"); LanguageHandler.SetLanguageLine(CannotRemoveKey, "Too many active rods in nuclear reactor to remove enhancement"); LanguageHandler.SetLanguageLine(InactiveRodKey, "Inactive"); string executingLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string assetsFolder = Path.Combine(executingLocation, "Assets"); string filePath = Path.Combine(assetsFolder, "CyNukReactorHUD.png"); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, PowerIndicatorIconID, filePath); }
internal KitFabricator(List <TechType> clonedRoomKits, List <TechType> clonedCorridorKits, List <TechType> clonedModuleKits, List <TechType> clonedUtilityKits) : base("PurpleKitFabricator", "Base Kit Fabricator", "Used to compress Base construction materials into a Construction Kit") { ClonedRoomKits = clonedRoomKits; ClonedCorridorKits = clonedCorridorKits; ClonedModuleKits = clonedModuleKits; ClonedUtilityKits = clonedUtilityKits; OnFinishedPatching += () => { Root.CraftTreeCreation += CreateCraftingTree; LanguageHandler.SetLanguageLine(string.Format(LangFormat, KitFab, "RoomsMenu"), "Rooms"); LanguageHandler.SetLanguageLine(string.Format(LangFormat, KitFab, "CorridorMenu"), "Corridors"); LanguageHandler.SetLanguageLine(string.Format(LangFormat, KitFab, "ModuleMenu"), "Modules"); LanguageHandler.SetLanguageLine(string.Format(LangFormat, KitFab, "UtilityMenu"), "Utilities"); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, string.Format(SpriteFormat, KitFab, "RoomsMenu"), SpriteManager.Get(TechType.BaseRoom)); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, string.Format(SpriteFormat, KitFab, "CorridorMenu"), SpriteManager.Get(TechType.BaseCorridorX)); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, string.Format(SpriteFormat, KitFab, "ModuleMenu"), SpriteManager.Get(TechType.BaseBioReactor)); SpriteHandler.RegisterSprite(SpriteManager.Group.Category, string.Format(SpriteFormat, KitFab, "UtilityMenu"), SpriteManager.Get(TechType.BaseHatch)); }; }
private static void SetupIngredientsInventorySettings() { WaterParkCreature.waterParkCreatureParameters[TechType.ReaperLeviathan] = new WaterParkCreatureParameters(0.01f, 0.06f, 1f, 3f, false); WaterParkCreature.waterParkCreatureParameters[TechType.GhostLeviathan] = new WaterParkCreatureParameters(0.01f, 0.06f, 1f, 3f, false); WaterParkCreature.waterParkCreatureParameters[TechType.Warper] = new WaterParkCreatureParameters(0.05f, 0.2f, 1f, 3f, false); LanguageHandler.SetTechTypeName(TechType.ReaperLeviathan, "Reaper Leviathan"); LanguageHandler.SetTechTypeTooltip(TechType.ReaperLeviathan, "The Reaper Leviathan is an aggressive leviathan class species usually found swimming in large open areas."); LanguageHandler.SetTechTypeName(TechType.Warper, "Warper"); LanguageHandler.SetTechTypeTooltip(TechType.Warper, "The Warper, or the Self-Warping Quarantine Enforcer Unit as named by the Precursors, is a bio-mechanical life form created by the Precursor race to hunt infected lifeforms."); LanguageHandler.SetTechTypeName(TechType.GhostLeviathan, "Ghost Leviathan"); LanguageHandler.SetTechTypeTooltip(TechType.GhostLeviathan, "While the Ghost Leviathan is bigger then a Reaper Leviathan its aggression is territorial in nature, not predatory"); Sprite reaper = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "reaper_icon.png")); if (reaper != null) { SpriteHandler.RegisterSprite(TechType.ReaperLeviathan, reaper); } Sprite ghost = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "ghost_icon.png")); if (ghost != null) { SpriteHandler.RegisterSprite(TechType.GhostLeviathan, ghost); } Sprite warper = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "warper_icon.png")); if (warper != null) { SpriteHandler.RegisterSprite(TechType.Warper, warper); } CraftDataHandler.SetItemSize(TechType.ReaperLeviathan, new Vector2int(5, 5)); CraftDataHandler.SetItemSize(TechType.GhostLeviathan, new Vector2int(6, 6)); CraftDataHandler.SetItemSize(TechType.Warper, new Vector2int(3, 3)); }