diff --git a/.gitignore b/.gitignore index f8ceaa6..1658cb6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.vs/potioncraft-crucible/FileContentIndex /.vs/ProjectEvaluation /.vs +/Thunderstore/plugins diff --git a/Crucible.Ingredients/CrucibleIngredientsPlugin.cs b/Crucible.Ingredients/CrucibleIngredientsPlugin.cs index 53b3e76..cfc25b4 100644 --- a/Crucible.Ingredients/CrucibleIngredientsPlugin.cs +++ b/Crucible.Ingredients/CrucibleIngredientsPlugin.cs @@ -21,7 +21,7 @@ namespace RoboPhredDev.PotionCraft.Crucible.Ingredients /// /// BepInEx plugin for Crucible Config mods. /// - [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible.Ingredients", "Ingredient support for Crucible Modding Framework", "1.0.0.0")] + [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible.Ingredients", "Ingredient support for Crucible Modding Framework", "1.1.0.0")] [BepInDependency("net.RoboPhredDev.PotionCraft.Crucible")] public class CrucibleIngredientsPlugin : BaseUnityPlugin { diff --git a/Crucible.PotionBottles/CruciblePotionBottlesPlugin.cs b/Crucible.PotionBottles/CruciblePotionBottlesPlugin.cs index 5a5affa..efb2959 100644 --- a/Crucible.PotionBottles/CruciblePotionBottlesPlugin.cs +++ b/Crucible.PotionBottles/CruciblePotionBottlesPlugin.cs @@ -21,7 +21,7 @@ namespace RoboPhredDev.PotionCraft.Crucible.PotionBottles /// /// BepInEx plugin for Crucible Config mods. /// - [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible.PotionBottles", "Potion Bottle support for Crucible Modding Framework", "1.0.0.0")] + [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible.PotionBottles", "Potion Bottle support for Crucible Modding Framework", "1.1.0.0")] [BepInDependency("net.RoboPhredDev.PotionCraft.Crucible")] public class CruciblePotionBottlesPlugin : BaseUnityPlugin { diff --git a/Crucible/CruciblePlugin.cs b/Crucible/CruciblePlugin.cs index 256deb4..d306adc 100644 --- a/Crucible/CruciblePlugin.cs +++ b/Crucible/CruciblePlugin.cs @@ -29,7 +29,7 @@ namespace RoboPhredDev.PotionCraft.Crucible /// /// BepInEx plugin for Crucible Config mods. /// - [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible", "Crucible Modding Framework", "1.1.1.0")] + [BepInPlugin("net.RoboPhredDev.PotionCraft.Crucible", "Crucible Modding Framework", "1.1.2.0")] public class CruciblePlugin : BaseUnityPlugin { private ICollection mods; @@ -112,6 +112,9 @@ private static ICollection LoadAllConfigMods() { var mods = new List(); + var pluginsDirectoryMods = TryLoadPluginsDirectoryMods(); + mods.AddRange(pluginsDirectoryMods); + var path = Path.Combine("crucible", "mods"); if (!Directory.Exists(path)) { @@ -130,6 +133,28 @@ private static ICollection LoadAllConfigMods() return mods; } + /// + /// This method will search for mods in the BepInEx plugins directory. + /// This allows support for mod loaders which can only put mods in the plugins directory. + /// + private static IEnumerable TryLoadPluginsDirectoryMods() + { + var mods = new List(); + + var pluginLocation = Paths.PluginPath; + + var zipFiles = Directory.GetFiles(pluginLocation, "*.zip", SearchOption.AllDirectories); + var zipMods = zipFiles.Select(file => TryLoadFileMod(file)).Where(x => x != null); + mods.AddRange(zipMods); + + var packageFiles = Directory.GetFiles(pluginLocation, "package.yml", SearchOption.AllDirectories); + var directories = packageFiles.Select(Directory.GetParent).Select(d => d.FullName); + var directoryMods = directories.Select(folder => TryLoadDirectoryMod(folder)).Where(x => x != null); + mods.AddRange(directoryMods); + + return mods; + } + private static CruciblePackageMod TryLoadDirectoryMod(string modFolder) { try diff --git a/Thunderstore/LICENSE.txt b/Thunderstore/LICENSE.txt new file mode 100644 index 0000000..e046835 --- /dev/null +++ b/Thunderstore/LICENSE.txt @@ -0,0 +1,167 @@ +Copyright RoboPhred, 2021 + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/Thunderstore/README.md b/Thunderstore/README.md new file mode 100644 index 0000000..ac5fe25 --- /dev/null +++ b/Thunderstore/README.md @@ -0,0 +1,74 @@ +# Crucible Modding Framework +Crucible is a modding framework for PotionCraft, with the following features + +- Abstracted game api, to allow for future-proof access to the game from BepInEx mods. +- YAML config based mod loader, to allow for configuration based mods without code. + +Out of the box, Crucible provides support for creating code-free PotionCraft mods for: + +- Custom ingredients +- Custom potion bottles, including labels and icons +- Custom customers +- Custom traders + +Additionally, Crucible provides an API for other BepInEx mods that provides: + +- Shared access to sprite atlases, allowing mods to add new icons without conflicting. +- Shared access to save data, allowing mods to add data to the save files in a way that will not conflict. +- Adding new translatable text. +- Identifying NPC templates by attribute. +- Adding inventory items to NPC traders. +- Access to create and customize ingredients, wrapped behind and API that will remain stable across game updates. +- Support for mods that can add new features to Crucible Packages, both through new configuration sections and extending existing sections. + +## Installation (game, automated) +This is the recommended way to install Crucible Modding Framework. + +- Download and install Thunderstore Mod Manager or r2modman. + - Click Install with Mod Manager button on top of the page. + - Run the game via the mod manager. + +Note: If you are installing a Crucible dependent mod use the installation instructions provided by that mod. When installing from Thunderstore Crucible will be automatically downloaded if it is included as a dependency. + +## Installation (manual) +If you are installing this manually, do the following: + +If you are not sure where your Potion Craft steam directory is you can find out by opening steam, going to your library, and right clicking on Potion Craft > Properties > Local Files > Browse. + +- Download and install [BepInEx 5.x 64 bit](https://github.com/BepInEx/BepInEx/releases) + - The contents of the BepInEx zip should be extracted to your PotionCraft steam directory. + - If properly installed, you should see a `winhttp.dll` file and `BepInEx` folder alongside your `Potion Craft.exe` +- Download and install [Crucible](https://github.com/RoboPhred/potioncraft-crucible/releases/latest) + - The contents of the Crucible zip should be extracted to your PotionCraft steam directory. + - If properly installed, you should have a `Crucible` driectory at `Potion Craft/BepInEx/plugins` + +## Crucible Package Mods + +Crucible Package mods are collections of assets and config files that allow mods to be created for PotionCraft without resorting to reverse engineering or compiling custom code. +Anyone who can put together art assets can use Crucible Packages to create mods for the game. + +Some benefits of using Crucible Packages: + +- Low barrier of entry: No programming experience is required. +- Much less chance of future game updates breaking compatibility. Only Crucible needs to be updated. + +### Making Crucible Package Mods + +See [Creating Crucible Packages](https://github.com/RoboPhred/potioncraft-crucible/wiki/Getting-Started:-Crucible-Package-Mods) + +### Using Thunderstore with Crucible Package Mods + +See [Using Thunderstore with Crucible Package Mods](https://github.com/RoboPhred/potioncraft-crucible/wiki/Getting-Started:-Uploading-your-Crucible-Package-Mod-to-Thunderstore) + +## Using the Crucible Modding API + +Modders wishing to take advantage of Crucible's GameAPI should take a BepInEx dependency on Crucible and reference the Crucible.GameAPI dll. + +**Note**: While it is possible to include the Crucible.GameAPI dll with your mod download, doing so puts you at great risk for causing conflicts with other mods, including Crucible itself. While Crucible.GameAPI takes great care +to remain maximally compatible with other mods, certain features may not function properly if duplicated across multiple mods. Storing custom data on save files and injecting custom sprite atlases are particularly fragile, and distributing +your own copy of Crucible.GameAPI may break this functionality in the presense of Crucible Core or other mods that also redistribute Crucible.GameAPI. + + + +### Steam Deck Installation +See [this guide](https://docs.google.com/document/d/1Y3PDeMaffkh7x4U3j46YZ9K6AhM2EvRF9v3mAGBFzW4) for installing Potion Craft mods on the Steam Deck \ No newline at end of file diff --git a/Thunderstore/icon.png b/Thunderstore/icon.png new file mode 100644 index 0000000..bcee426 Binary files /dev/null and b/Thunderstore/icon.png differ diff --git a/Thunderstore/manifest.json b/Thunderstore/manifest.json new file mode 100644 index 0000000..38ba6a1 --- /dev/null +++ b/Thunderstore/manifest.json @@ -0,0 +1,10 @@ +{ + "name": "Crucible_Modding_Framework", + "version_number": "1.1.0", + "website_url": "https://github.com/RoboPhred/potioncraft-crucible", + "description": "Crucible is a modding framework for PotionCraft with support for custom ingredients, custom npcs, and custom potion bottles.", + "dependencies": [ + "BepInEx-BepInExPack_PotionCraft-5.4.18" + ] + +} \ No newline at end of file