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 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 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); }
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 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 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 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; } }
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 HorizontalWallLocker() : base("horizontalwalllocker", "Horizontal Wall Locker", "Small, wall-mounted storage solution.") { OnFinishedPatching += () => { CraftDataHandler.RemoveFromGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType); CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType, TechType.SmallLocker); }; }
private void PatchTechDataEntry() { CraftDataHandler.SetTechData(TechType, GetBlueprintRecipe()); if (GroupForPDA != TechGroup.Uncategorized) { List <TechCategory> categories = new List <TechCategory>(); CraftData.GetBuilderCategories(GroupForPDA, categories); if (categories.Contains(CategoryForPDA)) { CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType); } else { Logger.Error($"Failed to add {TechType} to {GroupForPDA}/{CategoryForPDA} as it is not a registered combination."); } } if (EncyclopediaEntryData != null) { PDAEncyclopediaHandler.AddCustomEntry(EncyclopediaEntryData); } if (!UnlockedAtStart) { var unlockTech = RequiredForUnlock == TechType.None? this.TechType: RequiredForUnlock; KnownTechHandler.SetAnalysisTechEntry(unlockTech, new TechType[1] { TechType }, DiscoverMessageResolved); if (CompoundTechsForUnlock != null && CompoundTechsForUnlock.Count > 0) { KnownTechHandler.SetCompoundUnlock(this.TechType, CompoundTechsForUnlock); } if (AddScannerEntry) { PDAScanner.EntryData entryData = new PDAScanner.EntryData() { key = unlockTech, blueprint = TechType, destroyAfterScan = DestroyFragmentOnScan, isFragment = true, locked = true, scanTime = TimeToScanFragment, totalFragments = FragmentsToScan }; if (EncyclopediaEntryData != null) { entryData.encyclopedia = EncyclopediaEntryData.key; } PDAHandler.AddCustomScannerEntry(entryData); } } }
protected void addToGroup(TechGroup group, TechCategory category, TechType after = TechType.None) { CraftDataHandler.AddToGroup(group, category, TechType, after); if (group >= TechGroup.BasePieces && group <= TechGroup.Miscellaneous) // little hack { CraftDataHandler.AddBuildable(TechType); } }
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); }
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 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); }
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; }
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 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); }
/// <summary> /// Initializes a new instance of the <seealso cref="Craftable"/> <see cref="CyclopsUpgrade"/> class.<para/> /// Any item created with this class with automatically be equipable in the Cyclops. /// </summary> /// <param name="classId">The main internal identifier for this item. Your item's <see cref="T: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 CyclopsUpgrade(string classId, string friendlyName, string description) : base(classId, friendlyName, description) { base.OnFinishedPatching += () => { if (this.SortAfter == TechType.None) { CraftDataHandler.AddToGroup(this.GroupForPDA, this.CategoryForPDA, this.TechType); } else { CraftDataHandler.AddToGroup(this.GroupForPDA, this.CategoryForPDA, this.TechType, this.SortAfter); } }; }
// 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!"); }
private void Patch() { if (IsPatched) { return; // Already patched. Skip all this. } if (Prerequisite != null && !Prerequisite.IsPatched) { Prerequisite.Patch(); // Go and patch the prerequisite craftable first } PrePatch(); // Run any prepatch overrides if (PatchTechTypeOnly) // Register just the TechType to preserve the ID. { this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, false); } else // Full patching { this.TechType = TechTypeHandler.AddTechType( internalName: NameID, displayName: FriendlyName, tooltip: Description, sprite: ImageUtils.LoadSpriteFromFile($"./QMods/UpgradedVehicles/Assets/{NameID}.png"), unlockAtStart: false); CraftTreeHandler.AddCraftingNode(FabricatorType, this.TechType, FabricatorTab); CraftDataHandler.SetTechData(this.TechType, GetRecipe()); PrefabHandler.RegisterPrefab(this); if (Config.ForceUnlockAtStart) { KnownTechHandler.UnlockOnStart(this.TechType); } else { KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] { this.TechType }, $"{FriendlyName} blueprint discovered!"); } CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, this.TechType); } PostPatch(); // Run any postpatch overrides IsPatched = true; }
private void PatchTechDataEntry() { CraftDataHandler.SetTechData(this.TechType, GetBlueprintRecipe()); CraftDataHandler.AddToGroup(this.GroupForPDA, this.CategoryForPDA, this.TechType); if (this.UnlockedAtStart) { KnownTechHandler.UnlockOnStart(this.TechType); } else { KnownTechHandler.SetAnalysisTechEntry(this.RequiredForUnlock, new TechType[1] { this.TechType }, $"{this.FriendlyName} blueprint discovered!"); } }
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); } }
public static void Inject() { try { bundle = AssetBundle.LoadFromFile("./QMods/Manta/mantabundle"); GameObject manta = new GameObject("mantaconsole"); Object.DontDestroyOnLoad(manta); MantaConsole mant = manta.AddComponent <MantaConsole>(); foreach (MeshRenderer rend in mant.obj.GetComponentsInChildren <MeshRenderer>()) { rend.material.shader = Shader.Find("MarmosetUBER"); } //make the model mantaTech = TechTypeHandler.AddTechType("MantaModel", "Miniature Manta Submarine", "A model of the concept Manta Submarine"); MantaPrefab prefab = new MantaPrefab("MantaModel", "Submarine/Build/MantaModel", mantaTech); PrefabHandler.RegisterPrefab(prefab); TechData helper = new TechData() { Ingredients = new List <Ingredient>() { new Ingredient(TechType.Titanium, 2) } }; CraftDataHandler.SetTechData(mantaTech, helper); CraftDataHandler.AddBuildable(mantaTech); CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, mantaTech); } catch (Exception e) { Console.WriteLine("[MantaMod] Mod Loading Failed: " + e.Message + e.StackTrace); StackTrace st = new StackTrace(e, true); int line = st.GetFrame(st.FrameCount - 1).GetFileLineNumber(); Console.WriteLine("[MantaMod] Error occurred in line: " + line); } }
public void Patch(CraftTree.Type craftTreeType) { TreeTypeID = craftTreeType; CraftDataHandler.SetTechData(TechType, new TechData() { Ingredients = new List <Ingredient> { new Ingredient(TechType.Titanium, 2), new Ingredient(TechType.ComputerChip, 1), new Ingredient(TechType.Diamond, 1), new Ingredient(TechType.Lead, 1), } }); CraftDataHandler.AddBuildable(TechType); CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, TechType, TechType.Fabricator); LanguageHandler.SetLanguageLine("UseCompressor", "Use Vehicle Module Fabricator"); PrefabHandler.RegisterPrefab(this); }
public static void Patch() { bundle = AssetBundle.LoadFromFile(Path.Combine(Environment.CurrentDirectory, "QMods/Precursor Fabricator/fabricatorassets")); string assetFolder = Path.Combine(Environment.CurrentDirectory, "QMods/Precursor Fabricator/Assets"); TechType fabricator = TechTypeHandler.AddTechType("AlienFab", "Precursor Fabricator", "A device capable of fabricating materials of alien origin"); PrefabHandler.RegisterPrefab(new FabricatorPrefab("AlienFab", "WorldEntities/AlienFabricator", fabricator)); SpriteHandler.RegisterSprite(fabricator, Path.Combine(assetFolder, "PrecursorFabricator.png")); TechType ingot = TechTypeHandler.AddTechType("PrecursorIngot", "Precursor Alloy Ingot", "A super-dense, electronically active bar of alien metal"); PrefabHandler.RegisterPrefab(new IngotPrefab("PrecursorIngot", "WorldEntities/PrecursorIngot", ingot)); SpriteHandler.RegisterSprite(ingot, Path.Combine(assetFolder, "PrecursorIngot.png")); CraftDataHandler.AddBuildable(fabricator); CraftDataHandler.AddToGroup(TechGroup.InteriorPieces, TechCategory.InteriorPiece, fabricator); CraftDataHandler.SetCraftingTime(fabricator, 2f); TechData data = new TechData(new Ingredient(TechType.PlasteelIngot, 2), new Ingredient(TechType.PrecursorIonCrystal, 2), new Ingredient(TechType.Kyanite, 1)); CraftDataHandler.SetTechData(fabricator, data); TechData ingotData = new TechData(new Ingredient(TechType.PlasteelIngot, 6), new Ingredient(TechType.PrecursorIonCrystal, 1)); ingotData.craftAmount = 1; CraftDataHandler.SetTechData(ingot, ingotData); root = CraftTreeHandler.CreateCustomCraftTreeAndType("PrecursorFabricator", out fabType); root.AddCraftingNode(ingot); if (TechTypeHandler.TryGetModdedTechType("IonFragment", out TechType depletedCube)) { root.AddCraftingNode(depletedCube); } }
public static void Patch() { // Create new Craft Tree Type CreateCustomTree(out CraftTree.Type craftType); HModTreeType = craftType; // Create a new TechType for new fabricator HModFabTechType = TechTypeHandler.AddTechType(CustomFabAndTreeID, FriendlyName, "Construct Player upgrade modules So you can survive more deadly woonds, or even deliver them yourself.", ImageUtils.LoadSpriteFromFile(@"./QMods/HealthModuleMod/Assets/MissingFabricator.png"), true); // Create a Recipie for the new TechType var customFabRecipe = new TechData() { craftAmount = 1, Ingredients = new List <Ingredient>(new Ingredient[3]//State you are using 3 ingredients { new Ingredient(TechType.Titanium, 1), new Ingredient(TechType.ComputerChip, 1), new Ingredient(TechType.FiberMesh, 2), //State what ingredients you are using. }) }; // Add the new TechType to the buildables CraftDataHandler.AddBuildable(HModFabTechType); // Add the new TechType to the group of Interior Module buildables CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, HModFabTechType); LanguageHandler.SetLanguageLine(HandOverText, "Use Vehicle Module Fabricator"); // Set the buildable prefab PrefabHandler.RegisterPrefab(new HModFabricatorModulePrefab(CustomFabAndTreeID, HModFabTechType)); // Associate the recipie to the new TechType CraftDataHandler.SetTechData(HModFabTechType, customFabRecipe); string unlockMessage = $"{FriendlyName} blueprint discovered!"; SMLHelper.CustomSpriteHandler.customSprites.Add(new SMLHelper.CustomSprite(TechType.Terraformer, ImageUtils.LoadSpriteFromFile(@"./QMods/HealthModuleMod/Assets/TerraFormer.png"))); var toUnlock = new TechType[1] { TechType.DiamondBlade }; KnownTechHandler.SetAnalysisTechEntry(TechType.Diamond, toUnlock, unlockMessage); var toUnlock1 = new TechType[1] { HModFabTechType }; KnownTechHandler.SetAnalysisTechEntry(TechType.FiberMesh, toUnlock1, unlockMessage); var toUnlock2 = new TechType[1] { TechType.Terraformer }; KnownTechHandler.SetAnalysisTechEntry(TechType.Melon, toUnlock2, unlockMessage); var toUnlock3 = new TechType[1] { TechType.BaseUpgradeConsole }; KnownTechHandler.SetAnalysisTechEntry(TechType.Terraformer, toUnlock3, unlockMessage); //KnownTechHandler.SetAnalysisTechEntry(TechType.Cyclops, toUnlock, unlockMessage); }
private void MakeEquipable() { CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.CyclopsModule); CraftDataHandler.AddToGroup(TechGroup.Cyclops, TechCategory.CyclopsUpgrades, this.TechType); }
// Token: 0x06000005 RID: 5 RVA: 0x00002098 File Offset: 0x00000298 public static void Patch() { Logger.Log("Started Patching BonesharkEgg"); QPatch.egg1tt = TechTypeHandler.AddTechType("Boneshark Egg", "Boneshark Egg", "Required to hatch: Spotted Dockleaf."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg1tt); LanguageHandler.SetTechTypeTooltip(TechType.BonesharkEgg, "Required to hatch: Spotted Dockleaf"); KnownTechHandler.UnlockOnStart(QPatch.egg1tt); Atlas.Sprite sprite = SpriteManager.Get(TechType.BonesharkEgg); SpriteHandler.RegisterSprite(QPatch.egg1tt, sprite); Logger.Log("Started Patching CrabsnakeEgg"); QPatch.egg2tt = TechTypeHandler.AddTechType("Crabsnake Egg", "Crabsnake Egg", "Required to hatch: Jellyshroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg2tt); LanguageHandler.SetTechTypeTooltip(TechType.CrabsnakeEgg, "Required to hatch: Jellyshroom."); KnownTechHandler.UnlockOnStart(QPatch.egg2tt); Atlas.Sprite sprite2 = SpriteManager.Get(TechType.CrabsnakeEgg); SpriteHandler.RegisterSprite(QPatch.egg2tt, sprite2); Logger.Log("Started Patching CrabsquidEgg"); QPatch.egg3tt = TechTypeHandler.AddTechType("Crabsquid Egg", "Crabsquid Egg", "Required to hatch: Bloodvine."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg3tt); LanguageHandler.SetTechTypeTooltip(TechType.CrabsquidEgg, "Required to hatch: Bloodvine."); KnownTechHandler.UnlockOnStart(QPatch.egg3tt); Atlas.Sprite sprite3 = SpriteManager.Get(TechType.CrabsquidEgg); SpriteHandler.RegisterSprite(QPatch.egg3tt, sprite3); Logger.Log("Started Patching CrashfishEgg"); QPatch.egg4tt = TechTypeHandler.AddTechType("Crashfish Egg", "Crashfish Egg", "Required to hatch: Spiked Horn Grass."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg4tt); LanguageHandler.SetTechTypeTooltip(TechType.CrashEgg, "Required to hatch: Spiked Horn Grass."); KnownTechHandler.UnlockOnStart(QPatch.egg4tt); Atlas.Sprite sprite4 = SpriteManager.Get(TechType.CrashEgg); SpriteHandler.RegisterSprite(QPatch.egg4tt, sprite4); Logger.Log("Started Patching GasopodEgg"); QPatch.egg5tt = TechTypeHandler.AddTechType("Gasopod Egg", "Gasopod Egg", "Required to hatch: Creepvine."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg5tt); LanguageHandler.SetTechTypeTooltip(TechType.GasopodEgg, "Required to hatch: Creepvine."); KnownTechHandler.UnlockOnStart(QPatch.egg5tt); Atlas.Sprite sprite5 = SpriteManager.Get(TechType.GasopodEgg); SpriteHandler.RegisterSprite(QPatch.egg5tt, sprite5); Logger.Log("Started Patching JellyrayEgg"); QPatch.egg6tt = TechTypeHandler.AddTechType("Jellyray Egg", "Jellyray Egg", "Required to hatch: Jellyshroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg6tt); LanguageHandler.SetTechTypeTooltip(TechType.JellyrayEgg, "Required to hatch: Jellyshroom."); KnownTechHandler.UnlockOnStart(QPatch.egg6tt); Atlas.Sprite sprite6 = SpriteManager.Get(TechType.JellyrayEgg); SpriteHandler.RegisterSprite(QPatch.egg6tt, sprite6); Logger.Log("Started Patching LavaLizardEgg"); QPatch.egg7tt = TechTypeHandler.AddTechType("Lavalizard Egg", "Lavalizard Egg", "Required to hatch: Deep Shroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg7tt); LanguageHandler.SetTechTypeTooltip(TechType.LavaLizardEgg, "Required to hatch: Deep Shroom."); KnownTechHandler.UnlockOnStart(QPatch.egg7tt); Atlas.Sprite sprite7 = SpriteManager.Get(TechType.LavaLizardEgg); SpriteHandler.RegisterSprite(QPatch.egg7tt, sprite7); Logger.Log("Started Patching MesmerEgg"); QPatch.egg8tt = TechTypeHandler.AddTechType("Mesmer Egg", "Mesmer Egg", "Required to hatch: Violet Beau."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg8tt); LanguageHandler.SetTechTypeTooltip(TechType.MesmerEgg, "Required to hatch: Violet Beau."); KnownTechHandler.UnlockOnStart(QPatch.egg8tt); Atlas.Sprite sprite8 = SpriteManager.Get(TechType.MesmerEgg); SpriteHandler.RegisterSprite(QPatch.egg8tt, sprite8); Logger.Log("Started Patching RabbitRayEgg"); QPatch.egg9tt = TechTypeHandler.AddTechType("Rabbitray Egg", "Rabbitray Egg", "Required to hatch: Veined Nettle."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg9tt); LanguageHandler.SetTechTypeTooltip(TechType.RabbitrayEgg, "Required to hatch: Veined Nettle."); KnownTechHandler.UnlockOnStart(QPatch.egg9tt); Atlas.Sprite sprite9 = SpriteManager.Get(TechType.RabbitrayEgg); SpriteHandler.RegisterSprite(QPatch.egg9tt, sprite9); Logger.Log("Started Patching SandsharkEgg"); QPatch.egg10tt = TechTypeHandler.AddTechType("Sandshark Egg", "Sandshark Egg", "Required to hatch: Writhing Weed."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg10tt); LanguageHandler.SetTechTypeTooltip(TechType.SandsharkEgg, "Required to hatch: Writhing Weed."); KnownTechHandler.UnlockOnStart(QPatch.egg10tt); Atlas.Sprite sprite10 = SpriteManager.Get(TechType.SandsharkEgg); SpriteHandler.RegisterSprite(QPatch.egg10tt, sprite10); Logger.Log("Started Patching ShockerEgg"); QPatch.egg11tt = TechTypeHandler.AddTechType("Shocker Egg", "Shocker Egg", "Required to hatch: Bulb Bush."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg11tt); LanguageHandler.SetTechTypeTooltip(TechType.ShockerEgg, "Required to hatch: Bulb Bush."); KnownTechHandler.UnlockOnStart(QPatch.egg11tt); Atlas.Sprite sprite11 = SpriteManager.Get(TechType.ShockerEgg); SpriteHandler.RegisterSprite(QPatch.egg11tt, sprite11); Logger.Log("Started Patching SpadefishEgg"); QPatch.egg12tt = TechTypeHandler.AddTechType("Spadefish Egg", "Spadefish Egg", "Required to hatch: Blue Palm."); LanguageHandler.SetTechTypeTooltip(TechType.SpadefishEgg, "Required to hatch: Blue Palm."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg12tt); KnownTechHandler.UnlockOnStart(QPatch.egg12tt); Atlas.Sprite sprite12 = SpriteManager.Get(TechType.SpadefishEgg); SpriteHandler.RegisterSprite(QPatch.egg12tt, sprite12); Logger.Log("Started Patching StalkerEgg"); QPatch.egg13tt = TechTypeHandler.AddTechType("Stalker Egg", "Stalker Egg", "Required to hatch: Creepvine."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg13tt); LanguageHandler.SetTechTypeTooltip(TechType.StalkerEgg, "Required to hatch: Creepvine."); KnownTechHandler.UnlockOnStart(QPatch.egg13tt); Atlas.Sprite sprite13 = SpriteManager.Get(TechType.StalkerEgg); SpriteHandler.RegisterSprite(QPatch.egg13tt, sprite13); Logger.Log("Started Patching CutefishEgg"); QPatch.egg14tt = TechTypeHandler.AddTechType("Cutefish Egg", "Cutefish Egg", "Required to hatch: AcidMushroom."); LanguageHandler.SetTechTypeTooltip(TechType.CutefishEgg, "Required to hatch: AcidMushroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg14tt); KnownTechHandler.UnlockOnStart(QPatch.egg14tt); Atlas.Sprite sprite14 = SpriteManager.Get(TechType.CutefishEgg); SpriteHandler.RegisterSprite(QPatch.egg14tt, sprite14); Logger.Log("Started Patching ReefbackEgg"); QPatch.egg15tt = TechTypeHandler.AddTechType("Reefback Egg", "Reefback Egg", "Required to hatch: AcidMushroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg15tt); LanguageHandler.SetTechTypeTooltip(TechType.ReefbackEgg, "Required to hatch: AcidMushroom."); KnownTechHandler.UnlockOnStart(QPatch.egg15tt); Atlas.Sprite sprite15 = SpriteManager.Get(TechType.ReefbackEgg); SpriteHandler.RegisterSprite(QPatch.egg15tt, sprite15); Logger.Log("Started Patching JumperEgg"); QPatch.egg16tt = TechTypeHandler.AddTechType("Jumper Egg", "Jumper Egg", "Required to hatch: AcidMushroom."); LanguageHandler.SetTechTypeTooltip(TechType.JumperEgg, "Required to hatch: AcidMushroom."); LanguageHandler.SetTechTypeTooltip(egg16tt, "Required to hatch: AcidMushroom."); CraftDataHandler.AddToGroup(TechGroup.Miscellaneous, TechCategory.Misc, QPatch.egg16tt); KnownTechHandler.UnlockOnStart(QPatch.egg16tt); Atlas.Sprite sprite16 = SpriteManager.Get(TechType.JumperEgg); SpriteHandler.RegisterSprite(QPatch.egg16tt, sprite16); }